From b75c16d5d8b94cf1dd3de4c7314265dc0ad9d08b Mon Sep 17 00:00:00 2001 From: Matt Loring Date: Fri, 29 Jan 2016 11:07:56 -0800 Subject: [PATCH 001/632] Initial Commit --- handwritten/cloud-profiler/.editorconfig | 14 ++ handwritten/cloud-profiler/.gitignore | 3 + handwritten/cloud-profiler/.jshintrc | 28 +++ handwritten/cloud-profiler/CONTRIBUTING.md | 20 ++ handwritten/cloud-profiler/LICENSE | 202 ++++++++++++++++++ handwritten/cloud-profiler/README.md | 11 + .../benchmarks/buffer-allocation.js | 30 +++ .../cloud-profiler/benchmarks/buffers.js | 28 +++ handwritten/cloud-profiler/benchmarks/fib.js | 33 +++ handwritten/cloud-profiler/benchmarks/web.js | 29 +++ handwritten/cloud-profiler/binding.gyp | 19 ++ handwritten/cloud-profiler/lib/builder.js | 153 +++++++++++++ .../cloud-profiler/lib/heap_builder.js | 160 ++++++++++++++ handwritten/cloud-profiler/lib/heap_index.js | 58 +++++ handwritten/cloud-profiler/lib/index.js | 87 ++++++++ handwritten/cloud-profiler/package.json | 30 +++ .../cloud-profiler/src/cpu-profiler.cc | 97 +++++++++ .../src/sampling-heap-profiler.cc | 87 ++++++++ handwritten/cloud-profiler/src/statistics.cc | 49 +++++ 19 files changed, 1138 insertions(+) create mode 100644 handwritten/cloud-profiler/.editorconfig create mode 100644 handwritten/cloud-profiler/.gitignore create mode 100644 handwritten/cloud-profiler/.jshintrc create mode 100644 handwritten/cloud-profiler/CONTRIBUTING.md create mode 100644 handwritten/cloud-profiler/LICENSE create mode 100644 handwritten/cloud-profiler/README.md create mode 100644 handwritten/cloud-profiler/benchmarks/buffer-allocation.js create mode 100644 handwritten/cloud-profiler/benchmarks/buffers.js create mode 100644 handwritten/cloud-profiler/benchmarks/fib.js create mode 100644 handwritten/cloud-profiler/benchmarks/web.js create mode 100644 handwritten/cloud-profiler/binding.gyp create mode 100644 handwritten/cloud-profiler/lib/builder.js create mode 100644 handwritten/cloud-profiler/lib/heap_builder.js create mode 100644 handwritten/cloud-profiler/lib/heap_index.js create mode 100644 handwritten/cloud-profiler/lib/index.js create mode 100644 handwritten/cloud-profiler/package.json create mode 100644 handwritten/cloud-profiler/src/cpu-profiler.cc create mode 100644 handwritten/cloud-profiler/src/sampling-heap-profiler.cc create mode 100644 handwritten/cloud-profiler/src/statistics.cc diff --git a/handwritten/cloud-profiler/.editorconfig b/handwritten/cloud-profiler/.editorconfig new file mode 100644 index 00000000000..62e0fdb64aa --- /dev/null +++ b/handwritten/cloud-profiler/.editorconfig @@ -0,0 +1,14 @@ +; http://editorconfig.org + +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +indent_size = 4 diff --git a/handwritten/cloud-profiler/.gitignore b/handwritten/cloud-profiler/.gitignore new file mode 100644 index 00000000000..b33f2e06c49 --- /dev/null +++ b/handwritten/cloud-profiler/.gitignore @@ -0,0 +1,3 @@ +build +node_modules +third_party diff --git a/handwritten/cloud-profiler/.jshintrc b/handwritten/cloud-profiler/.jshintrc new file mode 100644 index 00000000000..a4f50d1c821 --- /dev/null +++ b/handwritten/cloud-profiler/.jshintrc @@ -0,0 +1,28 @@ +{ + "bitwise": true, + "curly": true, + "eqeqeq": true, + "esnext": true, + "freeze": true, + "immed": true, + "indent": 2, + "latedef": "nofunc", + "maxlen": 100, + "newcap": true, + "node": true, + "noarg": true, + "quotmark": "single", + "strict": true, + "trailing": true, + "undef": true, + "unused": true, + "globals": { + /* Mocha-provided globals */ + "describe": false, + "it": false, + "before": false, + "beforeEach": false, + "after": false, + "afterEach": false + } +} diff --git a/handwritten/cloud-profiler/CONTRIBUTING.md b/handwritten/cloud-profiler/CONTRIBUTING.md new file mode 100644 index 00000000000..0e104db5e20 --- /dev/null +++ b/handwritten/cloud-profiler/CONTRIBUTING.md @@ -0,0 +1,20 @@ +# How to become a contributor and submit your own code + +## Contributor License Agreements + +We'd love to accept your patches! Before we can take them, we have to jump a couple of legal hurdles. + +Please fill out either the individual or corporate Contributor License Agreement (CLA). + + * If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html). + * If you work for a company that wants to allow you to contribute your work, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html). + +Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we'll be able to accept your pull requests. + +## Contributing A Patch + +1. Submit an issue describing your proposed change to the repo in question. +1. The repo owner will respond to your issue promptly. +1. If your proposed change is accepted, and you haven't already done so, sign a Contributor License Agreement (see details above). +1. Fork the desired repo, develop and test your code changes. +1. Submit a pull request. diff --git a/handwritten/cloud-profiler/LICENSE b/handwritten/cloud-profiler/LICENSE new file mode 100644 index 00000000000..a4c5efd822f --- /dev/null +++ b/handwritten/cloud-profiler/LICENSE @@ -0,0 +1,202 @@ + + 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 2014 Google Inc. + + 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/handwritten/cloud-profiler/README.md b/handwritten/cloud-profiler/README.md new file mode 100644 index 00000000000..d78712646e8 --- /dev/null +++ b/handwritten/cloud-profiler/README.md @@ -0,0 +1,11 @@ +# Google Cloud Profiler + +This module implements experimental support for profiling Node.js apps. +This module is under development and is not suitable for production +use at this point. + +This module uses APIs there are undocumented and are not covered by any +deprecation policy, and this may be subject to change without notice. + +The API this module exports is experimental and is not covered by any +deprecation policy, and may be changed without notice. diff --git a/handwritten/cloud-profiler/benchmarks/buffer-allocation.js b/handwritten/cloud-profiler/benchmarks/buffer-allocation.js new file mode 100644 index 00000000000..babdb4eebc0 --- /dev/null +++ b/handwritten/cloud-profiler/benchmarks/buffer-allocation.js @@ -0,0 +1,30 @@ +/** + * Copyright 2015 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'; + +var a = []; + +function f() { + a.push(new Buffer(100)); + if (a.length === 10000) { + return; + } else { + setTimeout(f, 1); + } +}; + +f(); diff --git a/handwritten/cloud-profiler/benchmarks/buffers.js b/handwritten/cloud-profiler/benchmarks/buffers.js new file mode 100644 index 00000000000..10b2108e955 --- /dev/null +++ b/handwritten/cloud-profiler/benchmarks/buffers.js @@ -0,0 +1,28 @@ +/** + * Copyright 2015 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'; + +// buffer.fill should take us to native code +function bufferTest() { + var assert = require('assert'); + var buffer = new Buffer(8192); + for (var k = 0; k < 1e7; k++) + buffer.fill(0); +} + +// ticks in native code +bufferTest(); diff --git a/handwritten/cloud-profiler/benchmarks/fib.js b/handwritten/cloud-profiler/benchmarks/fib.js new file mode 100644 index 00000000000..44b47702727 --- /dev/null +++ b/handwritten/cloud-profiler/benchmarks/fib.js @@ -0,0 +1,33 @@ +/** + * Copyright 2015 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'; + +function fib(n) { + if (n < 2) { + return n; + } else { + var t1 = fib(n - 1); + var t2 = fib(n - 2); + return t1 + t2; + } +} + +// called from top level +fib(30); + +// should show up with a different stack depth +(function() { fib(30); })(); diff --git a/handwritten/cloud-profiler/benchmarks/web.js b/handwritten/cloud-profiler/benchmarks/web.js new file mode 100644 index 00000000000..d94507b3f41 --- /dev/null +++ b/handwritten/cloud-profiler/benchmarks/web.js @@ -0,0 +1,29 @@ +/** + * Copyright 2015 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'; + +var http = require('http'); +var cp = require('child_process'); + +var server = http.createServer(function(req, res) { + res.end(new Array(100).join(',')); +}); + +server.listen(8080, function() { + cp.spawn('ab', [ '-n', '110000', '-c', '10', 'http://127.0.0.1:8080/' ]) + .on('close', function() { server.close(); }); +}); diff --git a/handwritten/cloud-profiler/binding.gyp b/handwritten/cloud-profiler/binding.gyp new file mode 100644 index 00000000000..3b777cce04b --- /dev/null +++ b/handwritten/cloud-profiler/binding.gyp @@ -0,0 +1,19 @@ +{ + "targets": [ + { + "target_name": "cpu_profiler", + "sources": [ "src/cpu-profiler.cc" ], + "include_dirs": [ " 0) { + var sample = new Sample({ + location_id : stack, + value : [ node.hitCount * SAMPLE_INTERVAL, node.hitCount ] + // label? + }); + samples.push(sample); + } + node.children.forEach(function(child) { serializeNode(child, stack); }); + stack.shift(); +} + +function serialize(prof, startTimeNanos) { + samples = []; + locations = []; + functions = []; + locationMap = {}; + functionMap = {}; + strings = strings.slice(0, 5); + serializeNode(prof.topDownRoot, []); + var profile = new Profile({ + sample_type : [ timeValue, sampleValue ], + sample : samples, + // mapping: mappings, + location : locations, "function" : functions, + string_table : strings, + // opt drop_frames + // opt keep_frames + time_nanos : startTimeNanos, // Nanos + duration_nanos : prof.endTime - prof.startTime, // Nanos + + period_type : timeValue, + period : SAMPLE_INTERVAL + }); + return profile; +} + +module.exports.serialize = serialize; diff --git a/handwritten/cloud-profiler/lib/heap_builder.js b/handwritten/cloud-profiler/lib/heap_builder.js new file mode 100644 index 00000000000..159dd285707 --- /dev/null +++ b/handwritten/cloud-profiler/lib/heap_builder.js @@ -0,0 +1,160 @@ +/** + * Copyright 2015 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'; + +var ProtoBuf = require('protobufjs'); +var builder = ProtoBuf.loadProtoFile('third_party/proto/profile.proto'); +var perftools = builder.build('perftools'); + +// TODO: pass this value explicitly when starting the profiler +const SAMPLE_PERIOD = 512 * 1024; + +var Profile = perftools.profiles.Profile; +var ValueType = perftools.profiles.ValueType; +var Sample = perftools.profiles.Sample; +var Location = perftools.profiles.Location; +var Mapping = perftools.profiles.Mapping; +var Function = perftools.profiles.Function; +var Line = perftools.profiles.Line; + +var strings = [ '' ]; +var samples = []; + +var locationIds = [ 'dummy' ]; +var locations = []; +var locationMap = {}; + +var functionIds = [ 'dummy' ]; +var functions = []; +var functionMap = {}; + +function getIndexOrAdd(str, lst) { + var index = lst.indexOf(str); + if (index !== -1) { + return index; + } + index = lst.push(str); + return index - 1; +} + +function getStringIndex(str) { return getIndexOrAdd(str, strings); } + +function getFunction(stackNode) { + var unique = JSON.stringify(stackNode); + var id = getIndexOrAdd(unique, functionIds); + if (functionMap[id]) { + return functionMap[id]; + } + var f = new Function({ + id : id, + name : getStringIndex(stackNode.name || '(anonymous)'), + system_name : getStringIndex('callUID-' + id), + filename : getStringIndex(stackNode.scriptName) + // start_line + }); + functions.push(f); + functionMap[id] = f; + return f; +} + +function getLine(stackNode) { + return new Line( + {function_id : getFunction(stackNode).id, line : stackNode.line}); +} + +function getLocation(stackNode) { + var unique = JSON.stringify(stackNode); + var id = getIndexOrAdd(unique, locationIds); + if (locationMap[id]) { + return locationMap[id]; + } + var location = new Location({ + id : id, + // mapping_id: getMapping(node).id, + line : [ getLine(stackNode) ] + }); + locations.push(location); + locationMap[id] = location; + return location; +} + +var sampleValue = + new ValueType(getStringIndex('objects'), getStringIndex('count')); +var timeValue = + new ValueType(getStringIndex('space'), getStringIndex('bytes')); + +function reduce(allocations) { + var allocs = {}; + allocations.forEach(function(alloc) { + if (!allocs[alloc.size]) { + allocs[alloc.size] = alloc.count; + } else { + allocs[alloc.size] += alloc.count; + } + }); + return allocs; +} + +function serializeNode(node, stack) { + var location = getLocation(node); + stack.unshift(location.id); // leaf is first in the stack + var reducedAllocations = reduce(node.allocations); + for (var weight in reducedAllocations) { + var count = reducedAllocations[weight]; + var avgSize = weight / count; + var scale = 1.0 / (1.0 - Math.exp(-(avgSize) / SAMPLE_PERIOD)); + count = count * scale; + weight = weight * scale; + var sample = new Sample({ + location_id : stack, + value : [ count, weight ] + // label? + }); + samples.push(sample); + } + node.children.forEach(function(child) { serializeNode(child, stack); }); + stack.shift(); +} + +function serialize(prof, startTimeNanos, endTimeNanos) { + samples = []; + locations = []; + functions = []; + locationMap = {}; + functionMap = {}; + strings = strings.slice(0, 5); + locationIds = locationIds.slice(0, 1); + functionIds = functionIds.slice(0, 1); + serializeNode(prof, []); + var profile = new Profile({ + sample_type : [ timeValue, sampleValue ], + sample : samples, + // mapping: mappings, + location : locations, "function" : functions, + string_table : strings, + // opt drop_frames + // opt keep_frames + time_nanos : startTimeNanos, // Nanos + duration_nanos : endTimeNanos - startTimeNanos, // Nanos + + period_type : timeValue, + period : SAMPLE_PERIOD + }); + return profile; +} + +module.exports.serialize = serialize; diff --git a/handwritten/cloud-profiler/lib/heap_index.js b/handwritten/cloud-profiler/lib/heap_index.js new file mode 100644 index 00000000000..1e382e94163 --- /dev/null +++ b/handwritten/cloud-profiler/lib/heap_index.js @@ -0,0 +1,58 @@ +/** + * Copyright 2015 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'; + +var profiler = require('bindings')('sampling_heap_profiler'); +var stats = require('bindings')('statistics'); +var zlib = require('zlib'); +var fs = require('fs'); +var stream = require('stream'); + +var builder = require('./heap_builder.js'); + +var startTime = Date.now(); +// console.log('V8 statistics', require('v8').getHeapStatistics()); +// console.log('V8 heap statistics', stats.getHeapSpaceStatistics()); + +profiler.startSamplingHeapProfiler(); + +var intervalMillis = 5 * 1000; + +function profileInterval() { + setTimeout(function() { + var endTime = Date.now(); + var runName = 'cloud-profile-' + endTime; + // console.log('V8 statistics', require('v8').getHeapStatistics()); + // console.log('V8 heap statistics', stats.getHeapSpaceStatistics()); + var result = profiler.getAllocationProfile(); + // console.log('sample count * sample rate', result.length * 1024); + var processed = builder.serialize(result, startTime * 1e6, endTime * 1e6) + .encode() + .toBuffer(); + var outp = fs.createWriteStream(runName + '.pb.gz'); + var inp = new stream.PassThrough(); + inp.end(processed); + inp.pipe(zlib.createGzip()).pipe(outp).on('close', profileInterval); + }, intervalMillis).unref(); +} + +process.on('exit', function() { profiler.stopSamplingHeapProfiler(); }); + +process.on('uncaughtException', + function(e) { profiler.stopSamplingHeapProfiler(); throw e; }); + +profileInterval(); diff --git a/handwritten/cloud-profiler/lib/index.js b/handwritten/cloud-profiler/lib/index.js new file mode 100644 index 00000000000..ea2a58bf9f9 --- /dev/null +++ b/handwritten/cloud-profiler/lib/index.js @@ -0,0 +1,87 @@ +/** + * Copyright 2015 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'; + +var assert = require('assert'); +var util = require('util'); +var profiler = require('bindings')('cpu_profiler'); +var zlib = require('zlib'); +var fs = require('fs'); +var stream = require('stream'); + +var builder = require('./builder.js'); + +function timeToNanos(tuple) { return tuple[0] * 1e9 + tuple[1]; } + +var durationMillis = 10 * 1000; +var intervalMillis = 60 * 1000; +var isActive = false; + +function profileInterval() { + assert(durationMillis <= intervalMillis); + var startDelay = Math.random(0, intervalMillis - durationMillis); + setTimeout(function() { + var startTime = Date.now(); + var runName = 'cloud-profile-' + startTime; + profiler.startProfiling(runName, true); + isActive = true; + setTimeout(function() { + isActive = false; + var result = profiler.stopProfiling(runName); + var processed = + builder.serialize(result, startTime * 1e6).encode().toBuffer(); + var outp = fs.createWriteStream(runName + '.pb.gz'); + var inp = new stream.PassThrough(); + inp.end(processed); + inp.pipe(zlib.createGzip()).pipe(outp).on('close', function() { + setTimeout(profileInterval, + intervalMillis - startDelay - durationMillis) + .unref(); + }); + }, durationMillis).unref(); + }, startDelay).unref(); +} + +process.on('exit', function() { + if (isActive) { + profiler.stopProfiling(); + } +}); +process.on('uncaughtException', function() { + if (isActive) { + profiler.stopProfiling(); + } +}); + +profileInterval(); + +/*function printNode(node, indent) { + indent = indent || 0; + var s = sprintf('%5u %s %d #%d %d %s %d', node.hitCount, + Array(indent).join(' '), indent / 2, node.id, node.callUID, + node.functionName, node.scriptId); + if (node.url !== '') { + s += ' ' + node.url + ':' + node.lineNumber; + } + if (node.lineTicks) + s += ' lineTicks ' + util.inspect(node.lineTicks); + + // TODO: deopt infos + // TODO: bailout reason + console.log(s); + node.children.forEach(function(child) { printNode(child, indent + 2); }); +}*/ diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json new file mode 100644 index 00000000000..98e17bca014 --- /dev/null +++ b/handwritten/cloud-profiler/package.json @@ -0,0 +1,30 @@ +{ + "name": "google-cloud-profile", + "version": "0.0.1", + "description": "Adds support for Google Cloud Profiler to node.js applications", + "main": "lib/index.js", + "scripts": { + "install": "node-gyp rebuild", + "test": "mocha --timeout 4000" + }, + "author": "Google Inc.", + "contributors": [ + { + "name": "Ali Ijaz Sheikh", + "email": "ofrobots@google.com" + }, + { + "name": "Matt Loring", + "email": "mattloring@google.com" + } + ], + "license": "Apache-2.0", + "dependencies": { + "bindings": "^1.2.1", + "nan": "^2.1.0", + "protobufjs": "^4.0.0-b2" + }, + "devDependencies": { + "clang-format": "^1.0.33" + } +} diff --git a/handwritten/cloud-profiler/src/cpu-profiler.cc b/handwritten/cloud-profiler/src/cpu-profiler.cc new file mode 100644 index 00000000000..c42f6ecdb40 --- /dev/null +++ b/handwritten/cloud-profiler/src/cpu-profiler.cc @@ -0,0 +1,97 @@ +/** + * Copyright 2015 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. + */ + +#include "v8-profiler.h" +#include "nan.h" + +using namespace v8; + +Local TranslateCpuProfileNode(const CpuProfileNode* node) { + // TODO: Implement unimplemented interface + Local js_node = Nan::New(); + js_node->Set(Nan::New("functionName").ToLocalChecked(), + node->GetFunctionName()); + js_node->Set(Nan::New("scriptResourceName").ToLocalChecked(), + node->GetScriptResourceName()); + js_node->Set(Nan::New("lineNumber").ToLocalChecked(), + Nan::New(node->GetLineNumber())); + js_node->Set(Nan::New("hitCount").ToLocalChecked(), + Nan::New(node->GetHitCount())); + js_node->Set(Nan::New("callUid").ToLocalChecked(), + Nan::New(node->GetCallUid())); + int32_t count = node->GetChildrenCount(); + Local children = Nan::New(count); + for (int32_t i = 0; i < count; i++) { + children->Set(i, TranslateCpuProfileNode(node->GetChild(i))); + } + js_node->Set(Nan::New("children").ToLocalChecked(), + children); + return js_node; +} + +Local TranslateCpuProfile(const CpuProfile* profile) { + // TODO: Implement unimplemented interface + Local js_profile = Nan::New(); + js_profile->Set(Nan::New("title").ToLocalChecked(), + profile->GetTitle()); + js_profile->Set(Nan::New("topDownRoot").ToLocalChecked(), + TranslateCpuProfileNode(profile->GetTopDownRoot())); + js_profile->Set(Nan::New("samplesCount").ToLocalChecked(), + Nan::New(profile->GetSamplesCount())); + js_profile->Set(Nan::New("startTime").ToLocalChecked(), + Nan::New(profile->GetStartTime())); + js_profile->Set(Nan::New("endTime").ToLocalChecked(), + Nan::New(profile->GetEndTime())); + return js_profile; +} + +NAN_METHOD(StartProfiling) { + Local name = info[0].As(); + bool record_samples = info[1].As()->BooleanValue(); + info.GetIsolate()->GetCpuProfiler()->StartProfiling(name, record_samples); +} + +NAN_METHOD(StopProfiling) { + Local name = info[0].As(); + CpuProfile* profile = + info.GetIsolate()->GetCpuProfiler()->StopProfiling(name); + Local translated_profile = TranslateCpuProfile(profile); + profile->Delete(); + info.GetReturnValue().Set(translated_profile); +} + +NAN_METHOD(SetSamplingInterval) { + int us = info[0].As()->IntegerValue(); + info.GetIsolate()->GetCpuProfiler()->SetSamplingInterval(us); +} + +NAN_METHOD(SetIdle) { + bool is_idle = info[0].As()->BooleanValue(); + info.GetIsolate()->GetCpuProfiler()->SetIdle(is_idle); +} + +NAN_MODULE_INIT(InitAll) { + Nan::Set(target, Nan::New("startProfiling").ToLocalChecked(), + Nan::GetFunction(Nan::New(StartProfiling)).ToLocalChecked()); + Nan::Set(target, Nan::New("stopProfiling").ToLocalChecked(), + Nan::GetFunction(Nan::New(StopProfiling)).ToLocalChecked()); + Nan::Set(target, Nan::New("setSamplingInterval").ToLocalChecked(), + Nan::GetFunction(Nan::New(SetSamplingInterval)).ToLocalChecked()); + Nan::Set(target, Nan::New("setIdle").ToLocalChecked(), + Nan::GetFunction(Nan::New(SetIdle)).ToLocalChecked()); +} + +NODE_MODULE(cpu_profiler, InitAll); diff --git a/handwritten/cloud-profiler/src/sampling-heap-profiler.cc b/handwritten/cloud-profiler/src/sampling-heap-profiler.cc new file mode 100644 index 00000000000..10e73215c0a --- /dev/null +++ b/handwritten/cloud-profiler/src/sampling-heap-profiler.cc @@ -0,0 +1,87 @@ +/** + * Copyright 2015 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. + */ + +#include "v8-profiler.h" +#include "nan.h" + +using namespace v8; + +Local TranslateAllocationProfile(AllocationProfile::Node* node) { + Local js_node = Nan::New(); + js_node->Set(Nan::New("name").ToLocalChecked(), + node->name); + js_node->Set(Nan::New("scriptName").ToLocalChecked(), + node->script_name); + js_node->Set(Nan::New("lineNumber").ToLocalChecked(), + Nan::New(node->line_number)); + Local children = Nan::New(node->children.size()); + for (size_t i = 0; i < node->children.size(); i++) { + children->Set(i, TranslateAllocationProfile(node->children[i])); + } + js_node->Set(Nan::New("children").ToLocalChecked(), + children); + Local allocations = Nan::New(node->allocations.size()); + for (size_t i = 0; i < node->allocations.size(); i++) { + AllocationProfile::Allocation alloc = node->allocations[i]; + Local js_alloc = Nan::New(); + js_alloc->Set(Nan::New("size").ToLocalChecked(), + Nan::New(alloc.size)); + js_alloc->Set(Nan::New("count").ToLocalChecked(), + Nan::New(alloc.count)); + allocations->Set(i, js_alloc); + } + js_node->Set(Nan::New("allocations").ToLocalChecked(), + allocations); + return js_node; +} + +NAN_METHOD(StartSamplingHeapProfiler) { + if (info.Length() == 2) { + if (!info[0]->IsUint32()) { + return Nan::ThrowTypeError("First argument type must be uint32."); + } + if (!info[1]->IsNumber()) { + return Nan::ThrowTypeError("First argument type must be Integer."); + } + uint64_t sample_interval = info[0].As()->Uint32Value(); + int stack_depth = info[1].As()->IntegerValue(); + info.GetIsolate()->GetHeapProfiler()-> + StartSamplingHeapProfiler(sample_interval, stack_depth); + } else { + info.GetIsolate()->GetHeapProfiler()->StartSamplingHeapProfiler(); + } +} + +NAN_METHOD(StopSamplingHeapProfiler) { + info.GetIsolate()->GetHeapProfiler()->StopSamplingHeapProfiler(); +} + +NAN_METHOD(GetAllocationProfile) { + AllocationProfile profile = info.GetIsolate()->GetHeapProfiler()->GetAllocationProfile(); + AllocationProfile::Node* root = profile.GetRootNode(); + info.GetReturnValue().Set(TranslateAllocationProfile(root)); +} + +NAN_MODULE_INIT(InitAll) { + Nan::Set(target, Nan::New("startSamplingHeapProfiler").ToLocalChecked(), + Nan::GetFunction(Nan::New(StartSamplingHeapProfiler)).ToLocalChecked()); + Nan::Set(target, Nan::New("stopSamplingHeapProfiler").ToLocalChecked(), + Nan::GetFunction(Nan::New(StopSamplingHeapProfiler)).ToLocalChecked()); + Nan::Set(target, Nan::New("getAllocationProfile").ToLocalChecked(), + Nan::GetFunction(Nan::New(GetAllocationProfile)).ToLocalChecked()); +} + +NODE_MODULE(sampling_heap_profiler, InitAll); diff --git a/handwritten/cloud-profiler/src/statistics.cc b/handwritten/cloud-profiler/src/statistics.cc new file mode 100644 index 00000000000..3165f48adad --- /dev/null +++ b/handwritten/cloud-profiler/src/statistics.cc @@ -0,0 +1,49 @@ +/** + * Copyright 2015 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. + */ + +#include "v8.h" +#include "nan.h" + +using namespace v8; + +NAN_METHOD(GetHeapSpaceStatistics) { + size_t num_spaces = info.GetIsolate()->NumberOfHeapSpaces(); + Local stats_array = Nan::New(num_spaces); + for (size_t space = 0; space < num_spaces; space++) { + HeapSpaceStatistics space_stats; + info.GetIsolate()->GetHeapSpaceStatistics(&space_stats, space); + Local stats_elem = Nan::New(); + stats_elem->Set(Nan::New("name").ToLocalChecked(), + Nan::New(space_stats.space_name()).ToLocalChecked()); + stats_elem->Set(Nan::New("spaceSize").ToLocalChecked(), + Nan::New(space_stats.space_size())); + stats_elem->Set(Nan::New("spaceUsedSize").ToLocalChecked(), + Nan::New(space_stats.space_used_size())); + stats_elem->Set(Nan::New("spaceAvailableSize").ToLocalChecked(), + Nan::New(space_stats.space_available_size())); + stats_elem->Set(Nan::New("physicalSpaceSize").ToLocalChecked(), + Nan::New(space_stats.physical_space_size())); + stats_array->Set(space, stats_elem); + } + info.GetReturnValue().Set(stats_array); +} + +NAN_MODULE_INIT(InitAll) { + Nan::Set(target, Nan::New("getHeapSpaceStatistics").ToLocalChecked(), + Nan::GetFunction(Nan::New(GetHeapSpaceStatistics)).ToLocalChecked()); +} + +NODE_MODULE(statistics, InitAll); From 00fa01fd35d1206d27bbe44025514738ee43ffad Mon Sep 17 00:00:00 2001 From: Matt Loring Date: Fri, 29 Jan 2016 11:32:38 -0800 Subject: [PATCH 002/632] Add dependency badges --- handwritten/cloud-profiler/README.md | 8 ++++++++ handwritten/cloud-profiler/package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/README.md b/handwritten/cloud-profiler/README.md index d78712646e8..75677cb4fd2 100644 --- a/handwritten/cloud-profiler/README.md +++ b/handwritten/cloud-profiler/README.md @@ -1,5 +1,8 @@ # Google Cloud Profiler +[![Dependency Status][david-image]][david-url] +[![devDependency Status][david-dev-image]][david-dev-url] + This module implements experimental support for profiling Node.js apps. This module is under development and is not suitable for production use at this point. @@ -9,3 +12,8 @@ deprecation policy, and this may be subject to change without notice. The API this module exports is experimental and is not covered by any deprecation policy, and may be changed without notice. + +[david-image]: https://david-dm.org/GoogleCloudPlatform/cloud-profiler-nodejs.svg +[david-url]: https://david-dm.org/GoogleCloudPlatform/cloud-profiler-nodejs +[david-dev-image]: https://david-dm.org/GoogleCloudPlatform/cloud-profiler-nodejs/dev-status.svg +[david-dev-url]: https://david-dm.org/GoogleCloudPlatform/cloud-profiler-nodejs#info=devDependencies diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 98e17bca014..ed4ae2b9a6a 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -22,7 +22,7 @@ "dependencies": { "bindings": "^1.2.1", "nan": "^2.1.0", - "protobufjs": "^4.0.0-b2" + "protobufjs": "~5.0.1" }, "devDependencies": { "clang-format": "^1.0.33" From 2d26f62cd8cd91883778cda6dd5651855c9b706d Mon Sep 17 00:00:00 2001 From: Matt Loring Date: Fri, 29 Jan 2016 11:27:58 -0800 Subject: [PATCH 003/632] Add profile.proto and third party directory Proto imported from https://github.com/google/pprof --- handwritten/cloud-profiler/.gitignore | 1 - .../cloud-profiler/third_party/proto/LICENSE | 203 ++++++++++++++++++ .../third_party/proto/README.google | 8 + .../third_party/proto/profile.proto | 180 ++++++++++++++++ 4 files changed, 391 insertions(+), 1 deletion(-) create mode 100644 handwritten/cloud-profiler/third_party/proto/LICENSE create mode 100644 handwritten/cloud-profiler/third_party/proto/README.google create mode 100644 handwritten/cloud-profiler/third_party/proto/profile.proto diff --git a/handwritten/cloud-profiler/.gitignore b/handwritten/cloud-profiler/.gitignore index b33f2e06c49..e3fbd98336e 100644 --- a/handwritten/cloud-profiler/.gitignore +++ b/handwritten/cloud-profiler/.gitignore @@ -1,3 +1,2 @@ build node_modules -third_party diff --git a/handwritten/cloud-profiler/third_party/proto/LICENSE b/handwritten/cloud-profiler/third_party/proto/LICENSE new file mode 100644 index 00000000000..f4f87bd4ed6 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/proto/LICENSE @@ -0,0 +1,203 @@ + + 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. + \ No newline at end of file diff --git a/handwritten/cloud-profiler/third_party/proto/README.google b/handwritten/cloud-profiler/third_party/proto/README.google new file mode 100644 index 00000000000..bebfac054cb --- /dev/null +++ b/handwritten/cloud-profiler/third_party/proto/README.google @@ -0,0 +1,8 @@ +URL: https://github.com/google/pprof/blob/d174bbe741d0e8039ecf6504b15f708d1ee5c0f2 +Version: d174bbe741d0e8039ecf6504b15f708d1ee5c0f2 +License: Apache 2.0 +License File: # LICENSE +Description: + pprof is a tool for visualization and analysis of profiling data. +Local Modifications: + All code except the profile.proto file has been removed. diff --git a/handwritten/cloud-profiler/third_party/proto/profile.proto b/handwritten/cloud-profiler/third_party/proto/profile.proto new file mode 100644 index 00000000000..0df631f7091 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/proto/profile.proto @@ -0,0 +1,180 @@ +// Profile is a common stacktrace profile format. +// +// Measurements represented with this format should follow the +// following conventions: +// +// - Consumers should treat unset optional fields as if they had been +// set with their default value. +// +// - When possible, measurements should be stored in "unsampled" form +// that is most useful to humans. There should be enough +// information present to determine the original sampled values. +// +// - On-disk, the serialized proto must be gzip-compressed. +// +// - The profile is represented as a set of samples, where each sample +// references a sequence of locations, and where each location belongs +// to a mapping. +// - There is a N->1 relationship from sample.location_id entries to +// locations. For every sample.location_id entry there must be a +// unique Location with that id. +// - There is an optional N->1 relationship from locations to +// mappings. For every nonzero Location.mapping_id there must be a +// unique Mapping with that id. + +syntax = "proto3"; + +package perftools.profiles; + +option java_package = "com.google.perftools.profiles"; +option java_outer_classname = "ProfileProto"; + +message Profile { + // A description of the samples associated with each Sample.value. + // For a cpu profile this might be: + // [["cpu","nanoseconds"]] or [["wall","seconds"]] or [["syscall","count"]] + // For a heap profile, this might be: + // [["allocations","count"], ["space","bytes"]], + // If one of the values represents the number of events represented + // by the sample, by convention it should be at index 0 and use + // sample_type.unit == "count". + repeated ValueType sample_type = 1; + // The set of samples recorded in this profile. + repeated Sample sample = 2; + // Mapping from address ranges to the image/binary/library mapped + // into that address range. mapping[0] will be the main binary. + repeated Mapping mapping = 3; + // Useful program location + repeated Location location = 4; + // Functions referenced by locations + repeated Function function = 5; + // A common table for strings referenced by various messages. + // string_table[0] must always be "". + repeated string string_table = 6 [enforce_utf8 = false]; + // frames with Function.function_name fully matching the following + // regexp will be dropped from the samples, along with their successors. + int64 drop_frames = 7; // Index into string table. + // frames with Function.function_name fully matching the following + // regexp will be kept, even if it matches drop_functions. + int64 keep_frames = 8; // Index into string table. + + // The following fields are informational, do not affect + // interpretation of results. + + // Time of collection (UTC) represented as nanoseconds past the epoch. + int64 time_nanos = 9; + // Duration of the profile, if a duration makes sense. + int64 duration_nanos = 10; + // The kind of events between sampled ocurrences. + // e.g [ "cpu","cycles" ] or [ "heap","bytes" ] + ValueType period_type = 11; + // The number of events between sampled occurrences. + int64 period = 12; + // Freeform text associated to the profile. + repeated int64 comment = 13; // Indices into string table. +} + +// ValueType describes the semantics and measurement units of a value. +message ValueType { + int64 type = 1; // Index into string table. + int64 unit = 2; // Index into string table. +} + +// Each Sample records values encountered in some program +// context. The program context is typically a stack trace, perhaps +// augmented with auxiliary information like the thread-id, some +// indicator of a higher level request being handled etc. +message Sample { + // The ids recorded here correspond to a Profile.location.id. + // The leaf is at location_id[0]. + repeated uint64 location_id = 1; + // The type and unit of each value is defined by the corresponding + // entry in Profile.sample_type. All samples must have the same + // number of values, the same as the length of Profile.sample_type. + // When aggregating multiple samples into a single sample, the + // result has a list of values that is the elemntwise sum of the + // lists of the originals. + repeated int64 value = 2; + // label includes additional context for this sample. It can include + // things like a thread id, allocation size, etc + repeated Label label = 3; +} + +message Label { + int64 key = 1; // Index into string table + + // At most one of the following must be present + int64 str = 2; // Index into string table + int64 num = 3; +} + +message Mapping { + // Unique nonzero id for the mapping. + uint64 id = 1; + // Address at which the binary (or DLL) is loaded into memory. + uint64 memory_start = 2; + // The limit of the address range occupied by this mapping. + uint64 memory_limit = 3; + // Offset in the binary that corresponds to the first mapped address. + uint64 file_offset = 4; + // The object this entry is loaded from. This can be a filename on + // disk for the main binary and shared libraries, or virtual + // abstractions like "[vdso]". + int64 filename = 5; // Index into string table + // A string that uniquely identifies a particular program version + // with high probability. E.g., for binaries generated by GNU tools, + // it could be the contents of the .note.gnu.build-id field. + int64 build_id = 6; // Index into string table + + // The following fields indicate the resolution of symbolic info. + bool has_functions = 7; + bool has_filenames = 8; + bool has_line_numbers = 9; + bool has_inline_frames = 10; +} + +// Describes function and line table debug information. +message Location { + // Unique nonzero id for the location. A profile could use + // instruction addresses or any integer sequence as ids. + uint64 id = 1; + // The id of the corresponding profile.Mapping for this location. + // If can be unset if the mapping is unknown or not applicable for + // this profile type. + uint64 mapping_id = 2; + // The instruction address for this location, if available. It + // should be within [Mapping.memory_start...Mapping.memory_limit] + // for the corresponding mapping. A non-leaf address may be in the + // middle of a call instruction. It is up to display tools to find + // the beginning of the instruction if necessary. + uint64 address = 3; + // Multiple line indicates this location has inlined functions, + // where the last entry represents the caller into which the + // preceding entries were inlined. + // + // E.g., if memcpy() is inlined into printf: + // line[0].function_name == "memcpy" + // line[1].function_name == "printf" + repeated Line line = 4; +} + +message Line { + // The id of the corresponding profile.Function for this line. + uint64 function_id = 1; + // Line number in source code. + int64 line = 2; +} + +message Function { + // Unique nonzero id for the function. + uint64 id = 1; + // Name of the function, in human-readable form if available. + int64 name = 2; // Index into string table + // Name of the function, as identified by the system. + // For instance, it can be a C++ mangled name. + int64 system_name = 3; // Index into string table + // Source file containing the function. + int64 filename = 4; // Index into string table + // Line number in source file. + int64 start_line = 5; +} \ No newline at end of file From e0f757058dacb0a55612b1e2a0a7008ab301a562 Mon Sep 17 00:00:00 2001 From: Matt Loring Date: Mon, 1 Feb 2016 16:24:53 -0800 Subject: [PATCH 004/632] Update profile collection to match new api --- handwritten/cloud-profiler/src/sampling-heap-profiler.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/src/sampling-heap-profiler.cc b/handwritten/cloud-profiler/src/sampling-heap-profiler.cc index 10e73215c0a..789f57f91b1 100644 --- a/handwritten/cloud-profiler/src/sampling-heap-profiler.cc +++ b/handwritten/cloud-profiler/src/sampling-heap-profiler.cc @@ -70,9 +70,10 @@ NAN_METHOD(StopSamplingHeapProfiler) { } NAN_METHOD(GetAllocationProfile) { - AllocationProfile profile = info.GetIsolate()->GetHeapProfiler()->GetAllocationProfile(); - AllocationProfile::Node* root = profile.GetRootNode(); + AllocationProfile* profile = info.GetIsolate()->GetHeapProfiler()->GetAllocationProfile(); + AllocationProfile::Node* root = profile->GetRootNode(); info.GetReturnValue().Set(TranslateAllocationProfile(root)); + free(profile); } NAN_MODULE_INIT(InitAll) { From 806d2bde8fb0bb3e18737a0bf8a76a0dd9f0b98e Mon Sep 17 00:00:00 2001 From: Matt Loring Date: Tue, 23 Feb 2016 11:43:58 -0800 Subject: [PATCH 005/632] Name benchmark functions for meaningful profiling output --- handwritten/cloud-profiler/benchmarks/web.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handwritten/cloud-profiler/benchmarks/web.js b/handwritten/cloud-profiler/benchmarks/web.js index d94507b3f41..4226c3266af 100644 --- a/handwritten/cloud-profiler/benchmarks/web.js +++ b/handwritten/cloud-profiler/benchmarks/web.js @@ -19,11 +19,11 @@ var http = require('http'); var cp = require('child_process'); -var server = http.createServer(function(req, res) { +var server = http.createServer(function handler(req, res) { res.end(new Array(100).join(',')); }); -server.listen(8080, function() { +server.listen(8080, function listened() { cp.spawn('ab', [ '-n', '110000', '-c', '10', 'http://127.0.0.1:8080/' ]) - .on('close', function() { server.close(); }); + .on('close', function closer() { server.close(); }); }); From 5ddb8fd91febb0bff9c6e1212dd9f1ef58667911 Mon Sep 17 00:00:00 2001 From: Matt Loring Date: Tue, 23 Feb 2016 12:06:42 -0800 Subject: [PATCH 006/632] Remove unsampling logic from agent Unsampling has been moved into V8 with https://codereview.chromium.org/1706343002 so this logic is no longer necessary in the agent. This change also updates the units used for emitted profiles to be more consistent with other profilers. --- .../cloud-profiler/lib/heap_builder.js | 31 +++++-------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/handwritten/cloud-profiler/lib/heap_builder.js b/handwritten/cloud-profiler/lib/heap_builder.js index 159dd285707..645608ac0ff 100644 --- a/handwritten/cloud-profiler/lib/heap_builder.js +++ b/handwritten/cloud-profiler/lib/heap_builder.js @@ -92,36 +92,19 @@ function getLocation(stackNode) { return location; } -var sampleValue = +var countValue = new ValueType(getStringIndex('objects'), getStringIndex('count')); -var timeValue = +var bytesValue = new ValueType(getStringIndex('space'), getStringIndex('bytes')); -function reduce(allocations) { - var allocs = {}; - allocations.forEach(function(alloc) { - if (!allocs[alloc.size]) { - allocs[alloc.size] = alloc.count; - } else { - allocs[alloc.size] += alloc.count; - } - }); - return allocs; -} - function serializeNode(node, stack) { var location = getLocation(node); stack.unshift(location.id); // leaf is first in the stack - var reducedAllocations = reduce(node.allocations); - for (var weight in reducedAllocations) { - var count = reducedAllocations[weight]; - var avgSize = weight / count; - var scale = 1.0 / (1.0 - Math.exp(-(avgSize) / SAMPLE_PERIOD)); - count = count * scale; - weight = weight * scale; + for (var i in node.allocations) { + var alloc = node.allocations[i]; var sample = new Sample({ location_id : stack, - value : [ count, weight ] + value : [ alloc.count, alloc.count * alloc.size ] // label? }); samples.push(sample); @@ -141,7 +124,7 @@ function serialize(prof, startTimeNanos, endTimeNanos) { functionIds = functionIds.slice(0, 1); serializeNode(prof, []); var profile = new Profile({ - sample_type : [ timeValue, sampleValue ], + sample_type : [ countValue, bytesValue ], sample : samples, // mapping: mappings, location : locations, "function" : functions, @@ -151,7 +134,7 @@ function serialize(prof, startTimeNanos, endTimeNanos) { time_nanos : startTimeNanos, // Nanos duration_nanos : endTimeNanos - startTimeNanos, // Nanos - period_type : timeValue, + period_type : bytesValue, period : SAMPLE_PERIOD }); return profile; From 828f4849c4f867124cdbf96ac91b19e4721ac786 Mon Sep 17 00:00:00 2001 From: Matt Loring Date: Fri, 6 May 2016 19:45:57 +0200 Subject: [PATCH 007/632] Added support for devtools formatted output --- handwritten/cloud-profiler/lib/heap_index.js | 16 ++++++++++++++++ .../cloud-profiler/src/sampling-heap-profiler.cc | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/handwritten/cloud-profiler/lib/heap_index.js b/handwritten/cloud-profiler/lib/heap_index.js index 1e382e94163..5369ed6ce65 100644 --- a/handwritten/cloud-profiler/lib/heap_index.js +++ b/handwritten/cloud-profiler/lib/heap_index.js @@ -40,6 +40,8 @@ function profileInterval() { // console.log('V8 heap statistics', stats.getHeapSpaceStatistics()); var result = profiler.getAllocationProfile(); // console.log('sample count * sample rate', result.length * 1024); + var devtoolsFormat = translateToDevtools(result); + fs.writeFile(runName + '.heapprofile', JSON.stringify({ head: devtoolsFormat })); var processed = builder.serialize(result, startTime * 1e6, endTime * 1e6) .encode() .toBuffer(); @@ -50,6 +52,20 @@ function profileInterval() { }, intervalMillis).unref(); } +function translateToDevtools(node) { + var result = {}; + result.functionName = node.name; + result.scriptId = node.scriptId; + result.lineNumber = node.lineNumber; + result.columnNumber = node.columnNumber; + result.url = node.scriptName; + result.selfSize = node.allocations.reduce(function(sum, alloc) { + return sum + alloc.size * alloc.count; + }, 0); + result.children = node.children.map(translateToDevtools); + return result; +} + process.on('exit', function() { profiler.stopSamplingHeapProfiler(); }); process.on('uncaughtException', diff --git a/handwritten/cloud-profiler/src/sampling-heap-profiler.cc b/handwritten/cloud-profiler/src/sampling-heap-profiler.cc index 789f57f91b1..6741d4fcd30 100644 --- a/handwritten/cloud-profiler/src/sampling-heap-profiler.cc +++ b/handwritten/cloud-profiler/src/sampling-heap-profiler.cc @@ -25,8 +25,12 @@ Local TranslateAllocationProfile(AllocationProfile::Node* node) { node->name); js_node->Set(Nan::New("scriptName").ToLocalChecked(), node->script_name); + js_node->Set(Nan::New("scriptId").ToLocalChecked(), + Nan::New(node->script_id)); js_node->Set(Nan::New("lineNumber").ToLocalChecked(), Nan::New(node->line_number)); + js_node->Set(Nan::New("columnNumber").ToLocalChecked(), + Nan::New(node->column_number)); Local children = Nan::New(node->children.size()); for (size_t i = 0; i < node->children.size(); i++) { children->Set(i, TranslateAllocationProfile(node->children[i])); From 4371042d8fde65417bfb83451822ff88ea3e3e64 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Wed, 27 Sep 2017 08:05:17 -0700 Subject: [PATCH 008/632] chore: introduce gts (#8) Introduce google ts style through the `gts` npm module. Migrate source code to TypeScript. Switch proto compilation to static to be able to get types. --- handwritten/cloud-profiler/.gitignore | 3 + handwritten/cloud-profiler/binding.gyp | 6 +- .../{src => bindings}/cpu-profiler.cc | 0 .../sampling-heap-profiler.cc | 0 .../{src => bindings}/statistics.cc | 0 handwritten/cloud-profiler/lib/builder.js | 153 -- .../cloud-profiler/lib/heap_builder.js | 143 -- handwritten/cloud-profiler/package-lock.json | 1625 +++++++++++++++++ handwritten/cloud-profiler/package.json | 49 +- handwritten/cloud-profiler/src/builder.ts | 123 ++ .../cloud-profiler/src/heap-builder.ts | 135 ++ .../{lib/heap_index.js => src/heap-index.ts} | 61 +- .../{lib/index.js => src/index.ts} | 51 +- handwritten/cloud-profiler/src/util.ts | 24 + handwritten/cloud-profiler/src/v8-types.ts | 49 + handwritten/cloud-profiler/tsconfig.json | 16 + 16 files changed, 2073 insertions(+), 365 deletions(-) rename handwritten/cloud-profiler/{src => bindings}/cpu-profiler.cc (100%) rename handwritten/cloud-profiler/{src => bindings}/sampling-heap-profiler.cc (100%) rename handwritten/cloud-profiler/{src => bindings}/statistics.cc (100%) delete mode 100644 handwritten/cloud-profiler/lib/builder.js delete mode 100644 handwritten/cloud-profiler/lib/heap_builder.js create mode 100644 handwritten/cloud-profiler/package-lock.json create mode 100644 handwritten/cloud-profiler/src/builder.ts create mode 100644 handwritten/cloud-profiler/src/heap-builder.ts rename handwritten/cloud-profiler/{lib/heap_index.js => src/heap-index.ts} (54%) rename handwritten/cloud-profiler/{lib/index.js => src/index.ts} (61%) create mode 100644 handwritten/cloud-profiler/src/util.ts create mode 100644 handwritten/cloud-profiler/src/v8-types.ts create mode 100644 handwritten/cloud-profiler/tsconfig.json diff --git a/handwritten/cloud-profiler/.gitignore b/handwritten/cloud-profiler/.gitignore index e3fbd98336e..8f21f7baddf 100644 --- a/handwritten/cloud-profiler/.gitignore +++ b/handwritten/cloud-profiler/.gitignore @@ -1,2 +1,5 @@ +.vscode build node_modules +src/profile.d.ts +src/profile.js diff --git a/handwritten/cloud-profiler/binding.gyp b/handwritten/cloud-profiler/binding.gyp index 3b777cce04b..17544900764 100644 --- a/handwritten/cloud-profiler/binding.gyp +++ b/handwritten/cloud-profiler/binding.gyp @@ -2,17 +2,17 @@ "targets": [ { "target_name": "cpu_profiler", - "sources": [ "src/cpu-profiler.cc" ], + "sources": [ "bindings/cpu-profiler.cc" ], "include_dirs": [ " 0) { - var sample = new Sample({ - location_id : stack, - value : [ node.hitCount * SAMPLE_INTERVAL, node.hitCount ] - // label? - }); - samples.push(sample); - } - node.children.forEach(function(child) { serializeNode(child, stack); }); - stack.shift(); -} - -function serialize(prof, startTimeNanos) { - samples = []; - locations = []; - functions = []; - locationMap = {}; - functionMap = {}; - strings = strings.slice(0, 5); - serializeNode(prof.topDownRoot, []); - var profile = new Profile({ - sample_type : [ timeValue, sampleValue ], - sample : samples, - // mapping: mappings, - location : locations, "function" : functions, - string_table : strings, - // opt drop_frames - // opt keep_frames - time_nanos : startTimeNanos, // Nanos - duration_nanos : prof.endTime - prof.startTime, // Nanos - - period_type : timeValue, - period : SAMPLE_INTERVAL - }); - return profile; -} - -module.exports.serialize = serialize; diff --git a/handwritten/cloud-profiler/lib/heap_builder.js b/handwritten/cloud-profiler/lib/heap_builder.js deleted file mode 100644 index 645608ac0ff..00000000000 --- a/handwritten/cloud-profiler/lib/heap_builder.js +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Copyright 2015 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'; - -var ProtoBuf = require('protobufjs'); -var builder = ProtoBuf.loadProtoFile('third_party/proto/profile.proto'); -var perftools = builder.build('perftools'); - -// TODO: pass this value explicitly when starting the profiler -const SAMPLE_PERIOD = 512 * 1024; - -var Profile = perftools.profiles.Profile; -var ValueType = perftools.profiles.ValueType; -var Sample = perftools.profiles.Sample; -var Location = perftools.profiles.Location; -var Mapping = perftools.profiles.Mapping; -var Function = perftools.profiles.Function; -var Line = perftools.profiles.Line; - -var strings = [ '' ]; -var samples = []; - -var locationIds = [ 'dummy' ]; -var locations = []; -var locationMap = {}; - -var functionIds = [ 'dummy' ]; -var functions = []; -var functionMap = {}; - -function getIndexOrAdd(str, lst) { - var index = lst.indexOf(str); - if (index !== -1) { - return index; - } - index = lst.push(str); - return index - 1; -} - -function getStringIndex(str) { return getIndexOrAdd(str, strings); } - -function getFunction(stackNode) { - var unique = JSON.stringify(stackNode); - var id = getIndexOrAdd(unique, functionIds); - if (functionMap[id]) { - return functionMap[id]; - } - var f = new Function({ - id : id, - name : getStringIndex(stackNode.name || '(anonymous)'), - system_name : getStringIndex('callUID-' + id), - filename : getStringIndex(stackNode.scriptName) - // start_line - }); - functions.push(f); - functionMap[id] = f; - return f; -} - -function getLine(stackNode) { - return new Line( - {function_id : getFunction(stackNode).id, line : stackNode.line}); -} - -function getLocation(stackNode) { - var unique = JSON.stringify(stackNode); - var id = getIndexOrAdd(unique, locationIds); - if (locationMap[id]) { - return locationMap[id]; - } - var location = new Location({ - id : id, - // mapping_id: getMapping(node).id, - line : [ getLine(stackNode) ] - }); - locations.push(location); - locationMap[id] = location; - return location; -} - -var countValue = - new ValueType(getStringIndex('objects'), getStringIndex('count')); -var bytesValue = - new ValueType(getStringIndex('space'), getStringIndex('bytes')); - -function serializeNode(node, stack) { - var location = getLocation(node); - stack.unshift(location.id); // leaf is first in the stack - for (var i in node.allocations) { - var alloc = node.allocations[i]; - var sample = new Sample({ - location_id : stack, - value : [ alloc.count, alloc.count * alloc.size ] - // label? - }); - samples.push(sample); - } - node.children.forEach(function(child) { serializeNode(child, stack); }); - stack.shift(); -} - -function serialize(prof, startTimeNanos, endTimeNanos) { - samples = []; - locations = []; - functions = []; - locationMap = {}; - functionMap = {}; - strings = strings.slice(0, 5); - locationIds = locationIds.slice(0, 1); - functionIds = functionIds.slice(0, 1); - serializeNode(prof, []); - var profile = new Profile({ - sample_type : [ countValue, bytesValue ], - sample : samples, - // mapping: mappings, - location : locations, "function" : functions, - string_table : strings, - // opt drop_frames - // opt keep_frames - time_nanos : startTimeNanos, // Nanos - duration_nanos : endTimeNanos - startTimeNanos, // Nanos - - period_type : bytesValue, - period : SAMPLE_PERIOD - }); - return profile; -} - -module.exports.serialize = serialize; diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json new file mode 100644 index 00000000000..433635b057f --- /dev/null +++ b/handwritten/cloud-profiler/package-lock.json @@ -0,0 +1,1625 @@ +{ + "name": "@google-cloud/profiler", + "version": "0.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=", + "dev": true + }, + "@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "dev": true + }, + "@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "dev": true + }, + "@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=", + "dev": true + }, + "@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", + "dev": true, + "requires": { + "@protobufjs/aspromise": "1.1.2", + "@protobufjs/inquire": "1.1.0" + } + }, + "@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=", + "dev": true + }, + "@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=", + "dev": true + }, + "@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=", + "dev": true + }, + "@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=", + "dev": true + }, + "@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=", + "dev": true + }, + "@types/long": { + "version": "3.0.32", + "resolved": "https://registry.npmjs.org/@types/long/-/long-3.0.32.tgz", + "integrity": "sha512-ZXyOOm83p7X8p3s0IYM3VeueNmHpkk/yMlP8CLeOnEcu6hIwPH7YjZBvhQkR0ZFS2DqZAxKtJ/M5fcuv3OU5BA==", + "dev": true + }, + "@types/node": { + "version": "8.0.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.30.tgz", + "integrity": "sha512-IaQtG3DWe9gRsmk1DqNnYyRVjGDVcBdZywkRVF2f62Boe8XKmlR7lNcwC6pk4V4W8nk+Zu+vdGMsOdRTDj1JPA==", + "dev": true + }, + "ansi-align": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz", + "integrity": "sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=", + "dev": true, + "requires": { + "string-width": "2.1.1" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "ansi-escapes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", + "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "bindings": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz", + "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==" + }, + "boxen": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.2.1.tgz", + "integrity": "sha1-DxHn/jRO25OXl3/BPt5/ZNlWSB0=", + "dev": true, + "requires": { + "ansi-align": "2.0.0", + "camelcase": "4.1.0", + "chalk": "2.1.0", + "cli-boxes": "1.0.0", + "string-width": "2.1.1", + "term-size": "1.2.0", + "widest-line": "1.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true + }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "requires": { + "camelcase": "2.1.1", + "map-obj": "1.0.1" + } + }, + "capture-stack-trace": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz", + "integrity": "sha1-Sm+gc5nCa7pH8LJJa00PtAjFVQ0=", + "dev": true + }, + "chalk": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", + "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.4.0" + } + }, + "clang-format": { + "version": "1.0.55", + "resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.0.55.tgz", + "integrity": "sha1-gDEnEynieneaXQj8Xc4k18UsFNU=", + "dev": true, + "requires": { + "async": "1.5.2", + "glob": "7.1.2", + "resolve": "1.4.0" + } + }, + "cli-boxes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz", + "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=", + "dev": true + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "2.0.0" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "color-convert": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", + "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true + }, + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "configstore": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.1.tgz", + "integrity": "sha512-5oNkD/L++l0O6xGXxb1EWS7SivtjfGQlRyxJsYgE0Z495/L81e2h4/d3r969hoPXuFItzNOKMtsXgYG4c7dYvw==", + "dev": true, + "requires": { + "dot-prop": "4.2.0", + "graceful-fs": "4.1.11", + "make-dir": "1.0.0", + "unique-string": "1.0.0", + "write-file-atomic": "2.3.0", + "xdg-basedir": "3.0.0" + } + }, + "create-error-class": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", + "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=", + "dev": true, + "requires": { + "capture-stack-trace": "1.0.0" + } + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "4.1.1", + "shebang-command": "1.2.0", + "which": "1.3.0" + } + }, + "crypto-random-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz", + "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", + "dev": true + }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "1.0.2" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "deep-extend": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", + "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", + "dev": true + }, + "diff": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", + "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", + "dev": true + }, + "dot-prop": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "dev": true, + "requires": { + "is-obj": "1.0.1" + } + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "error-ex": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", + "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "dev": true, + "requires": { + "is-arrayish": "0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" + } + }, + "external-editor": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.5.tgz", + "integrity": "sha512-Msjo64WT5W+NhOpQXh0nOHm+n0RfU1QUwDnKYvJ8dEJ8zlwLrqXNTv5mSUTJpepf41PDJGyhueTw2vNZW+Fr/w==", + "dev": true, + "requires": { + "iconv-lite": "0.4.19", + "jschardet": "1.5.1", + "tmp": "0.0.33" + } + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5" + } + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "got": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", + "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", + "dev": true, + "requires": { + "create-error-class": "3.0.2", + "duplexer3": "0.1.4", + "get-stream": "3.0.0", + "is-redirect": "1.0.0", + "is-retry-allowed": "1.1.0", + "is-stream": "1.1.0", + "lowercase-keys": "1.0.0", + "safe-buffer": "5.1.1", + "timed-out": "4.0.1", + "unzip-response": "2.0.1", + "url-parse-lax": "1.0.0" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "gts": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/gts/-/gts-0.3.1.tgz", + "integrity": "sha512-sQ3PB13CRo25OLFnnQw2Y2Kcrdp2q8onLxxcWSyqoSSPFfvcIM0yVwJHllQeCGT/CuDIrrD0XAEt5GqKMbv1CA==", + "dev": true, + "requires": { + "chalk": "2.1.0", + "clang-format": "1.0.55", + "inquirer": "3.3.0", + "meow": "3.7.0", + "pify": "3.0.0", + "read-package-json": "2.0.12", + "rimraf": "2.6.2", + "tslint": "5.7.0", + "update-notifier": "2.2.0", + "write-file-atomic": "2.3.0" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "hosted-git-info": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", + "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", + "dev": true + }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", + "dev": true + }, + "import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "2.0.1" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "ini": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", + "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=", + "dev": true + }, + "inquirer": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", + "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", + "dev": true, + "requires": { + "ansi-escapes": "3.0.0", + "chalk": "2.1.0", + "cli-cursor": "2.1.0", + "cli-width": "2.2.0", + "external-editor": "2.0.5", + "figures": "2.0.0", + "lodash": "4.17.4", + "mute-stream": "0.0.7", + "run-async": "2.3.0", + "rx-lite": "4.0.8", + "rx-lite-aggregates": "4.0.8", + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "through": "2.3.8" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "1.1.1" + } + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-npm": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", + "integrity": "sha1-8vtjpl5JBbQGyGBydloaTceTufQ=", + "dev": true + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-redirect": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", + "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", + "dev": true + }, + "is-retry-allowed": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", + "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "jschardet": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.5.1.tgz", + "integrity": "sha512-vE2hT1D0HLZCLLclfBSfkfTTedhVj0fubHpJBHKwwUWX0nSbhPAfk+SG9rTX95BYNmau8rGFfCeaT6T5OW1C2A==", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz", + "integrity": "sha512-xyQpxeWWMKyJps9CuGJYeng6ssI5bpqS9ltQpdVQ90t4ql6NdnxFKh95JcRt2cun/DjMVNrdjniLPuMA69xmCw==", + "dev": true + }, + "latest-version": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz", + "integrity": "sha1-ogU4P+oyKzO1rjsYq+4NwvNW7hU=", + "dev": true, + "requires": { + "package-json": "4.0.1" + } + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "strip-bom": "2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + }, + "long": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", + "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=", + "dev": true + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "0.4.1", + "signal-exit": "3.0.2" + } + }, + "lowercase-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", + "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=", + "dev": true + }, + "lru-cache": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + }, + "make-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.0.0.tgz", + "integrity": "sha1-l6ARdR6R3YfPre9Ygy67BJNt6Xg=", + "dev": true, + "requires": { + "pify": "2.3.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + }, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "requires": { + "camelcase-keys": "2.1.0", + "decamelize": "1.2.0", + "loud-rejection": "1.6.0", + "map-obj": "1.0.1", + "minimist": "1.2.0", + "normalize-package-data": "2.4.0", + "object-assign": "4.1.1", + "read-pkg-up": "1.0.1", + "redent": "1.0.0", + "trim-newlines": "1.0.0" + } + }, + "mimic-fn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", + "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "1.1.8" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "nan": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", + "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=" + }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true, + "requires": { + "hosted-git-info": "2.5.0", + "is-builtin-module": "1.0.0", + "semver": "5.4.1", + "validate-npm-package-license": "3.0.1" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "2.0.1" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "1.1.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "package-json": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", + "integrity": "sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0=", + "dev": true, + "requires": { + "got": "6.7.1", + "registry-auth-token": "3.3.1", + "registry-url": "3.1.0", + "semver": "5.4.1" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "1.3.1" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "2.0.1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "2.0.4" + } + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, + "protobufjs": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.0.tgz", + "integrity": "sha512-47Y49f5JN5Qsbxas2TyI2zFO8j9GpQAQm5thf54fr2O8qcP/jkIXYxmYx1hN2WQFAhESU1xpVn5NWVDBB8WFnw==", + "dev": true, + "requires": { + "@protobufjs/aspromise": "1.1.2", + "@protobufjs/base64": "1.1.2", + "@protobufjs/codegen": "2.0.4", + "@protobufjs/eventemitter": "1.1.0", + "@protobufjs/fetch": "1.1.0", + "@protobufjs/float": "1.0.2", + "@protobufjs/inquire": "1.1.0", + "@protobufjs/path": "1.1.2", + "@protobufjs/pool": "1.1.0", + "@protobufjs/utf8": "1.1.0", + "@types/long": "3.0.32", + "@types/node": "7.0.43", + "long": "3.2.0" + }, + "dependencies": { + "@types/node": { + "version": "7.0.43", + "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.43.tgz", + "integrity": "sha512-7scYwwfHNppXvH/9JzakbVxk0o0QUILVk1Lv64GRaxwPuGpnF1QBiwdvhDpLcymb8BpomQL3KYoWKq3wUdDMhQ==", + "dev": true + } + } + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "rc": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz", + "integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=", + "dev": true, + "requires": { + "deep-extend": "0.4.2", + "ini": "1.3.4", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" + } + }, + "read-package-json": { + "version": "2.0.12", + "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.0.12.tgz", + "integrity": "sha512-m7/I0+tP6D34EVvSlzCtuVA4D/dHL6OpLcn2e4XVP5X57pCKGUy1JjRSBVKHWpB+vUU91sL85h84qX0MdXzBSw==", + "dev": true, + "requires": { + "glob": "7.1.2", + "graceful-fs": "4.1.11", + "json-parse-better-errors": "1.0.1", + "normalize-package-data": "2.4.0", + "slash": "1.0.0" + } + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "1.1.0", + "normalize-package-data": "2.4.0", + "path-type": "1.1.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "1.1.2", + "read-pkg": "1.1.0" + } + }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dev": true, + "requires": { + "indent-string": "2.1.0", + "strip-indent": "1.0.1" + } + }, + "registry-auth-token": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.1.tgz", + "integrity": "sha1-+w0yie4Nmtosu1KvXf5mywcNMAY=", + "dev": true, + "requires": { + "rc": "1.2.1", + "safe-buffer": "5.1.1" + } + }, + "registry-url": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", + "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=", + "dev": true, + "requires": { + "rc": "1.2.1" + } + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "1.0.2" + } + }, + "resolve": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", + "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", + "dev": true, + "requires": { + "path-parse": "1.0.5" + } + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "2.0.1", + "signal-exit": "3.0.2" + } + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "7.1.2" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "2.1.0" + } + }, + "rx-lite": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", + "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", + "dev": true + }, + "rx-lite-aggregates": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", + "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", + "dev": true, + "requires": { + "rx-lite": "4.0.8" + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "dev": true + }, + "semver": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", + "dev": true + }, + "semver-diff": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz", + "integrity": "sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=", + "dev": true, + "requires": { + "semver": "5.4.1" + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "spdx-correct": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", + "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", + "dev": true, + "requires": { + "spdx-license-ids": "1.2.2" + } + }, + "spdx-expression-parse": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", + "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", + "dev": true + }, + "spdx-license-ids": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", + "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", + "dev": true + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "0.2.1" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "4.0.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + }, + "term-size": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", + "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", + "dev": true, + "requires": { + "execa": "0.7.0" + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "dev": true + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "1.0.2" + } + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true + }, + "tslib": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.7.1.tgz", + "integrity": "sha1-vIAEFkaRkjp5/oN4u+s9ogF1OOw=", + "dev": true + }, + "tslint": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.7.0.tgz", + "integrity": "sha1-wl4NDJL6EgHCvDDoROCOaCtPNVI=", + "dev": true, + "requires": { + "babel-code-frame": "6.26.0", + "colors": "1.1.2", + "commander": "2.11.0", + "diff": "3.3.1", + "glob": "7.1.2", + "minimatch": "3.0.4", + "resolve": "1.4.0", + "semver": "5.4.1", + "tslib": "1.7.1", + "tsutils": "2.8.2" + } + }, + "tsutils": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.8.2.tgz", + "integrity": "sha1-LBSGukMSYIRbCsb5Aq/Z1wio6mo=", + "dev": true, + "requires": { + "tslib": "1.7.1" + } + }, + "typescript": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.2.tgz", + "integrity": "sha1-A4qV99m7tCCxvzW6MdTFwd0//jQ=", + "dev": true + }, + "unique-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", + "integrity": "sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo=", + "dev": true, + "requires": { + "crypto-random-string": "1.0.0" + } + }, + "unzip-response": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", + "integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c=", + "dev": true + }, + "update-notifier": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-2.2.0.tgz", + "integrity": "sha1-G1g3z5DAc22IYncytmHBOPht5y8=", + "dev": true, + "requires": { + "boxen": "1.2.1", + "chalk": "1.1.3", + "configstore": "3.1.1", + "import-lazy": "2.1.0", + "is-npm": "1.0.0", + "latest-version": "3.1.0", + "semver-diff": "2.1.0", + "xdg-basedir": "3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "dev": true, + "requires": { + "prepend-http": "1.0.4" + } + }, + "validate-npm-package-license": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", + "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", + "dev": true, + "requires": { + "spdx-correct": "1.0.2", + "spdx-expression-parse": "1.0.4" + } + }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + }, + "widest-line": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-1.0.0.tgz", + "integrity": "sha1-DAnIXCqUaD0Nfq+O4JfVZL8OEFw=", + "dev": true, + "requires": { + "string-width": "1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "imurmurhash": "0.1.4", + "signal-exit": "3.0.2" + } + }, + "xdg-basedir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", + "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + } + } +} diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index ed4ae2b9a6a..441f691dbfe 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -1,30 +1,43 @@ { - "name": "google-cloud-profile", + "name": "@google-cloud/profiler", "version": "0.0.1", "description": "Adds support for Google Cloud Profiler to node.js applications", - "main": "lib/index.js", + "main": "build/src/index.js", "scripts": { "install": "node-gyp rebuild", - "test": "mocha --timeout 4000" + "test": "mocha --timeout 4000", + "check": "gts check", + "clean": "gts clean", + "compile": "npm run proto && tsc -p .", + "fix": "gts fix", + "prepare": "npm run compile", + "pretest": "npm run compile", + "posttest": "npm run check", + "proto": "mkdir -p build/src && pbjs -t static-module -w commonjs -o src/profile.js third_party/proto/profile.proto && pbts -o src/profile.d.ts src/profile.js && cp src/profile.js build/src" + }, + "author": { + "name": "Google Inc." }, - "author": "Google Inc.", - "contributors": [ - { - "name": "Ali Ijaz Sheikh", - "email": "ofrobots@google.com" - }, - { - "name": "Matt Loring", - "email": "mattloring@google.com" - } - ], "license": "Apache-2.0", "dependencies": { "bindings": "^1.2.1", - "nan": "^2.1.0", - "protobufjs": "~5.0.1" + "nan": "^2.1.0" }, "devDependencies": { - "clang-format": "^1.0.33" - } + "@types/node": "^8.0.30", + "clang-format": "^1.0.33", + "gts": "latest", + "protobufjs": "~6.8.0", + "typescript": "^2.4.1" + }, + "files": [ + "build/src", + "build/types", + "bindings", + "third_party", + "binding.gyp", + "package-lock.json", + "package.json", + "README.md" + ] } diff --git a/handwritten/cloud-profiler/src/builder.ts b/handwritten/cloud-profiler/src/builder.ts new file mode 100644 index 00000000000..3310118fe24 --- /dev/null +++ b/handwritten/cloud-profiler/src/builder.ts @@ -0,0 +1,123 @@ +/** + * Copyright 2015 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. + */ +import {perftools} from './profile'; +import {getIndexOrAdd} from './util'; +import {CpuProfile, CpuProfileNode} from './v8-types'; + +// TODO: CpuProfiler::sample_interval_ can be customized.. should query that +const SAMPLE_INTERVAL = 1000; + +// A stack of function UIDs. +type Stack = Array; + +let strings = ['']; +let samples: Array = []; + +let locations: Array = []; +let locationMap: Map; + +let functions: Array = []; +let functionMap: Map; + +function getFunction(node: CpuProfileNode) { + const id = node.callUid; + if (functionMap.has(id)) { + // Map.get returns possibly undefined, but we know it is defined. + // TODO: figure out how to avoid the cast. + return functionMap.get(id) as perftools.profiles.Function; + } + const f = new perftools.profiles.Function({ + id: id, + name: getIndexOrAdd(node.functionName || '(anonymous)', strings), + systemName: getIndexOrAdd('callUID-' + id, strings), + filename: getIndexOrAdd(node.scriptResourceName || '(unknown)', strings) + // start_line + }); + functions.push(f); + functionMap.set(id, f); + return f; +} + +function getLine(node: CpuProfileNode) { + return new perftools.profiles.Line( + {functionId: getFunction(node).id, line: node.lineNumber}); +} + +function getLocation(node: CpuProfileNode): perftools.profiles.Location { + const id = node.callUid; + if (locationMap.has(id)) { + return locationMap.get(id) as perftools.profiles.Location; + } + const location = new perftools.profiles.Location({ + id: id, + // mapping_id: getMapping(node).id, + line: [getLine(node)] + }); + locations.push(location); + locationMap.set(id, location); + return location; +} + +const sampleValue = new perftools.profiles.ValueType({ + type: getIndexOrAdd('samples', strings), + unit: getIndexOrAdd('count', strings) +}); +const timeValue = new perftools.profiles.ValueType( + {type: getIndexOrAdd('time', strings), unit: getIndexOrAdd('µs', strings)}); + +function serializeNode(node: CpuProfileNode, stack: Stack) { + const location = getLocation(node); + // TODO: deal with location.id being a Long. + stack.unshift(location.id as number); // leaf is first in the stack + if (node.hitCount > 0) { + const sample = new perftools.profiles.Sample({ + locationId: stack, + value: [node.hitCount * SAMPLE_INTERVAL, node.hitCount] + // label? + }); + samples.push(sample); + } + node.children.forEach(function(child) { + serializeNode(child, stack); + }); + stack.shift(); +} + +export function serialize( + prof: CpuProfile, startTimeNanos: number): perftools.profiles.IProfile { + samples = []; + locations = []; + functions = []; + locationMap = new Map(); + functionMap = new Map(); + strings = strings.slice(0, 5); + serializeNode(prof.topDownRoot, []); + return { + sampleType: [timeValue, sampleValue], + sample: samples, + // mapping: mappings, + location: locations, + 'function': functions, + stringTable: strings, + // opt drop_frames + // opt keep_frames + timeNanos: startTimeNanos, // Nanos + durationNanos: prof.endTime - prof.startTime, // Nanos + + periodType: timeValue, + period: SAMPLE_INTERVAL + }; +} diff --git a/handwritten/cloud-profiler/src/heap-builder.ts b/handwritten/cloud-profiler/src/heap-builder.ts new file mode 100644 index 00000000000..9f6dc454a22 --- /dev/null +++ b/handwritten/cloud-profiler/src/heap-builder.ts @@ -0,0 +1,135 @@ +/** + * Copyright 2015 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. + */ +import {perftools} from './profile'; +import {getIndexOrAdd} from './util'; +import {AllocationProfileNode} from './v8-types'; + +// A stack of function UIDs. +// TODO: duplicated in builder.ts +type Stack = Array; + + +// TODO: pass this value explicitly when starting the profiler +const SAMPLE_PERIOD = 512 * 1024; + +let strings = ['']; +let samples: Array = []; + +let locationIds = ['dummy']; +let locations: Array = []; +let locationMap: Map; + +let functionIds = ['dummy']; +let functions: Array = []; +let functionMap: Map; + +function getStringIndex(str: string) { + return getIndexOrAdd(str, strings); +} + +function getFunction(stackNode: AllocationProfileNode) { + const unique = JSON.stringify(stackNode); + const id = getIndexOrAdd(unique, functionIds); + if (functionMap.has(id)) { + return functionMap.get(id); + } + const f = new perftools.profiles.Function({ + id: id, + name: getStringIndex(stackNode.name || '(anonymous)'), + systemName: getStringIndex('callUID-' + id), + filename: getStringIndex(stackNode.scriptName) + // start_line + }); + functions.push(f); + functionMap.set(id, f); + return f; +} + +function getLine(stackNode: AllocationProfileNode) { + return new perftools.profiles.Line({ + functionId: (getFunction(stackNode) as perftools.profiles.Function).id, + line: stackNode.lineNumber + }); +} + +function getLocation(stackNode: AllocationProfileNode) { + const unique = JSON.stringify(stackNode); + const id = getIndexOrAdd(unique, locationIds); + if (locationMap.has(id)) { + return locationMap.get(id); + } + const location = new perftools.profiles.Location({ + id: id, + // mapping_id: getMapping(node).id, + line: [getLine(stackNode)] + }); + locations.push(location); + locationMap.set(id, location); + return location; +} + +const countValue = new perftools.profiles.ValueType( + {type: getStringIndex('objects'), unit: getStringIndex('count')}); +const bytesValue = new perftools.profiles.ValueType( + {type: getStringIndex('space'), unit: getStringIndex('bytes')}); + +function serializeNode(node: AllocationProfileNode, stack: Stack) { + // TODO: get rid of the cast. + const location = getLocation(node) as perftools.profiles.Location; + // TODO: get rid of the cast + stack.unshift(location.id as number); // leaf is first in the stack + for (const alloc of node.allocations) { + const sample = new perftools.profiles.Sample({ + locationId: stack, + value: [alloc.count, alloc.count * alloc.size] + // label? + }); + samples.push(sample); + } + node.children.forEach(function(child) { + serializeNode(child, stack); + }); + stack.shift(); +} + +export function serialize( + prof: AllocationProfileNode, startTimeNanos: number, + endTimeNanos: number): perftools.profiles.IProfile { + samples = []; + locations = []; + functions = []; + locationMap = new Map(); + functionMap = new Map(); + strings = strings.slice(0, 5); + locationIds = locationIds.slice(0, 1); + functionIds = functionIds.slice(0, 1); + serializeNode(prof, []); + return { + sampleType: [countValue, bytesValue], + sample: samples, + // mapping: mappings, + location: locations, + 'function': functions, + stringTable: strings, + // opt drop_frames + // opt keep_frames + timeNanos: startTimeNanos, // Nanos + durationNanos: endTimeNanos - startTimeNanos, // Nanos + + periodType: bytesValue, + period: SAMPLE_PERIOD + }; +} diff --git a/handwritten/cloud-profiler/lib/heap_index.js b/handwritten/cloud-profiler/src/heap-index.ts similarity index 54% rename from handwritten/cloud-profiler/lib/heap_index.js rename to handwritten/cloud-profiler/src/heap-index.ts index 5369ed6ce65..b8f84924431 100644 --- a/handwritten/cloud-profiler/lib/heap_index.js +++ b/handwritten/cloud-profiler/src/heap-index.ts @@ -14,46 +14,53 @@ * limitations under the License. */ -'use strict'; +import * as fs from 'fs'; +import * as stream from 'stream'; +import * as zlib from 'zlib'; -var profiler = require('bindings')('sampling_heap_profiler'); -var stats = require('bindings')('statistics'); -var zlib = require('zlib'); -var fs = require('fs'); -var stream = require('stream'); +import {serialize} from './heap-builder'; +import {perftools} from './profile'; +import {AllocationProfileNode} from './v8-types'; -var builder = require('./heap_builder.js'); +const profiler = require('bindings')('sampling_heap_profiler'); +const stats = require('bindings')('statistics'); -var startTime = Date.now(); +const startTime = Date.now(); // console.log('V8 statistics', require('v8').getHeapStatistics()); // console.log('V8 heap statistics', stats.getHeapSpaceStatistics()); profiler.startSamplingHeapProfiler(); -var intervalMillis = 5 * 1000; +const intervalMillis = 5 * 1000; function profileInterval() { setTimeout(function() { - var endTime = Date.now(); - var runName = 'cloud-profile-' + endTime; + const endTime = Date.now(); + const runName = 'cloud-profile-' + endTime; // console.log('V8 statistics', require('v8').getHeapStatistics()); // console.log('V8 heap statistics', stats.getHeapSpaceStatistics()); - var result = profiler.getAllocationProfile(); + const result = profiler.getAllocationProfile(); // console.log('sample count * sample rate', result.length * 1024); - var devtoolsFormat = translateToDevtools(result); - fs.writeFile(runName + '.heapprofile', JSON.stringify({ head: devtoolsFormat })); - var processed = builder.serialize(result, startTime * 1e6, endTime * 1e6) - .encode() - .toBuffer(); - var outp = fs.createWriteStream(runName + '.pb.gz'); - var inp = new stream.PassThrough(); - inp.end(processed); + const devtoolsFormat = translateToDevtools(result); + + // // TODO: deal with the result of writing. + fs.writeFile( + runName + '.heapprofile', JSON.stringify({head: devtoolsFormat}), + () => {/*empty*/}); + + const serialized = serialize(result, startTime * 1e6, endTime * 1e6); + const writer = perftools.profiles.Profile.encode(serialized); + const buffer = writer.finish(); + + const outp = fs.createWriteStream(runName + '.pb.gz'); + const inp = new stream.PassThrough(); + inp.end(buffer); inp.pipe(zlib.createGzip()).pipe(outp).on('close', profileInterval); }, intervalMillis).unref(); } -function translateToDevtools(node) { - var result = {}; +function translateToDevtools(node: AllocationProfileNode) { + const result: any = {}; result.functionName = node.name; result.scriptId = node.scriptId; result.lineNumber = node.lineNumber; @@ -66,9 +73,13 @@ function translateToDevtools(node) { return result; } -process.on('exit', function() { profiler.stopSamplingHeapProfiler(); }); +process.on('exit', function() { + profiler.stopSamplingHeapProfiler(); +}); -process.on('uncaughtException', - function(e) { profiler.stopSamplingHeapProfiler(); throw e; }); +process.on('uncaughtException', function(e) { + profiler.stopSamplingHeapProfiler(); + throw e; +}); profileInterval(); diff --git a/handwritten/cloud-profiler/lib/index.js b/handwritten/cloud-profiler/src/index.ts similarity index 61% rename from handwritten/cloud-profiler/lib/index.js rename to handwritten/cloud-profiler/src/index.ts index ea2a58bf9f9..7a9d6c93e2a 100644 --- a/handwritten/cloud-profiler/lib/index.js +++ b/handwritten/cloud-profiler/src/index.ts @@ -13,43 +13,48 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import * as assert from 'assert'; +import * as fs from 'fs'; +import * as stream from 'stream'; +import * as util from 'util'; +import * as zlib from 'zlib'; -'use strict'; +import {serialize} from './builder'; +import {perftools} from './profile'; -var assert = require('assert'); -var util = require('util'); -var profiler = require('bindings')('cpu_profiler'); -var zlib = require('zlib'); -var fs = require('fs'); -var stream = require('stream'); +type HrTimeTuple = [number, number]; -var builder = require('./builder.js'); +const profiler = require('bindings')('cpu_profiler'); -function timeToNanos(tuple) { return tuple[0] * 1e9 + tuple[1]; } +function timeToNanos(tuple: HrTimeTuple) { + return tuple[0] * 1e9 + tuple[1]; +} -var durationMillis = 10 * 1000; -var intervalMillis = 60 * 1000; -var isActive = false; +const durationMillis = 10 * 1000; +const intervalMillis = 60 * 1000; +let isActive = false; function profileInterval() { assert(durationMillis <= intervalMillis); - var startDelay = Math.random(0, intervalMillis - durationMillis); + const startDelay = (intervalMillis - durationMillis) * Math.random(); setTimeout(function() { - var startTime = Date.now(); - var runName = 'cloud-profile-' + startTime; + const startTime = Date.now(); + const runName = 'cloud-profile-' + startTime; profiler.startProfiling(runName, true); isActive = true; setTimeout(function() { isActive = false; - var result = profiler.stopProfiling(runName); - var processed = - builder.serialize(result, startTime * 1e6).encode().toBuffer(); - var outp = fs.createWriteStream(runName + '.pb.gz'); - var inp = new stream.PassThrough(); - inp.end(processed); + const result = profiler.stopProfiling(runName); + const serialized = serialize(result, startTime * 1e6); + const writer = perftools.profiles.Profile.encode(serialized); + const buffer = writer.finish(); + + const outp = fs.createWriteStream(runName + '.pb.gz'); + const inp = new stream.PassThrough(); + inp.end(buffer); inp.pipe(zlib.createGzip()).pipe(outp).on('close', function() { - setTimeout(profileInterval, - intervalMillis - startDelay - durationMillis) + setTimeout( + profileInterval, intervalMillis - startDelay - durationMillis) .unref(); }); }, durationMillis).unref(); diff --git a/handwritten/cloud-profiler/src/util.ts b/handwritten/cloud-profiler/src/util.ts new file mode 100644 index 00000000000..d0c58be22a8 --- /dev/null +++ b/handwritten/cloud-profiler/src/util.ts @@ -0,0 +1,24 @@ +/** + * Copyright 2015 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. + */ + +export function getIndexOrAdd(element: T, lst: Array) { + let index = lst.indexOf(element); + if (index !== -1) { + return index; + } + index = lst.push(element); + return index - 1; +} diff --git a/handwritten/cloud-profiler/src/v8-types.ts b/handwritten/cloud-profiler/src/v8-types.ts new file mode 100644 index 00000000000..2b1fac6c901 --- /dev/null +++ b/handwritten/cloud-profiler/src/v8-types.ts @@ -0,0 +1,49 @@ +/** + * 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. + */ + +// Type Definitions based on implementation in bindings/ + +export interface CpuProfile { + /** Time in nanoseconds at which profile was stopped. */ + endTime: number; + topDownRoot: CpuProfileNode; + /** Time in nanoseconds at which profile was started. */ + startTime: number; +} + +export interface CpuProfileNode { + callUid: number; + scriptResourceName?: string; + functionName?: string; + lineNumber: number; + hitCount: number; + children: Array; +} + +export interface AllocationProfileNode { + name: string; + scriptName: string; + scriptId: number; + lineNumber: number; + columnNumber: number; + allocations: Array; + children: Array; +} + +export interface Allocation { + size: number; + count: number; +} diff --git a/handwritten/cloud-profiler/tsconfig.json b/handwritten/cloud-profiler/tsconfig.json new file mode 100644 index 00000000000..c47ad1de00a --- /dev/null +++ b/handwritten/cloud-profiler/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build" + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} From 6db2796af84eb7010045d3d7d109715681c81f0f Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Fri, 29 Sep 2017 17:47:15 -0700 Subject: [PATCH 009/632] chore: add .travis.yml (#10) --- handwritten/cloud-profiler/.travis.yml | 17 +++++++++++++++++ handwritten/cloud-profiler/package.json | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 handwritten/cloud-profiler/.travis.yml diff --git a/handwritten/cloud-profiler/.travis.yml b/handwritten/cloud-profiler/.travis.yml new file mode 100644 index 00000000000..3274ac6fe69 --- /dev/null +++ b/handwritten/cloud-profiler/.travis.yml @@ -0,0 +1,17 @@ +sudo: false + +language: node_js + +node_js: + - "6" + - "8" + +env: + - CXX=g++-4.8 + +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 441f691dbfe..908c95723ac 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -5,7 +5,7 @@ "main": "build/src/index.js", "scripts": { "install": "node-gyp rebuild", - "test": "mocha --timeout 4000", + "test": "true", "check": "gts check", "clean": "gts clean", "compile": "npm run proto && tsc -p .", From 55e289962af1f81e8244ff8168d155c4ebb67494 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Tue, 10 Oct 2017 09:56:02 -0700 Subject: [PATCH 010/632] Added code capturing how to start agent (#9) --- handwritten/cloud-profiler/package-lock.json | 1507 +---------------- handwritten/cloud-profiler/package.json | 2 + handwritten/cloud-profiler/src/builder.ts | 123 -- handwritten/cloud-profiler/src/config.ts | 74 + .../cloud-profiler/src/heap-builder.ts | 135 -- handwritten/cloud-profiler/src/heap-index.ts | 85 - handwritten/cloud-profiler/src/index.ts | 128 +- handwritten/cloud-profiler/src/profiler.ts | 67 + .../src/profilers/cpu-profiler.ts | 7 + .../src/profilers/heap-profiler.ts | 7 + .../cloud-profiler/third_party/types/LICENSE | 202 +++ .../third_party/types/README.google | 10 + .../third_party/types/common-types.ts | 105 ++ .../third_party/types/gcp-metadata-types.ts | 32 + handwritten/cloud-profiler/tsconfig.json | 6 +- 15 files changed, 646 insertions(+), 1844 deletions(-) delete mode 100644 handwritten/cloud-profiler/src/builder.ts create mode 100644 handwritten/cloud-profiler/src/config.ts delete mode 100644 handwritten/cloud-profiler/src/heap-builder.ts delete mode 100644 handwritten/cloud-profiler/src/heap-index.ts create mode 100644 handwritten/cloud-profiler/src/profiler.ts create mode 100644 handwritten/cloud-profiler/src/profilers/cpu-profiler.ts create mode 100644 handwritten/cloud-profiler/src/profilers/heap-profiler.ts create mode 100644 handwritten/cloud-profiler/third_party/types/LICENSE create mode 100644 handwritten/cloud-profiler/third_party/types/README.google create mode 100644 handwritten/cloud-profiler/third_party/types/common-types.ts create mode 100644 handwritten/cloud-profiler/third_party/types/gcp-metadata-types.ts diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 433635b057f..d7e4ddf7935 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -68,6 +68,12 @@ "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=", "dev": true }, + "@types/extend": { + "version": "2.0.30", + "resolved": "https://registry.npmjs.org/@types/extend/-/extend-2.0.30.tgz", + "integrity": "sha1-WMyT9iHQo1jT/sm9bnObxg7H4nU=", + "dev": true + }, "@types/long": { "version": "3.0.32", "resolved": "https://registry.npmjs.org/@types/long/-/long-3.0.32.tgz", @@ -80,119 +86,12 @@ "integrity": "sha512-IaQtG3DWe9gRsmk1DqNnYyRVjGDVcBdZywkRVF2f62Boe8XKmlR7lNcwC6pk4V4W8nk+Zu+vdGMsOdRTDj1JPA==", "dev": true }, - "ansi-align": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz", - "integrity": "sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=", - "dev": true, - "requires": { - "string-width": "2.1.1" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - } - } - }, - "ansi-escapes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", - "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", - "dev": true - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.0" - } - }, - "array-find-index": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", - "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", - "dev": true - }, "async": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", "dev": true }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "esutils": "2.0.2", - "js-tokens": "3.0.2" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -204,60 +103,6 @@ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz", "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==" }, - "boxen": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.2.1.tgz", - "integrity": "sha1-DxHn/jRO25OXl3/BPt5/ZNlWSB0=", - "dev": true, - "requires": { - "ansi-align": "2.0.0", - "camelcase": "4.1.0", - "chalk": "2.1.0", - "cli-boxes": "1.0.0", - "string-width": "2.1.1", - "term-size": "1.2.0", - "widest-line": "1.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - } - } - }, "brace-expansion": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", @@ -268,45 +113,6 @@ "concat-map": "0.0.1" } }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "camelcase": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", - "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", - "dev": true - }, - "camelcase-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", - "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", - "dev": true, - "requires": { - "camelcase": "2.1.1", - "map-obj": "1.0.1" - } - }, - "capture-stack-trace": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz", - "integrity": "sha1-Sm+gc5nCa7pH8LJJa00PtAjFVQ0=", - "dev": true - }, - "chalk": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", - "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.4.0" - } - }, "clang-format": { "version": "1.0.55", "resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.0.55.tgz", @@ -318,213 +124,16 @@ "resolve": "1.4.0" } }, - "cli-boxes": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz", - "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=", - "dev": true - }, - "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", - "dev": true, - "requires": { - "restore-cursor": "2.0.0" - } - }, - "cli-width": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", - "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", - "dev": true - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, - "color-convert": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", - "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "colors": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", - "dev": true - }, - "commander": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", - "dev": true - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "configstore": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.1.tgz", - "integrity": "sha512-5oNkD/L++l0O6xGXxb1EWS7SivtjfGQlRyxJsYgE0Z495/L81e2h4/d3r969hoPXuFItzNOKMtsXgYG4c7dYvw==", - "dev": true, - "requires": { - "dot-prop": "4.2.0", - "graceful-fs": "4.1.11", - "make-dir": "1.0.0", - "unique-string": "1.0.0", - "write-file-atomic": "2.3.0", - "xdg-basedir": "3.0.0" - } - }, - "create-error-class": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", - "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=", - "dev": true, - "requires": { - "capture-stack-trace": "1.0.0" - } - }, - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true, - "requires": { - "lru-cache": "4.1.1", - "shebang-command": "1.2.0", - "which": "1.3.0" - } - }, - "crypto-random-string": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz", - "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", - "dev": true - }, - "currently-unhandled": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", - "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", - "dev": true, - "requires": { - "array-find-index": "1.0.2" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "deep-extend": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", - "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", - "dev": true - }, - "diff": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", - "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", - "dev": true - }, - "dot-prop": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", - "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", - "dev": true, - "requires": { - "is-obj": "1.0.1" - } - }, - "duplexer3": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", - "dev": true - }, - "error-ex": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", - "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", - "dev": true, - "requires": { - "is-arrayish": "0.2.1" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - }, - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", - "dev": true, - "requires": { - "cross-spawn": "5.1.0", - "get-stream": "3.0.0", - "is-stream": "1.1.0", - "npm-run-path": "2.0.2", - "p-finally": "1.0.0", - "signal-exit": "3.0.2", - "strip-eof": "1.0.0" - } - }, - "external-editor": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.5.tgz", - "integrity": "sha512-Msjo64WT5W+NhOpQXh0nOHm+n0RfU1QUwDnKYvJ8dEJ8zlwLrqXNTv5mSUTJpepf41PDJGyhueTw2vNZW+Fr/w==", - "dev": true, - "requires": { - "iconv-lite": "0.4.19", - "jschardet": "1.5.1", - "tmp": "0.0.33" - } - }, - "figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", - "dev": true, - "requires": { - "escape-string-regexp": "1.0.5" - } - }, - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "dev": true, - "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "2.0.1" - } + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" }, "fs.realpath": { "version": "1.0.0", @@ -532,18 +141,6 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", - "dev": true - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true - }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", @@ -558,97 +155,6 @@ "path-is-absolute": "1.0.1" } }, - "got": { - "version": "6.7.1", - "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", - "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", - "dev": true, - "requires": { - "create-error-class": "3.0.2", - "duplexer3": "0.1.4", - "get-stream": "3.0.0", - "is-redirect": "1.0.0", - "is-retry-allowed": "1.1.0", - "is-stream": "1.1.0", - "lowercase-keys": "1.0.0", - "safe-buffer": "5.1.1", - "timed-out": "4.0.1", - "unzip-response": "2.0.1", - "url-parse-lax": "1.0.0" - } - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "gts": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/gts/-/gts-0.3.1.tgz", - "integrity": "sha512-sQ3PB13CRo25OLFnnQw2Y2Kcrdp2q8onLxxcWSyqoSSPFfvcIM0yVwJHllQeCGT/CuDIrrD0XAEt5GqKMbv1CA==", - "dev": true, - "requires": { - "chalk": "2.1.0", - "clang-format": "1.0.55", - "inquirer": "3.3.0", - "meow": "3.7.0", - "pify": "3.0.0", - "read-package-json": "2.0.12", - "rimraf": "2.6.2", - "tslint": "5.7.0", - "update-notifier": "2.2.0", - "write-file-atomic": "2.3.0" - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", - "dev": true - }, - "hosted-git-info": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", - "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", - "dev": true - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", - "dev": true - }, - "import-lazy": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", - "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", - "dev": true - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "indent-string": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", - "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", - "dev": true, - "requires": { - "repeating": "2.0.1" - } - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -665,961 +171,96 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, - "ini": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", - "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=", + "long": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", + "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=", "dev": true }, - "inquirer": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", - "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "ansi-escapes": "3.0.0", - "chalk": "2.1.0", - "cli-cursor": "2.1.0", - "cli-width": "2.2.0", - "external-editor": "2.0.5", - "figures": "2.0.0", - "lodash": "4.17.4", - "mute-stream": "0.0.7", - "run-async": "2.3.0", - "rx-lite": "4.0.8", - "rx-lite-aggregates": "4.0.8", - "string-width": "2.1.1", - "strip-ansi": "4.0.0", - "through": "2.3.8" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - } + "brace-expansion": "1.1.8" } }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true + "nan": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", + "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=" }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "builtin-modules": "1.1.1" + "wrappy": "1.0.2" } }, - "is-finite": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", - "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, + "protobufjs": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.0.tgz", + "integrity": "sha512-47Y49f5JN5Qsbxas2TyI2zFO8j9GpQAQm5thf54fr2O8qcP/jkIXYxmYx1hN2WQFAhESU1xpVn5NWVDBB8WFnw==", "dev": true, "requires": { - "number-is-nan": "1.0.1" + "@protobufjs/aspromise": "1.1.2", + "@protobufjs/base64": "1.1.2", + "@protobufjs/codegen": "2.0.4", + "@protobufjs/eventemitter": "1.1.0", + "@protobufjs/fetch": "1.1.0", + "@protobufjs/float": "1.0.2", + "@protobufjs/inquire": "1.1.0", + "@protobufjs/path": "1.1.2", + "@protobufjs/pool": "1.1.0", + "@protobufjs/utf8": "1.1.0", + "@types/long": "3.0.32", + "@types/node": "7.0.43", + "long": "3.2.0" + }, + "dependencies": { + "@types/node": { + "version": "7.0.43", + "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.43.tgz", + "integrity": "sha512-7scYwwfHNppXvH/9JzakbVxk0o0QUILVk1Lv64GRaxwPuGpnF1QBiwdvhDpLcymb8BpomQL3KYoWKq3wUdDMhQ==", + "dev": true + } } }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "resolve": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", + "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", "dev": true, "requires": { - "number-is-nan": "1.0.1" + "path-parse": "1.0.5" } }, - "is-npm": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", - "integrity": "sha1-8vtjpl5JBbQGyGBydloaTceTufQ=", - "dev": true - }, - "is-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", - "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", - "dev": true - }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true - }, - "is-redirect": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", - "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", - "dev": true - }, - "is-retry-allowed": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", - "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=", - "dev": true - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "typescript": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.3.tgz", + "integrity": "sha512-ptLSQs2S4QuS6/OD1eAKG+S5G8QQtrU5RT32JULdZQtM1L3WTi34Wsu48Yndzi8xsObRAB9RPt/KhA9wlpEF6w==", "dev": true }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, - "jschardet": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.5.1.tgz", - "integrity": "sha512-vE2hT1D0HLZCLLclfBSfkfTTedhVj0fubHpJBHKwwUWX0nSbhPAfk+SG9rTX95BYNmau8rGFfCeaT6T5OW1C2A==", - "dev": true - }, - "json-parse-better-errors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz", - "integrity": "sha512-xyQpxeWWMKyJps9CuGJYeng6ssI5bpqS9ltQpdVQ90t4ql6NdnxFKh95JcRt2cun/DjMVNrdjniLPuMA69xmCw==", - "dev": true - }, - "latest-version": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz", - "integrity": "sha1-ogU4P+oyKzO1rjsYq+4NwvNW7hU=", - "dev": true, - "requires": { - "package-json": "4.0.1" - } - }, - "load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "strip-bom": "2.0.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } - } - }, - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", - "dev": true - }, - "long": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", - "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=", - "dev": true - }, - "loud-rejection": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", - "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", - "dev": true, - "requires": { - "currently-unhandled": "0.4.1", - "signal-exit": "3.0.2" - } - }, - "lowercase-keys": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", - "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=", - "dev": true - }, - "lru-cache": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", - "dev": true, - "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" - } - }, - "make-dir": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.0.0.tgz", - "integrity": "sha1-l6ARdR6R3YfPre9Ygy67BJNt6Xg=", - "dev": true, - "requires": { - "pify": "2.3.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } - } - }, - "map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true - }, - "meow": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", - "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", - "dev": true, - "requires": { - "camelcase-keys": "2.1.0", - "decamelize": "1.2.0", - "loud-rejection": "1.6.0", - "map-obj": "1.0.1", - "minimist": "1.2.0", - "normalize-package-data": "2.4.0", - "object-assign": "4.1.1", - "read-pkg-up": "1.0.1", - "redent": "1.0.0", - "trim-newlines": "1.0.0" - } - }, - "mimic-fn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", - "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "1.1.8" - } - }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - }, - "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", - "dev": true - }, - "nan": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", - "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=" - }, - "normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", - "dev": true, - "requires": { - "hosted-git-info": "2.5.0", - "is-builtin-module": "1.0.0", - "semver": "5.4.1", - "validate-npm-package-license": "3.0.1" - } - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "2.0.1" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1.0.2" - } - }, - "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", - "dev": true, - "requires": { - "mimic-fn": "1.1.0" - } - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "package-json": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", - "integrity": "sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0=", - "dev": true, - "requires": { - "got": "6.7.1", - "registry-auth-token": "3.3.1", - "registry-url": "3.1.0", - "semver": "5.4.1" - } - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true, - "requires": { - "error-ex": "1.3.1" - } - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "dev": true, - "requires": { - "pinkie-promise": "2.0.1" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "path-parse": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", - "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", - "dev": true - }, - "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } - } - }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dev": true, - "requires": { - "pinkie": "2.0.4" - } - }, - "prepend-http": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", - "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", - "dev": true - }, - "protobufjs": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.0.tgz", - "integrity": "sha512-47Y49f5JN5Qsbxas2TyI2zFO8j9GpQAQm5thf54fr2O8qcP/jkIXYxmYx1hN2WQFAhESU1xpVn5NWVDBB8WFnw==", - "dev": true, - "requires": { - "@protobufjs/aspromise": "1.1.2", - "@protobufjs/base64": "1.1.2", - "@protobufjs/codegen": "2.0.4", - "@protobufjs/eventemitter": "1.1.0", - "@protobufjs/fetch": "1.1.0", - "@protobufjs/float": "1.0.2", - "@protobufjs/inquire": "1.1.0", - "@protobufjs/path": "1.1.2", - "@protobufjs/pool": "1.1.0", - "@protobufjs/utf8": "1.1.0", - "@types/long": "3.0.32", - "@types/node": "7.0.43", - "long": "3.2.0" - }, - "dependencies": { - "@types/node": { - "version": "7.0.43", - "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.43.tgz", - "integrity": "sha512-7scYwwfHNppXvH/9JzakbVxk0o0QUILVk1Lv64GRaxwPuGpnF1QBiwdvhDpLcymb8BpomQL3KYoWKq3wUdDMhQ==", - "dev": true - } - } - }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true - }, - "rc": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz", - "integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=", - "dev": true, - "requires": { - "deep-extend": "0.4.2", - "ini": "1.3.4", - "minimist": "1.2.0", - "strip-json-comments": "2.0.1" - } - }, - "read-package-json": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.0.12.tgz", - "integrity": "sha512-m7/I0+tP6D34EVvSlzCtuVA4D/dHL6OpLcn2e4XVP5X57pCKGUy1JjRSBVKHWpB+vUU91sL85h84qX0MdXzBSw==", - "dev": true, - "requires": { - "glob": "7.1.2", - "graceful-fs": "4.1.11", - "json-parse-better-errors": "1.0.1", - "normalize-package-data": "2.4.0", - "slash": "1.0.0" - } - }, - "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", - "dev": true, - "requires": { - "load-json-file": "1.1.0", - "normalize-package-data": "2.4.0", - "path-type": "1.1.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", - "dev": true, - "requires": { - "find-up": "1.1.2", - "read-pkg": "1.1.0" - } - }, - "redent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", - "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", - "dev": true, - "requires": { - "indent-string": "2.1.0", - "strip-indent": "1.0.1" - } - }, - "registry-auth-token": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.1.tgz", - "integrity": "sha1-+w0yie4Nmtosu1KvXf5mywcNMAY=", - "dev": true, - "requires": { - "rc": "1.2.1", - "safe-buffer": "5.1.1" - } - }, - "registry-url": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", - "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=", - "dev": true, - "requires": { - "rc": "1.2.1" - } - }, - "repeating": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "dev": true, - "requires": { - "is-finite": "1.0.2" - } - }, - "resolve": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", - "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", - "dev": true, - "requires": { - "path-parse": "1.0.5" - } - }, - "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", - "dev": true, - "requires": { - "onetime": "2.0.1", - "signal-exit": "3.0.2" - } - }, - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "7.1.2" - } - }, - "run-async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", - "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", - "dev": true, - "requires": { - "is-promise": "2.1.0" - } - }, - "rx-lite": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", - "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", - "dev": true - }, - "rx-lite-aggregates": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", - "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", - "dev": true, - "requires": { - "rx-lite": "4.0.8" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "semver": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", - "dev": true - }, - "semver-diff": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz", - "integrity": "sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=", - "dev": true, - "requires": { - "semver": "5.4.1" - } - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", - "dev": true - }, - "spdx-correct": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", - "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", - "dev": true, - "requires": { - "spdx-license-ids": "1.2.2" - } - }, - "spdx-expression-parse": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", - "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", - "dev": true - }, - "spdx-license-ids": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", - "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", - "dev": true - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dev": true, - "requires": { - "is-utf8": "0.2.1" - } - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, - "strip-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", - "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", - "dev": true, - "requires": { - "get-stdin": "4.0.1" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - }, - "supports-color": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - }, - "term-size": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", - "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", - "dev": true, - "requires": { - "execa": "0.7.0" - } - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "timed-out": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", - "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", - "dev": true - }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "1.0.2" - } - }, - "trim-newlines": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", - "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", - "dev": true - }, - "tslib": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.7.1.tgz", - "integrity": "sha1-vIAEFkaRkjp5/oN4u+s9ogF1OOw=", - "dev": true - }, - "tslint": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.7.0.tgz", - "integrity": "sha1-wl4NDJL6EgHCvDDoROCOaCtPNVI=", - "dev": true, - "requires": { - "babel-code-frame": "6.26.0", - "colors": "1.1.2", - "commander": "2.11.0", - "diff": "3.3.1", - "glob": "7.1.2", - "minimatch": "3.0.4", - "resolve": "1.4.0", - "semver": "5.4.1", - "tslib": "1.7.1", - "tsutils": "2.8.2" - } - }, - "tsutils": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.8.2.tgz", - "integrity": "sha1-LBSGukMSYIRbCsb5Aq/Z1wio6mo=", - "dev": true, - "requires": { - "tslib": "1.7.1" - } - }, - "typescript": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.2.tgz", - "integrity": "sha1-A4qV99m7tCCxvzW6MdTFwd0//jQ=", - "dev": true - }, - "unique-string": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", - "integrity": "sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo=", - "dev": true, - "requires": { - "crypto-random-string": "1.0.0" - } - }, - "unzip-response": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", - "integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c=", - "dev": true - }, - "update-notifier": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-2.2.0.tgz", - "integrity": "sha1-G1g3z5DAc22IYncytmHBOPht5y8=", - "dev": true, - "requires": { - "boxen": "1.2.1", - "chalk": "1.1.3", - "configstore": "3.1.1", - "import-lazy": "2.1.0", - "is-npm": "1.0.0", - "latest-version": "3.1.0", - "semver-diff": "2.1.0", - "xdg-basedir": "3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, - "url-parse-lax": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", - "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", - "dev": true, - "requires": { - "prepend-http": "1.0.4" - } - }, - "validate-npm-package-license": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", - "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", - "dev": true, - "requires": { - "spdx-correct": "1.0.2", - "spdx-expression-parse": "1.0.4" - } - }, - "which": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", - "dev": true, - "requires": { - "isexe": "2.0.0" - } - }, - "widest-line": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-1.0.0.tgz", - "integrity": "sha1-DAnIXCqUaD0Nfq+O4JfVZL8OEFw=", - "dev": true, - "requires": { - "string-width": "1.0.2" - } - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true - }, - "write-file-atomic": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", - "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "imurmurhash": "0.1.4", - "signal-exit": "3.0.2" - } - }, - "xdg-basedir": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", - "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", - "dev": true - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true } } } diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 908c95723ac..4f138d9433c 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -21,9 +21,11 @@ "license": "Apache-2.0", "dependencies": { "bindings": "^1.2.1", + "extend": "^3.0.1", "nan": "^2.1.0" }, "devDependencies": { + "@types/extend": "^2.0.30", "@types/node": "^8.0.30", "clang-format": "^1.0.33", "gts": "latest", diff --git a/handwritten/cloud-profiler/src/builder.ts b/handwritten/cloud-profiler/src/builder.ts deleted file mode 100644 index 3310118fe24..00000000000 --- a/handwritten/cloud-profiler/src/builder.ts +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright 2015 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. - */ -import {perftools} from './profile'; -import {getIndexOrAdd} from './util'; -import {CpuProfile, CpuProfileNode} from './v8-types'; - -// TODO: CpuProfiler::sample_interval_ can be customized.. should query that -const SAMPLE_INTERVAL = 1000; - -// A stack of function UIDs. -type Stack = Array; - -let strings = ['']; -let samples: Array = []; - -let locations: Array = []; -let locationMap: Map; - -let functions: Array = []; -let functionMap: Map; - -function getFunction(node: CpuProfileNode) { - const id = node.callUid; - if (functionMap.has(id)) { - // Map.get returns possibly undefined, but we know it is defined. - // TODO: figure out how to avoid the cast. - return functionMap.get(id) as perftools.profiles.Function; - } - const f = new perftools.profiles.Function({ - id: id, - name: getIndexOrAdd(node.functionName || '(anonymous)', strings), - systemName: getIndexOrAdd('callUID-' + id, strings), - filename: getIndexOrAdd(node.scriptResourceName || '(unknown)', strings) - // start_line - }); - functions.push(f); - functionMap.set(id, f); - return f; -} - -function getLine(node: CpuProfileNode) { - return new perftools.profiles.Line( - {functionId: getFunction(node).id, line: node.lineNumber}); -} - -function getLocation(node: CpuProfileNode): perftools.profiles.Location { - const id = node.callUid; - if (locationMap.has(id)) { - return locationMap.get(id) as perftools.profiles.Location; - } - const location = new perftools.profiles.Location({ - id: id, - // mapping_id: getMapping(node).id, - line: [getLine(node)] - }); - locations.push(location); - locationMap.set(id, location); - return location; -} - -const sampleValue = new perftools.profiles.ValueType({ - type: getIndexOrAdd('samples', strings), - unit: getIndexOrAdd('count', strings) -}); -const timeValue = new perftools.profiles.ValueType( - {type: getIndexOrAdd('time', strings), unit: getIndexOrAdd('µs', strings)}); - -function serializeNode(node: CpuProfileNode, stack: Stack) { - const location = getLocation(node); - // TODO: deal with location.id being a Long. - stack.unshift(location.id as number); // leaf is first in the stack - if (node.hitCount > 0) { - const sample = new perftools.profiles.Sample({ - locationId: stack, - value: [node.hitCount * SAMPLE_INTERVAL, node.hitCount] - // label? - }); - samples.push(sample); - } - node.children.forEach(function(child) { - serializeNode(child, stack); - }); - stack.shift(); -} - -export function serialize( - prof: CpuProfile, startTimeNanos: number): perftools.profiles.IProfile { - samples = []; - locations = []; - functions = []; - locationMap = new Map(); - functionMap = new Map(); - strings = strings.slice(0, 5); - serializeNode(prof.topDownRoot, []); - return { - sampleType: [timeValue, sampleValue], - sample: samples, - // mapping: mappings, - location: locations, - 'function': functions, - stringTable: strings, - // opt drop_frames - // opt keep_frames - timeNanos: startTimeNanos, // Nanos - durationNanos: prof.endTime - prof.startTime, // Nanos - - periodType: timeValue, - period: SAMPLE_INTERVAL - }; -} diff --git a/handwritten/cloud-profiler/src/config.ts b/handwritten/cloud-profiler/src/config.ts new file mode 100644 index 00000000000..74d03745710 --- /dev/null +++ b/handwritten/cloud-profiler/src/config.ts @@ -0,0 +1,74 @@ +/** + * 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. + */ + +import {AuthenticationConfig, Common, ServiceConfig} from '../third_party/types/common-types'; +import {ProfilerConfig} from './profiler'; + +const common: Common = require('@google-cloud/common'); +const extend = require('extend'); + +// Configuration for Profiler. +export interface Config extends AuthenticationConfig { + // Cloud Console projectId to associate profiles with instead of one read + // from VM metadata server. + projectId?: string; + + // Log levels: 0-disabled,1-error,2-warn,3-info,4-debug. + logLevel?: number; + + // Specifies the service with which profiles from this application will be + // associated. + serviceContext?: { + // Name of the service under which the profiled data will be recorded and + // exposed in the UI for the project. + // You can specify an arbitrary string, see deployment.target at + // https://github.com/googleapis/googleapis/blob/master/google/devtools/cloudprofiler/v2/profiler.proto + // for restrictions. + // The string should be the same across different replicas of your service + // so that a globally constant profiling rate is maintained. + service?: string; + + // Version of the service. It can be an arbitrary string. Stackdriver + // Profiler profiles each version of each service in each zone once per + // minute. + version?: string; + }; + + // Virtual machine instance to associate profiles with instead of the one + // read from the VM metadata server. + instance?: string; + + // Zone to associate profiles with instead of the one read from the VM + // metadata server. + zone?: string; + + // When true, CPU profiling will be disabled. + disableCpu?: boolean; + + // When true, heap profiling will be disabled. + disableHeap?: boolean; +} + +// Default values for configuration for a profiler. +export const defaultConfig: Config = { + projectId: '{{projectId}}', + logLevel: 1, + serviceContext: { + version: '', + }, + disableHeap: false, + disableCpu: false, +}; diff --git a/handwritten/cloud-profiler/src/heap-builder.ts b/handwritten/cloud-profiler/src/heap-builder.ts deleted file mode 100644 index 9f6dc454a22..00000000000 --- a/handwritten/cloud-profiler/src/heap-builder.ts +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Copyright 2015 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. - */ -import {perftools} from './profile'; -import {getIndexOrAdd} from './util'; -import {AllocationProfileNode} from './v8-types'; - -// A stack of function UIDs. -// TODO: duplicated in builder.ts -type Stack = Array; - - -// TODO: pass this value explicitly when starting the profiler -const SAMPLE_PERIOD = 512 * 1024; - -let strings = ['']; -let samples: Array = []; - -let locationIds = ['dummy']; -let locations: Array = []; -let locationMap: Map; - -let functionIds = ['dummy']; -let functions: Array = []; -let functionMap: Map; - -function getStringIndex(str: string) { - return getIndexOrAdd(str, strings); -} - -function getFunction(stackNode: AllocationProfileNode) { - const unique = JSON.stringify(stackNode); - const id = getIndexOrAdd(unique, functionIds); - if (functionMap.has(id)) { - return functionMap.get(id); - } - const f = new perftools.profiles.Function({ - id: id, - name: getStringIndex(stackNode.name || '(anonymous)'), - systemName: getStringIndex('callUID-' + id), - filename: getStringIndex(stackNode.scriptName) - // start_line - }); - functions.push(f); - functionMap.set(id, f); - return f; -} - -function getLine(stackNode: AllocationProfileNode) { - return new perftools.profiles.Line({ - functionId: (getFunction(stackNode) as perftools.profiles.Function).id, - line: stackNode.lineNumber - }); -} - -function getLocation(stackNode: AllocationProfileNode) { - const unique = JSON.stringify(stackNode); - const id = getIndexOrAdd(unique, locationIds); - if (locationMap.has(id)) { - return locationMap.get(id); - } - const location = new perftools.profiles.Location({ - id: id, - // mapping_id: getMapping(node).id, - line: [getLine(stackNode)] - }); - locations.push(location); - locationMap.set(id, location); - return location; -} - -const countValue = new perftools.profiles.ValueType( - {type: getStringIndex('objects'), unit: getStringIndex('count')}); -const bytesValue = new perftools.profiles.ValueType( - {type: getStringIndex('space'), unit: getStringIndex('bytes')}); - -function serializeNode(node: AllocationProfileNode, stack: Stack) { - // TODO: get rid of the cast. - const location = getLocation(node) as perftools.profiles.Location; - // TODO: get rid of the cast - stack.unshift(location.id as number); // leaf is first in the stack - for (const alloc of node.allocations) { - const sample = new perftools.profiles.Sample({ - locationId: stack, - value: [alloc.count, alloc.count * alloc.size] - // label? - }); - samples.push(sample); - } - node.children.forEach(function(child) { - serializeNode(child, stack); - }); - stack.shift(); -} - -export function serialize( - prof: AllocationProfileNode, startTimeNanos: number, - endTimeNanos: number): perftools.profiles.IProfile { - samples = []; - locations = []; - functions = []; - locationMap = new Map(); - functionMap = new Map(); - strings = strings.slice(0, 5); - locationIds = locationIds.slice(0, 1); - functionIds = functionIds.slice(0, 1); - serializeNode(prof, []); - return { - sampleType: [countValue, bytesValue], - sample: samples, - // mapping: mappings, - location: locations, - 'function': functions, - stringTable: strings, - // opt drop_frames - // opt keep_frames - timeNanos: startTimeNanos, // Nanos - durationNanos: endTimeNanos - startTimeNanos, // Nanos - - periodType: bytesValue, - period: SAMPLE_PERIOD - }; -} diff --git a/handwritten/cloud-profiler/src/heap-index.ts b/handwritten/cloud-profiler/src/heap-index.ts deleted file mode 100644 index b8f84924431..00000000000 --- a/handwritten/cloud-profiler/src/heap-index.ts +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright 2015 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. - */ - -import * as fs from 'fs'; -import * as stream from 'stream'; -import * as zlib from 'zlib'; - -import {serialize} from './heap-builder'; -import {perftools} from './profile'; -import {AllocationProfileNode} from './v8-types'; - -const profiler = require('bindings')('sampling_heap_profiler'); -const stats = require('bindings')('statistics'); - -const startTime = Date.now(); -// console.log('V8 statistics', require('v8').getHeapStatistics()); -// console.log('V8 heap statistics', stats.getHeapSpaceStatistics()); - -profiler.startSamplingHeapProfiler(); - -const intervalMillis = 5 * 1000; - -function profileInterval() { - setTimeout(function() { - const endTime = Date.now(); - const runName = 'cloud-profile-' + endTime; - // console.log('V8 statistics', require('v8').getHeapStatistics()); - // console.log('V8 heap statistics', stats.getHeapSpaceStatistics()); - const result = profiler.getAllocationProfile(); - // console.log('sample count * sample rate', result.length * 1024); - const devtoolsFormat = translateToDevtools(result); - - // // TODO: deal with the result of writing. - fs.writeFile( - runName + '.heapprofile', JSON.stringify({head: devtoolsFormat}), - () => {/*empty*/}); - - const serialized = serialize(result, startTime * 1e6, endTime * 1e6); - const writer = perftools.profiles.Profile.encode(serialized); - const buffer = writer.finish(); - - const outp = fs.createWriteStream(runName + '.pb.gz'); - const inp = new stream.PassThrough(); - inp.end(buffer); - inp.pipe(zlib.createGzip()).pipe(outp).on('close', profileInterval); - }, intervalMillis).unref(); -} - -function translateToDevtools(node: AllocationProfileNode) { - const result: any = {}; - result.functionName = node.name; - result.scriptId = node.scriptId; - result.lineNumber = node.lineNumber; - result.columnNumber = node.columnNumber; - result.url = node.scriptName; - result.selfSize = node.allocations.reduce(function(sum, alloc) { - return sum + alloc.size * alloc.count; - }, 0); - result.children = node.children.map(translateToDevtools); - return result; -} - -process.on('exit', function() { - profiler.stopSamplingHeapProfiler(); -}); - -process.on('uncaughtException', function(e) { - profiler.stopSamplingHeapProfiler(); - throw e; -}); - -profileInterval(); diff --git a/handwritten/cloud-profiler/src/index.ts b/handwritten/cloud-profiler/src/index.ts index 7a9d6c93e2a..dbf51d9f9a4 100644 --- a/handwritten/cloud-profiler/src/index.ts +++ b/handwritten/cloud-profiler/src/index.ts @@ -1,5 +1,5 @@ /** - * Copyright 2015 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. @@ -13,80 +13,76 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import * as assert from 'assert'; -import * as fs from 'fs'; -import * as stream from 'stream'; -import * as util from 'util'; -import * as zlib from 'zlib'; +import * as extend from 'extend'; +import * as path from 'path'; +import {AuthenticationConfig, Common, ServiceConfig} from '../third_party/types/common-types'; +import {Config, defaultConfig} from './config'; +import {Profiler, ProfilerConfig} from './profiler'; -import {serialize} from './builder'; -import {perftools} from './profile'; +const common: Common = require('@google-cloud/common'); -type HrTimeTuple = [number, number]; +// initConfig sets unset values in the configuration to the value retrieved from +// environment variables, metadata, or the default value specified in +// defaultConfig. +// Returns rejected promise if value that must be set cannot be initialized. +async function initConfig(config: Config): Promise { + config = common.util.normalizeArguments(null, config); -const profiler = require('bindings')('cpu_profiler'); + const envConfig = { + logLevel: process.env.GCLOUD_PROFILER_LOGLEVEL, + projectId: process.env.GCLOUD_PROJECT, + serviceContext: { + service: process.env.GAE_SERVICE, + version: process.env.GAE_VERSION, + } + }; -function timeToNanos(tuple: HrTimeTuple) { - return tuple[0] * 1e9 + tuple[1]; -} - -const durationMillis = 10 * 1000; -const intervalMillis = 60 * 1000; -let isActive = false; + let envSetConfig: Config = {}; + if (process.env.hasOwnProperty('GCLOUD_PROFILER_CONFIG')) { + envSetConfig = + require(path.resolve(process.env.GCLOUD_PROFILER_CONFIG)) as Config; + } -function profileInterval() { - assert(durationMillis <= intervalMillis); - const startDelay = (intervalMillis - durationMillis) * Math.random(); - setTimeout(function() { - const startTime = Date.now(); - const runName = 'cloud-profile-' + startTime; - profiler.startProfiling(runName, true); - isActive = true; - setTimeout(function() { - isActive = false; - const result = profiler.stopProfiling(runName); - const serialized = serialize(result, startTime * 1e6); - const writer = perftools.profiles.Profile.encode(serialized); - const buffer = writer.finish(); + let normalizedConfig = extend(true, {}, defaultConfig, envConfig, config); - const outp = fs.createWriteStream(runName + '.pb.gz'); - const inp = new stream.PassThrough(); - inp.end(buffer); - inp.pipe(zlib.createGzip()).pipe(outp).on('close', function() { - setTimeout( - profileInterval, intervalMillis - startDelay - durationMillis) - .unref(); - }); - }, durationMillis).unref(); - }, startDelay).unref(); -} + if (normalizedConfig.serviceContext.service === undefined) { + throw new Error('service name must be specified in the configuration'); + } -process.on('exit', function() { - if (isActive) { - profiler.stopProfiling(); + // TODO: fetch instance and zone from metadata. This will require function to + // be asynchrous. + if (normalizedConfig.instance === undefined) { + normalizedConfig.instance = ''; } -}); -process.on('uncaughtException', function() { - if (isActive) { - profiler.stopProfiling(); + if (normalizedConfig.zone === undefined) { + normalizedConfig.zone = ''; } -}); -profileInterval(); + return normalizedConfig; +} + +let profiler: Profiler|undefined = undefined; -/*function printNode(node, indent) { - indent = indent || 0; - var s = sprintf('%5u %s %d #%d %d %s %d', node.hitCount, - Array(indent).join(' '), indent / 2, node.id, node.callUID, - node.functionName, node.scriptId); - if (node.url !== '') { - s += ' ' + node.url + ':' + node.lineNumber; - } - if (node.lineTicks) - s += ' lineTicks ' + util.inspect(node.lineTicks); +/** + * Starts the profiling agent and returns a promise. + * If any error is encountered when profiling, the promise will be rejected. + * + * config - Config describing configuration for profiling. + * + * @example + * profiler.start(); + * + * @example + * profiler.start(config); + * + */ +export async function start(config: Config = {}): Promise { + const normalizedConfig = await initConfig(config); + profiler = new Profiler(normalizedConfig); + return profiler.start(); +} - // TODO: deopt infos - // TODO: bailout reason - console.log(s); - node.children.forEach(function(child) { printNode(child, indent + 2); }); -}*/ +// If the module was --require'd from the command line, start the agent. +if (module.parent && module.parent.id === 'internal/preload') { + start(); +} diff --git a/handwritten/cloud-profiler/src/profiler.ts b/handwritten/cloud-profiler/src/profiler.ts new file mode 100644 index 00000000000..6d7a958d886 --- /dev/null +++ b/handwritten/cloud-profiler/src/profiler.ts @@ -0,0 +1,67 @@ +/** + * 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. + */ +import * as path from 'path'; +import {AuthenticationConfig, Common, Logger, Service, ServiceConfig} from '../third_party/types/common-types'; +import {Config} from './config'; +import {CpuProfiler} from './profilers/cpu-profiler'; +import {HeapProfiler} from './profilers/heap-profiler'; + +const pjson = require('../../../package.json'); +const common: Common = require('@google-cloud/common'); + +export interface ProfilerConfig extends AuthenticationConfig { + projectId: string; + logLevel: number; + serviceContext: {service: string; version?: string;}; + instance: string; + zone: string; + disableCpu: boolean; + disableHeap: boolean; +} + +// TODO: finish implementing Profiler. +// TODO: add stop() method to stop profiling. +export class Profiler { + config: ProfilerConfig; + logger: Logger; + service: Service; + + constructor(config: ProfilerConfig) { + this.config = config; + + this.service = new common.Service( + { + baseUrl: 'https://cloudprofiler.googleapis.com/v2', + scopes: ['https://www.googleapis.com/auth/monitoring.write'], + }, + this.config); + + this.logger = new common.logger({ + level: common.logger.LEVELS[config.logLevel as number], + tag: pjson.name + }); + } + + // Begins collection and uploading of profiles. + // If profiling fails or another problem is encountered, the returned promise + // will be rejected. + // TODO: implement + // TODO: explain failure situations. + async start(): Promise { + return Promise.reject( + new Error('start() is unimplemented for ProfileAgent')); + } +} diff --git a/handwritten/cloud-profiler/src/profilers/cpu-profiler.ts b/handwritten/cloud-profiler/src/profilers/cpu-profiler.ts new file mode 100644 index 00000000000..098020c77e2 --- /dev/null +++ b/handwritten/cloud-profiler/src/profilers/cpu-profiler.ts @@ -0,0 +1,7 @@ +// Unimplemented stub of CpuProfiler +// TODO: implement +export class CpuProfiler { + constructor() { + throw new Error('CPU Profiler is unimplemented'); + } +} diff --git a/handwritten/cloud-profiler/src/profilers/heap-profiler.ts b/handwritten/cloud-profiler/src/profilers/heap-profiler.ts new file mode 100644 index 00000000000..8b2a9004d57 --- /dev/null +++ b/handwritten/cloud-profiler/src/profilers/heap-profiler.ts @@ -0,0 +1,7 @@ +// Unimplemented stub of HeapProfiler +// TODO: implement +export class HeapProfiler { + constructor() { + throw new Error('Heap Profiler is unimplemented'); + } +} diff --git a/handwritten/cloud-profiler/third_party/types/LICENSE b/handwritten/cloud-profiler/third_party/types/LICENSE new file mode 100644 index 00000000000..6c4f91c6e90 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/types/LICENSE @@ -0,0 +1,202 @@ + + 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 2014 Google Inc. + + 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. \ No newline at end of file diff --git a/handwritten/cloud-profiler/third_party/types/README.google b/handwritten/cloud-profiler/third_party/types/README.google new file mode 100644 index 00000000000..fcc6d07b7d6 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/types/README.google @@ -0,0 +1,10 @@ +https://github.com/GoogleCloudPlatform/cloud-debug-nodejs/commit/fa41721e965bcb98ac3d446384ff55e5cc0036ac +Version: fa41721e965bcb98ac3d446384ff55e5cc0036ac +License: Apache 2.0 +License File: # LICENSE +Description: + cloud-debug-nodejs provides Stackdriver Debugger support for Node.js + applications. +Local Modifications: + All code except common-types.ts and gcp-metadata-types.ts has been + removed. diff --git a/handwritten/cloud-profiler/third_party/types/common-types.ts b/handwritten/cloud-profiler/third_party/types/common-types.ts new file mode 100644 index 00000000000..0ad5857df16 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/types/common-types.ts @@ -0,0 +1,105 @@ +/** + * 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. + */ + +import * as http from 'http'; + +/** + * Authentication Configuration – shared across all Google Cloud Libraries. + * For more details see {@link + * https://googlecloudplatform.github.io/google-cloud-node/#/docs/google-cloud/0.56.0/guides/authentication} + * and {@link + * https://developers.google.com/identity/protocols/application-default-credentials}. + */ +export interface AuthenticationConfig { + /** + * The projectId of the Google Cloud Platform project whose applications will + * be debugged. If not specified, we will try to use detect this through + * either the GCLOUD_PROJECT environment variable, through the embedded + * projectId in the provided key, the metadata service, or the default project + * configured in the gcloud cli. If none of these mechanisms are successful, + * the debug agent will fail to function. + */ + projectId?: string; + + /** + * Path to a service account .json, .pem or .p12 key file. + */ + keyFilename?: string; + + /** + * Required when using .p12 or pem key files. + */ + email?: string; + + /** + * Instead of a keyFilename, credentials can also be provided inline. + */ + credentials?: {client_email?: string; private_key?: string;}; +} + +export interface ServiceConfig { + baseUrl: string; + scopes: string[]; +} + +// TODO: Make this more precise +export interface ServiceObjectConfig { + parent: any; + baseUrl: string; + createMethod?: string; + id?: string; + methods?: any; +} + +export interface LoggerOptions { + level?: string; + levels?: string[]; + tag: string; +} + +export interface Logger { + new(options?: string|LoggerOptions): Logger; + LEVELS: string[]; + // TODO: Determine the correct signatures for these members + error: (message: any, ...args: any[]) => void; + warn: (message: any, ...args: any[]) => void; + info: (message: any, ...args: any[]) => void; + debug: (message: any, ...args: any[]) => void; +} + +export interface Service { + new(config: ServiceConfig, options: AuthenticationConfig): Service; +} + +export interface ServiceObject { + new(config: ServiceObjectConfig): ServiceObject; + // TODO: Determine if this signature is correct. + request: + (reqOpts: {uri: string, json: boolean}, + callback: (err: Error, body: any, response: http.ServerResponse) => + void) => void; +} + +export interface Common { + Service: Service; + ServiceObject: ServiceObject; + logger: Logger; + util: { + // TODO: Make this more precise. + normalizeArguments: (globalContext: any, localConfig: any, options?: any) => + any; + }; +} diff --git a/handwritten/cloud-profiler/third_party/types/gcp-metadata-types.ts b/handwritten/cloud-profiler/third_party/types/gcp-metadata-types.ts new file mode 100644 index 00000000000..eef5a69e184 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/types/gcp-metadata-types.ts @@ -0,0 +1,32 @@ +/** + * 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. + */ + +import * as http from 'http'; + +export interface GcpMetadata { + // TODO: Determine if the signature of the callback on these methods are + // correct. + instance: + (options: string|{property: string}, + callback: + (err: Error, response: http.ServerResponse, + metadataProject: string) => void) => http.ServerResponse; + project: + (options: string|{property: string}, + callback: + (err: Error, response: http.ServerResponse, + metadataProject: string) => void) => http.ServerResponse; +} diff --git a/handwritten/cloud-profiler/tsconfig.json b/handwritten/cloud-profiler/tsconfig.json index c47ad1de00a..c5c1cda9917 100644 --- a/handwritten/cloud-profiler/tsconfig.json +++ b/handwritten/cloud-profiler/tsconfig.json @@ -2,13 +2,15 @@ "extends": "./node_modules/gts/tsconfig-google.json", "compilerOptions": { "rootDir": ".", - "outDir": "build" + "outDir": "build", + "lib": [ "es2015" ] }, "include": [ "src/*.ts", "src/**/*.ts", "test/*.ts", - "test/**/*.ts" + "test/**/*.ts", + "third_party/types/*.ts" ], "exclude": [ "node_modules" From bab0097d4d138d0bc4d8a93723bea15430fb2a59 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 19 Oct 2017 11:04:32 -0700 Subject: [PATCH 011/632] add local time profile collection (#11) --- handwritten/cloud-profiler/.travis.yml | 4 + handwritten/cloud-profiler/binding.gyp | 4 +- .../{cpu-profiler.cc => time-profiler.cc} | 14 +- handwritten/cloud-profiler/package-lock.json | 3879 ++++++++++++++++- handwritten/cloud-profiler/package.json | 13 +- handwritten/cloud-profiler/src/config.ts | 6 +- handwritten/cloud-profiler/src/profiler.ts | 8 +- .../src/profilers/cpu-profiler.ts | 7 - .../src/profilers/profile-serializer.ts | 146 + .../src/profilers/time-profiler.ts | 44 + handwritten/cloud-profiler/src/v8-types.ts | 8 +- .../cloud-profiler/test/profile-for-test.ts | 133 + .../test/test-profile-serializer.ts | 30 + .../cloud-profiler/test/test-time-profiler.ts | 63 + handwritten/cloud-profiler/tsconfig.json | 2 +- 15 files changed, 4237 insertions(+), 124 deletions(-) rename handwritten/cloud-profiler/bindings/{cpu-profiler.cc => time-profiler.cc} (88%) delete mode 100644 handwritten/cloud-profiler/src/profilers/cpu-profiler.ts create mode 100644 handwritten/cloud-profiler/src/profilers/profile-serializer.ts create mode 100644 handwritten/cloud-profiler/src/profilers/time-profiler.ts create mode 100644 handwritten/cloud-profiler/test/profile-for-test.ts create mode 100644 handwritten/cloud-profiler/test/test-profile-serializer.ts create mode 100644 handwritten/cloud-profiler/test/test-time-profiler.ts diff --git a/handwritten/cloud-profiler/.travis.yml b/handwritten/cloud-profiler/.travis.yml index 3274ac6fe69..ba5340de3e1 100644 --- a/handwritten/cloud-profiler/.travis.yml +++ b/handwritten/cloud-profiler/.travis.yml @@ -15,3 +15,7 @@ addons: - ubuntu-toolchain-r-test packages: - g++-4.8 + +script: + - npm run test + - npm run codecov diff --git a/handwritten/cloud-profiler/binding.gyp b/handwritten/cloud-profiler/binding.gyp index 17544900764..fc08c746b78 100644 --- a/handwritten/cloud-profiler/binding.gyp +++ b/handwritten/cloud-profiler/binding.gyp @@ -1,8 +1,8 @@ { "targets": [ { - "target_name": "cpu_profiler", - "sources": [ "bindings/cpu-profiler.cc" ], + "target_name": "time_profiler", + "sources": [ "bindings/time-profiler.cc" ], "include_dirs": [ " TranslateCpuProfileNode(const CpuProfileNode* node) { - // TODO: Implement unimplemented interface +Local TranslateTimeProfileNode(const CpuProfileNode* node) { Local js_node = Nan::New(); js_node->Set(Nan::New("functionName").ToLocalChecked(), node->GetFunctionName()); @@ -35,20 +34,19 @@ Local TranslateCpuProfileNode(const CpuProfileNode* node) { int32_t count = node->GetChildrenCount(); Local children = Nan::New(count); for (int32_t i = 0; i < count; i++) { - children->Set(i, TranslateCpuProfileNode(node->GetChild(i))); + children->Set(i, TranslateTimeProfileNode(node->GetChild(i))); } js_node->Set(Nan::New("children").ToLocalChecked(), children); return js_node; } -Local TranslateCpuProfile(const CpuProfile* profile) { - // TODO: Implement unimplemented interface +Local TranslateTimeProfile(const CpuProfile* profile) { Local js_profile = Nan::New(); js_profile->Set(Nan::New("title").ToLocalChecked(), profile->GetTitle()); js_profile->Set(Nan::New("topDownRoot").ToLocalChecked(), - TranslateCpuProfileNode(profile->GetTopDownRoot())); + TranslateTimeProfileNode(profile->GetTopDownRoot())); js_profile->Set(Nan::New("samplesCount").ToLocalChecked(), Nan::New(profile->GetSamplesCount())); js_profile->Set(Nan::New("startTime").ToLocalChecked(), @@ -68,7 +66,7 @@ NAN_METHOD(StopProfiling) { Local name = info[0].As(); CpuProfile* profile = info.GetIsolate()->GetCpuProfiler()->StopProfiling(name); - Local translated_profile = TranslateCpuProfile(profile); + Local translated_profile = TranslateTimeProfile(profile); profile->Delete(); info.GetReturnValue().Set(translated_profile); } @@ -94,4 +92,4 @@ NAN_MODULE_INIT(InitAll) { Nan::GetFunction(Nan::New(SetIdle)).ToLocalChecked()); } -NODE_MODULE(cpu_profiler, InitAll); +NODE_MODULE(time_profiler, InitAll); diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index d7e4ddf7935..90fa11c069e 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -68,6 +68,12 @@ "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=", "dev": true }, + "@types/delay": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/delay/-/delay-2.0.0.tgz", + "integrity": "sha512-BdyAlJMOdeaoBP67d3M0kpAIiQQE3x11ZTOAjav/bdvdpyWu4V6uhtIhAXEj3vITyGzTvHhgJK1MRArYCFbYQQ==", + "dev": true + }, "@types/extend": { "version": "2.0.30", "resolved": "https://registry.npmjs.org/@types/extend/-/extend-2.0.30.tgz", @@ -80,10 +86,76 @@ "integrity": "sha512-ZXyOOm83p7X8p3s0IYM3VeueNmHpkk/yMlP8CLeOnEcu6hIwPH7YjZBvhQkR0ZFS2DqZAxKtJ/M5fcuv3OU5BA==", "dev": true }, + "@types/mocha": { + "version": "2.2.43", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.43.tgz", + "integrity": "sha512-xNlAmH+lRJdUMXClMTI9Y0pRqIojdxfm7DHsIxoB2iTzu3fnPmSMEN8SsSx0cdwV36d02PWCWaDUoZPDSln+xw==", + "dev": true + }, "@types/node": { - "version": "8.0.30", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.30.tgz", - "integrity": "sha512-IaQtG3DWe9gRsmk1DqNnYyRVjGDVcBdZywkRVF2f62Boe8XKmlR7lNcwC6pk4V4W8nk+Zu+vdGMsOdRTDj1JPA==", + "version": "8.0.34", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.34.tgz", + "integrity": "sha512-Jnmm57+nHqvJUPwUzt1CLoLzFtF2B2vgG7cWFut+a4nqTp9/L6pL0N+o0Jt3V7AQnCKMsPEqQpLFZYleBCdq3w==", + "dev": true + }, + "@types/sinon": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-2.3.6.tgz", + "integrity": "sha512-4+8BQOU/siROrXyMliceCUvQ3dy719ctUBBMcTRjcrWJ5uiR/wccIVPsO3aLBB86j8JFQeF0FlQR6ZpSNsbA6Q==", + "dev": true + }, + "ansi-align": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz", + "integrity": "sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=", + "dev": true, + "requires": { + "string-width": "2.1.1" + } + }, + "ansi-escapes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", + "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + }, + "argv": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/argv/-/argv-0.0.2.tgz", + "integrity": "sha1-7L0W+JSbFXGDcRsb2jNPN4QBhas=", + "dev": true + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", + "dev": true + }, + "assert-plus": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", "dev": true }, "async": { @@ -92,17 +164,130 @@ "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", "dev": true }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "aws-sign2": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", + "dev": true + }, + "aws4": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", + "dev": true + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, "bindings": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz", "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==" }, + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "dev": true, + "requires": { + "hoek": "2.16.3" + } + }, + "boxen": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.2.1.tgz", + "integrity": "sha1-DxHn/jRO25OXl3/BPt5/ZNlWSB0=", + "dev": true, + "requires": { + "ansi-align": "2.0.0", + "camelcase": "4.1.0", + "chalk": "2.1.0", + "cli-boxes": "1.0.0", + "string-width": "2.1.1", + "term-size": "1.2.0", + "widest-line": "1.0.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + } + } + }, "brace-expansion": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", @@ -113,6 +298,57 @@ "concat-map": "0.0.1" } }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true + }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "requires": { + "camelcase": "2.1.1", + "map-obj": "1.0.1" + } + }, + "capture-stack-trace": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz", + "integrity": "sha1-Sm+gc5nCa7pH8LJJa00PtAjFVQ0=", + "dev": true + }, + "caseless": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", + "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", + "dev": true + }, + "chalk": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", + "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.4.0" + } + }, "clang-format": { "version": "1.0.55", "resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.0.55.tgz", @@ -124,142 +360,3597 @@ "resolve": "1.4.0" } }, + "cli-boxes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz", + "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=", + "dev": true + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "2.0.0" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "codecov": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/codecov/-/codecov-2.3.1.tgz", + "integrity": "sha1-fdqUXNWKH2CBAltbA+4Bou8g+G4=", + "dev": true, + "requires": { + "argv": "0.0.2", + "request": "2.77.0", + "urlgrey": "0.4.4" + } + }, + "color-convert": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", + "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true + }, + "combined-stream": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "dev": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + "configstore": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.1.tgz", + "integrity": "sha512-5oNkD/L++l0O6xGXxb1EWS7SivtjfGQlRyxJsYgE0Z495/L81e2h4/d3r969hoPXuFItzNOKMtsXgYG4c7dYvw==", + "dev": true, + "requires": { + "dot-prop": "4.2.0", + "graceful-fs": "4.1.11", + "make-dir": "1.0.0", + "unique-string": "1.0.0", + "write-file-atomic": "2.3.0", + "xdg-basedir": "3.0.0" + } }, - "fs.realpath": { + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "create-error-class": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", + "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=", + "dev": true, + "requires": { + "capture-stack-trace": "1.0.0" + } + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "4.1.1", + "shebang-command": "1.2.0", + "which": "1.3.0" + } + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "dev": true, + "requires": { + "boom": "2.10.1" + } + }, + "crypto-random-string": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz", + "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", "dev": true }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "array-find-index": "1.0.2" } }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } } }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, - "long": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", - "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=", + "deep-extend": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", + "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", "dev": true }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, + "delay": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/delay/-/delay-2.0.0.tgz", + "integrity": "sha1-kRLq3APk7H4AKXM3iW8nO72R+uU=", "requires": { - "brace-expansion": "1.1.8" + "p-defer": "1.0.0" } }, - "nan": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", - "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=" + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "diff": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.4.0.tgz", + "integrity": "sha512-QpVuMTEoJMF7cKzi6bvWhRulU1fZqZnvyVQgNhPaxxuTYwyjn/j1v9falseQ/uXWwPnO56RBfwtg4h/EQXmucA==", + "dev": true + }, + "dot-prop": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", "dev": true, "requires": { - "wrappy": "1.0.2" + "is-obj": "1.0.1" } }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", "dev": true }, - "path-parse": { + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "error-ex": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", + "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "dev": true, + "requires": { + "is-arrayish": "0.2.1" + } + }, + "escape-string-regexp": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", - "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, - "protobufjs": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.0.tgz", - "integrity": "sha512-47Y49f5JN5Qsbxas2TyI2zFO8j9GpQAQm5thf54fr2O8qcP/jkIXYxmYx1hN2WQFAhESU1xpVn5NWVDBB8WFnw==", + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true, "requires": { - "@protobufjs/aspromise": "1.1.2", - "@protobufjs/base64": "1.1.2", - "@protobufjs/codegen": "2.0.4", - "@protobufjs/eventemitter": "1.1.0", - "@protobufjs/fetch": "1.1.0", - "@protobufjs/float": "1.0.2", - "@protobufjs/inquire": "1.1.0", - "@protobufjs/path": "1.1.2", - "@protobufjs/pool": "1.1.0", - "@protobufjs/utf8": "1.1.0", - "@types/long": "3.0.32", - "@types/node": "7.0.43", - "long": "3.2.0" - }, - "dependencies": { - "@types/node": { - "version": "7.0.43", - "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.43.tgz", - "integrity": "sha512-7scYwwfHNppXvH/9JzakbVxk0o0QUILVk1Lv64GRaxwPuGpnF1QBiwdvhDpLcymb8BpomQL3KYoWKq3wUdDMhQ==", - "dev": true - } + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" } }, - "resolve": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", - "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + }, + "external-editor": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.5.tgz", + "integrity": "sha512-Msjo64WT5W+NhOpQXh0nOHm+n0RfU1QUwDnKYvJ8dEJ8zlwLrqXNTv5mSUTJpepf41PDJGyhueTw2vNZW+Fr/w==", "dev": true, "requires": { - "path-parse": "1.0.5" + "iconv-lite": "0.4.19", + "jschardet": "1.5.1", + "tmp": "0.0.33" } }, - "typescript": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.3.tgz", - "integrity": "sha512-ptLSQs2S4QuS6/OD1eAKG+S5G8QQtrU5RT32JULdZQtM1L3WTi34Wsu48Yndzi8xsObRAB9RPt/KhA9wlpEF6w==", + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", "dev": true }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5" + } + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", + "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "dev": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.17" + } + }, + "formatio": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.2.0.tgz", + "integrity": "sha1-87IWfZBoxGmKjVH092CjmlTYGOs=", + "dev": true, + "requires": { + "samsam": "1.3.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "generate-function": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", + "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", + "dev": true + }, + "generate-object-property": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", + "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", + "dev": true, + "requires": { + "is-property": "1.0.2" + } + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } + } + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "global-dirs": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.0.tgz", + "integrity": "sha1-ENNAOeDfBCcuJizyQiT3IJQ0308=", + "dev": true, + "requires": { + "ini": "1.3.4" + } + }, + "got": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", + "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", + "dev": true, + "requires": { + "create-error-class": "3.0.2", + "duplexer3": "0.1.4", + "get-stream": "3.0.0", + "is-redirect": "1.0.0", + "is-retry-allowed": "1.1.0", + "is-stream": "1.1.0", + "lowercase-keys": "1.0.0", + "safe-buffer": "5.1.1", + "timed-out": "4.0.1", + "unzip-response": "2.0.1", + "url-parse-lax": "1.0.0" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "growl": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", + "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", + "dev": true + }, + "gts": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/gts/-/gts-0.3.1.tgz", + "integrity": "sha512-sQ3PB13CRo25OLFnnQw2Y2Kcrdp2q8onLxxcWSyqoSSPFfvcIM0yVwJHllQeCGT/CuDIrrD0XAEt5GqKMbv1CA==", + "dev": true, + "requires": { + "chalk": "2.1.0", + "clang-format": "1.0.55", + "inquirer": "3.3.0", + "meow": "3.7.0", + "pify": "3.0.0", + "read-package-json": "2.0.12", + "rimraf": "2.6.2", + "tslint": "5.7.0", + "update-notifier": "2.3.0", + "write-file-atomic": "2.3.0" + } + }, + "har-validator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", + "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "commander": "2.11.0", + "is-my-json-valid": "2.16.1", + "pinkie-promise": "2.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + } + } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "hawk": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "dev": true, + "requires": { + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" + } + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", + "dev": true + }, + "hosted-git-info": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", + "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", + "dev": true + }, + "http-signature": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "dev": true, + "requires": { + "assert-plus": "0.2.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" + } + }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", + "dev": true + }, + "import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "2.0.1" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "ini": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", + "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=", + "dev": true + }, + "inquirer": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", + "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", + "dev": true, + "requires": { + "ansi-escapes": "3.0.0", + "chalk": "2.1.0", + "cli-cursor": "2.1.0", + "cli-width": "2.2.0", + "external-editor": "2.0.5", + "figures": "2.0.0", + "lodash": "4.17.4", + "mute-stream": "0.0.7", + "run-async": "2.3.0", + "rx-lite": "4.0.8", + "rx-lite-aggregates": "4.0.8", + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "through": "2.3.8" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "1.1.1" + } + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-installed-globally": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.1.0.tgz", + "integrity": "sha1-Df2Y9akRFxbdU13aZJL2e/PSWoA=", + "dev": true, + "requires": { + "global-dirs": "0.1.0", + "is-path-inside": "1.0.0" + } + }, + "is-my-json-valid": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz", + "integrity": "sha512-ochPsqWS1WXj8ZnMIV0vnNXooaMhp7cyL4FMSIPKTtnV0Ha/T19G2b9kkhcNsabV9bxYkze7/aLZJb/bYuFduQ==", + "dev": true, + "requires": { + "generate-function": "2.0.0", + "generate-object-property": "1.2.0", + "jsonpointer": "4.0.1", + "xtend": "4.0.1" + } + }, + "is-npm": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", + "integrity": "sha1-8vtjpl5JBbQGyGBydloaTceTufQ=", + "dev": true + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-path-inside": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", + "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", + "dev": true, + "requires": { + "path-is-inside": "1.0.2" + } + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-property": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", + "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", + "dev": true + }, + "is-redirect": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", + "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", + "dev": true + }, + "is-retry-allowed": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", + "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, + "optional": true + }, + "jschardet": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.5.1.tgz", + "integrity": "sha512-vE2hT1D0HLZCLLclfBSfkfTTedhVj0fubHpJBHKwwUWX0nSbhPAfk+SG9rTX95BYNmau8rGFfCeaT6T5OW1C2A==", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz", + "integrity": "sha512-xyQpxeWWMKyJps9CuGJYeng6ssI5bpqS9ltQpdVQ90t4ql6NdnxFKh95JcRt2cun/DjMVNrdjniLPuMA69xmCw==", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "jsonpointer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", + "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", + "dev": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } + } + }, + "just-extend": { + "version": "1.1.22", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-1.1.22.tgz", + "integrity": "sha1-MzCvdWyralQnAMZLLk5KoGLVL/8=", + "dev": true + }, + "latest-version": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz", + "integrity": "sha1-ogU4P+oyKzO1rjsYq+4NwvNW7hU=", + "dev": true, + "requires": { + "package-json": "4.0.1" + } + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "strip-bom": "2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", + "dev": true + }, + "lolex": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.1.3.tgz", + "integrity": "sha512-BdHq78SeI+6PAUtl4atDuCt7L6E4fab3mSRtqxm4ywaXe4uP7jZ0TTcFNuU20syUjxZc2l7jFqKVMJ+AX0LnpQ==", + "dev": true + }, + "long": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", + "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=", + "dev": true + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "0.4.1", + "signal-exit": "3.0.2" + } + }, + "lowercase-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", + "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=", + "dev": true + }, + "lru-cache": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + }, + "make-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.0.0.tgz", + "integrity": "sha1-l6ARdR6R3YfPre9Ygy67BJNt6Xg=", + "dev": true, + "requires": { + "pify": "2.3.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + }, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "requires": { + "camelcase-keys": "2.1.0", + "decamelize": "1.2.0", + "loud-rejection": "1.6.0", + "map-obj": "1.0.1", + "minimist": "1.2.0", + "normalize-package-data": "2.4.0", + "object-assign": "4.1.1", + "read-pkg-up": "1.0.1", + "redent": "1.0.0", + "trim-newlines": "1.0.0" + } + }, + "mime-db": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", + "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", + "dev": true + }, + "mime-types": { + "version": "2.1.17", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", + "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", + "dev": true, + "requires": { + "mime-db": "1.30.0" + } + }, + "mimic-fn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", + "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "1.1.8" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "mocha": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.0.1.tgz", + "integrity": "sha512-evDmhkoA+cBNiQQQdSKZa2b9+W2mpLoj50367lhy+Klnx9OV8XlCIhigUnn1gaTFLQCa0kdNhEGDr0hCXOQFDw==", + "dev": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.11.0", + "debug": "3.1.0", + "diff": "3.3.1", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.3", + "he": "1.1.1", + "mkdirp": "0.5.1", + "supports-color": "4.4.0" + }, + "dependencies": { + "diff": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", + "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", + "dev": true + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "nan": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", + "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=" + }, + "native-promise-only": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/native-promise-only/-/native-promise-only-0.8.1.tgz", + "integrity": "sha1-IKMYwwy0X3H+et+/eyHJnBRy7xE=", + "dev": true + }, + "nise": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/nise/-/nise-1.1.1.tgz", + "integrity": "sha512-f5DMJB0MqBaSuP2NAwPx7HyVKPdaozds0KsNe9XIP3npKWt/QUg73l5TTLRTSwfG/Y3AB0ktacuxX4QNcg6vVw==", + "dev": true, + "requires": { + "formatio": "1.2.0", + "just-extend": "1.1.22", + "lolex": "1.6.0", + "path-to-regexp": "1.7.0", + "text-encoding": "0.6.4" + }, + "dependencies": { + "lolex": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.6.0.tgz", + "integrity": "sha1-OpoCg0UqR9dDnnJzG54H1zhuSfY=", + "dev": true + } + } + }, + "node-uuid": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", + "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=", + "dev": true + }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true, + "requires": { + "hosted-git-info": "2.5.0", + "is-builtin-module": "1.0.0", + "semver": "5.4.1", + "validate-npm-package-license": "3.0.1" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "2.0.1" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "nyc": { + "version": "11.2.1", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-11.2.1.tgz", + "integrity": "sha1-rYUK/p261/SXByi0suR/7Rw4chw=", + "dev": true, + "requires": { + "archy": "1.0.0", + "arrify": "1.0.1", + "caching-transform": "1.0.1", + "convert-source-map": "1.5.0", + "debug-log": "1.0.1", + "default-require-extensions": "1.0.0", + "find-cache-dir": "0.1.1", + "find-up": "2.1.0", + "foreground-child": "1.5.6", + "glob": "7.1.2", + "istanbul-lib-coverage": "1.1.1", + "istanbul-lib-hook": "1.0.7", + "istanbul-lib-instrument": "1.8.0", + "istanbul-lib-report": "1.1.1", + "istanbul-lib-source-maps": "1.2.1", + "istanbul-reports": "1.1.2", + "md5-hex": "1.3.0", + "merge-source-map": "1.0.4", + "micromatch": "2.3.11", + "mkdirp": "0.5.1", + "resolve-from": "2.0.0", + "rimraf": "2.6.1", + "signal-exit": "3.0.2", + "spawn-wrap": "1.3.8", + "test-exclude": "4.1.1", + "yargs": "8.0.2", + "yargs-parser": "5.0.0" + }, + "dependencies": { + "align-text": { + "version": "0.1.4", + "bundled": true, + "dev": true, + "requires": { + "kind-of": "3.2.2", + "longest": "1.0.1", + "repeat-string": "1.6.1" + } + }, + "amdefine": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "bundled": true, + "dev": true + }, + "append-transform": { + "version": "0.4.0", + "bundled": true, + "dev": true, + "requires": { + "default-require-extensions": "1.0.0" + } + }, + "archy": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "arr-diff": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "arr-flatten": "1.1.0" + } + }, + "arr-flatten": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "array-unique": { + "version": "0.2.1", + "bundled": true, + "dev": true + }, + "arrify": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "async": { + "version": "1.5.2", + "bundled": true, + "dev": true + }, + "babel-code-frame": { + "version": "6.26.0", + "bundled": true, + "dev": true, + "requires": { + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" + } + }, + "babel-generator": { + "version": "6.26.0", + "bundled": true, + "dev": true, + "requires": { + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "detect-indent": "4.0.0", + "jsesc": "1.3.0", + "lodash": "4.17.4", + "source-map": "0.5.7", + "trim-right": "1.0.1" + } + }, + "babel-messages": { + "version": "6.23.0", + "bundled": true, + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-runtime": { + "version": "6.26.0", + "bundled": true, + "dev": true, + "requires": { + "core-js": "2.5.1", + "regenerator-runtime": "0.11.0" + } + }, + "babel-template": { + "version": "6.26.0", + "bundled": true, + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "lodash": "4.17.4" + } + }, + "babel-traverse": { + "version": "6.26.0", + "bundled": true, + "dev": true, + "requires": { + "babel-code-frame": "6.26.0", + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "debug": "2.6.8", + "globals": "9.18.0", + "invariant": "2.2.2", + "lodash": "4.17.4" + } + }, + "babel-types": { + "version": "6.26.0", + "bundled": true, + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "esutils": "2.0.2", + "lodash": "4.17.4", + "to-fast-properties": "1.0.3" + } + }, + "babylon": { + "version": "6.18.0", + "bundled": true, + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "brace-expansion": { + "version": "1.1.8", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "1.8.5", + "bundled": true, + "dev": true, + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" + } + }, + "builtin-modules": { + "version": "1.1.1", + "bundled": true, + "dev": true + }, + "caching-transform": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "requires": { + "md5-hex": "1.3.0", + "mkdirp": "0.5.1", + "write-file-atomic": "1.3.4" + } + }, + "camelcase": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "optional": true + }, + "center-align": { + "version": "0.1.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "align-text": "0.1.4", + "lazy-cache": "1.0.4" + } + }, + "chalk": { + "version": "1.1.3", + "bundled": true, + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "cliui": { + "version": "2.1.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "center-align": "0.1.3", + "right-align": "0.1.3", + "wordwrap": "0.0.2" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.2", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "commondir": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "convert-source-map": { + "version": "1.5.0", + "bundled": true, + "dev": true + }, + "core-js": { + "version": "2.5.1", + "bundled": true, + "dev": true + }, + "cross-spawn": { + "version": "4.0.2", + "bundled": true, + "dev": true, + "requires": { + "lru-cache": "4.1.1", + "which": "1.3.0" + } + }, + "debug": { + "version": "2.6.8", + "bundled": true, + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "debug-log": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "decamelize": { + "version": "1.2.0", + "bundled": true, + "dev": true + }, + "default-require-extensions": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "strip-bom": "2.0.0" + } + }, + "detect-indent": { + "version": "4.0.0", + "bundled": true, + "dev": true, + "requires": { + "repeating": "2.0.1" + } + }, + "error-ex": { + "version": "1.3.1", + "bundled": true, + "dev": true, + "requires": { + "is-arrayish": "0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "bundled": true, + "dev": true + }, + "esutils": { + "version": "2.0.2", + "bundled": true, + "dev": true + }, + "execa": { + "version": "0.7.0", + "bundled": true, + "dev": true, + "requires": { + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "5.1.0", + "bundled": true, + "dev": true, + "requires": { + "lru-cache": "4.1.1", + "shebang-command": "1.2.0", + "which": "1.3.0" + } + } + } + }, + "expand-brackets": { + "version": "0.1.5", + "bundled": true, + "dev": true, + "requires": { + "is-posix-bracket": "0.1.1" + } + }, + "expand-range": { + "version": "1.8.2", + "bundled": true, + "dev": true, + "requires": { + "fill-range": "2.2.3" + } + }, + "extglob": { + "version": "0.3.2", + "bundled": true, + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "filename-regex": { + "version": "2.0.1", + "bundled": true, + "dev": true + }, + "fill-range": { + "version": "2.2.3", + "bundled": true, + "dev": true, + "requires": { + "is-number": "2.1.0", + "isobject": "2.1.0", + "randomatic": "1.1.7", + "repeat-element": "1.1.2", + "repeat-string": "1.6.1" + } + }, + "find-cache-dir": { + "version": "0.1.1", + "bundled": true, + "dev": true, + "requires": { + "commondir": "1.0.1", + "mkdirp": "0.5.1", + "pkg-dir": "1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "bundled": true, + "dev": true, + "requires": { + "locate-path": "2.0.0" + } + }, + "for-in": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "for-own": { + "version": "0.1.5", + "bundled": true, + "dev": true, + "requires": { + "for-in": "1.0.2" + } + }, + "foreground-child": { + "version": "1.5.6", + "bundled": true, + "dev": true, + "requires": { + "cross-spawn": "4.0.2", + "signal-exit": "3.0.2" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "get-caller-file": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "bundled": true, + "dev": true + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "glob-base": { + "version": "0.3.0", + "bundled": true, + "dev": true, + "requires": { + "glob-parent": "2.0.0", + "is-glob": "2.0.1" + } + }, + "glob-parent": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "is-glob": "2.0.1" + } + }, + "globals": { + "version": "9.18.0", + "bundled": true, + "dev": true + }, + "graceful-fs": { + "version": "4.1.11", + "bundled": true, + "dev": true + }, + "handlebars": { + "version": "4.0.10", + "bundled": true, + "dev": true, + "requires": { + "async": "1.5.2", + "optimist": "0.6.1", + "source-map": "0.4.4", + "uglify-js": "2.8.29" + }, + "dependencies": { + "source-map": { + "version": "0.4.4", + "bundled": true, + "dev": true, + "requires": { + "amdefine": "1.0.1" + } + } + } + }, + "has-ansi": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "has-flag": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "hosted-git-info": { + "version": "2.5.0", + "bundled": true, + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "bundled": true, + "dev": true + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "invariant": { + "version": "2.2.2", + "bundled": true, + "dev": true, + "requires": { + "loose-envify": "1.3.1" + } + }, + "invert-kv": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "is-arrayish": { + "version": "0.2.1", + "bundled": true, + "dev": true + }, + "is-buffer": { + "version": "1.1.5", + "bundled": true, + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "builtin-modules": "1.1.1" + } + }, + "is-dotfile": { + "version": "1.0.3", + "bundled": true, + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "bundled": true, + "dev": true, + "requires": { + "is-primitive": "2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "bundled": true, + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-glob": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "is-number": { + "version": "2.1.0", + "bundled": true, + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "is-posix-bracket": { + "version": "0.1.1", + "bundled": true, + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "is-utf8": { + "version": "0.2.1", + "bundled": true, + "dev": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "isexe": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "isobject": { + "version": "2.1.0", + "bundled": true, + "dev": true, + "requires": { + "isarray": "1.0.0" + } + }, + "istanbul-lib-coverage": { + "version": "1.1.1", + "bundled": true, + "dev": true + }, + "istanbul-lib-hook": { + "version": "1.0.7", + "bundled": true, + "dev": true, + "requires": { + "append-transform": "0.4.0" + } + }, + "istanbul-lib-instrument": { + "version": "1.8.0", + "bundled": true, + "dev": true, + "requires": { + "babel-generator": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "istanbul-lib-coverage": "1.1.1", + "semver": "5.4.1" + } + }, + "istanbul-lib-report": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "requires": { + "istanbul-lib-coverage": "1.1.1", + "mkdirp": "0.5.1", + "path-parse": "1.0.5", + "supports-color": "3.2.3" + }, + "dependencies": { + "supports-color": { + "version": "3.2.3", + "bundled": true, + "dev": true, + "requires": { + "has-flag": "1.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "requires": { + "debug": "2.6.8", + "istanbul-lib-coverage": "1.1.1", + "mkdirp": "0.5.1", + "rimraf": "2.6.1", + "source-map": "0.5.7" + } + }, + "istanbul-reports": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "requires": { + "handlebars": "4.0.10" + } + }, + "js-tokens": { + "version": "3.0.2", + "bundled": true, + "dev": true + }, + "jsesc": { + "version": "1.3.0", + "bundled": true, + "dev": true + }, + "kind-of": { + "version": "3.2.2", + "bundled": true, + "dev": true, + "requires": { + "is-buffer": "1.1.5" + } + }, + "lazy-cache": { + "version": "1.0.4", + "bundled": true, + "dev": true, + "optional": true + }, + "lcid": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "invert-kv": "1.0.0" + } + }, + "load-json-file": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "strip-bom": "2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "p-locate": "2.0.0", + "path-exists": "3.0.0" + }, + "dependencies": { + "path-exists": { + "version": "3.0.0", + "bundled": true, + "dev": true + } + } + }, + "lodash": { + "version": "4.17.4", + "bundled": true, + "dev": true + }, + "longest": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "loose-envify": { + "version": "1.3.1", + "bundled": true, + "dev": true, + "requires": { + "js-tokens": "3.0.2" + } + }, + "lru-cache": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + }, + "md5-hex": { + "version": "1.3.0", + "bundled": true, + "dev": true, + "requires": { + "md5-o-matic": "0.1.1" + } + }, + "md5-o-matic": { + "version": "0.1.1", + "bundled": true, + "dev": true + }, + "mem": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "requires": { + "mimic-fn": "1.1.0" + } + }, + "merge-source-map": { + "version": "1.0.4", + "bundled": true, + "dev": true, + "requires": { + "source-map": "0.5.7" + } + }, + "micromatch": { + "version": "2.3.11", + "bundled": true, + "dev": true, + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" + } + }, + "mimic-fn": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "1.1.8" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "normalize-package-data": { + "version": "2.4.0", + "bundled": true, + "dev": true, + "requires": { + "hosted-git-info": "2.5.0", + "is-builtin-module": "1.0.0", + "semver": "5.4.1", + "validate-npm-package-license": "3.0.1" + } + }, + "normalize-path": { + "version": "2.1.1", + "bundled": true, + "dev": true, + "requires": { + "remove-trailing-separator": "1.1.0" + } + }, + "npm-run-path": { + "version": "2.0.2", + "bundled": true, + "dev": true, + "requires": { + "path-key": "2.0.1" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true + }, + "object.omit": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "requires": { + "for-own": "0.1.5", + "is-extendable": "0.1.1" + } + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "optimist": { + "version": "0.6.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8", + "wordwrap": "0.0.3" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "os-locale": { + "version": "2.1.0", + "bundled": true, + "dev": true, + "requires": { + "execa": "0.7.0", + "lcid": "1.0.0", + "mem": "1.1.0" + } + }, + "p-finally": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "p-limit": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "p-locate": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "p-limit": "1.1.0" + } + }, + "parse-glob": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "glob-base": "0.3.0", + "is-dotfile": "1.0.3", + "is-extglob": "1.0.0", + "is-glob": "2.0.1" + } + }, + "parse-json": { + "version": "2.2.0", + "bundled": true, + "dev": true, + "requires": { + "error-ex": "1.3.1" + } + }, + "path-exists": { + "version": "2.1.0", + "bundled": true, + "dev": true, + "requires": { + "pinkie-promise": "2.0.1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "path-key": { + "version": "2.0.1", + "bundled": true, + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "bundled": true, + "dev": true + }, + "path-type": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + } + }, + "pify": { + "version": "2.3.0", + "bundled": true, + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "bundled": true, + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "requires": { + "pinkie": "2.0.4" + } + }, + "pkg-dir": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "find-up": "1.1.2" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "requires": { + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" + } + } + } + }, + "preserve": { + "version": "0.2.0", + "bundled": true, + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "randomatic": { + "version": "1.1.7", + "bundled": true, + "dev": true, + "requires": { + "is-number": "3.0.0", + "kind-of": "4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "bundled": true, + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "bundled": true, + "dev": true, + "requires": { + "is-buffer": "1.1.5" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "bundled": true, + "dev": true, + "requires": { + "is-buffer": "1.1.5" + } + } + } + }, + "read-pkg": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "requires": { + "load-json-file": "1.1.0", + "normalize-package-data": "2.4.0", + "path-type": "1.1.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "requires": { + "find-up": "1.1.2", + "read-pkg": "1.1.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "requires": { + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" + } + } + } + }, + "regenerator-runtime": { + "version": "0.11.0", + "bundled": true, + "dev": true + }, + "regex-cache": { + "version": "0.4.4", + "bundled": true, + "dev": true, + "requires": { + "is-equal-shallow": "0.1.3" + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "repeat-element": { + "version": "1.1.2", + "bundled": true, + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "bundled": true, + "dev": true + }, + "repeating": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "requires": { + "is-finite": "1.0.2" + } + }, + "require-directory": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "resolve-from": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "right-align": { + "version": "0.1.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "align-text": "0.1.4" + } + }, + "rimraf": { + "version": "2.6.1", + "bundled": true, + "dev": true, + "requires": { + "glob": "7.1.2" + } + }, + "semver": { + "version": "5.4.1", + "bundled": true, + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true + }, + "slide": { + "version": "1.1.6", + "bundled": true, + "dev": true + }, + "source-map": { + "version": "0.5.7", + "bundled": true, + "dev": true + }, + "spawn-wrap": { + "version": "1.3.8", + "bundled": true, + "dev": true, + "requires": { + "foreground-child": "1.5.6", + "mkdirp": "0.5.1", + "os-homedir": "1.0.2", + "rimraf": "2.6.1", + "signal-exit": "3.0.2", + "which": "1.3.0" + } + }, + "spdx-correct": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "spdx-license-ids": "1.2.2" + } + }, + "spdx-expression-parse": { + "version": "1.0.4", + "bundled": true, + "dev": true + }, + "spdx-license-ids": { + "version": "1.2.2", + "bundled": true, + "dev": true + }, + "string-width": { + "version": "2.1.1", + "bundled": true, + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "bundled": true, + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "strip-bom": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "is-utf8": "0.2.1" + } + }, + "strip-eof": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "supports-color": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "test-exclude": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "requires": { + "arrify": "1.0.1", + "micromatch": "2.3.11", + "object-assign": "4.1.1", + "read-pkg-up": "1.0.1", + "require-main-filename": "1.0.1" + } + }, + "to-fast-properties": { + "version": "1.0.3", + "bundled": true, + "dev": true + }, + "trim-right": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "uglify-js": { + "version": "2.8.29", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "source-map": "0.5.7", + "uglify-to-browserify": "1.0.2", + "yargs": "3.10.0" + }, + "dependencies": { + "yargs": { + "version": "3.10.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "camelcase": "1.2.1", + "cliui": "2.1.0", + "decamelize": "1.2.0", + "window-size": "0.1.0" + } + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "validate-npm-package-license": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "spdx-correct": "1.0.2", + "spdx-expression-parse": "1.0.4" + } + }, + "which": { + "version": "1.3.0", + "bundled": true, + "dev": true, + "requires": { + "isexe": "2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "window-size": { + "version": "0.1.0", + "bundled": true, + "dev": true, + "optional": true + }, + "wordwrap": { + "version": "0.0.3", + "bundled": true, + "dev": true + }, + "wrap-ansi": { + "version": "2.1.0", + "bundled": true, + "dev": true, + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1" + }, + "dependencies": { + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "write-file-atomic": { + "version": "1.3.4", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "imurmurhash": "0.1.4", + "slide": "1.1.6" + } + }, + "y18n": { + "version": "3.2.1", + "bundled": true, + "dev": true + }, + "yallist": { + "version": "2.1.2", + "bundled": true, + "dev": true + }, + "yargs": { + "version": "8.0.2", + "bundled": true, + "dev": true, + "requires": { + "camelcase": "4.1.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "os-locale": "2.1.0", + "read-pkg-up": "2.0.0", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "2.1.1", + "which-module": "2.0.0", + "y18n": "3.2.1", + "yargs-parser": "7.0.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "bundled": true, + "dev": true + }, + "cliui": { + "version": "3.2.0", + "bundled": true, + "dev": true, + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wrap-ansi": "2.1.0" + }, + "dependencies": { + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } + } + }, + "load-json-file": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "strip-bom": "3.0.0" + } + }, + "path-type": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "pify": "2.3.0" + } + }, + "read-pkg": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "load-json-file": "2.0.0", + "normalize-package-data": "2.4.0", + "path-type": "2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "find-up": "2.1.0", + "read-pkg": "2.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "bundled": true, + "dev": true + }, + "yargs-parser": { + "version": "7.0.0", + "bundled": true, + "dev": true, + "requires": { + "camelcase": "4.1.0" + } + } + } + }, + "yargs-parser": { + "version": "5.0.0", + "bundled": true, + "dev": true, + "requires": { + "camelcase": "3.0.0" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "bundled": true, + "dev": true + } + } + } + } + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "1.1.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=" + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "package-json": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", + "integrity": "sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0=", + "dev": true, + "requires": { + "got": "6.7.1", + "registry-auth-token": "3.3.1", + "registry-url": "3.1.0", + "semver": "5.4.1" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "1.3.1" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "2.0.1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, + "path-to-regexp": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", + "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", + "dev": true, + "requires": { + "isarray": "0.0.1" + } + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "2.0.4" + } + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, + "protobufjs": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.0.tgz", + "integrity": "sha512-47Y49f5JN5Qsbxas2TyI2zFO8j9GpQAQm5thf54fr2O8qcP/jkIXYxmYx1hN2WQFAhESU1xpVn5NWVDBB8WFnw==", + "dev": true, + "requires": { + "@protobufjs/aspromise": "1.1.2", + "@protobufjs/base64": "1.1.2", + "@protobufjs/codegen": "2.0.4", + "@protobufjs/eventemitter": "1.1.0", + "@protobufjs/fetch": "1.1.0", + "@protobufjs/float": "1.0.2", + "@protobufjs/inquire": "1.1.0", + "@protobufjs/path": "1.1.2", + "@protobufjs/pool": "1.1.0", + "@protobufjs/utf8": "1.1.0", + "@types/long": "3.0.32", + "@types/node": "7.0.43", + "long": "3.2.0" + }, + "dependencies": { + "@types/node": { + "version": "7.0.43", + "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.43.tgz", + "integrity": "sha512-7scYwwfHNppXvH/9JzakbVxk0o0QUILVk1Lv64GRaxwPuGpnF1QBiwdvhDpLcymb8BpomQL3KYoWKq3wUdDMhQ==", + "dev": true + } + } + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "qs": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", + "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=", + "dev": true + }, + "rc": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz", + "integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=", + "dev": true, + "requires": { + "deep-extend": "0.4.2", + "ini": "1.3.4", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" + } + }, + "read-package-json": { + "version": "2.0.12", + "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.0.12.tgz", + "integrity": "sha512-m7/I0+tP6D34EVvSlzCtuVA4D/dHL6OpLcn2e4XVP5X57pCKGUy1JjRSBVKHWpB+vUU91sL85h84qX0MdXzBSw==", + "dev": true, + "requires": { + "glob": "7.1.2", + "graceful-fs": "4.1.11", + "json-parse-better-errors": "1.0.1", + "normalize-package-data": "2.4.0", + "slash": "1.0.0" + } + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "1.1.0", + "normalize-package-data": "2.4.0", + "path-type": "1.1.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "1.1.2", + "read-pkg": "1.1.0" + } + }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dev": true, + "requires": { + "indent-string": "2.1.0", + "strip-indent": "1.0.1" + } + }, + "registry-auth-token": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.1.tgz", + "integrity": "sha1-+w0yie4Nmtosu1KvXf5mywcNMAY=", + "dev": true, + "requires": { + "rc": "1.2.1", + "safe-buffer": "5.1.1" + } + }, + "registry-url": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", + "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=", + "dev": true, + "requires": { + "rc": "1.2.1" + } + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "1.0.2" + } + }, + "request": { + "version": "2.77.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.77.0.tgz", + "integrity": "sha1-KwDYIDDt7cyXCJ/6XYgQqcKqMUs=", + "dev": true, + "requires": { + "aws-sign2": "0.6.0", + "aws4": "1.6.0", + "caseless": "0.11.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.1.4", + "har-validator": "2.0.6", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.17", + "node-uuid": "1.4.8", + "oauth-sign": "0.8.2", + "qs": "6.3.2", + "stringstream": "0.0.5", + "tough-cookie": "2.3.3", + "tunnel-agent": "0.4.3" + } + }, + "resolve": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", + "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", + "dev": true, + "requires": { + "path-parse": "1.0.5" + } + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "2.0.1", + "signal-exit": "3.0.2" + } + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "7.1.2" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "2.1.0" + } + }, + "rx-lite": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", + "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", + "dev": true + }, + "rx-lite-aggregates": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", + "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", + "dev": true, + "requires": { + "rx-lite": "4.0.8" + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "dev": true + }, + "samsam": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.3.0.tgz", + "integrity": "sha512-1HwIYD/8UlOtFS3QO3w7ey+SdSDFE4HRNLZoZRYVQefrOY3l17epswImeB1ijgJFQJodIaHcwkp3r/myBjFVbg==", + "dev": true + }, + "semver": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", + "dev": true + }, + "semver-diff": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz", + "integrity": "sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=", + "dev": true, + "requires": { + "semver": "5.4.1" + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "sinon": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.0.1.tgz", + "integrity": "sha512-4qIY0pCWCvGCJpV/1JkFu9kbsNEZ9O34cG1oru/c7OCDtrEs50Gq/VjkA2ID5ZwLyoNx1i1ws118oh/p6fVeDg==", + "dev": true, + "requires": { + "diff": "3.4.0", + "formatio": "1.2.0", + "lodash.get": "4.4.2", + "lolex": "2.1.3", + "native-promise-only": "0.8.1", + "nise": "1.1.1", + "path-to-regexp": "1.7.0", + "samsam": "1.3.0", + "text-encoding": "0.6.4", + "type-detect": "4.0.3" + } + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "dev": true, + "requires": { + "hoek": "2.16.3" + } + }, + "spdx-correct": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", + "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", + "dev": true, + "requires": { + "spdx-license-ids": "1.2.2" + } + }, + "spdx-expression-parse": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", + "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", + "dev": true + }, + "spdx-license-ids": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", + "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", + "dev": true + }, + "sshpk": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", + "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "dev": true, + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "0.2.1" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "4.0.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + }, + "term-size": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", + "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", + "dev": true, + "requires": { + "execa": "0.7.0" + } + }, + "text-encoding": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", + "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "dev": true + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "1.0.2" + } + }, + "tough-cookie": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", + "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", + "dev": true, + "requires": { + "punycode": "1.4.1" + } + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true + }, + "tslib": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz", + "integrity": "sha512-ymKWWZJST0/CkgduC2qkzjMOWr4bouhuURNXCn/inEX0L57BnRG6FhX76o7FOnsjHazCjfU2LKeSrlS2sIKQJg==", + "dev": true + }, + "tslint": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.7.0.tgz", + "integrity": "sha1-wl4NDJL6EgHCvDDoROCOaCtPNVI=", + "dev": true, + "requires": { + "babel-code-frame": "6.26.0", + "colors": "1.1.2", + "commander": "2.11.0", + "diff": "3.4.0", + "glob": "7.1.2", + "minimatch": "3.0.4", + "resolve": "1.4.0", + "semver": "5.4.1", + "tslib": "1.8.0", + "tsutils": "2.12.1" + } + }, + "tsutils": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.12.1.tgz", + "integrity": "sha1-9Nlc4zkciXHkblTEzw7bCiHdWyQ=", + "dev": true, + "requires": { + "tslib": "1.8.0" + } + }, + "tunnel-agent": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", + "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", + "dev": true + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true, + "optional": true + }, + "type-detect": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", + "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", + "dev": true + }, + "typescript": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.3.tgz", + "integrity": "sha512-ptLSQs2S4QuS6/OD1eAKG+S5G8QQtrU5RT32JULdZQtM1L3WTi34Wsu48Yndzi8xsObRAB9RPt/KhA9wlpEF6w==", + "dev": true + }, + "unique-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", + "integrity": "sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo=", + "dev": true, + "requires": { + "crypto-random-string": "1.0.0" + } + }, + "unzip-response": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", + "integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c=", + "dev": true + }, + "update-notifier": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-2.3.0.tgz", + "integrity": "sha1-TognpruRUUCrCTVZ1wFOPruDdFE=", + "dev": true, + "requires": { + "boxen": "1.2.1", + "chalk": "2.1.0", + "configstore": "3.1.1", + "import-lazy": "2.1.0", + "is-installed-globally": "0.1.0", + "is-npm": "1.0.0", + "latest-version": "3.1.0", + "semver-diff": "2.1.0", + "xdg-basedir": "3.0.0" + } + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "dev": true, + "requires": { + "prepend-http": "1.0.4" + } + }, + "urlgrey": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/urlgrey/-/urlgrey-0.4.4.tgz", + "integrity": "sha1-iS/pWWCAXoVRnxzUOJ8stMu3ZS8=", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", + "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", + "dev": true, + "requires": { + "spdx-correct": "1.0.2", + "spdx-expression-parse": "1.0.4" + } + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } + } + }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + }, + "widest-line": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-1.0.0.tgz", + "integrity": "sha1-DAnIXCqUaD0Nfq+O4JfVZL8OEFw=", + "dev": true, + "requires": { + "string-width": "1.0.2" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "imurmurhash": "0.1.4", + "signal-exit": "3.0.2" + } + }, + "xdg-basedir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", + "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", + "dev": true + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true } } diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 4f138d9433c..e702954478c 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -5,9 +5,10 @@ "main": "build/src/index.js", "scripts": { "install": "node-gyp rebuild", - "test": "true", + "test": "nyc mocha build/test/test-*.js", "check": "gts check", "clean": "gts clean", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json", "compile": "npm run proto && tsc -p .", "fix": "gts fix", "prepare": "npm run compile", @@ -21,15 +22,23 @@ "license": "Apache-2.0", "dependencies": { "bindings": "^1.2.1", + "delay": "^2.0.0", "extend": "^3.0.1", "nan": "^2.1.0" }, "devDependencies": { + "@types/delay": "^2.0.0", "@types/extend": "^2.0.30", + "@types/mocha": "^2.2.43", "@types/node": "^8.0.30", + "@types/sinon": "^2.3.6", "clang-format": "^1.0.33", - "gts": "latest", + "codecov": "^2.3.1", + "gts": "^0.3.1", + "mocha": "^4.0.1", + "nyc": "^11.2.1", "protobufjs": "~6.8.0", + "sinon": "^4.0.1", "typescript": "^2.4.1" }, "files": [ diff --git a/handwritten/cloud-profiler/src/config.ts b/handwritten/cloud-profiler/src/config.ts index 74d03745710..b8a96c2302e 100644 --- a/handwritten/cloud-profiler/src/config.ts +++ b/handwritten/cloud-profiler/src/config.ts @@ -55,8 +55,8 @@ export interface Config extends AuthenticationConfig { // metadata server. zone?: string; - // When true, CPU profiling will be disabled. - disableCpu?: boolean; + // When true, time profiling will be disabled. + disableTime?: boolean; // When true, heap profiling will be disabled. disableHeap?: boolean; @@ -70,5 +70,5 @@ export const defaultConfig: Config = { version: '', }, disableHeap: false, - disableCpu: false, + disableTime: false, }; diff --git a/handwritten/cloud-profiler/src/profiler.ts b/handwritten/cloud-profiler/src/profiler.ts index 6d7a958d886..26eeba6070c 100644 --- a/handwritten/cloud-profiler/src/profiler.ts +++ b/handwritten/cloud-profiler/src/profiler.ts @@ -14,12 +14,14 @@ * limitations under the License. */ import * as path from 'path'; + import {AuthenticationConfig, Common, Logger, Service, ServiceConfig} from '../third_party/types/common-types'; + import {Config} from './config'; -import {CpuProfiler} from './profilers/cpu-profiler'; import {HeapProfiler} from './profilers/heap-profiler'; +import {TimeProfiler} from './profilers/time-profiler'; -const pjson = require('../../../package.json'); +const pjson = require('../../package.json'); const common: Common = require('@google-cloud/common'); export interface ProfilerConfig extends AuthenticationConfig { @@ -28,7 +30,7 @@ export interface ProfilerConfig extends AuthenticationConfig { serviceContext: {service: string; version?: string;}; instance: string; zone: string; - disableCpu: boolean; + disableTime: boolean; disableHeap: boolean; } diff --git a/handwritten/cloud-profiler/src/profilers/cpu-profiler.ts b/handwritten/cloud-profiler/src/profilers/cpu-profiler.ts deleted file mode 100644 index 098020c77e2..00000000000 --- a/handwritten/cloud-profiler/src/profilers/cpu-profiler.ts +++ /dev/null @@ -1,7 +0,0 @@ -// Unimplemented stub of CpuProfiler -// TODO: implement -export class CpuProfiler { - constructor() { - throw new Error('CPU Profiler is unimplemented'); - } -} diff --git a/handwritten/cloud-profiler/src/profilers/profile-serializer.ts b/handwritten/cloud-profiler/src/profilers/profile-serializer.ts new file mode 100644 index 00000000000..9ea20010edc --- /dev/null +++ b/handwritten/cloud-profiler/src/profilers/profile-serializer.ts @@ -0,0 +1,146 @@ +/** + * 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. + */ + +import {perftools} from '../profile'; +import {getIndexOrAdd} from '../util'; +import {TimeProfile, TimeProfileNode} from '../v8-types'; +// A stack of function UIDs. +type Stack = Array; +interface Entry { + node: TimeProfileNode; + stack: Stack; +} + +/** + * Converts v8 Profile into profile with profile format used by Stackdriver + * Profiler. + * + * @param prof - profile to be converted. + * @param intervalMicros - average time (microseconds) between samples. + */ +export function serializeTimeProfile( + prof: TimeProfile, intervalMicros: number) { + let samples: Array = []; + let locations: Array = []; + let functions: Array = []; + let locationMap: Map = new Map(); + let functionMap: Map = new Map(); + let strings = ['']; + + let sampleValueType = createSampleValueType(); + let timeValueType = createTimeValueType(); + + serializeNode(prof.topDownRoot); + + return { + sampleType: [sampleValueType, timeValueType], + sample: samples, + location: locations, + function: functions, + stringTable: strings, + // opt drop_frames + // opt keep_frames + timeNanos: 1000 * 1000 * prof.endTime, // Nanos + durationNanos: 1000 * 1000 * (prof.endTime - prof.startTime), // Nanos + + periodType: timeValueType, + period: intervalMicros + }; + + /** + * Adds samples from a node and it's children to the fields tracking + * profile serialization. + * + * @param node - the node which is serialized + * @param stack - the stack trace to the current node. + */ + function serializeNode(root: TimeProfileNode) { + let entries: Entry[] = []; + // don't include root node in serialized profile, start with it's children. + for (let child of root.children) { + entries.push({node: child, stack: []}); + } + while (entries.length > 0) { + let entry = entries.pop(); + if (entry !== undefined) { + let node = entry.node; + let stack = entry.stack; + let location = getLocation(node); + stack.unshift(location.id as number); + if (node.hitCount > 0) { + const sample = new perftools.profiles.Sample({ + locationId: stack, + value: [node.hitCount, node.hitCount * intervalMicros] + }); + samples.push(sample); + } + for (let child of node.children) { + entries.push({node: child, stack: stack.slice(0)}); + } + } + } + } + + function getLocation(node: TimeProfileNode): perftools.profiles.Location { + const id = node.callUid; + let location = locationMap.get(id); + if (location !== undefined) { + return location; + } + location = new perftools.profiles.Location({id: id, line: [getLine(node)]}); + locations.push(location); + locationMap.set(id, location); + return location; + } + + function getLine(node: TimeProfileNode): perftools.profiles.Line { + return new perftools.profiles.Line( + {functionId: getFunction(node).id, line: node.lineNumber}); + } + + function getFunction(node: TimeProfileNode): perftools.profiles.Function { + const id = node.callUid; + let f = functionMap.get(id); + if (f !== undefined) { + return f; + } + const name = getIndexOrAdd(node.functionName || '(anonymous)', strings); + f = new perftools.profiles.Function({ + id: id, + name: name, + systemName: name, + filename: getIndexOrAdd(node.scriptResourceName || '(unknown)', strings) + // start_line + }); + functions.push(f); + functionMap.set(id, f); + return f; + } + + function createSampleValueType(): perftools.profiles.ValueType { + return new perftools.profiles.ValueType({ + type: getIndexOrAdd('samples', strings), + unit: getIndexOrAdd('count', strings) + }); + } + + function createTimeValueType(): perftools.profiles.ValueType { + return new perftools.profiles.ValueType({ + type: getIndexOrAdd('time', strings), + unit: getIndexOrAdd('microseconds', strings) + }); + } +} diff --git a/handwritten/cloud-profiler/src/profilers/time-profiler.ts b/handwritten/cloud-profiler/src/profilers/time-profiler.ts new file mode 100644 index 00000000000..5948cfbb803 --- /dev/null +++ b/handwritten/cloud-profiler/src/profilers/time-profiler.ts @@ -0,0 +1,44 @@ +/** + * 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. + */ + +import * as delay from 'delay'; + +import {perftools} from '../profile'; +import {serializeTimeProfile} from './profile-serializer'; + +const profiler = require('bindings')('time_profiler'); + +export class TimeProfiler { + /** + * @param intervalMicros - average time in microseconds between samples + */ + constructor(private intervalMicros: number) { + profiler.setSamplingInterval(this.intervalMicros); + } + + /** + * Collects a profile for the duration specified. + * + * @param durationMillis - time in milliseconds for which to collect profile. + */ + async profile(durationMillis: number): Promise { + const runName = 'stackdriver-profiler-' + Date.now() + '-' + Math.random(); + profiler.startProfiling(runName, true); + await delay(durationMillis); + let result = profiler.stopProfiling(runName); + return serializeTimeProfile(result, this.intervalMicros); + } +} diff --git a/handwritten/cloud-profiler/src/v8-types.ts b/handwritten/cloud-profiler/src/v8-types.ts index 2b1fac6c901..aa286001107 100644 --- a/handwritten/cloud-profiler/src/v8-types.ts +++ b/handwritten/cloud-profiler/src/v8-types.ts @@ -16,21 +16,21 @@ // Type Definitions based on implementation in bindings/ -export interface CpuProfile { +export interface TimeProfile { /** Time in nanoseconds at which profile was stopped. */ endTime: number; - topDownRoot: CpuProfileNode; + topDownRoot: TimeProfileNode; /** Time in nanoseconds at which profile was started. */ startTime: number; } -export interface CpuProfileNode { +export interface TimeProfileNode { callUid: number; scriptResourceName?: string; functionName?: string; lineNumber: number; hitCount: number; - children: Array; + children: Array; } export interface AllocationProfileNode { diff --git a/handwritten/cloud-profiler/test/profile-for-test.ts b/handwritten/cloud-profiler/test/profile-for-test.ts new file mode 100644 index 00000000000..b59e8475ecd --- /dev/null +++ b/handwritten/cloud-profiler/test/profile-for-test.ts @@ -0,0 +1,133 @@ + +import {perftools} from '../src/profile'; +import {TimeProfile, TimeProfileNode} from '../src/v8-types'; + +const leaf1: TimeProfileNode = { + callUid: 5, + scriptResourceName: 'script3', + functionName: 'function5', + lineNumber: 5, + hitCount: 5, + children: [], +}; + +const leaf2 = { + callUid: 4, + scriptResourceName: 'script3', + functionName: 'function4', + lineNumber: 10, + hitCount: 2, + children: [], +}; + +const leaf3 = { + callUid: 3, + scriptResourceName: 'script3', + functionName: 'function3', + lineNumber: 15, + hitCount: 3, + children: [], +}; + +const node1 = { + callUid: 2, + scriptResourceName: 'script2', + functionName: 'function2', + lineNumber: 20, + hitCount: 7, + children: [leaf1, leaf2], +}; + +const main = { + callUid: 1, + scriptResourceName: 'script1', + functionName: 'main', + lineNumber: 1, + hitCount: 0, + children: [node1, leaf3], +}; + +const root = { + callUid: 0, + scriptResourceName: 'root', + functionName: 'root', + lineNumber: 0, + hitCount: 0, + children: [main], +}; + +export const timeProfileTree: TimeProfile = { + startTime: 0, + endTime: 100, + topDownRoot: root, +}; + +const lines = [ + {functionId: 1, line: 1}, + {functionId: 2, line: 20}, + {functionId: 3, line: 15}, + {functionId: 4, line: 10}, + {functionId: 5, line: 5}, +]; + +const functions = [ + new perftools.profiles.Function({id: 1, name: 5, systemName: 5, filename: 6}), + new perftools.profiles.Function({id: 3, name: 7, systemName: 7, filename: 8}), + new perftools.profiles.Function( + {id: 2, name: 9, systemName: 9, filename: 10}), + new perftools.profiles.Function( + {id: 4, name: 11, systemName: 11, filename: 8}), + new perftools.profiles.Function( + {id: 5, name: 12, systemName: 12, filename: 8}), +]; + +const locations = [ + new perftools.profiles.Location({ + line: [lines[0]], + id: 1, + }), + new perftools.profiles.Location({ + line: [lines[2]], + id: 3, + }), + new perftools.profiles.Location({ + line: [lines[1]], + id: 2, + }), + new perftools.profiles.Location({ + line: [lines[3]], + id: 4, + }), + new perftools.profiles.Location({ + line: [lines[4]], + id: 5, + }), +]; + +export const timeProfile: perftools.profiles.IProfile = { + sampleType: [ + new perftools.profiles.ValueType({type: 1, unit: 2}), + new perftools.profiles.ValueType({type: 3, unit: 4}), + ], + sample: [ + new perftools.profiles.Sample( + {locationId: [3, 1], value: [3, 3000], label: []}), + new perftools.profiles.Sample( + {locationId: [2, 1], value: [7, 7000], label: []}), + new perftools.profiles.Sample( + {locationId: [4, 2, 1], value: [2, 2000], label: []}), + new perftools.profiles.Sample( + {locationId: [5, 2, 1], value: [5, 5000], label: []}), + + ], + location: locations, + function: functions, + stringTable: [ + '', 'samples', 'count', 'time', 'microseconds', 'main', 'script1', + 'function3', 'script3', 'function2', 'script2', 'function4', 'function5' + ], + timeNanos: 100 * 1000 * 1000, + durationNanos: 100 * 1000 * 1000, + periodType: new perftools.profiles.ValueType({type: 3, unit: 4}), + period: 1000, +}; diff --git a/handwritten/cloud-profiler/test/test-profile-serializer.ts b/handwritten/cloud-profiler/test/test-profile-serializer.ts new file mode 100644 index 00000000000..3a27ecc57e8 --- /dev/null +++ b/handwritten/cloud-profiler/test/test-profile-serializer.ts @@ -0,0 +1,30 @@ +/** + * 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. + */ + +import {perftools} from '../src/profile'; +import {serializeTimeProfile} from '../src/profilers/profile-serializer'; +import {TimeProfile, TimeProfileNode} from '../src/v8-types'; + +import {timeProfile, timeProfileTree} from './profile-for-test'; + +let assert = require('assert'); + +describe('serializeTimeProfile', () => { + it('should produce expected profile', () => { + const timeProfileOut = serializeTimeProfile(timeProfileTree, 1000); + assert.deepEqual(timeProfile, timeProfileOut); + }); +}); diff --git a/handwritten/cloud-profiler/test/test-time-profiler.ts b/handwritten/cloud-profiler/test/test-time-profiler.ts new file mode 100644 index 00000000000..78f14ae803b --- /dev/null +++ b/handwritten/cloud-profiler/test/test-time-profiler.ts @@ -0,0 +1,63 @@ +/** + * 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. + */ + +import * as delay from 'delay'; +import * as sinon from 'sinon'; + +import {perftools} from '../src/profile'; +import {TimeProfiler} from '../src/profilers/time-profiler'; + +import {timeProfile, timeProfileTree} from './profile-for-test'; + +let assert = require('assert'); +const v8TimeProfiler = require('bindings')('time_profiler'); + +describe('TimeProfiler', () => { + describe('profile', () => { + before(() => { + sinon.stub(v8TimeProfiler, 'startProfiling'); + sinon.stub(v8TimeProfiler, 'stopProfiling').returns(timeProfileTree); + sinon.stub(v8TimeProfiler, 'setSamplingInterval'); + }); + + after(() => { + v8TimeProfiler.startProfiling.restore(); + v8TimeProfiler.stopProfiling.restore(); + v8TimeProfiler.setSamplingInterval.restore(); + }); + + it('should profile during duration and finish profiling after duration', + async () => { + const durationMillis = 500; + const intervalMicros = 1000; + let profiler = new TimeProfiler(intervalMicros); + let isProfiling = true; + let profilePromise = profiler.profile(durationMillis).then(() => { + isProfiling = false; + }); + await delay(2 * durationMillis); + assert.equal(false, isProfiling, 'profiler is still running'); + }); + + it('should return a profile equal to the expected profile', async () => { + const durationMillis = 500; + const intervalMicros = 1000; + let profiler = new TimeProfiler(intervalMicros); + let profile = await profiler.profile(durationMillis); + assert.deepEqual(timeProfile, profile); + }); + }); +}); diff --git a/handwritten/cloud-profiler/tsconfig.json b/handwritten/cloud-profiler/tsconfig.json index c5c1cda9917..7affdd7a0fc 100644 --- a/handwritten/cloud-profiler/tsconfig.json +++ b/handwritten/cloud-profiler/tsconfig.json @@ -2,7 +2,7 @@ "extends": "./node_modules/gts/tsconfig-google.json", "compilerOptions": { "rootDir": ".", - "outDir": "build", + "outDir": "build", "lib": [ "es2015" ] }, "include": [ From 3f04b1c354ae3c0b655df0d38374ebf4b01e4c07 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Mon, 23 Oct 2017 11:22:54 -0700 Subject: [PATCH 012/632] chore: update profile.proto (#21) --- .../third_party/proto/README.google | 4 ++-- .../third_party/proto/profile.proto | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/handwritten/cloud-profiler/third_party/proto/README.google b/handwritten/cloud-profiler/third_party/proto/README.google index bebfac054cb..5f5913ac3aa 100644 --- a/handwritten/cloud-profiler/third_party/proto/README.google +++ b/handwritten/cloud-profiler/third_party/proto/README.google @@ -1,5 +1,5 @@ -URL: https://github.com/google/pprof/blob/d174bbe741d0e8039ecf6504b15f708d1ee5c0f2 -Version: d174bbe741d0e8039ecf6504b15f708d1ee5c0f2 +URL: https://github.com/google/pprof/tree/c70cbc2c12c3c07c76269944233837844e7dcb29 +Version: c70cbc2c12c3c07c76269944233837844e7dcb29 License: Apache 2.0 License File: # LICENSE Description: diff --git a/handwritten/cloud-profiler/third_party/proto/profile.proto b/handwritten/cloud-profiler/third_party/proto/profile.proto index 0df631f7091..78caf4138b2 100644 --- a/handwritten/cloud-profiler/third_party/proto/profile.proto +++ b/handwritten/cloud-profiler/third_party/proto/profile.proto @@ -50,7 +50,7 @@ message Profile { repeated Function function = 5; // A common table for strings referenced by various messages. // string_table[0] must always be "". - repeated string string_table = 6 [enforce_utf8 = false]; + repeated string string_table = 6; // frames with Function.function_name fully matching the following // regexp will be dropped from the samples, along with their successors. int64 drop_frames = 7; // Index into string table. @@ -72,6 +72,9 @@ message Profile { int64 period = 12; // Freeform text associated to the profile. repeated int64 comment = 13; // Indices into string table. + // Index into the string table of the type of the preferred sample + // value. If unset, clients should default to the last sample value. + int64 default_sample_type = 14; } // ValueType describes the semantics and measurement units of a value. @@ -106,6 +109,15 @@ message Label { // At most one of the following must be present int64 str = 2; // Index into string table int64 num = 3; + + // Should only be present when num is present. + // Specifies the units of num. + // Use arbitrary string (for example, "requests") as a custom count unit. + // If no unit is specified, consumer may apply heuristic to deduce the unit. + // Consumers may also interpret units like "bytes" and "kilobytes" as memory + // units and units like "seconds" and "nanoseconds" as time units, + // and apply appropriate unit conversions to these. + int64 num_unit = 4; // Index into string table } message Mapping { @@ -177,4 +189,4 @@ message Function { int64 filename = 4; // Index into string table // Line number in source file. int64 start_line = 5; -} \ No newline at end of file +} From 8a06961a6c6f79931efc570d4bb558961e900256 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 26 Oct 2017 17:41:00 -0700 Subject: [PATCH 013/632] feat: get instance and zone from metadata (#12) --- handwritten/cloud-profiler/package-lock.json | 1543 ++++++++++++----- handwritten/cloud-profiler/package.json | 9 +- handwritten/cloud-profiler/src/config.ts | 3 +- handwritten/cloud-profiler/src/index.ts | 65 +- handwritten/cloud-profiler/src/profiler.ts | 3 +- .../test/fixtures/test-config.json | 12 + .../cloud-profiler/test/test-init-config.ts | 241 +++ .../third_party/types/gcp-metadata-types.ts | 32 - 8 files changed, 1420 insertions(+), 488 deletions(-) create mode 100644 handwritten/cloud-profiler/test/fixtures/test-config.json create mode 100644 handwritten/cloud-profiler/test/test-init-config.ts delete mode 100644 handwritten/cloud-profiler/third_party/types/gcp-metadata-types.ts diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 90fa11c069e..248d85b823d 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -4,6 +4,31 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@google-cloud/common": { + "version": "0.13.6", + "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.13.6.tgz", + "integrity": "sha1-qdjhN7xCmkSrqWif5qDkMxeE+FM=", + "requires": { + "array-uniq": "1.0.3", + "arrify": "1.0.1", + "concat-stream": "1.6.0", + "create-error-class": "3.0.2", + "duplexify": "3.5.1", + "ent": "2.2.0", + "extend": "3.0.1", + "google-auto-auth": "0.7.2", + "is": "3.2.1", + "log-driver": "1.2.5", + "methmeth": "1.1.0", + "modelo": "4.2.0", + "request": "2.83.0", + "retry-request": "3.1.0", + "split-array-stream": "1.0.3", + "stream-events": "1.0.2", + "string-format-obj": "1.1.0", + "through2": "2.0.3" + } + }, "@protobufjs/aspromise": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", @@ -80,6 +105,15 @@ "integrity": "sha1-WMyT9iHQo1jT/sm9bnObxg7H4nU=", "dev": true }, + "@types/form-data": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.0.tgz", + "integrity": "sha512-vm5OGsKc61Sx/GTRMQ9d0H0PYCDebT78/bdIBPCoPEHdgp0etaH1RzMmkDygymUmyXTj3rdWQn0sRUpYKZzljA==", + "dev": true, + "requires": { + "@types/node": "8.0.34" + } + }, "@types/long": { "version": "3.0.32", "resolved": "https://registry.npmjs.org/@types/long/-/long-3.0.32.tgz", @@ -98,12 +132,38 @@ "integrity": "sha512-Jnmm57+nHqvJUPwUzt1CLoLzFtF2B2vgG7cWFut+a4nqTp9/L6pL0N+o0Jt3V7AQnCKMsPEqQpLFZYleBCdq3w==", "dev": true }, + "@types/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-BIRcpFqRm64rVuuYCFzOF37I2IEP3sXhiCjy8NbzJkxqFY2CLiDLFPhh6Sph/eXPXctg05MayCEDmeKCOIUBFg==" + }, + "@types/request": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/request/-/request-2.0.6.tgz", + "integrity": "sha512-8/VAk8kgeWuNQTOMmhaLyYmzX7Foshcdh0f1KwkyWQPmoPCy4AIMDx4KqI/n/uO5pAw2FOCgW+76iJTyjYsIRw==", + "dev": true, + "requires": { + "@types/form-data": "2.2.0", + "@types/node": "8.0.34" + } + }, "@types/sinon": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-2.3.6.tgz", "integrity": "sha512-4+8BQOU/siROrXyMliceCUvQ3dy719ctUBBMcTRjcrWJ5uiR/wccIVPsO3aLBB86j8JFQeF0FlQR6ZpSNsbA6Q==", "dev": true }, + "ajv": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.2.4.tgz", + "integrity": "sha1-Pa+ai2ciEpn9ro2C0RftjmyAJEs=", + "requires": { + "co": "4.6.0", + "fast-deep-equal": "1.0.0", + "json-schema-traverse": "0.3.1", + "json-stable-stringify": "1.0.1" + } + }, "ansi-align": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz", @@ -146,17 +206,25 @@ "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", "dev": true }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=" + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" + }, "asn1": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", - "dev": true + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" }, "assert-plus": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", - "dev": true + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" }, "async": { "version": "1.5.2", @@ -167,20 +235,17 @@ "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "aws-sign2": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", - "dev": true + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" }, "aws4": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", - "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", - "dev": true + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" }, "babel-code-frame": { "version": "6.26.0", @@ -241,11 +306,15 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "base64url": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/base64url/-/base64url-2.0.0.tgz", + "integrity": "sha1-6sFuA+oUOO/5Qj1puqNiYu0fcLs=" + }, "bcrypt-pbkdf": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", - "dev": true, "optional": true, "requires": { "tweetnacl": "0.14.5" @@ -257,12 +326,11 @@ "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==" }, "boom": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", - "dev": true, + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", "requires": { - "hoek": "2.16.3" + "hoek": "4.2.0" } }, "boxen": { @@ -304,6 +372,11 @@ "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", "dev": true }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" + }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", @@ -329,14 +402,12 @@ "capture-stack-trace": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz", - "integrity": "sha1-Sm+gc5nCa7pH8LJJa00PtAjFVQ0=", - "dev": true + "integrity": "sha1-Sm+gc5nCa7pH8LJJa00PtAjFVQ0=" }, "caseless": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", - "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", - "dev": true + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, "chalk": { "version": "2.1.0", @@ -381,6 +452,11 @@ "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", "dev": true }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", @@ -396,6 +472,191 @@ "argv": "0.0.2", "request": "2.77.0", "urlgrey": "0.4.4" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "assert-plus": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", + "dev": true + }, + "aws-sign2": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", + "dev": true + }, + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "dev": true, + "requires": { + "hoek": "2.16.3" + } + }, + "caseless": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", + "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "dev": true, + "requires": { + "boom": "2.10.1" + } + }, + "form-data": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", + "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "dev": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.17" + } + }, + "har-validator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", + "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "commander": "2.11.0", + "is-my-json-valid": "2.16.1", + "pinkie-promise": "2.0.1" + } + }, + "hawk": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "dev": true, + "requires": { + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" + } + }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", + "dev": true + }, + "http-signature": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "dev": true, + "requires": { + "assert-plus": "0.2.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" + } + }, + "node-uuid": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", + "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=", + "dev": true + }, + "qs": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", + "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=", + "dev": true + }, + "request": { + "version": "2.77.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.77.0.tgz", + "integrity": "sha1-KwDYIDDt7cyXCJ/6XYgQqcKqMUs=", + "dev": true, + "requires": { + "aws-sign2": "0.6.0", + "aws4": "1.6.0", + "caseless": "0.11.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.1.4", + "har-validator": "2.0.6", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.17", + "node-uuid": "1.4.8", + "oauth-sign": "0.8.2", + "qs": "6.3.2", + "stringstream": "0.0.5", + "tough-cookie": "2.3.3", + "tunnel-agent": "0.4.3" + } + }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "dev": true, + "requires": { + "hoek": "2.16.3" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "tunnel-agent": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", + "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", + "dev": true + } } }, "color-convert": { @@ -423,7 +684,6 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", - "dev": true, "requires": { "delayed-stream": "1.0.0" } @@ -440,6 +700,16 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "concat-stream": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", + "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.3", + "typedarray": "0.0.6" + } + }, "configstore": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.1.tgz", @@ -457,14 +727,12 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "create-error-class": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=", - "dev": true, "requires": { "capture-stack-trace": "1.0.0" } @@ -481,12 +749,21 @@ } }, "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", - "dev": true, + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", "requires": { - "boom": "2.10.1" + "boom": "5.2.0" + }, + "dependencies": { + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "requires": { + "hoek": "4.2.0" + } + } } }, "crypto-random-string": { @@ -508,17 +785,8 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dev": true, "requires": { "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } } }, "debug": { @@ -553,8 +821,7 @@ "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, "diff": { "version": "3.4.0", @@ -577,16 +844,48 @@ "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", "dev": true }, + "duplexify": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.1.tgz", + "integrity": "sha512-j5goxHTwVED1Fpe5hh3q9R93Kip0Bg2KVAt4f8CEYM3UEwYcPSvWbXaUQOzdX/HtiNomipv+gU7ASQPDbV7pGQ==", + "requires": { + "end-of-stream": "1.4.0", + "inherits": "2.0.3", + "readable-stream": "2.3.3", + "stream-shift": "1.0.0" + } + }, "ecc-jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", - "dev": true, "optional": true, "requires": { "jsbn": "0.1.1" } }, + "ecdsa-sig-formatter": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.9.tgz", + "integrity": "sha1-S8kmJ07Dtau1AW5+HWCSGsJisqE=", + "requires": { + "base64url": "2.0.0", + "safe-buffer": "5.1.1" + } + }, + "end-of-stream": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.0.tgz", + "integrity": "sha1-epDYM+/abPpurA9JSduw+tOmMgY=", + "requires": { + "once": "1.4.0" + } + }, + "ent": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", + "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=" + }, "error-ex": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", @@ -642,8 +941,12 @@ "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", + "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=" }, "figures": { "version": "2.0.0", @@ -667,14 +970,12 @@ "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" }, "form-data": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", - "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", - "dev": true, + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", + "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", "requires": { "asynckit": "0.4.0", "combined-stream": "1.0.5", @@ -696,6 +997,15 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "gcp-metadata": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.4.0.tgz", + "integrity": "sha512-utt8/TgnjfiVd2WnOuxQ64P66f9jc6v15wbchcjc3WAGxFlTYZmH6d7YGae7aW1A57z5vgzOaP973dmFqY+BRQ==", + "requires": { + "extend": "3.0.1", + "retry-request": "3.1.0" + } + }, "generate-function": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", @@ -727,17 +1037,8 @@ "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, "requires": { "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } } }, "glob": { @@ -763,6 +1064,55 @@ "ini": "1.3.4" } }, + "google-auth-library": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-0.10.0.tgz", + "integrity": "sha1-bhW6vuhf0d0U2NEoopW2g41SE24=", + "requires": { + "gtoken": "1.2.3", + "jws": "3.1.4", + "lodash.noop": "3.0.1", + "request": "2.83.0" + } + }, + "google-auto-auth": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.7.2.tgz", + "integrity": "sha512-ux2n2AE2g3+vcLXwL4dP/M12SFMRX5dzCzBfhAEkTeAB7dpyGdOIEj7nmUx0BHKaCcUQrRWg9kT63X/Mmtk1+A==", + "requires": { + "async": "2.5.0", + "gcp-metadata": "0.3.1", + "google-auth-library": "0.10.0", + "request": "2.83.0" + }, + "dependencies": { + "async": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", + "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", + "requires": { + "lodash": "4.17.4" + } + }, + "gcp-metadata": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.3.1.tgz", + "integrity": "sha512-5kJPX/RXuqoLmHiOOgkSDk/LI0QaXpEvZ3pvQP4ifjGGDKZKVSOjL/GcDjXA5kLxppFCOjmmsu0Uoop9d1upaQ==", + "requires": { + "extend": "3.0.1", + "retry-request": "3.1.0" + } + } + } + }, + "google-p12-pem": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-0.1.2.tgz", + "integrity": "sha1-M8RqsCGqc0+gMys5YKmj/8svMXc=", + "requires": { + "node-forge": "0.7.1" + } + }, "got": { "version": "6.7.1", "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", @@ -794,6 +1144,17 @@ "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", "dev": true }, + "gtoken": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-1.2.3.tgz", + "integrity": "sha512-wQAJflfoqSgMWrSBk9Fg86q+sd6s7y6uJhIvvIPz++RElGlMtEqsdAR2oWwZ/WTEtp7P9xFbJRrT976oRgzJ/w==", + "requires": { + "google-p12-pem": "0.1.2", + "jws": "3.1.4", + "mime": "1.4.1", + "request": "2.83.0" + } + }, "gts": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/gts/-/gts-0.3.1.tgz", @@ -812,58 +1173,18 @@ "write-file-atomic": "2.3.0" } }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, "har-validator": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", - "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", - "dev": true, + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "requires": { - "chalk": "1.1.3", - "commander": "2.11.0", - "is-my-json-valid": "2.16.1", - "pinkie-promise": "2.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } + "ajv": "5.2.4", + "har-schema": "2.0.0" } }, "has-ansi": { @@ -890,15 +1211,14 @@ "dev": true }, "hawk": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", - "dev": true, + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" + "boom": "4.3.1", + "cryptiles": "3.1.2", + "hoek": "4.2.0", + "sntp": "2.0.2" } }, "he": { @@ -908,10 +1228,9 @@ "dev": true }, "hoek": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", - "dev": true + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", + "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==" }, "hosted-git-info": { "version": "2.5.0", @@ -920,12 +1239,11 @@ "dev": true }, "http-signature": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", - "dev": true, + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "requires": { - "assert-plus": "0.2.0", + "assert-plus": "1.0.0", "jsprim": "1.4.1", "sshpk": "1.13.1" } @@ -970,8 +1288,7 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "ini": { "version": "1.3.4", @@ -1001,6 +1318,11 @@ "through": "2.3.8" } }, + "is": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/is/-/is-3.2.1.tgz", + "integrity": "sha1-0Kwq1V63sL7JJqUmb2xmKqqD3KU=" + }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -1104,11 +1426,15 @@ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, + "is-stream-ended": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-stream-ended/-/is-stream-ended-0.1.3.tgz", + "integrity": "sha1-oEc7Jnx1ZjVIa+7cfjNE5UnRUqw=" + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, "is-utf8": { "version": "0.2.1", @@ -1131,8 +1457,7 @@ "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, "js-tokens": { "version": "3.0.2", @@ -1144,7 +1469,6 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true, "optional": true }, "jschardet": { @@ -1162,14 +1486,30 @@ "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "requires": { + "jsonify": "0.0.0" + } }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" }, "jsonpointer": { "version": "4.0.1", @@ -1181,20 +1521,11 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "dev": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", "json-schema": "0.2.3", "verror": "1.10.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } } }, "just-extend": { @@ -1203,6 +1534,27 @@ "integrity": "sha1-MzCvdWyralQnAMZLLk5KoGLVL/8=", "dev": true }, + "jwa": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.1.5.tgz", + "integrity": "sha1-oFUs4CIHQs1S4VN3SjKQXDDnVuU=", + "requires": { + "base64url": "2.0.0", + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.9", + "safe-buffer": "5.1.1" + } + }, + "jws": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.1.4.tgz", + "integrity": "sha1-+ei5M46KhHJ31kRLFGT2GIDgUKI=", + "requires": { + "base64url": "2.0.0", + "jwa": "1.1.5", + "safe-buffer": "5.1.1" + } + }, "latest-version": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz", @@ -1236,8 +1588,7 @@ "lodash": { "version": "4.17.4", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", - "dev": true + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" }, "lodash.get": { "version": "4.4.2", @@ -1245,6 +1596,16 @@ "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", "dev": true }, + "lodash.noop": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash.noop/-/lodash.noop-3.0.1.tgz", + "integrity": "sha1-OBiPTWUKOkdCWEObluxFsyYXEzw=" + }, + "log-driver": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.5.tgz", + "integrity": "sha1-euTsJXMC/XkNVXyxDJcQDYV7AFY=" + }, "lolex": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.1.3.tgz", @@ -1324,17 +1685,25 @@ "trim-newlines": "1.0.0" } }, + "methmeth": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/methmeth/-/methmeth-1.1.0.tgz", + "integrity": "sha1-6AomYY5S9cQiKGG7dIUQvRDikIk=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, "mime-db": { "version": "1.30.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", - "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", - "dev": true + "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=" }, "mime-types": { "version": "2.1.17", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", - "dev": true, "requires": { "mime-db": "1.30.0" } @@ -1403,6 +1772,11 @@ } } }, + "modelo": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/modelo/-/modelo-4.2.0.tgz", + "integrity": "sha1-O0tCACOmbKfjK9uhbnEJN+FNGws=" + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -1447,11 +1821,10 @@ } } }, - "node-uuid": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", - "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=", - "dev": true + "node-forge": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.1.tgz", + "integrity": "sha1-naYR6giYL0uUIGs760zJZl8gwwA=" }, "normalize-package-data": { "version": "2.4.0", @@ -1517,7 +1890,8 @@ "dependencies": { "align-text": { "version": "0.1.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", "dev": true, "requires": { "kind-of": "3.2.2", @@ -1527,22 +1901,26 @@ }, "amdefine": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", "dev": true }, "ansi-regex": { "version": "2.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, "ansi-styles": { "version": "2.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", "dev": true }, "append-transform": { "version": "0.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-0.4.0.tgz", + "integrity": "sha1-126/jKlNJ24keja61EpLdKthGZE=", "dev": true, "requires": { "default-require-extensions": "1.0.0" @@ -1550,12 +1928,14 @@ }, "archy": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", "dev": true }, "arr-diff": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", "dev": true, "requires": { "arr-flatten": "1.1.0" @@ -1563,27 +1943,32 @@ }, "arr-flatten": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=", "dev": true }, "array-unique": { "version": "0.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", "dev": true }, "arrify": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "dev": true }, "async": { "version": "1.5.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", "dev": true }, "babel-code-frame": { "version": "6.26.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", "dev": true, "requires": { "chalk": "1.1.3", @@ -1593,7 +1978,8 @@ }, "babel-generator": { "version": "6.26.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", + "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", "dev": true, "requires": { "babel-messages": "6.23.0", @@ -1608,7 +1994,8 @@ }, "babel-messages": { "version": "6.23.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", "dev": true, "requires": { "babel-runtime": "6.26.0" @@ -1616,7 +2003,8 @@ }, "babel-runtime": { "version": "6.26.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "dev": true, "requires": { "core-js": "2.5.1", @@ -1625,7 +2013,8 @@ }, "babel-template": { "version": "6.26.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", "dev": true, "requires": { "babel-runtime": "6.26.0", @@ -1637,7 +2026,8 @@ }, "babel-traverse": { "version": "6.26.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", "dev": true, "requires": { "babel-code-frame": "6.26.0", @@ -1653,7 +2043,8 @@ }, "babel-types": { "version": "6.26.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", "dev": true, "requires": { "babel-runtime": "6.26.0", @@ -1664,17 +2055,20 @@ }, "babylon": { "version": "6.18.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha1-ry87iPpvXB5MY00aD46sT1WzleM=", "dev": true }, "balanced-match": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, "brace-expansion": { "version": "1.1.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", "dev": true, "requires": { "balanced-match": "1.0.0", @@ -1683,7 +2077,8 @@ }, "braces": { "version": "1.8.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", "dev": true, "requires": { "expand-range": "1.8.2", @@ -1693,12 +2088,14 @@ }, "builtin-modules": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, "caching-transform": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-1.0.1.tgz", + "integrity": "sha1-bb2y8g+Nj7znnz6U6dF0Lc31wKE=", "dev": true, "requires": { "md5-hex": "1.3.0", @@ -1708,13 +2105,15 @@ }, "camelcase": { "version": "1.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", "dev": true, "optional": true }, "center-align": { "version": "0.1.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", "dev": true, "optional": true, "requires": { @@ -1724,7 +2123,8 @@ }, "chalk": { "version": "1.1.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { "ansi-styles": "2.2.1", @@ -1736,7 +2136,8 @@ }, "cliui": { "version": "2.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", "dev": true, "optional": true, "requires": { @@ -1747,7 +2148,8 @@ "dependencies": { "wordwrap": { "version": "0.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", "dev": true, "optional": true } @@ -1755,32 +2157,38 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, "commondir": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", "dev": true }, "concat-map": { "version": "0.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, "convert-source-map": { "version": "1.5.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", + "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", "dev": true }, "core-js": { "version": "2.5.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", + "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=", "dev": true }, "cross-spawn": { "version": "4.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", + "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", "dev": true, "requires": { "lru-cache": "4.1.1", @@ -1789,7 +2197,8 @@ }, "debug": { "version": "2.6.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", "dev": true, "requires": { "ms": "2.0.0" @@ -1797,17 +2206,20 @@ }, "debug-log": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/debug-log/-/debug-log-1.0.1.tgz", + "integrity": "sha1-IwdjLUwEOCuN+KMvcLiVBG1SdF8=", "dev": true }, "decamelize": { "version": "1.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, "default-require-extensions": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-1.0.0.tgz", + "integrity": "sha1-836hXT4T/9m0N9M+GnW1+5eHTLg=", "dev": true, "requires": { "strip-bom": "2.0.0" @@ -1815,7 +2227,8 @@ }, "detect-indent": { "version": "4.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", "dev": true, "requires": { "repeating": "2.0.1" @@ -1823,7 +2236,8 @@ }, "error-ex": { "version": "1.3.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", + "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", "dev": true, "requires": { "is-arrayish": "0.2.1" @@ -1831,17 +2245,20 @@ }, "escape-string-regexp": { "version": "1.0.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, "esutils": { "version": "2.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", "dev": true }, "execa": { "version": "0.7.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true, "requires": { "cross-spawn": "5.1.0", @@ -1855,7 +2272,8 @@ "dependencies": { "cross-spawn": { "version": "5.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { "lru-cache": "4.1.1", @@ -1867,7 +2285,8 @@ }, "expand-brackets": { "version": "0.1.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", "dev": true, "requires": { "is-posix-bracket": "0.1.1" @@ -1875,7 +2294,8 @@ }, "expand-range": { "version": "1.8.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "dev": true, "requires": { "fill-range": "2.2.3" @@ -1883,7 +2303,8 @@ }, "extglob": { "version": "0.3.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", "dev": true, "requires": { "is-extglob": "1.0.0" @@ -1891,12 +2312,14 @@ }, "filename-regex": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", "dev": true }, "fill-range": { "version": "2.2.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", + "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", "dev": true, "requires": { "is-number": "2.1.0", @@ -1908,7 +2331,8 @@ }, "find-cache-dir": { "version": "0.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-0.1.1.tgz", + "integrity": "sha1-yN765XyKUqinhPnjHFfHQumToLk=", "dev": true, "requires": { "commondir": "1.0.1", @@ -1918,7 +2342,8 @@ }, "find-up": { "version": "2.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { "locate-path": "2.0.0" @@ -1926,12 +2351,14 @@ }, "for-in": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", "dev": true }, "for-own": { "version": "0.1.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", "dev": true, "requires": { "for-in": "1.0.2" @@ -1939,7 +2366,8 @@ }, "foreground-child": { "version": "1.5.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-1.5.6.tgz", + "integrity": "sha1-T9ca0t/elnibmApcCilZN8svXOk=", "dev": true, "requires": { "cross-spawn": "4.0.2", @@ -1948,22 +2376,26 @@ }, "fs.realpath": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, "get-caller-file": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", + "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", "dev": true }, "get-stream": { "version": "3.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, "glob": { "version": "7.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "dev": true, "requires": { "fs.realpath": "1.0.0", @@ -1976,7 +2408,8 @@ }, "glob-base": { "version": "0.3.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", "dev": true, "requires": { "glob-parent": "2.0.0", @@ -1985,7 +2418,8 @@ }, "glob-parent": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", "dev": true, "requires": { "is-glob": "2.0.1" @@ -1993,17 +2427,20 @@ }, "globals": { "version": "9.18.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha1-qjiWs+abSH8X4x7SFD1pqOMMLYo=", "dev": true }, "graceful-fs": { "version": "4.1.11", - "bundled": true, + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", "dev": true }, "handlebars": { "version": "4.0.10", - "bundled": true, + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.10.tgz", + "integrity": "sha1-PTDHGLCaPZbyPqTMH0A8TTup/08=", "dev": true, "requires": { "async": "1.5.2", @@ -2014,7 +2451,8 @@ "dependencies": { "source-map": { "version": "0.4.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { "amdefine": "1.0.1" @@ -2024,7 +2462,8 @@ }, "has-ansi": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true, "requires": { "ansi-regex": "2.1.1" @@ -2032,22 +2471,26 @@ }, "has-flag": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", "dev": true }, "hosted-git-info": { "version": "2.5.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", + "integrity": "sha1-bWDjSzq7yDEwYsO3mO+NkBoHrzw=", "dev": true }, "imurmurhash": { "version": "0.1.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, "inflight": { "version": "1.0.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { "once": "1.4.0", @@ -2056,12 +2499,14 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, "invariant": { "version": "2.2.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", "dev": true, "requires": { "loose-envify": "1.3.1" @@ -2069,22 +2514,26 @@ }, "invert-kv": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, "is-arrayish": { "version": "0.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, "is-buffer": { "version": "1.1.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", + "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", "dev": true }, "is-builtin-module": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { "builtin-modules": "1.1.1" @@ -2092,12 +2541,14 @@ }, "is-dotfile": { "version": "1.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", "dev": true }, "is-equal-shallow": { "version": "0.1.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", "dev": true, "requires": { "is-primitive": "2.0.0" @@ -2105,17 +2556,20 @@ }, "is-extendable": { "version": "0.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", "dev": true }, "is-extglob": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", "dev": true }, "is-finite": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", "dev": true, "requires": { "number-is-nan": "1.0.1" @@ -2123,7 +2577,8 @@ }, "is-fullwidth-code-point": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { "number-is-nan": "1.0.1" @@ -2131,7 +2586,8 @@ }, "is-glob": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { "is-extglob": "1.0.0" @@ -2139,7 +2595,8 @@ }, "is-number": { "version": "2.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", "dev": true, "requires": { "kind-of": "3.2.2" @@ -2147,37 +2604,44 @@ }, "is-posix-bracket": { "version": "0.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", "dev": true }, "is-primitive": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", "dev": true }, "is-stream": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, "is-utf8": { "version": "0.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", "dev": true }, "isarray": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, "isexe": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, "isobject": { "version": "2.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", "dev": true, "requires": { "isarray": "1.0.0" @@ -2185,12 +2649,14 @@ }, "istanbul-lib-coverage": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz", + "integrity": "sha1-c7+5mIhSmUFck9OKPprfeEp3qdo=", "dev": true }, "istanbul-lib-hook": { "version": "1.0.7", - "bundled": true, + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-1.0.7.tgz", + "integrity": "sha1-3WYH8DB2V4/n1vKmMM8UO0m6zdw=", "dev": true, "requires": { "append-transform": "0.4.0" @@ -2198,7 +2664,8 @@ }, "istanbul-lib-instrument": { "version": "1.8.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.8.0.tgz", + "integrity": "sha1-ZvbJQhzJ7EcE928tsIS6kHiitTI=", "dev": true, "requires": { "babel-generator": "6.26.0", @@ -2212,7 +2679,8 @@ }, "istanbul-lib-report": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz", + "integrity": "sha1-8OVfVmVf+jQiIIC3oM1HYOFAX8k=", "dev": true, "requires": { "istanbul-lib-coverage": "1.1.1", @@ -2223,7 +2691,8 @@ "dependencies": { "supports-color": { "version": "3.2.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", "dev": true, "requires": { "has-flag": "1.0.0" @@ -2233,7 +2702,8 @@ }, "istanbul-lib-source-maps": { "version": "1.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.1.tgz", + "integrity": "sha1-pv4ay6jOCO68Y45XLilNJnAIqgw=", "dev": true, "requires": { "debug": "2.6.8", @@ -2245,7 +2715,8 @@ }, "istanbul-reports": { "version": "1.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.2.tgz", + "integrity": "sha1-D7Lj9qqZIr085F0F2KtNXo4HvU8=", "dev": true, "requires": { "handlebars": "4.0.10" @@ -2253,17 +2724,20 @@ }, "js-tokens": { "version": "3.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", "dev": true }, "jsesc": { "version": "1.3.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, "kind-of": { "version": "3.2.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { "is-buffer": "1.1.5" @@ -2271,13 +2745,15 @@ }, "lazy-cache": { "version": "1.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", "dev": true, "optional": true }, "lcid": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true, "requires": { "invert-kv": "1.0.0" @@ -2285,7 +2761,8 @@ }, "load-json-file": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { "graceful-fs": "4.1.11", @@ -2297,7 +2774,8 @@ }, "locate-path": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true, "requires": { "p-locate": "2.0.0", @@ -2306,24 +2784,28 @@ "dependencies": { "path-exists": { "version": "3.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true } } }, "lodash": { "version": "4.17.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", "dev": true }, "longest": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", "dev": true }, "loose-envify": { "version": "1.3.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", "dev": true, "requires": { "js-tokens": "3.0.2" @@ -2331,7 +2813,8 @@ }, "lru-cache": { "version": "4.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha1-Yi4y6CSItJJ5EUpPns9F581rulU=", "dev": true, "requires": { "pseudomap": "1.0.2", @@ -2340,7 +2823,8 @@ }, "md5-hex": { "version": "1.3.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/md5-hex/-/md5-hex-1.3.0.tgz", + "integrity": "sha1-0sSv6YPENwZiF5uMrRRSGRNQRsQ=", "dev": true, "requires": { "md5-o-matic": "0.1.1" @@ -2348,12 +2832,14 @@ }, "md5-o-matic": { "version": "0.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/md5-o-matic/-/md5-o-matic-0.1.1.tgz", + "integrity": "sha1-givM1l4RfFFPqxdrJZRdVBAKA8M=", "dev": true }, "mem": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true, "requires": { "mimic-fn": "1.1.0" @@ -2361,7 +2847,8 @@ }, "merge-source-map": { "version": "1.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.0.4.tgz", + "integrity": "sha1-pd5GU42uhNQRTMXqArR3KmNGcB8=", "dev": true, "requires": { "source-map": "0.5.7" @@ -2369,7 +2856,8 @@ }, "micromatch": { "version": "2.3.11", - "bundled": true, + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", "dev": true, "requires": { "arr-diff": "2.0.0", @@ -2389,12 +2877,14 @@ }, "mimic-fn": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", + "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", "dev": true }, "minimatch": { "version": "3.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", "dev": true, "requires": { "brace-expansion": "1.1.8" @@ -2402,12 +2892,14 @@ }, "minimist": { "version": "0.0.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { "minimist": "0.0.8" @@ -2415,12 +2907,14 @@ }, "ms": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, "normalize-package-data": { "version": "2.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha1-EvlaMH1YNSB1oEkHuErIvpisAS8=", "dev": true, "requires": { "hosted-git-info": "2.5.0", @@ -2431,7 +2925,8 @@ }, "normalize-path": { "version": "2.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { "remove-trailing-separator": "1.1.0" @@ -2439,7 +2934,8 @@ }, "npm-run-path": { "version": "2.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, "requires": { "path-key": "2.0.1" @@ -2447,17 +2943,20 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, "object-assign": { "version": "4.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true }, "object.omit": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", "dev": true, "requires": { "for-own": "0.1.5", @@ -2466,7 +2965,8 @@ }, "once": { "version": "1.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { "wrappy": "1.0.2" @@ -2474,7 +2974,8 @@ }, "optimist": { "version": "0.6.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", "dev": true, "requires": { "minimist": "0.0.8", @@ -2483,12 +2984,14 @@ }, "os-homedir": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, "os-locale": { "version": "2.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha1-QrwpAKa1uL0XN2yOiCtlr8zyS/I=", "dev": true, "requires": { "execa": "0.7.0", @@ -2498,17 +3001,20 @@ }, "p-finally": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, "p-limit": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", + "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=", "dev": true }, "p-locate": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true, "requires": { "p-limit": "1.1.0" @@ -2516,7 +3022,8 @@ }, "parse-glob": { "version": "3.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", "dev": true, "requires": { "glob-base": "0.3.0", @@ -2527,7 +3034,8 @@ }, "parse-json": { "version": "2.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { "error-ex": "1.3.1" @@ -2535,7 +3043,8 @@ }, "path-exists": { "version": "2.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { "pinkie-promise": "2.0.1" @@ -2543,22 +3052,26 @@ }, "path-is-absolute": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, "path-key": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "dev": true }, "path-parse": { "version": "1.0.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", "dev": true }, "path-type": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, "requires": { "graceful-fs": "4.1.11", @@ -2568,17 +3081,20 @@ }, "pify": { "version": "2.3.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, "pinkie": { "version": "2.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", "dev": true }, "pinkie-promise": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { "pinkie": "2.0.4" @@ -2586,7 +3102,8 @@ }, "pkg-dir": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz", + "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=", "dev": true, "requires": { "find-up": "1.1.2" @@ -2594,7 +3111,8 @@ "dependencies": { "find-up": { "version": "1.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { "path-exists": "2.1.0", @@ -2605,17 +3123,20 @@ }, "preserve": { "version": "0.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", "dev": true }, "pseudomap": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, "randomatic": { "version": "1.1.7", - "bundled": true, + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", + "integrity": "sha1-x6vpzIuHwLqodrGf3oP9RkeX44w=", "dev": true, "requires": { "is-number": "3.0.0", @@ -2624,7 +3145,8 @@ "dependencies": { "is-number": { "version": "3.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, "requires": { "kind-of": "3.2.2" @@ -2632,7 +3154,8 @@ "dependencies": { "kind-of": { "version": "3.2.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { "is-buffer": "1.1.5" @@ -2642,7 +3165,8 @@ }, "kind-of": { "version": "4.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, "requires": { "is-buffer": "1.1.5" @@ -2652,7 +3176,8 @@ }, "read-pkg": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "dev": true, "requires": { "load-json-file": "1.1.0", @@ -2662,7 +3187,8 @@ }, "read-pkg-up": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, "requires": { "find-up": "1.1.2", @@ -2671,7 +3197,8 @@ "dependencies": { "find-up": { "version": "1.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { "path-exists": "2.1.0", @@ -2682,12 +3209,14 @@ }, "regenerator-runtime": { "version": "0.11.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", + "integrity": "sha1-flT+W1zNXWYk6mJVw0c74JC4AuE=", "dev": true }, "regex-cache": { "version": "0.4.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha1-db3FiioUls7EihKDW8VMjVYjNt0=", "dev": true, "requires": { "is-equal-shallow": "0.1.3" @@ -2695,22 +3224,26 @@ }, "remove-trailing-separator": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", "dev": true }, "repeat-element": { "version": "1.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", "dev": true }, "repeat-string": { "version": "1.6.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", "dev": true }, "repeating": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", "dev": true, "requires": { "is-finite": "1.0.2" @@ -2718,22 +3251,26 @@ }, "require-directory": { "version": "2.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, "require-main-filename": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, "resolve-from": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", + "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=", "dev": true }, "right-align": { "version": "0.1.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", "dev": true, "optional": true, "requires": { @@ -2742,7 +3279,8 @@ }, "rimraf": { "version": "2.6.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", + "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", "dev": true, "requires": { "glob": "7.1.2" @@ -2750,17 +3288,20 @@ }, "semver": { "version": "5.4.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha1-4FnAnYVx8FQII3M0M1BdOi8AsY4=", "dev": true }, "set-blocking": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, "shebang-command": { "version": "1.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { "shebang-regex": "1.0.0" @@ -2768,27 +3309,32 @@ }, "shebang-regex": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, "signal-exit": { "version": "3.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, "slide": { "version": "1.1.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", "dev": true }, "source-map": { "version": "0.5.7", - "bundled": true, + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true }, "spawn-wrap": { "version": "1.3.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-1.3.8.tgz", + "integrity": "sha1-+ip5uZDLsLsAGNymdI2INnsZ7DE=", "dev": true, "requires": { "foreground-child": "1.5.6", @@ -2801,7 +3347,8 @@ }, "spdx-correct": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", + "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", "dev": true, "requires": { "spdx-license-ids": "1.2.2" @@ -2809,17 +3356,20 @@ }, "spdx-expression-parse": { "version": "1.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", + "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", "dev": true }, "spdx-license-ids": { "version": "1.2.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", + "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", "dev": true }, "string-width": { "version": "2.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", "dev": true, "requires": { "is-fullwidth-code-point": "2.0.0", @@ -2828,17 +3378,20 @@ "dependencies": { "ansi-regex": { "version": "3.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, "is-fullwidth-code-point": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "strip-ansi": { "version": "4.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { "ansi-regex": "3.0.0" @@ -2848,7 +3401,8 @@ }, "strip-ansi": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { "ansi-regex": "2.1.1" @@ -2856,7 +3410,8 @@ }, "strip-bom": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { "is-utf8": "0.2.1" @@ -2864,17 +3419,20 @@ }, "strip-eof": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, "supports-color": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, "test-exclude": { "version": "4.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.1.1.tgz", + "integrity": "sha1-TYSWSwlmsAh+zDNKLOAC09k0HiY=", "dev": true, "requires": { "arrify": "1.0.1", @@ -2886,17 +3444,20 @@ }, "to-fast-properties": { "version": "1.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", "dev": true }, "trim-right": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", "dev": true }, "uglify-js": { "version": "2.8.29", - "bundled": true, + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", "dev": true, "optional": true, "requires": { @@ -2907,7 +3468,8 @@ "dependencies": { "yargs": { "version": "3.10.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "optional": true, "requires": { @@ -2921,13 +3483,15 @@ }, "uglify-to-browserify": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", "dev": true, "optional": true }, "validate-npm-package-license": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", + "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", "dev": true, "requires": { "spdx-correct": "1.0.2", @@ -2936,7 +3500,8 @@ }, "which": { "version": "1.3.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha1-/wS9/AEO5UfXgL7DjhrBwnd9JTo=", "dev": true, "requires": { "isexe": "2.0.0" @@ -2944,23 +3509,27 @@ }, "which-module": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, "window-size": { "version": "0.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", "dev": true, "optional": true }, "wordwrap": { "version": "0.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", "dev": true }, "wrap-ansi": { "version": "2.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { "string-width": "1.0.2", @@ -2969,7 +3538,8 @@ "dependencies": { "string-width": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { "code-point-at": "1.1.0", @@ -2981,12 +3551,14 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, "write-file-atomic": { "version": "1.3.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.4.tgz", + "integrity": "sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=", "dev": true, "requires": { "graceful-fs": "4.1.11", @@ -2996,17 +3568,20 @@ }, "y18n": { "version": "3.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", "dev": true }, "yallist": { "version": "2.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true }, "yargs": { "version": "8.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", + "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", "dev": true, "requires": { "camelcase": "4.1.0", @@ -3026,12 +3601,14 @@ "dependencies": { "camelcase": { "version": "4.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true }, "cliui": { "version": "3.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "dev": true, "requires": { "string-width": "1.0.2", @@ -3041,7 +3618,8 @@ "dependencies": { "string-width": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { "code-point-at": "1.1.0", @@ -3053,7 +3631,8 @@ }, "load-json-file": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { "graceful-fs": "4.1.11", @@ -3064,7 +3643,8 @@ }, "path-type": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", "dev": true, "requires": { "pify": "2.3.0" @@ -3072,7 +3652,8 @@ }, "read-pkg": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", "dev": true, "requires": { "load-json-file": "2.0.0", @@ -3082,7 +3663,8 @@ }, "read-pkg-up": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", "dev": true, "requires": { "find-up": "2.1.0", @@ -3091,12 +3673,14 @@ }, "strip-bom": { "version": "3.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "dev": true }, "yargs-parser": { "version": "7.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", + "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", "dev": true, "requires": { "camelcase": "4.1.0" @@ -3106,7 +3690,8 @@ }, "yargs-parser": { "version": "5.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz", + "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", "dev": true, "requires": { "camelcase": "3.0.0" @@ -3114,7 +3699,8 @@ "dependencies": { "camelcase": { "version": "3.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", "dev": true } } @@ -3124,8 +3710,7 @@ "oauth-sign": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", - "dev": true + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" }, "object-assign": { "version": "4.1.1", @@ -3137,7 +3722,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1.0.2" } @@ -3250,11 +3834,15 @@ } } }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, "pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" }, "pinkie": { "version": "2.0.4", @@ -3277,6 +3865,11 @@ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", "dev": true }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" + }, "protobufjs": { "version": "6.8.0", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.0.tgz", @@ -3315,14 +3908,12 @@ "punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" }, "qs": { - "version": "6.3.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", - "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=", - "dev": true + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" }, "rc": { "version": "1.2.1", @@ -3370,6 +3961,27 @@ "read-pkg": "1.1.0" } }, + "readable-stream": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + } + } + }, "redent": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", @@ -3409,31 +4021,32 @@ } }, "request": { - "version": "2.77.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.77.0.tgz", - "integrity": "sha1-KwDYIDDt7cyXCJ/6XYgQqcKqMUs=", - "dev": true, + "version": "2.83.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", + "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", "requires": { - "aws-sign2": "0.6.0", + "aws-sign2": "0.7.0", "aws4": "1.6.0", - "caseless": "0.11.0", + "caseless": "0.12.0", "combined-stream": "1.0.5", "extend": "3.0.1", "forever-agent": "0.6.1", - "form-data": "2.1.4", - "har-validator": "2.0.6", - "hawk": "3.1.3", - "http-signature": "1.1.1", + "form-data": "2.3.1", + "har-validator": "5.0.3", + "hawk": "6.0.2", + "http-signature": "1.2.0", "is-typedarray": "1.0.0", "isstream": "0.1.2", "json-stringify-safe": "5.0.1", "mime-types": "2.1.17", - "node-uuid": "1.4.8", "oauth-sign": "0.8.2", - "qs": "6.3.2", + "performance-now": "2.1.0", + "qs": "6.5.1", + "safe-buffer": "5.1.1", "stringstream": "0.0.5", "tough-cookie": "2.3.3", - "tunnel-agent": "0.4.3" + "tunnel-agent": "0.6.0", + "uuid": "3.1.0" } }, "resolve": { @@ -3455,6 +4068,15 @@ "signal-exit": "3.0.2" } }, + "retry-request": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-3.1.0.tgz", + "integrity": "sha512-jOwZQlWR/boHhbAfzfOoUn28EDDotW2A7YxV2o5mfBb07H0k/zZAgbxRcckW08GKl/aT0JtPk1NViuk2BfHqVg==", + "requires": { + "request": "2.83.0", + "through2": "2.0.3" + } + }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", @@ -3491,8 +4113,7 @@ "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, "samsam": { "version": "1.3.0", @@ -3561,12 +4182,11 @@ "dev": true }, "sntp": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", - "dev": true, + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.0.2.tgz", + "integrity": "sha1-UGQRDwr4X3z9t9a2ekACjOUrSys=", "requires": { - "hoek": "2.16.3" + "hoek": "4.2.0" } }, "spdx-correct": { @@ -3590,11 +4210,29 @@ "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", "dev": true }, + "split-array-stream": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/split-array-stream/-/split-array-stream-1.0.3.tgz", + "integrity": "sha1-0rdajl4Ngk1S/eyLgiWDncLjXfo=", + "requires": { + "async": "2.5.0", + "is-stream-ended": "0.1.3" + }, + "dependencies": { + "async": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", + "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", + "requires": { + "lodash": "4.17.4" + } + } + } + }, "sshpk": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", - "dev": true, "requires": { "asn1": "0.2.3", "assert-plus": "1.0.0", @@ -3604,16 +4242,34 @@ "getpass": "0.1.7", "jsbn": "0.1.1", "tweetnacl": "0.14.5" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } } }, + "stream-events": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/stream-events/-/stream-events-1.0.2.tgz", + "integrity": "sha1-q/OfZsCJCk63lbyNXoWbJhW1kLI=", + "requires": { + "stubs": "3.0.0" + } + }, + "stream-shift": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", + "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=" + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "requires": { + "safe-buffer": "5.1.1" + } + }, + "string-format-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/string-format-obj/-/string-format-obj-1.1.0.tgz", + "integrity": "sha1-djVhCx7zlwE+hHi+mKFw4EmD0Gg=" + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -3627,8 +4283,7 @@ "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", - "dev": true + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" }, "strip-ansi": { "version": "4.0.0", @@ -3669,6 +4324,11 @@ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true }, + "stubs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz", + "integrity": "sha1-6NK6H6nJBXAwPAMLaQD31fiavls=" + }, "supports-color": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", @@ -3699,6 +4359,15 @@ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, + "through2": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "requires": { + "readable-stream": "2.3.3", + "xtend": "4.0.1" + } + }, "timed-out": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", @@ -3718,7 +4387,6 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", - "dev": true, "requires": { "punycode": "1.4.1" } @@ -3763,16 +4431,17 @@ } }, "tunnel-agent": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", - "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", - "dev": true + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "5.1.1" + } }, "tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true, "optional": true }, "type-detect": { @@ -3781,6 +4450,11 @@ "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", "dev": true }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + }, "typescript": { "version": "2.5.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.3.tgz", @@ -3834,6 +4508,16 @@ "integrity": "sha1-iS/pWWCAXoVRnxzUOJ8stMu3ZS8=", "dev": true }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "uuid": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", + "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" + }, "validate-npm-package-license": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", @@ -3848,19 +4532,10 @@ "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true, "requires": { "assert-plus": "1.0.0", "core-util-is": "1.0.2", "extsprintf": "1.3.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } } }, "which": { @@ -3921,8 +4596,7 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write-file-atomic": { "version": "2.3.0", @@ -3944,8 +4618,7 @@ "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" }, "yallist": { "version": "2.1.2", diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index e702954478c..36550b660a0 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -21,16 +21,23 @@ }, "license": "Apache-2.0", "dependencies": { + "@google-cloud/common": "^0.13.6", + "@types/pify": "^3.0.0", "bindings": "^1.2.1", "delay": "^2.0.0", "extend": "^3.0.1", - "nan": "^2.1.0" + "gcp-metadata": "^0.4.0", + "nan": "^2.1.0", + "pify": "^3.0.0", + "request": "^2.83.0", + "retry-request": "^3.0.1" }, "devDependencies": { "@types/delay": "^2.0.0", "@types/extend": "^2.0.30", "@types/mocha": "^2.2.43", "@types/node": "^8.0.30", + "@types/request": "^2.0.4", "@types/sinon": "^2.3.6", "clang-format": "^1.0.33", "codecov": "^2.3.1", diff --git a/handwritten/cloud-profiler/src/config.ts b/handwritten/cloud-profiler/src/config.ts index b8a96c2302e..65257731666 100644 --- a/handwritten/cloud-profiler/src/config.ts +++ b/handwritten/cloud-profiler/src/config.ts @@ -64,11 +64,12 @@ export interface Config extends AuthenticationConfig { // Default values for configuration for a profiler. export const defaultConfig: Config = { - projectId: '{{projectId}}', logLevel: 1, serviceContext: { version: '', }, disableHeap: false, disableTime: false, + instance: '', + zone: '' }; diff --git a/handwritten/cloud-profiler/src/index.ts b/handwritten/cloud-profiler/src/index.ts index dbf51d9f9a4..b8530547820 100644 --- a/handwritten/cloud-profiler/src/index.ts +++ b/handwritten/cloud-profiler/src/index.ts @@ -13,23 +13,36 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import * as extend from 'extend'; +import * as gcpMetadata from 'gcp-metadata'; import * as path from 'path'; -import {AuthenticationConfig, Common, ServiceConfig} from '../third_party/types/common-types'; +import * as pify from 'pify'; + +import {AuthenticationConfig, Common, ServiceConfig, ServiceObject} from '../third_party/types/common-types'; + import {Config, defaultConfig} from './config'; import {Profiler, ProfilerConfig} from './profiler'; const common: Common = require('@google-cloud/common'); +// Returns value of metadata field. +// Throws error if there is a problem accessing metadata API. +async function getMetadataInstanceField(field: string): Promise { + const [response, metadata] = + await pify(gcpMetadata.instance, {multiArgs: true})(field); + return metadata; +} + // initConfig sets unset values in the configuration to the value retrieved from -// environment variables, metadata, or the default value specified in +// environment variables, metadata, or the default values specified in // defaultConfig. -// Returns rejected promise if value that must be set cannot be initialized. -async function initConfig(config: Config): Promise { +// Throws error if value that must be set cannot be initialized. +// Exported for testing purposes. +export async function initConfig(config: Config): Promise { config = common.util.normalizeArguments(null, config); - const envConfig = { - logLevel: process.env.GCLOUD_PROFILER_LOGLEVEL, + const envConfig: Config = { projectId: process.env.GCLOUD_PROJECT, serviceContext: { service: process.env.GAE_SERVICE, @@ -37,28 +50,46 @@ async function initConfig(config: Config): Promise { } }; + if (process.env.GCLOUD_PROFILER_LOGLEVEL !== undefined) { + let envLogLevel = parseInt(process.env.GCLOUD_PROFILER_LOGLEVEL || '', 10); + if (envLogLevel !== NaN) { + envConfig.logLevel = envLogLevel; + } + } + let envSetConfig: Config = {}; if (process.env.hasOwnProperty('GCLOUD_PROFILER_CONFIG')) { envSetConfig = require(path.resolve(process.env.GCLOUD_PROFILER_CONFIG)) as Config; } - let normalizedConfig = extend(true, {}, defaultConfig, envConfig, config); + let mergedConfig = + extend(true, {}, defaultConfig, envSetConfig, envConfig, config); - if (normalizedConfig.serviceContext.service === undefined) { - throw new Error('service name must be specified in the configuration'); + if (!mergedConfig.zone || !mergedConfig.instance) { + const [instance, zone] = + await Promise + .all([ + getMetadataInstanceField('name'), getMetadataInstanceField('zone') + ]) + .catch( + (err: Error) => { + // ignore errors, which will occur when not on GCE. + }) || + ['', '']; + if (!mergedConfig.zone) { + mergedConfig.zone = zone.substring(zone.lastIndexOf('/') + 1); + } + if (!mergedConfig.instance) { + mergedConfig.instance = instance; + } } - // TODO: fetch instance and zone from metadata. This will require function to - // be asynchrous. - if (normalizedConfig.instance === undefined) { - normalizedConfig.instance = ''; - } - if (normalizedConfig.zone === undefined) { - normalizedConfig.zone = ''; + if (mergedConfig.serviceContext.service === undefined) { + throw new Error('Service must be specified in the configuration.'); } - return normalizedConfig; + return mergedConfig; } let profiler: Profiler|undefined = undefined; diff --git a/handwritten/cloud-profiler/src/profiler.ts b/handwritten/cloud-profiler/src/profiler.ts index 26eeba6070c..2abfbeae32e 100644 --- a/handwritten/cloud-profiler/src/profiler.ts +++ b/handwritten/cloud-profiler/src/profiler.ts @@ -25,7 +25,6 @@ const pjson = require('../../package.json'); const common: Common = require('@google-cloud/common'); export interface ProfilerConfig extends AuthenticationConfig { - projectId: string; logLevel: number; serviceContext: {service: string; version?: string;}; instance: string; @@ -64,6 +63,6 @@ export class Profiler { // TODO: explain failure situations. async start(): Promise { return Promise.reject( - new Error('start() is unimplemented for ProfileAgent')); + new Error('start() is unimplemented for ProfileAgent.')); } } diff --git a/handwritten/cloud-profiler/test/fixtures/test-config.json b/handwritten/cloud-profiler/test/fixtures/test-config.json new file mode 100644 index 00000000000..700e196d33b --- /dev/null +++ b/handwritten/cloud-profiler/test/fixtures/test-config.json @@ -0,0 +1,12 @@ +{ + "logLevel": 3, + "serviceContext": { + "version": "envConfig-version", + "service": "envConfig-service" + }, + "disableHeap": true, + "disableTime": true, + "instance": "envConfig-instance", + "zone": "envConfig-zone", + "projectId": "envConfig-fake-projectId" +} diff --git a/handwritten/cloud-profiler/test/test-init-config.ts b/handwritten/cloud-profiler/test/test-init-config.ts new file mode 100644 index 00000000000..cff652dd176 --- /dev/null +++ b/handwritten/cloud-profiler/test/test-init-config.ts @@ -0,0 +1,241 @@ +/** + * 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. + */ + +import * as assert from 'assert'; +import * as gcpMetadata from 'gcp-metadata'; +import * as request from 'request'; +import * as sinon from 'sinon'; + +import {initConfig} from '../src/index'; + +describe('initConfig', () => { + let savedEnv: NodeJS.ProcessEnv; + + before(() => { + savedEnv = process.env; + }); + + beforeEach(() => { + process.env = {}; + }); + + afterEach(() => { + (gcpMetadata.instance as any).restore(); + }); + + after(() => { + process.env = savedEnv; + }); + + it('should not modify specified fields when not on GCE', async () => { + sinon.stub(gcpMetadata, 'instance') + .throwsException('cannot access metadata'); + + const config = { + logLevel: 2, + serviceContext: {version: 'fake-version', service: 'fake-service'}, + disableHeap: true, + disableTime: true, + instance: 'instance', + zone: 'zone', + projectId: 'fake-projectId', + }; + let initializedConfig = await initConfig(config); + assert.deepEqual(initializedConfig, config); + }); + + it('should not modify specified fields when on GCE', async () => { + sinon.stub(gcpMetadata, 'instance') + .withArgs('name') + .callsArgWith(1, null, undefined, 'gce-instance') + .withArgs('zone') + .callsArgWith( + 1, null, undefined, 'projects/123456789012/zones/gce-zone'); + + const config = { + logLevel: 2, + serviceContext: {version: 'fake-version', service: 'fake-service'}, + disableHeap: true, + disableTime: true, + instance: 'instance', + zone: 'zone', + projectId: 'fake-projectId' + }; + let initializedConfig = await initConfig(config); + assert.deepEqual(initializedConfig, config); + }); + + it('should get zone and instance from GCE', async () => { + sinon.stub(gcpMetadata, 'instance') + .withArgs('name') + .callsArgWith(1, null, undefined, 'gce-instance') + .withArgs('zone') + .callsArgWith( + 1, null, undefined, 'projects/123456789012/zones/gce-zone'); + + const config = { + projectId: 'projectId', + logLevel: 2, + serviceContext: {version: '', service: 'fake-service'}, + disableHeap: true, + disableTime: true, + }; + const expConfig = { + logLevel: 2, + serviceContext: {version: '', service: 'fake-service'}, + disableHeap: true, + disableTime: true, + instance: 'gce-instance', + zone: 'gce-zone', + projectId: 'projectId', + }; + let initializedConfig = await initConfig(config); + assert.deepEqual(initializedConfig, expConfig); + }); + + it('should not reject when not on GCE and no zone and instance found', + async () => { + sinon.stub(gcpMetadata, 'instance') + .throwsException('cannot access metadata'); + const config = { + projectId: 'fake-projectId', + serviceContext: {service: 'fake-service'} + }; + const expConfig = { + logLevel: 1, + serviceContext: {version: '', service: 'fake-service'}, + disableHeap: false, + disableTime: false, + instance: '', + zone: '', + projectId: 'fake-projectId', + }; + let initializedConfig = await initConfig(config); + assert.deepEqual(initializedConfig, expConfig); + }); + + it('should reject when no service specified', () => { + sinon.stub(gcpMetadata, 'instance') + .throwsException('cannot access metadata'); + const config = { + logLevel: 2, + serviceContext: {version: ''}, + disableHeap: true, + disableTime: true, + }; + return initConfig(config) + .then(initializedConfig => { + assert.fail('expected error because no service in config'); + }) + .catch((e: Error) => { + assert.equal( + e.message, 'Service must be specified in the configuration.'); + }); + }); + + it('should get have no projectId when no projectId given', async () => { + sinon.stub(gcpMetadata, 'instance') + .throwsException('cannot access metadata'); + + const config = { + logLevel: 2, + serviceContext: {version: '', service: 'fake-service'}, + disableHeap: true, + disableTime: true, + instance: 'instance', + zone: 'zone' + }; + let initializedConfig = await initConfig(config); + assert.deepEqual(initializedConfig, config); + }); + + it('should get values from from environment variable when not specified in config or environment variables', + async () => { + process.env.GCLOUD_PROJECT = 'process-projectId'; + process.env.GCLOUD_PROFILER_LOGLEVEL = '4'; + process.env.GAE_SERVICE = 'process-service'; + process.env.GAE_VERSION = 'process-version'; + process.env.GCLOUD_PROFILER_CONFIG = './test/fixtures/test-config.json'; + sinon.stub(gcpMetadata, 'instance') + .withArgs('name') + .callsArgWith(1, null, undefined, 'gce-instance') + .withArgs('zone') + .callsArgWith( + 1, null, undefined, 'projects/123456789012/zones/gce-zone'); + const config = {}; + const expConfig = { + projectId: 'process-projectId', + logLevel: 4, + serviceContext: + {version: 'process-version', service: 'process-service'}, + disableHeap: true, + disableTime: true, + instance: 'envConfig-instance', + zone: 'envConfig-zone', + }; + let initializedConfig = await initConfig(config); + assert.deepEqual(initializedConfig, expConfig); + }); + + it('should not get values from from environment variable when values specified in config', + async () => { + process.env.GCLOUD_PROJECT = 'process-projectId'; + process.env.GCLOUD_PROFILER_LOGLEVEL = '4'; + process.env.GAE_SERVICE = 'process-service'; + process.env.GAE_VERSION = 'process-version'; + process.env.GCLOUD_PROFILER_CONFIG = './test/fixtures/test-config.json'; + sinon.stub(gcpMetadata, 'instance') + .withArgs('name') + .callsArgWith(1, null, undefined, 'gce-instance') + .withArgs('zone') + .callsArgWith( + 1, null, undefined, 'projects/123456789012/zones/gce-zone'); + + const config = { + projectId: 'config-projectId', + logLevel: 1, + serviceContext: {version: 'config-version', service: 'config-service'}, + disableHeap: false, + disableTime: false, + instance: 'instance', + zone: 'zone' + }; + let initializedConfig = await initConfig(config); + assert.deepEqual(initializedConfig, config); + }); + + it('should get values from from environment config when not specified in config or other environment variables', + async () => { + sinon.stub(gcpMetadata, 'instance') + .throwsException('cannot access metadata'); + process.env.GCLOUD_PROFILER_CONFIG = './test/fixtures/test-config.json'; + + const expConfig = { + logLevel: 3, + serviceContext: + {version: 'envConfig-version', service: 'envConfig-service'}, + disableHeap: true, + disableTime: true, + instance: 'envConfig-instance', + zone: 'envConfig-zone', + projectId: 'envConfig-fake-projectId', + }; + + const config = {}; + let initializedConfig = await initConfig(config); + assert.deepEqual(initializedConfig, expConfig); + }); +}); diff --git a/handwritten/cloud-profiler/third_party/types/gcp-metadata-types.ts b/handwritten/cloud-profiler/third_party/types/gcp-metadata-types.ts deleted file mode 100644 index eef5a69e184..00000000000 --- a/handwritten/cloud-profiler/third_party/types/gcp-metadata-types.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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. - */ - -import * as http from 'http'; - -export interface GcpMetadata { - // TODO: Determine if the signature of the callback on these methods are - // correct. - instance: - (options: string|{property: string}, - callback: - (err: Error, response: http.ServerResponse, - metadataProject: string) => void) => http.ServerResponse; - project: - (options: string|{property: string}, - callback: - (err: Error, response: http.ServerResponse, - metadataProject: string) => void) => http.ServerResponse; -} From 4f0c37015ef76a58c841bc91df66596cfc593737 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Fri, 27 Oct 2017 15:52:16 -0700 Subject: [PATCH 014/632] feat, fix: update profile serialization for heap profiling (#25) * address comments * address comments * address comments * address comments * addressed comments * update package-lock.json * add license to profiles-for-tests.js --- .../bindings/sampling-heap-profiler.cc | 2 +- .../cloud-profiler/bindings/time-profiler.cc | 10 +- handwritten/cloud-profiler/package-lock.json | 1271 ++++++++--------- .../src/profilers/profile-serializer.ts | 328 +++-- handwritten/cloud-profiler/src/util.ts | 24 - handwritten/cloud-profiler/src/v8-types.ts | 21 +- .../cloud-profiler/test/profile-for-test.ts | 133 -- .../cloud-profiler/test/profiles-for-tests.ts | 257 ++++ .../test/test-profile-serializer.ts | 17 +- .../cloud-profiler/test/test-time-profiler.ts | 4 +- 10 files changed, 1077 insertions(+), 990 deletions(-) delete mode 100644 handwritten/cloud-profiler/src/util.ts delete mode 100644 handwritten/cloud-profiler/test/profile-for-test.ts create mode 100644 handwritten/cloud-profiler/test/profiles-for-tests.ts diff --git a/handwritten/cloud-profiler/bindings/sampling-heap-profiler.cc b/handwritten/cloud-profiler/bindings/sampling-heap-profiler.cc index 6741d4fcd30..f806350b31a 100644 --- a/handwritten/cloud-profiler/bindings/sampling-heap-profiler.cc +++ b/handwritten/cloud-profiler/bindings/sampling-heap-profiler.cc @@ -41,7 +41,7 @@ Local TranslateAllocationProfile(AllocationProfile::Node* node) { for (size_t i = 0; i < node->allocations.size(); i++) { AllocationProfile::Allocation alloc = node->allocations[i]; Local js_alloc = Nan::New(); - js_alloc->Set(Nan::New("size").ToLocalChecked(), + js_alloc->Set(Nan::New("sizeBytes").ToLocalChecked(), Nan::New(alloc.size)); js_alloc->Set(Nan::New("count").ToLocalChecked(), Nan::New(alloc.count)); diff --git a/handwritten/cloud-profiler/bindings/time-profiler.cc b/handwritten/cloud-profiler/bindings/time-profiler.cc index a32ad0d80ee..76edcbacb5c 100644 --- a/handwritten/cloud-profiler/bindings/time-profiler.cc +++ b/handwritten/cloud-profiler/bindings/time-profiler.cc @@ -21,16 +21,18 @@ using namespace v8; Local TranslateTimeProfileNode(const CpuProfileNode* node) { Local js_node = Nan::New(); - js_node->Set(Nan::New("functionName").ToLocalChecked(), + js_node->Set(Nan::New("name").ToLocalChecked(), node->GetFunctionName()); - js_node->Set(Nan::New("scriptResourceName").ToLocalChecked(), + js_node->Set(Nan::New("scriptName").ToLocalChecked(), node->GetScriptResourceName()); + js_node->Set(Nan::New("scriptId").ToLocalChecked(), + Nan::New(node->GetScriptId())); js_node->Set(Nan::New("lineNumber").ToLocalChecked(), Nan::New(node->GetLineNumber())); + js_node->Set(Nan::New("columnNumber").ToLocalChecked(), + Nan::New(node->GetColumnNumber())); js_node->Set(Nan::New("hitCount").ToLocalChecked(), Nan::New(node->GetHitCount())); - js_node->Set(Nan::New("callUid").ToLocalChecked(), - Nan::New(node->GetCallUid())); int32_t count = node->GetChildrenCount(); Local children = Nan::New(count); for (int32_t i = 0; i < count; i++) { diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 248d85b823d..e4246c114ba 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -94,9 +94,9 @@ "dev": true }, "@types/delay": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@types/delay/-/delay-2.0.0.tgz", - "integrity": "sha512-BdyAlJMOdeaoBP67d3M0kpAIiQQE3x11ZTOAjav/bdvdpyWu4V6uhtIhAXEj3vITyGzTvHhgJK1MRArYCFbYQQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/delay/-/delay-2.0.1.tgz", + "integrity": "sha512-D1/YuYOcdOIdaQnaiUJ77VcilVvESkynw79CtGqpjkXyv4OUezEVZtdXnSOwXL8Zcelu66QbyC8QQcVQ/ZPdig==", "dev": true }, "@types/extend": { @@ -111,7 +111,7 @@ "integrity": "sha512-vm5OGsKc61Sx/GTRMQ9d0H0PYCDebT78/bdIBPCoPEHdgp0etaH1RzMmkDygymUmyXTj3rdWQn0sRUpYKZzljA==", "dev": true, "requires": { - "@types/node": "8.0.34" + "@types/node": "8.0.47" } }, "@types/long": { @@ -121,15 +121,15 @@ "dev": true }, "@types/mocha": { - "version": "2.2.43", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.43.tgz", - "integrity": "sha512-xNlAmH+lRJdUMXClMTI9Y0pRqIojdxfm7DHsIxoB2iTzu3fnPmSMEN8SsSx0cdwV36d02PWCWaDUoZPDSln+xw==", + "version": "2.2.44", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.44.tgz", + "integrity": "sha512-k2tWTQU8G4+iSMvqKi0Q9IIsWAp/n8xzdZS4Q4YVIltApoMA00wFBFdlJnmoaK1/z7B0Cy0yPe6GgXteSmdUNw==", "dev": true }, "@types/node": { - "version": "8.0.34", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.34.tgz", - "integrity": "sha512-Jnmm57+nHqvJUPwUzt1CLoLzFtF2B2vgG7cWFut+a4nqTp9/L6pL0N+o0Jt3V7AQnCKMsPEqQpLFZYleBCdq3w==", + "version": "8.0.47", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.47.tgz", + "integrity": "sha512-kOwL746WVvt/9Phf6/JgX/bsGQvbrK5iUgzyfwZNcKVFcjAUVSpF9HxevLTld2SG9aywYHOILj38arDdY1r/iQ==", "dev": true }, "@types/pify": { @@ -138,30 +138,30 @@ "integrity": "sha512-BIRcpFqRm64rVuuYCFzOF37I2IEP3sXhiCjy8NbzJkxqFY2CLiDLFPhh6Sph/eXPXctg05MayCEDmeKCOIUBFg==" }, "@types/request": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@types/request/-/request-2.0.6.tgz", - "integrity": "sha512-8/VAk8kgeWuNQTOMmhaLyYmzX7Foshcdh0f1KwkyWQPmoPCy4AIMDx4KqI/n/uO5pAw2FOCgW+76iJTyjYsIRw==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/request/-/request-2.0.7.tgz", + "integrity": "sha512-hlkmO+M7Xxx13YZwqQtXGC03KxcYbqmDQg3oHMRVODfSk2u0BELK7RfTNROisvrLRGOYdGoZPpnHwaPoKrPMbA==", "dev": true, "requires": { "@types/form-data": "2.2.0", - "@types/node": "8.0.34" + "@types/node": "8.0.47" } }, "@types/sinon": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-2.3.6.tgz", - "integrity": "sha512-4+8BQOU/siROrXyMliceCUvQ3dy719ctUBBMcTRjcrWJ5uiR/wccIVPsO3aLBB86j8JFQeF0FlQR6ZpSNsbA6Q==", + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-2.3.7.tgz", + "integrity": "sha512-w+LjztaZbgZWgt/y/VMP5BUAWLtSyoIJhXyW279hehLPyubDoBNwvhcj3WaSptcekuKYeTCVxrq60rdLc6ImJA==", "dev": true }, "ajv": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.2.4.tgz", - "integrity": "sha1-Pa+ai2ciEpn9ro2C0RftjmyAJEs=", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz", + "integrity": "sha1-RBT/dKUIecII7l/cgm4ywwNUnto=", "requires": { "co": "4.6.0", "fast-deep-equal": "1.0.0", - "json-schema-traverse": "0.3.1", - "json-stable-stringify": "1.0.1" + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" } }, "ansi-align": { @@ -180,19 +180,16 @@ "dev": true }, "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.0" - } + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true }, "argv": { "version": "0.0.2", @@ -227,10 +224,12 @@ "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" }, "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", + "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", + "requires": { + "lodash": "4.17.4" + } }, "asynckit": { "version": "0.4.0", @@ -256,48 +255,6 @@ "chalk": "1.1.3", "esutils": "2.0.2", "js-tokens": "3.0.2" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } } }, "balanced-match": { @@ -334,25 +291,54 @@ } }, "boxen": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.2.1.tgz", - "integrity": "sha1-DxHn/jRO25OXl3/BPt5/ZNlWSB0=", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.2.2.tgz", + "integrity": "sha1-Px1AMsMP/qnUsCwyLq8up0HcvOU=", "dev": true, "requires": { "ansi-align": "2.0.0", "camelcase": "4.1.0", - "chalk": "2.1.0", + "chalk": "2.3.0", "cli-boxes": "1.0.0", "string-width": "2.1.1", "term-size": "1.2.0", "widest-line": "1.0.0" }, "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + }, "camelcase": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } } } }, @@ -410,25 +396,35 @@ "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, "chalk": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", - "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "3.2.0", + "ansi-styles": "2.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "4.4.0" + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, "clang-format": { - "version": "1.0.55", - "resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.0.55.tgz", - "integrity": "sha1-gDEnEynieneaXQj8Xc4k18UsFNU=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.1.0.tgz", + "integrity": "sha512-0Aru49uTLoROl4sPTyO3fvF/NZ+fnGEy5i7bsRwA/bAYT+eWaAxK3sDxRvm/AW7Nwq83BvARH/npeF8OIAaGVQ==", "dev": true, "requires": { "async": "1.5.2", "glob": "7.1.2", - "resolve": "1.4.0" + "resolve": "1.5.0" + }, + "dependencies": { + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + } } }, "cli-boxes": { @@ -474,18 +470,6 @@ "urlgrey": "0.4.4" }, "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, "assert-plus": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", @@ -513,19 +497,6 @@ "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", "dev": true }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" - } - }, "cryptiles": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", @@ -636,21 +607,6 @@ "hoek": "2.16.3" } }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - }, "tunnel-agent": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", @@ -674,12 +630,6 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, - "colors": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", - "dev": true - }, "combined-stream": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", @@ -718,7 +668,7 @@ "requires": { "dot-prop": "4.2.0", "graceful-fs": "4.1.11", - "make-dir": "1.0.0", + "make-dir": "1.1.0", "unique-string": "1.0.0", "write-file-atomic": "2.3.0", "xdg-basedir": "3.0.0" @@ -934,7 +884,7 @@ "dev": true, "requires": { "iconv-lite": "0.4.19", - "jschardet": "1.5.1", + "jschardet": "1.6.0", "tmp": "0.0.33" } }, @@ -948,6 +898,11 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=" }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, "figures": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", @@ -1086,14 +1041,6 @@ "request": "2.83.0" }, "dependencies": { - "async": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", - "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", - "requires": { - "lodash": "4.17.4" - } - }, "gcp-metadata": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.3.1.tgz", @@ -1161,16 +1108,47 @@ "integrity": "sha512-sQ3PB13CRo25OLFnnQw2Y2Kcrdp2q8onLxxcWSyqoSSPFfvcIM0yVwJHllQeCGT/CuDIrrD0XAEt5GqKMbv1CA==", "dev": true, "requires": { - "chalk": "2.1.0", - "clang-format": "1.0.55", + "chalk": "2.3.0", + "clang-format": "1.1.0", "inquirer": "3.3.0", "meow": "3.7.0", "pify": "3.0.0", "read-package-json": "2.0.12", "rimraf": "2.6.2", - "tslint": "5.7.0", + "tslint": "5.8.0", "update-notifier": "2.3.0", "write-file-atomic": "2.3.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } } }, "har-schema": { @@ -1183,7 +1161,7 @@ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "requires": { - "ajv": "5.2.4", + "ajv": "5.3.0", "har-schema": "2.0.0" } }, @@ -1194,14 +1172,6 @@ "dev": true, "requires": { "ansi-regex": "2.1.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - } } }, "has-flag": { @@ -1218,7 +1188,7 @@ "boom": "4.3.1", "cryptiles": "3.1.2", "hoek": "4.2.0", - "sntp": "2.0.2" + "sntp": "2.1.0" } }, "he": { @@ -1303,7 +1273,7 @@ "dev": true, "requires": { "ansi-escapes": "3.0.0", - "chalk": "2.1.0", + "chalk": "2.3.0", "cli-cursor": "2.1.0", "cli-width": "2.2.0", "external-editor": "2.0.5", @@ -1316,6 +1286,52 @@ "string-width": "2.1.1", "strip-ansi": "4.0.0", "through": "2.3.8" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } } }, "is": { @@ -1443,10 +1459,9 @@ "dev": true }, "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isexe": { "version": "2.0.0", @@ -1472,9 +1487,9 @@ "optional": true }, "jschardet": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.5.1.tgz", - "integrity": "sha512-vE2hT1D0HLZCLLclfBSfkfTTedhVj0fubHpJBHKwwUWX0nSbhPAfk+SG9rTX95BYNmau8rGFfCeaT6T5OW1C2A==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.6.0.tgz", + "integrity": "sha512-xYuhvQ7I9PDJIGBWev9xm0+SMSed3ZDBAmvVjbFR1ZRLAF+vlXcQu6cRI9uAlj81rzikElRVteehwV7DuX2ZmQ==", "dev": true }, "json-parse-better-errors": { @@ -1493,24 +1508,11 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "requires": { - "jsonify": "0.0.0" - } - }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" - }, "jsonpointer": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", @@ -1529,9 +1531,9 @@ } }, "just-extend": { - "version": "1.1.22", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-1.1.22.tgz", - "integrity": "sha1-MzCvdWyralQnAMZLLk5KoGLVL/8=", + "version": "1.1.26", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-1.1.26.tgz", + "integrity": "sha512-IIG0FXHB/XpUZ7vGbktoc2EGsF+fLHJ1tU+vaqoKkVRBwH2FDxLTmkGkSp0XHRp6Y3KGZPIldH1YW8lOluGYrA==", "dev": true }, "jwa": { @@ -1645,20 +1647,12 @@ } }, "make-dir": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.0.0.tgz", - "integrity": "sha1-l6ARdR6R3YfPre9Ygy67BJNt6Xg=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.1.0.tgz", + "integrity": "sha512-0Pkui4wLJ7rxvmfUvs87skoEaxmu0hCUApF8nonzpl7q//FWp9zu8W61Scz4sd/kUiqDxvUhtoam2efDyiBzcA==", "dev": true, "requires": { - "pify": "2.3.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } + "pify": "3.0.0" } }, "map-obj": { @@ -1769,6 +1763,15 @@ "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", "dev": true + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } } } }, @@ -1794,20 +1797,14 @@ "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=" }, - "native-promise-only": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/native-promise-only/-/native-promise-only-0.8.1.tgz", - "integrity": "sha1-IKMYwwy0X3H+et+/eyHJnBRy7xE=", - "dev": true - }, "nise": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/nise/-/nise-1.1.1.tgz", - "integrity": "sha512-f5DMJB0MqBaSuP2NAwPx7HyVKPdaozds0KsNe9XIP3npKWt/QUg73l5TTLRTSwfG/Y3AB0ktacuxX4QNcg6vVw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/nise/-/nise-1.2.0.tgz", + "integrity": "sha512-q9jXh3UNsMV28KeqI43ILz5+c3l+RiNW8mhurEwCKckuHQbL+hTJIKKTiUlCPKlgQ/OukFvSnKB/Jk3+sFbkGA==", "dev": true, "requires": { "formatio": "1.2.0", - "just-extend": "1.1.22", + "just-extend": "1.1.26", "lolex": "1.6.0", "path-to-regexp": "1.7.0", "text-encoding": "0.6.4" @@ -1890,8 +1887,7 @@ "dependencies": { "align-text": { "version": "0.1.4", - "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", - "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "bundled": true, "dev": true, "requires": { "kind-of": "3.2.2", @@ -1901,26 +1897,22 @@ }, "amdefine": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "bundled": true, "dev": true }, "ansi-regex": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "bundled": true, "dev": true }, "ansi-styles": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "bundled": true, "dev": true }, "append-transform": { "version": "0.4.0", - "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-0.4.0.tgz", - "integrity": "sha1-126/jKlNJ24keja61EpLdKthGZE=", + "bundled": true, "dev": true, "requires": { "default-require-extensions": "1.0.0" @@ -1928,14 +1920,12 @@ }, "archy": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", - "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", + "bundled": true, "dev": true }, "arr-diff": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "bundled": true, "dev": true, "requires": { "arr-flatten": "1.1.0" @@ -1943,32 +1933,27 @@ }, "arr-flatten": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=", + "bundled": true, "dev": true }, "array-unique": { "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "bundled": true, "dev": true }, "arrify": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "bundled": true, "dev": true }, "async": { "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "bundled": true, "dev": true }, "babel-code-frame": { "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "bundled": true, "dev": true, "requires": { "chalk": "1.1.3", @@ -1978,8 +1963,7 @@ }, "babel-generator": { "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", - "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", + "bundled": true, "dev": true, "requires": { "babel-messages": "6.23.0", @@ -1994,8 +1978,7 @@ }, "babel-messages": { "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", - "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "bundled": true, "dev": true, "requires": { "babel-runtime": "6.26.0" @@ -2003,8 +1986,7 @@ }, "babel-runtime": { "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", - "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "bundled": true, "dev": true, "requires": { "core-js": "2.5.1", @@ -2013,8 +1995,7 @@ }, "babel-template": { "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", - "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "bundled": true, "dev": true, "requires": { "babel-runtime": "6.26.0", @@ -2026,8 +2007,7 @@ }, "babel-traverse": { "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", - "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "bundled": true, "dev": true, "requires": { "babel-code-frame": "6.26.0", @@ -2043,8 +2023,7 @@ }, "babel-types": { "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", - "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "bundled": true, "dev": true, "requires": { "babel-runtime": "6.26.0", @@ -2055,20 +2034,17 @@ }, "babylon": { "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha1-ry87iPpvXB5MY00aD46sT1WzleM=", + "bundled": true, "dev": true }, "balanced-match": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "bundled": true, "dev": true }, "brace-expansion": { "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "bundled": true, "dev": true, "requires": { "balanced-match": "1.0.0", @@ -2077,8 +2053,7 @@ }, "braces": { "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "bundled": true, "dev": true, "requires": { "expand-range": "1.8.2", @@ -2088,14 +2063,12 @@ }, "builtin-modules": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "bundled": true, "dev": true }, "caching-transform": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-1.0.1.tgz", - "integrity": "sha1-bb2y8g+Nj7znnz6U6dF0Lc31wKE=", + "bundled": true, "dev": true, "requires": { "md5-hex": "1.3.0", @@ -2105,15 +2078,13 @@ }, "camelcase": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "bundled": true, "dev": true, "optional": true }, "center-align": { "version": "0.1.3", - "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", - "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2123,8 +2094,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "bundled": true, "dev": true, "requires": { "ansi-styles": "2.2.1", @@ -2136,8 +2106,7 @@ }, "cliui": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -2148,8 +2117,7 @@ "dependencies": { "wordwrap": { "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "bundled": true, "dev": true, "optional": true } @@ -2157,38 +2125,32 @@ }, "code-point-at": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "bundled": true, "dev": true }, "commondir": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "bundled": true, "dev": true }, "concat-map": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "bundled": true, "dev": true }, "convert-source-map": { "version": "1.5.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", - "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", + "bundled": true, "dev": true }, "core-js": { "version": "2.5.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", - "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=", + "bundled": true, "dev": true }, "cross-spawn": { "version": "4.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", - "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", + "bundled": true, "dev": true, "requires": { "lru-cache": "4.1.1", @@ -2197,8 +2159,7 @@ }, "debug": { "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "bundled": true, "dev": true, "requires": { "ms": "2.0.0" @@ -2206,20 +2167,17 @@ }, "debug-log": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/debug-log/-/debug-log-1.0.1.tgz", - "integrity": "sha1-IwdjLUwEOCuN+KMvcLiVBG1SdF8=", + "bundled": true, "dev": true }, "decamelize": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "bundled": true, "dev": true }, "default-require-extensions": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-1.0.0.tgz", - "integrity": "sha1-836hXT4T/9m0N9M+GnW1+5eHTLg=", + "bundled": true, "dev": true, "requires": { "strip-bom": "2.0.0" @@ -2227,8 +2185,7 @@ }, "detect-indent": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", - "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "bundled": true, "dev": true, "requires": { "repeating": "2.0.1" @@ -2236,8 +2193,7 @@ }, "error-ex": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", - "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "bundled": true, "dev": true, "requires": { "is-arrayish": "0.2.1" @@ -2245,20 +2201,17 @@ }, "escape-string-regexp": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "bundled": true, "dev": true }, "esutils": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "bundled": true, "dev": true }, "execa": { "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "bundled": true, "dev": true, "requires": { "cross-spawn": "5.1.0", @@ -2272,8 +2225,7 @@ "dependencies": { "cross-spawn": { "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "bundled": true, "dev": true, "requires": { "lru-cache": "4.1.1", @@ -2285,8 +2237,7 @@ }, "expand-brackets": { "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "bundled": true, "dev": true, "requires": { "is-posix-bracket": "0.1.1" @@ -2294,8 +2245,7 @@ }, "expand-range": { "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "bundled": true, "dev": true, "requires": { "fill-range": "2.2.3" @@ -2303,8 +2253,7 @@ }, "extglob": { "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "bundled": true, "dev": true, "requires": { "is-extglob": "1.0.0" @@ -2312,14 +2261,12 @@ }, "filename-regex": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", - "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "bundled": true, "dev": true }, "fill-range": { "version": "2.2.3", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", - "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "bundled": true, "dev": true, "requires": { "is-number": "2.1.0", @@ -2331,8 +2278,7 @@ }, "find-cache-dir": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-0.1.1.tgz", - "integrity": "sha1-yN765XyKUqinhPnjHFfHQumToLk=", + "bundled": true, "dev": true, "requires": { "commondir": "1.0.1", @@ -2342,8 +2288,7 @@ }, "find-up": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "bundled": true, "dev": true, "requires": { "locate-path": "2.0.0" @@ -2351,14 +2296,12 @@ }, "for-in": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "bundled": true, "dev": true }, "for-own": { "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "bundled": true, "dev": true, "requires": { "for-in": "1.0.2" @@ -2366,8 +2309,7 @@ }, "foreground-child": { "version": "1.5.6", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-1.5.6.tgz", - "integrity": "sha1-T9ca0t/elnibmApcCilZN8svXOk=", + "bundled": true, "dev": true, "requires": { "cross-spawn": "4.0.2", @@ -2376,26 +2318,22 @@ }, "fs.realpath": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "bundled": true, "dev": true }, "get-caller-file": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", - "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "bundled": true, "dev": true }, "get-stream": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "bundled": true, "dev": true }, "glob": { "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", + "bundled": true, "dev": true, "requires": { "fs.realpath": "1.0.0", @@ -2408,8 +2346,7 @@ }, "glob-base": { "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", - "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "bundled": true, "dev": true, "requires": { "glob-parent": "2.0.0", @@ -2418,8 +2355,7 @@ }, "glob-parent": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", - "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "bundled": true, "dev": true, "requires": { "is-glob": "2.0.1" @@ -2427,20 +2363,17 @@ }, "globals": { "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha1-qjiWs+abSH8X4x7SFD1pqOMMLYo=", + "bundled": true, "dev": true }, "graceful-fs": { "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "bundled": true, "dev": true }, "handlebars": { "version": "4.0.10", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.10.tgz", - "integrity": "sha1-PTDHGLCaPZbyPqTMH0A8TTup/08=", + "bundled": true, "dev": true, "requires": { "async": "1.5.2", @@ -2451,8 +2384,7 @@ "dependencies": { "source-map": { "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", - "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "bundled": true, "dev": true, "requires": { "amdefine": "1.0.1" @@ -2462,8 +2394,7 @@ }, "has-ansi": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "bundled": true, "dev": true, "requires": { "ansi-regex": "2.1.1" @@ -2471,26 +2402,22 @@ }, "has-flag": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "bundled": true, "dev": true }, "hosted-git-info": { "version": "2.5.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", - "integrity": "sha1-bWDjSzq7yDEwYsO3mO+NkBoHrzw=", + "bundled": true, "dev": true }, "imurmurhash": { "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "bundled": true, "dev": true }, "inflight": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "bundled": true, "dev": true, "requires": { "once": "1.4.0", @@ -2499,14 +2426,12 @@ }, "inherits": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "bundled": true, "dev": true }, "invariant": { "version": "2.2.2", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", - "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", + "bundled": true, "dev": true, "requires": { "loose-envify": "1.3.1" @@ -2514,26 +2439,22 @@ }, "invert-kv": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "bundled": true, "dev": true }, "is-arrayish": { "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "bundled": true, "dev": true }, "is-buffer": { "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", - "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", + "bundled": true, "dev": true }, "is-builtin-module": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "bundled": true, "dev": true, "requires": { "builtin-modules": "1.1.1" @@ -2541,14 +2462,12 @@ }, "is-dotfile": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", - "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "bundled": true, "dev": true }, "is-equal-shallow": { "version": "0.1.3", - "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", - "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "bundled": true, "dev": true, "requires": { "is-primitive": "2.0.0" @@ -2556,20 +2475,17 @@ }, "is-extendable": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "bundled": true, "dev": true }, "is-extglob": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "bundled": true, "dev": true }, "is-finite": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", - "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "bundled": true, "dev": true, "requires": { "number-is-nan": "1.0.1" @@ -2577,8 +2493,7 @@ }, "is-fullwidth-code-point": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "bundled": true, "dev": true, "requires": { "number-is-nan": "1.0.1" @@ -2586,8 +2501,7 @@ }, "is-glob": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "bundled": true, "dev": true, "requires": { "is-extglob": "1.0.0" @@ -2595,8 +2509,7 @@ }, "is-number": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "bundled": true, "dev": true, "requires": { "kind-of": "3.2.2" @@ -2604,44 +2517,37 @@ }, "is-posix-bracket": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", - "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "bundled": true, "dev": true }, "is-primitive": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", - "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "bundled": true, "dev": true }, "is-stream": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "bundled": true, "dev": true }, "is-utf8": { "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "bundled": true, "dev": true }, "isarray": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "bundled": true, "dev": true }, "isexe": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "bundled": true, "dev": true }, "isobject": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "bundled": true, "dev": true, "requires": { "isarray": "1.0.0" @@ -2649,14 +2555,12 @@ }, "istanbul-lib-coverage": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz", - "integrity": "sha1-c7+5mIhSmUFck9OKPprfeEp3qdo=", + "bundled": true, "dev": true }, "istanbul-lib-hook": { "version": "1.0.7", - "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-1.0.7.tgz", - "integrity": "sha1-3WYH8DB2V4/n1vKmMM8UO0m6zdw=", + "bundled": true, "dev": true, "requires": { "append-transform": "0.4.0" @@ -2664,8 +2568,7 @@ }, "istanbul-lib-instrument": { "version": "1.8.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.8.0.tgz", - "integrity": "sha1-ZvbJQhzJ7EcE928tsIS6kHiitTI=", + "bundled": true, "dev": true, "requires": { "babel-generator": "6.26.0", @@ -2679,8 +2582,7 @@ }, "istanbul-lib-report": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz", - "integrity": "sha1-8OVfVmVf+jQiIIC3oM1HYOFAX8k=", + "bundled": true, "dev": true, "requires": { "istanbul-lib-coverage": "1.1.1", @@ -2691,8 +2593,7 @@ "dependencies": { "supports-color": { "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "bundled": true, "dev": true, "requires": { "has-flag": "1.0.0" @@ -2702,8 +2603,7 @@ }, "istanbul-lib-source-maps": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.1.tgz", - "integrity": "sha1-pv4ay6jOCO68Y45XLilNJnAIqgw=", + "bundled": true, "dev": true, "requires": { "debug": "2.6.8", @@ -2715,8 +2615,7 @@ }, "istanbul-reports": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.2.tgz", - "integrity": "sha1-D7Lj9qqZIr085F0F2KtNXo4HvU8=", + "bundled": true, "dev": true, "requires": { "handlebars": "4.0.10" @@ -2724,20 +2623,17 @@ }, "js-tokens": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "bundled": true, "dev": true }, "jsesc": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", - "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "bundled": true, "dev": true }, "kind-of": { "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "bundled": true, "dev": true, "requires": { "is-buffer": "1.1.5" @@ -2745,15 +2641,13 @@ }, "lazy-cache": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", - "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "bundled": true, "dev": true, "optional": true }, "lcid": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "bundled": true, "dev": true, "requires": { "invert-kv": "1.0.0" @@ -2761,8 +2655,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "bundled": true, "dev": true, "requires": { "graceful-fs": "4.1.11", @@ -2774,8 +2667,7 @@ }, "locate-path": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "bundled": true, "dev": true, "requires": { "p-locate": "2.0.0", @@ -2784,28 +2676,24 @@ "dependencies": { "path-exists": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "bundled": true, "dev": true } } }, "lodash": { "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "bundled": true, "dev": true }, "longest": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", - "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "bundled": true, "dev": true }, "loose-envify": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", - "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "bundled": true, "dev": true, "requires": { "js-tokens": "3.0.2" @@ -2813,8 +2701,7 @@ }, "lru-cache": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha1-Yi4y6CSItJJ5EUpPns9F581rulU=", + "bundled": true, "dev": true, "requires": { "pseudomap": "1.0.2", @@ -2823,8 +2710,7 @@ }, "md5-hex": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/md5-hex/-/md5-hex-1.3.0.tgz", - "integrity": "sha1-0sSv6YPENwZiF5uMrRRSGRNQRsQ=", + "bundled": true, "dev": true, "requires": { "md5-o-matic": "0.1.1" @@ -2832,14 +2718,12 @@ }, "md5-o-matic": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/md5-o-matic/-/md5-o-matic-0.1.1.tgz", - "integrity": "sha1-givM1l4RfFFPqxdrJZRdVBAKA8M=", + "bundled": true, "dev": true }, "mem": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", - "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "bundled": true, "dev": true, "requires": { "mimic-fn": "1.1.0" @@ -2847,8 +2731,7 @@ }, "merge-source-map": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.0.4.tgz", - "integrity": "sha1-pd5GU42uhNQRTMXqArR3KmNGcB8=", + "bundled": true, "dev": true, "requires": { "source-map": "0.5.7" @@ -2856,8 +2739,7 @@ }, "micromatch": { "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "bundled": true, "dev": true, "requires": { "arr-diff": "2.0.0", @@ -2877,14 +2759,12 @@ }, "mimic-fn": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", - "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", + "bundled": true, "dev": true }, "minimatch": { "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "bundled": true, "dev": true, "requires": { "brace-expansion": "1.1.8" @@ -2892,14 +2772,12 @@ }, "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "bundled": true, "dev": true }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "bundled": true, "dev": true, "requires": { "minimist": "0.0.8" @@ -2907,14 +2785,12 @@ }, "ms": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "bundled": true, "dev": true }, "normalize-package-data": { "version": "2.4.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha1-EvlaMH1YNSB1oEkHuErIvpisAS8=", + "bundled": true, "dev": true, "requires": { "hosted-git-info": "2.5.0", @@ -2925,8 +2801,7 @@ }, "normalize-path": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "bundled": true, "dev": true, "requires": { "remove-trailing-separator": "1.1.0" @@ -2934,8 +2809,7 @@ }, "npm-run-path": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "bundled": true, "dev": true, "requires": { "path-key": "2.0.1" @@ -2943,20 +2817,17 @@ }, "number-is-nan": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "bundled": true, "dev": true }, "object-assign": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "bundled": true, "dev": true }, "object.omit": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", - "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "bundled": true, "dev": true, "requires": { "for-own": "0.1.5", @@ -2965,8 +2836,7 @@ }, "once": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "bundled": true, "dev": true, "requires": { "wrappy": "1.0.2" @@ -2974,8 +2844,7 @@ }, "optimist": { "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "bundled": true, "dev": true, "requires": { "minimist": "0.0.8", @@ -2984,14 +2853,12 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "bundled": true, "dev": true }, "os-locale": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", - "integrity": "sha1-QrwpAKa1uL0XN2yOiCtlr8zyS/I=", + "bundled": true, "dev": true, "requires": { "execa": "0.7.0", @@ -3001,20 +2868,17 @@ }, "p-finally": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "bundled": true, "dev": true }, "p-limit": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", - "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=", + "bundled": true, "dev": true }, "p-locate": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "bundled": true, "dev": true, "requires": { "p-limit": "1.1.0" @@ -3022,8 +2886,7 @@ }, "parse-glob": { "version": "3.0.4", - "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", - "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "bundled": true, "dev": true, "requires": { "glob-base": "0.3.0", @@ -3034,8 +2897,7 @@ }, "parse-json": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "bundled": true, "dev": true, "requires": { "error-ex": "1.3.1" @@ -3043,8 +2905,7 @@ }, "path-exists": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "bundled": true, "dev": true, "requires": { "pinkie-promise": "2.0.1" @@ -3052,26 +2913,22 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "bundled": true, "dev": true }, "path-key": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "bundled": true, "dev": true }, "path-parse": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", - "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "bundled": true, "dev": true }, "path-type": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "bundled": true, "dev": true, "requires": { "graceful-fs": "4.1.11", @@ -3081,20 +2938,17 @@ }, "pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "bundled": true, "dev": true }, "pinkie": { "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "bundled": true, "dev": true }, "pinkie-promise": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "bundled": true, "dev": true, "requires": { "pinkie": "2.0.4" @@ -3102,8 +2956,7 @@ }, "pkg-dir": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz", - "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=", + "bundled": true, "dev": true, "requires": { "find-up": "1.1.2" @@ -3111,8 +2964,7 @@ "dependencies": { "find-up": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "bundled": true, "dev": true, "requires": { "path-exists": "2.1.0", @@ -3123,20 +2975,17 @@ }, "preserve": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", - "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "bundled": true, "dev": true }, "pseudomap": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "bundled": true, "dev": true }, "randomatic": { "version": "1.1.7", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", - "integrity": "sha1-x6vpzIuHwLqodrGf3oP9RkeX44w=", + "bundled": true, "dev": true, "requires": { "is-number": "3.0.0", @@ -3145,8 +2994,7 @@ "dependencies": { "is-number": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "bundled": true, "dev": true, "requires": { "kind-of": "3.2.2" @@ -3154,8 +3002,7 @@ "dependencies": { "kind-of": { "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "bundled": true, "dev": true, "requires": { "is-buffer": "1.1.5" @@ -3165,8 +3012,7 @@ }, "kind-of": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "bundled": true, "dev": true, "requires": { "is-buffer": "1.1.5" @@ -3176,8 +3022,7 @@ }, "read-pkg": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "bundled": true, "dev": true, "requires": { "load-json-file": "1.1.0", @@ -3187,8 +3032,7 @@ }, "read-pkg-up": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "bundled": true, "dev": true, "requires": { "find-up": "1.1.2", @@ -3197,8 +3041,7 @@ "dependencies": { "find-up": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "bundled": true, "dev": true, "requires": { "path-exists": "2.1.0", @@ -3209,14 +3052,12 @@ }, "regenerator-runtime": { "version": "0.11.0", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", - "integrity": "sha1-flT+W1zNXWYk6mJVw0c74JC4AuE=", + "bundled": true, "dev": true }, "regex-cache": { "version": "0.4.4", - "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", - "integrity": "sha1-db3FiioUls7EihKDW8VMjVYjNt0=", + "bundled": true, "dev": true, "requires": { "is-equal-shallow": "0.1.3" @@ -3224,26 +3065,22 @@ }, "remove-trailing-separator": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "bundled": true, "dev": true }, "repeat-element": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", - "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", + "bundled": true, "dev": true }, "repeat-string": { "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "bundled": true, "dev": true }, "repeating": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "bundled": true, "dev": true, "requires": { "is-finite": "1.0.2" @@ -3251,26 +3088,22 @@ }, "require-directory": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "bundled": true, "dev": true }, "require-main-filename": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "bundled": true, "dev": true }, "resolve-from": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", - "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=", + "bundled": true, "dev": true }, "right-align": { "version": "0.1.3", - "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", - "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -3279,8 +3112,7 @@ }, "rimraf": { "version": "2.6.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", - "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", + "bundled": true, "dev": true, "requires": { "glob": "7.1.2" @@ -3288,20 +3120,17 @@ }, "semver": { "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha1-4FnAnYVx8FQII3M0M1BdOi8AsY4=", + "bundled": true, "dev": true }, "set-blocking": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "bundled": true, "dev": true }, "shebang-command": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "bundled": true, "dev": true, "requires": { "shebang-regex": "1.0.0" @@ -3309,32 +3138,27 @@ }, "shebang-regex": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "bundled": true, "dev": true }, "signal-exit": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "bundled": true, "dev": true }, "slide": { "version": "1.1.6", - "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", - "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", + "bundled": true, "dev": true }, "source-map": { "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "bundled": true, "dev": true }, "spawn-wrap": { "version": "1.3.8", - "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-1.3.8.tgz", - "integrity": "sha1-+ip5uZDLsLsAGNymdI2INnsZ7DE=", + "bundled": true, "dev": true, "requires": { "foreground-child": "1.5.6", @@ -3347,8 +3171,7 @@ }, "spdx-correct": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", - "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", + "bundled": true, "dev": true, "requires": { "spdx-license-ids": "1.2.2" @@ -3356,20 +3179,17 @@ }, "spdx-expression-parse": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", - "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", + "bundled": true, "dev": true }, "spdx-license-ids": { "version": "1.2.2", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", - "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", + "bundled": true, "dev": true }, "string-width": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", + "bundled": true, "dev": true, "requires": { "is-fullwidth-code-point": "2.0.0", @@ -3378,20 +3198,17 @@ "dependencies": { "ansi-regex": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "bundled": true, "dev": true }, "is-fullwidth-code-point": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "bundled": true, "dev": true }, "strip-ansi": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "bundled": true, "dev": true, "requires": { "ansi-regex": "3.0.0" @@ -3401,8 +3218,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "bundled": true, "dev": true, "requires": { "ansi-regex": "2.1.1" @@ -3410,8 +3226,7 @@ }, "strip-bom": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "bundled": true, "dev": true, "requires": { "is-utf8": "0.2.1" @@ -3419,20 +3234,17 @@ }, "strip-eof": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "bundled": true, "dev": true }, "supports-color": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "bundled": true, "dev": true }, "test-exclude": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.1.1.tgz", - "integrity": "sha1-TYSWSwlmsAh+zDNKLOAC09k0HiY=", + "bundled": true, "dev": true, "requires": { "arrify": "1.0.1", @@ -3444,20 +3256,17 @@ }, "to-fast-properties": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", - "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "bundled": true, "dev": true }, "trim-right": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", - "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "bundled": true, "dev": true }, "uglify-js": { "version": "2.8.29", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", - "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -3468,8 +3277,7 @@ "dependencies": { "yargs": { "version": "3.10.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", - "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "bundled": true, "dev": true, "optional": true, "requires": { @@ -3483,15 +3291,13 @@ }, "uglify-to-browserify": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", - "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "bundled": true, "dev": true, "optional": true }, "validate-npm-package-license": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", - "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", + "bundled": true, "dev": true, "requires": { "spdx-correct": "1.0.2", @@ -3500,8 +3306,7 @@ }, "which": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha1-/wS9/AEO5UfXgL7DjhrBwnd9JTo=", + "bundled": true, "dev": true, "requires": { "isexe": "2.0.0" @@ -3509,27 +3314,23 @@ }, "which-module": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "bundled": true, "dev": true }, "window-size": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", - "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "bundled": true, "dev": true, "optional": true }, "wordwrap": { "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "bundled": true, "dev": true }, "wrap-ansi": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "bundled": true, "dev": true, "requires": { "string-width": "1.0.2", @@ -3538,8 +3339,7 @@ "dependencies": { "string-width": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "bundled": true, "dev": true, "requires": { "code-point-at": "1.1.0", @@ -3551,14 +3351,12 @@ }, "wrappy": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "bundled": true, "dev": true }, "write-file-atomic": { "version": "1.3.4", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.4.tgz", - "integrity": "sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=", + "bundled": true, "dev": true, "requires": { "graceful-fs": "4.1.11", @@ -3568,20 +3366,17 @@ }, "y18n": { "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "bundled": true, "dev": true }, "yallist": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "bundled": true, "dev": true }, "yargs": { "version": "8.0.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", - "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", + "bundled": true, "dev": true, "requires": { "camelcase": "4.1.0", @@ -3601,14 +3396,12 @@ "dependencies": { "camelcase": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "bundled": true, "dev": true }, "cliui": { "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "bundled": true, "dev": true, "requires": { "string-width": "1.0.2", @@ -3618,8 +3411,7 @@ "dependencies": { "string-width": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "bundled": true, "dev": true, "requires": { "code-point-at": "1.1.0", @@ -3631,8 +3423,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "bundled": true, "dev": true, "requires": { "graceful-fs": "4.1.11", @@ -3643,8 +3434,7 @@ }, "path-type": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "bundled": true, "dev": true, "requires": { "pify": "2.3.0" @@ -3652,8 +3442,7 @@ }, "read-pkg": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "bundled": true, "dev": true, "requires": { "load-json-file": "2.0.0", @@ -3663,8 +3452,7 @@ }, "read-pkg-up": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "bundled": true, "dev": true, "requires": { "find-up": "2.1.0", @@ -3673,14 +3461,12 @@ }, "strip-bom": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "bundled": true, "dev": true }, "yargs-parser": { "version": "7.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", - "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", + "bundled": true, "dev": true, "requires": { "camelcase": "4.1.0" @@ -3690,8 +3476,7 @@ }, "yargs-parser": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz", - "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", + "bundled": true, "dev": true, "requires": { "camelcase": "3.0.0" @@ -3699,8 +3484,7 @@ "dependencies": { "camelcase": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "bundled": true, "dev": true } } @@ -3813,6 +3597,14 @@ "dev": true, "requires": { "isarray": "0.0.1" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + } } }, "path-type": { @@ -3887,14 +3679,14 @@ "@protobufjs/pool": "1.1.0", "@protobufjs/utf8": "1.1.0", "@types/long": "3.0.32", - "@types/node": "7.0.43", + "@types/node": "7.0.46", "long": "3.2.0" }, "dependencies": { "@types/node": { - "version": "7.0.43", - "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.43.tgz", - "integrity": "sha512-7scYwwfHNppXvH/9JzakbVxk0o0QUILVk1Lv64GRaxwPuGpnF1QBiwdvhDpLcymb8BpomQL3KYoWKq3wUdDMhQ==", + "version": "7.0.46", + "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.46.tgz", + "integrity": "sha512-u+JAi1KtmaUoU/EHJkxoiuvzyo91FCE41Z9TZWWcOUU3P8oUdlDLdrGzCGWySPgbRMD17B0B+1aaJLYI9egQ6A==", "dev": true } } @@ -3916,9 +3708,9 @@ "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" }, "rc": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz", - "integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.2.tgz", + "integrity": "sha1-2M6ctX6NZNnHut2YdsfDTL48cHc=", "dev": true, "requires": { "deep-extend": "0.4.2", @@ -3973,13 +3765,6 @@ "safe-buffer": "5.1.1", "string_decoder": "1.0.3", "util-deprecate": "1.0.2" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - } } }, "redent": { @@ -3998,7 +3783,7 @@ "integrity": "sha1-+w0yie4Nmtosu1KvXf5mywcNMAY=", "dev": true, "requires": { - "rc": "1.2.1", + "rc": "1.2.2", "safe-buffer": "5.1.1" } }, @@ -4008,7 +3793,7 @@ "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=", "dev": true, "requires": { - "rc": "1.2.1" + "rc": "1.2.2" } }, "repeating": { @@ -4050,9 +3835,9 @@ } }, "resolve": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", - "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", + "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", "dev": true, "requires": { "path-parse": "1.0.5" @@ -4158,21 +3943,29 @@ "dev": true }, "sinon": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.0.1.tgz", - "integrity": "sha512-4qIY0pCWCvGCJpV/1JkFu9kbsNEZ9O34cG1oru/c7OCDtrEs50Gq/VjkA2ID5ZwLyoNx1i1ws118oh/p6fVeDg==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.0.2.tgz", + "integrity": "sha512-4mUsjHfjrHyPFGDTtNJl0q8cv4VOJGvQykI1r3fnn05ys0sQL9M1Y+DyyGNWLD2PMcoyqjJ/nFDm4K54V1eQOg==", "dev": true, "requires": { "diff": "3.4.0", "formatio": "1.2.0", "lodash.get": "4.4.2", "lolex": "2.1.3", - "native-promise-only": "0.8.1", - "nise": "1.1.1", - "path-to-regexp": "1.7.0", - "samsam": "1.3.0", - "text-encoding": "0.6.4", + "nise": "1.2.0", + "supports-color": "4.5.0", "type-detect": "4.0.3" + }, + "dependencies": { + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } } }, "slash": { @@ -4182,9 +3975,9 @@ "dev": true }, "sntp": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.0.2.tgz", - "integrity": "sha1-UGQRDwr4X3z9t9a2ekACjOUrSys=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", "requires": { "hoek": "4.2.0" } @@ -4217,16 +4010,6 @@ "requires": { "async": "2.5.0", "is-stream-ended": "0.1.3" - }, - "dependencies": { - "async": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", - "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", - "requires": { - "lodash": "4.17.4" - } - } } }, "sshpk": { @@ -4257,14 +4040,6 @@ "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=" }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "requires": { - "safe-buffer": "5.1.1" - } - }, "string-format-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/string-format-obj/-/string-format-obj-1.1.0.tgz", @@ -4278,6 +4053,31 @@ "requires": { "is-fullwidth-code-point": "2.0.0", "strip-ansi": "4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "requires": { + "safe-buffer": "5.1.1" } }, "stringstream": { @@ -4286,12 +4086,12 @@ "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" }, "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "3.0.0" + "ansi-regex": "2.1.1" } }, "strip-bom": { @@ -4330,13 +4130,10 @@ "integrity": "sha1-6NK6H6nJBXAwPAMLaQD31fiavls=" }, "supports-color": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true }, "term-size": { "version": "1.2.0", @@ -4404,21 +4201,53 @@ "dev": true }, "tslint": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.7.0.tgz", - "integrity": "sha1-wl4NDJL6EgHCvDDoROCOaCtPNVI=", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.8.0.tgz", + "integrity": "sha1-H0mtWy53x2w69N3K5VKuTjYS6xM=", "dev": true, "requires": { "babel-code-frame": "6.26.0", - "colors": "1.1.2", + "builtin-modules": "1.1.1", + "chalk": "2.3.0", "commander": "2.11.0", "diff": "3.4.0", "glob": "7.1.2", "minimatch": "3.0.4", - "resolve": "1.4.0", + "resolve": "1.5.0", "semver": "5.4.1", "tslib": "1.8.0", "tsutils": "2.12.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } } }, "tsutils": { @@ -4482,8 +4311,8 @@ "integrity": "sha1-TognpruRUUCrCTVZ1wFOPruDdFE=", "dev": true, "requires": { - "boxen": "1.2.1", - "chalk": "2.1.0", + "boxen": "1.2.2", + "chalk": "2.3.0", "configstore": "3.1.1", "import-lazy": "2.1.0", "is-installed-globally": "0.1.0", @@ -4491,6 +4320,37 @@ "latest-version": "3.1.0", "semver-diff": "2.1.0", "xdg-basedir": "3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } } }, "url-parse-lax": { @@ -4556,12 +4416,6 @@ "string-width": "1.0.2" }, "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, "is-fullwidth-code-point": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", @@ -4581,15 +4435,6 @@ "is-fullwidth-code-point": "1.0.0", "strip-ansi": "3.0.1" } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } } } }, diff --git a/handwritten/cloud-profiler/src/profilers/profile-serializer.ts b/handwritten/cloud-profiler/src/profilers/profile-serializer.ts index 9ea20010edc..650c72c4e35 100644 --- a/handwritten/cloud-profiler/src/profilers/profile-serializer.ts +++ b/handwritten/cloud-profiler/src/profilers/profile-serializer.ts @@ -15,132 +15,268 @@ */ import {perftools} from '../profile'; -import {getIndexOrAdd} from '../util'; -import {TimeProfile, TimeProfileNode} from '../v8-types'; -// A stack of function UIDs. +import {AllocationProfileNode, ProfileNode, TimeProfile, TimeProfileNode} from '../v8-types'; + +/** + * A stack of function IDs. + */ type Stack = Array; + +/** + * A function which converts entry into one or more samples, then + * appends those sample(s) to samples. + */ +type AppendEntryToSamples = + (entry: Entry, samples: perftools.profiles.Sample[]) => void; + +/** + * Profile node and stack trace to that node. + */ interface Entry { - node: TimeProfileNode; + node: ProfileNode; stack: Stack; } /** - * Converts v8 Profile into profile with profile format used by Stackdriver - * Profiler. - * - * @param prof - profile to be converted. - * @param intervalMicros - average time (microseconds) between samples. + * Heap profile node and stack trace to that node. */ -export function serializeTimeProfile( - prof: TimeProfile, intervalMicros: number) { - let samples: Array = []; - let locations: Array = []; - let functions: Array = []; - let locationMap: Map = new Map(); - let functionMap: Map = new Map(); - let strings = ['']; - - let sampleValueType = createSampleValueType(); - let timeValueType = createTimeValueType(); +interface AllocationEntry { + node: AllocationProfileNode; + stack: Stack; +} - serializeNode(prof.topDownRoot); +/** + * Time profile node and stack trace to that node. + */ +interface TimeEntry { + node: TimeProfileNode; + stack: Stack; +} - return { - sampleType: [sampleValueType, timeValueType], - sample: samples, - location: locations, - function: functions, - stringTable: strings, - // opt drop_frames - // opt keep_frames - timeNanos: 1000 * 1000 * prof.endTime, // Nanos - durationNanos: 1000 * 1000 * (prof.endTime - prof.startTime), // Nanos +/** + * Used to build string table and access strings and their ids within the table + * when serializing a profile. + */ +class StringTable { + strings: string[]; + stringsMap: Map; - periodType: timeValueType, - period: intervalMicros - }; + constructor() { + this.strings = []; + this.stringsMap = new Map(); + this.getIndexOrAdd(''); + } /** - * Adds samples from a node and it's children to the fields tracking - * profile serialization. - * - * @param node - the node which is serialized - * @param stack - the stack trace to the current node. + * Returns index of str within the table. Also adds str to string table if + * str is not in the table already. */ - function serializeNode(root: TimeProfileNode) { - let entries: Entry[] = []; - // don't include root node in serialized profile, start with it's children. - for (let child of root.children) { - entries.push({node: child, stack: []}); + getIndexOrAdd(str: string): number { + let idx = this.stringsMap.get(str); + if (idx !== undefined) { + return idx; } - while (entries.length > 0) { - let entry = entries.pop(); - if (entry !== undefined) { - let node = entry.node; - let stack = entry.stack; - let location = getLocation(node); - stack.unshift(location.id as number); - if (node.hitCount > 0) { - const sample = new perftools.profiles.Sample({ - locationId: stack, - value: [node.hitCount, node.hitCount * intervalMicros] - }); - samples.push(sample); - } - for (let child of node.children) { - entries.push({node: child, stack: stack.slice(0)}); - } - } + idx = this.strings.push(str) - 1; + this.stringsMap.set(str, idx); + return idx; + } +} + +/** + * Takes v8 profile and populates sample, location, and function fields of + * profile.proto. + * + * @param profile - profile.proto with empty sample, location, and function + * fields. + * @param root - root of v8 profile tree describing samples to be appended + * to profile. + * @param appendToSamples - function which converts entry to sample(s) and + * appends these to end of an array of samples. + * @param stringTable - string table for the existing profile. + */ +function serialize( + profile: perftools.profiles.IProfile, root: ProfileNode, + appendToSamples: AppendEntryToSamples, stringTable: StringTable) { + const samples: Array = []; + const locations: Array = []; + const functions: Array = []; + const locationMap: Map = new Map(); + const functionMap: Map = new Map(); + const functionIdMap = new Map(); + const locationIdMap = new Map(); + + const entries: Entry[] = root.children.map((n) => ({node: n, stack: []})); + while (entries.length > 0) { + const entry = entries.pop()!; + const node = entry.node; + const stack = entry.stack; + const location = getLocation(node); + stack.unshift(location.id as number); + appendToSamples(entry, samples); + for (let child of node.children) { + entries.push({node: child, stack: stack.slice()}); } } - function getLocation(node: TimeProfileNode): perftools.profiles.Location { - const id = node.callUid; - let location = locationMap.get(id); - if (location !== undefined) { - return location; + profile.sample = samples; + profile.location = locations; + profile.function = functions; + profile.stringTable = stringTable.strings; + + function getLocation(node: ProfileNode): perftools.profiles.Location { + const keyStr = + `${node.scriptId}:${node.lineNumber}:${node.columnNumber}:${node.name}`; + let id = locationIdMap.get(keyStr); + if (id !== undefined) { + // id is index+1, since 0 is not valid id. + return locations[id - 1]; } - location = new perftools.profiles.Location({id: id, line: [getLine(node)]}); + id = locations.length + 1; + locationIdMap.set(keyStr, id); + const location = + new perftools.profiles.Location({id: id, line: [getLine(node)]}); locations.push(location); - locationMap.set(id, location); return location; } - function getLine(node: TimeProfileNode): perftools.profiles.Line { - return new perftools.profiles.Line( - {functionId: getFunction(node).id, line: node.lineNumber}); + function getLine(node: ProfileNode): perftools.profiles.Line { + return new perftools.profiles.Line({ + functionId: getFunction(node).id, + line: node.lineNumber, + }); } - function getFunction(node: TimeProfileNode): perftools.profiles.Function { - const id = node.callUid; - let f = functionMap.get(id); - if (f !== undefined) { - return f; + function getFunction(node: ProfileNode): perftools.profiles.Function { + const keyStr = `${node.scriptId}:${node.name}`; + let id = functionIdMap.get(keyStr); + if (id !== undefined) { + // id is index+1, since 0 is not valid id. + return functions[id - 1]; } - const name = getIndexOrAdd(node.functionName || '(anonymous)', strings); - f = new perftools.profiles.Function({ + id = functions.length + 1; + functionIdMap.set(keyStr, id); + let nameId = stringTable.getIndexOrAdd(node.name); + let f = new perftools.profiles.Function({ id: id, - name: name, - systemName: name, - filename: getIndexOrAdd(node.scriptResourceName || '(unknown)', strings) - // start_line + name: nameId, + systemName: nameId, + filename: stringTable.getIndexOrAdd(node.scriptName) }); functions.push(f); - functionMap.set(id, f); return f; } +} - function createSampleValueType(): perftools.profiles.ValueType { - return new perftools.profiles.ValueType({ - type: getIndexOrAdd('samples', strings), - unit: getIndexOrAdd('count', strings) - }); - } +/** + * Returns value type for samples counts (type:samples, units:count), and + * adds strings used in this value type to the table. + */ +function createSampleValueType(table: StringTable): + perftools.profiles.ValueType { + return new perftools.profiles.ValueType({ + type: table.getIndexOrAdd('samples'), + unit: table.getIndexOrAdd('count') + }); +} - function createTimeValueType(): perftools.profiles.ValueType { - return new perftools.profiles.ValueType({ - type: getIndexOrAdd('time', strings), - unit: getIndexOrAdd('microseconds', strings) - }); - } +/** + * Returns value type for time samples (type:time, units:microseconds), and + * adds strings used in this value type to the table. + */ +function createTimeValueType(table: StringTable): perftools.profiles.ValueType { + return new perftools.profiles.ValueType({ + type: table.getIndexOrAdd('time'), + unit: table.getIndexOrAdd('microseconds') + }); +} + +/** + * Returns value type for memory allocations (type:space, units:bytes), and + * adds strings used in this value type to the table. + */ +function createAllocationValueType(table: StringTable): + perftools.profiles.ValueType { + return new perftools.profiles.ValueType( + {type: table.getIndexOrAdd('space'), unit: table.getIndexOrAdd('bytes')}); +} + +/** + * Converts v8 time profile into into a profile proto. + * (https://github.com/google/pprof/blob/master/proto/profile.proto) + * + * @param prof - profile to be converted. + * @param intervalMicros - average time (microseconds) between samples. + */ +export function serializeTimeProfile( + prof: TimeProfile, intervalMicros: number): perftools.profiles.IProfile { + const appendTimeEntryToSamples: AppendEntryToSamples = + (entry: TimeEntry, samples: perftools.profiles.Sample[]) => { + if (entry.node.hitCount > 0) { + const sample = new perftools.profiles.Sample({ + locationId: entry.stack, + value: + [entry.node.hitCount, entry.node.hitCount * intervalMicros] + }); + samples.push(sample); + } + }; + + const stringTable = new StringTable(); + const sampleValueType = createSampleValueType(stringTable); + const timeValueType = createTimeValueType(stringTable); + + const profile = { + sampleType: [sampleValueType, timeValueType], + timeNanos: prof.startTime * 1000 * 1000, + durationNanos: (prof.endTime - prof.startTime) * 1000 * 1000, + periodType: timeValueType, + period: intervalMicros, + }; + + serialize(profile, prof.topDownRoot, appendTimeEntryToSamples, stringTable); + + return profile; +} + +/** + * Converts v8 heap profile into into a profile proto. + * (https://github.com/google/pprof/blob/master/proto/profile.proto) + * + * @param prof - profile to be converted. + * @param startTimeNanos - start time of profile, in nanoseconds (POSIX time). + * @param durationsNanos - duration of the profile (wall clock time) in + * nanoseconds. + * @param intervalBytes - bytes allocated between samples. + */ +export function serializeHeapProfile( + prof: AllocationProfileNode, startTimeNanos: number, durationNanos: number, + intervalBytes: number): perftools.profiles.IProfile { + const appendHeapEntryToSamples: AppendEntryToSamples = + (entry: AllocationEntry, samples: perftools.profiles.Sample[]) => { + if (entry.node.allocations.length > 0) { + for (const alloc of entry.node.allocations) { + const sample = new perftools.profiles.Sample({ + locationId: entry.stack, + value: [alloc.count, alloc.sizeBytes * alloc.count] + // TODO: add tag for allocation size + }); + samples.push(sample); + } + } + }; + + const stringTable = new StringTable(); + const sampleValueType = createSampleValueType(stringTable); + const allocationValueType = createAllocationValueType(stringTable); + + const profile = { + sampleType: [sampleValueType, allocationValueType], + timeNanos: startTimeNanos, + durationNanos: durationNanos, + periodType: allocationValueType, + period: intervalBytes, + }; + + serialize(profile, prof, appendHeapEntryToSamples, stringTable); + return profile; } diff --git a/handwritten/cloud-profiler/src/util.ts b/handwritten/cloud-profiler/src/util.ts deleted file mode 100644 index d0c58be22a8..00000000000 --- a/handwritten/cloud-profiler/src/util.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright 2015 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. - */ - -export function getIndexOrAdd(element: T, lst: Array) { - let index = lst.indexOf(element); - if (index !== -1) { - return index; - } - index = lst.push(element); - return index - 1; -} diff --git a/handwritten/cloud-profiler/src/v8-types.ts b/handwritten/cloud-profiler/src/v8-types.ts index aa286001107..27848d14cec 100644 --- a/handwritten/cloud-profiler/src/v8-types.ts +++ b/handwritten/cloud-profiler/src/v8-types.ts @@ -24,26 +24,23 @@ export interface TimeProfile { startTime: number; } -export interface TimeProfileNode { - callUid: number; - scriptResourceName?: string; - functionName?: string; - lineNumber: number; - hitCount: number; - children: Array; -} - -export interface AllocationProfileNode { +export interface ProfileNode { + // name is the function name. name: string; scriptName: string; scriptId: number; lineNumber: number; columnNumber: number; + children: Array; +} + +export interface TimeProfileNode extends ProfileNode { hitCount: number; } + +export interface AllocationProfileNode extends ProfileNode { allocations: Array; - children: Array; } export interface Allocation { - size: number; + sizeBytes: number; count: number; } diff --git a/handwritten/cloud-profiler/test/profile-for-test.ts b/handwritten/cloud-profiler/test/profile-for-test.ts deleted file mode 100644 index b59e8475ecd..00000000000 --- a/handwritten/cloud-profiler/test/profile-for-test.ts +++ /dev/null @@ -1,133 +0,0 @@ - -import {perftools} from '../src/profile'; -import {TimeProfile, TimeProfileNode} from '../src/v8-types'; - -const leaf1: TimeProfileNode = { - callUid: 5, - scriptResourceName: 'script3', - functionName: 'function5', - lineNumber: 5, - hitCount: 5, - children: [], -}; - -const leaf2 = { - callUid: 4, - scriptResourceName: 'script3', - functionName: 'function4', - lineNumber: 10, - hitCount: 2, - children: [], -}; - -const leaf3 = { - callUid: 3, - scriptResourceName: 'script3', - functionName: 'function3', - lineNumber: 15, - hitCount: 3, - children: [], -}; - -const node1 = { - callUid: 2, - scriptResourceName: 'script2', - functionName: 'function2', - lineNumber: 20, - hitCount: 7, - children: [leaf1, leaf2], -}; - -const main = { - callUid: 1, - scriptResourceName: 'script1', - functionName: 'main', - lineNumber: 1, - hitCount: 0, - children: [node1, leaf3], -}; - -const root = { - callUid: 0, - scriptResourceName: 'root', - functionName: 'root', - lineNumber: 0, - hitCount: 0, - children: [main], -}; - -export const timeProfileTree: TimeProfile = { - startTime: 0, - endTime: 100, - topDownRoot: root, -}; - -const lines = [ - {functionId: 1, line: 1}, - {functionId: 2, line: 20}, - {functionId: 3, line: 15}, - {functionId: 4, line: 10}, - {functionId: 5, line: 5}, -]; - -const functions = [ - new perftools.profiles.Function({id: 1, name: 5, systemName: 5, filename: 6}), - new perftools.profiles.Function({id: 3, name: 7, systemName: 7, filename: 8}), - new perftools.profiles.Function( - {id: 2, name: 9, systemName: 9, filename: 10}), - new perftools.profiles.Function( - {id: 4, name: 11, systemName: 11, filename: 8}), - new perftools.profiles.Function( - {id: 5, name: 12, systemName: 12, filename: 8}), -]; - -const locations = [ - new perftools.profiles.Location({ - line: [lines[0]], - id: 1, - }), - new perftools.profiles.Location({ - line: [lines[2]], - id: 3, - }), - new perftools.profiles.Location({ - line: [lines[1]], - id: 2, - }), - new perftools.profiles.Location({ - line: [lines[3]], - id: 4, - }), - new perftools.profiles.Location({ - line: [lines[4]], - id: 5, - }), -]; - -export const timeProfile: perftools.profiles.IProfile = { - sampleType: [ - new perftools.profiles.ValueType({type: 1, unit: 2}), - new perftools.profiles.ValueType({type: 3, unit: 4}), - ], - sample: [ - new perftools.profiles.Sample( - {locationId: [3, 1], value: [3, 3000], label: []}), - new perftools.profiles.Sample( - {locationId: [2, 1], value: [7, 7000], label: []}), - new perftools.profiles.Sample( - {locationId: [4, 2, 1], value: [2, 2000], label: []}), - new perftools.profiles.Sample( - {locationId: [5, 2, 1], value: [5, 5000], label: []}), - - ], - location: locations, - function: functions, - stringTable: [ - '', 'samples', 'count', 'time', 'microseconds', 'main', 'script1', - 'function3', 'script3', 'function2', 'script2', 'function4', 'function5' - ], - timeNanos: 100 * 1000 * 1000, - durationNanos: 100 * 1000 * 1000, - periodType: new perftools.profiles.ValueType({type: 3, unit: 4}), - period: 1000, -}; diff --git a/handwritten/cloud-profiler/test/profiles-for-tests.ts b/handwritten/cloud-profiler/test/profiles-for-tests.ts new file mode 100644 index 00000000000..e4ffd72c067 --- /dev/null +++ b/handwritten/cloud-profiler/test/profiles-for-tests.ts @@ -0,0 +1,257 @@ +/** + * 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. + */ + +import {perftools} from '../src/profile'; +import {TimeProfile, TimeProfileNode} from '../src/v8-types'; + +const timeLeaf1 = { + name: 'function1', + scriptName: 'script1', + scriptId: 1, + lineNumber: 10, + columnNumber: 5, + hitCount: 1, + children: [] +}; + +const timeLeaf2 = { + name: 'function1', + scriptName: 'script2', + scriptId: 2, + lineNumber: 15, + columnNumber: 3, + hitCount: 2, + children: [] +}; + +const timeLeaf3 = { + name: 'function1', + scriptName: 'script1', + scriptId: 1, + lineNumber: 5, + columnNumber: 3, + hitCount: 1, + children: [] +}; + +const timeNode1 = { + name: 'function1', + scriptName: 'script1', + scriptId: 1, + lineNumber: 5, + columnNumber: 3, + hitCount: 3, + children: [timeLeaf1, timeLeaf2] +}; + +const timeNode2 = { + name: 'function2', + scriptName: 'script2', + scriptId: 2, + lineNumber: 1, + columnNumber: 5, + hitCount: 0, + children: [timeLeaf3] +}; + +const timeRoot = { + name: '(root)', + scriptName: 'root', + scriptId: 0, + lineNumber: 0, + columnNumber: 0, + hitCount: 0, + children: [timeNode1, timeNode2] +}; + +export const v8TimeProfile: TimeProfile = { + startTime: 0, + endTime: 10 * 1000, + topDownRoot: timeRoot, +}; + +const timeLines = [ + {functionId: 1, line: 1}, + {functionId: 2, line: 5}, + {functionId: 3, line: 15}, + {functionId: 2, line: 10}, +]; + +const timeFunctions = [ + new perftools.profiles.Function({id: 1, name: 5, systemName: 5, filename: 6}), + new perftools.profiles.Function({id: 2, name: 7, systemName: 7, filename: 8}), + new perftools.profiles.Function({id: 3, name: 7, systemName: 7, filename: 6}), +]; + +const timeLocations = [ + new perftools.profiles.Location({ + line: [timeLines[0]], + id: 1, + }), + new perftools.profiles.Location({ + line: [timeLines[1]], + id: 2, + }), + new perftools.profiles.Location({ + line: [timeLines[2]], + id: 3, + }), + new perftools.profiles.Location({ + line: [timeLines[3]], + id: 4, + }), +]; + +export const timeProfile: perftools.profiles.IProfile = { + sampleType: [ + new perftools.profiles.ValueType({type: 1, unit: 2}), + new perftools.profiles.ValueType({type: 3, unit: 4}), + ], + sample: [ + new perftools.profiles.Sample( + {locationId: [2, 1], value: [1, 1000], label: []}), + new perftools.profiles.Sample( + {locationId: [2], value: [3, 3000], label: []}), + new perftools.profiles.Sample( + {locationId: [3, 2], value: [2, 2000], label: []}), + new perftools.profiles.Sample( + {locationId: [4, 2], value: [1, 1000], label: []}), + + ], + location: timeLocations, + function: timeFunctions, + stringTable: [ + '', + 'samples', + 'count', + 'time', + 'microseconds', + 'function2', + 'script2', + 'function1', + 'script1', + ], + timeNanos: 0, + durationNanos: 10 * 1000 * 1000 * 1000, + periodType: new perftools.profiles.ValueType({type: 3, unit: 4}), + period: 1000, +}; + + +const heapLeaf1 = { + name: 'function2', + scriptName: 'script1', + scriptId: 1, + lineNumber: 8, + columnNumber: 5, + allocations: [{count: 5, sizeBytes: 1024}], + children: [] +}; + +const heapLeaf2 = { + name: 'function3', + scriptName: 'script1', + scriptId: 1, + lineNumber: 10, + columnNumber: 5, + allocations: [{count: 8, sizeBytes: 10}, {count: 15, sizeBytes: 72}], + children: [] +}; + +const heapNode2 = { + name: 'function1', + scriptName: 'script1', + scriptId: 1, + lineNumber: 5, + columnNumber: 5, + allocations: [], + children: [heapLeaf1, heapLeaf2] +}; + +const heapNode1 = { + name: 'main', + scriptName: 'main', + scriptId: 0, + lineNumber: 1, + columnNumber: 5, + allocations: [{count: 1, sizeBytes: 5}, {count: 3, sizeBytes: 7}], + children: [heapNode2] +}; + +export const v8HeapProfile = { + name: '(root)', + scriptName: '(root)', + scriptId: 10000, + lineNumber: 0, + columnNumber: 5, + allocations: [], + children: [heapNode1] +}; + +const heapLines = [ + {functionId: 1, line: 1}, {functionId: 2, line: 5}, {functionId: 3, line: 10}, + {functionId: 4, line: 8} +]; + +const heapFunctions = [ + new perftools.profiles.Function({id: 1, name: 5, systemName: 5, filename: 5}), + new perftools.profiles.Function({id: 2, name: 6, systemName: 6, filename: 7}), + new perftools.profiles.Function({id: 3, name: 8, systemName: 8, filename: 7}), + new perftools.profiles.Function( + {id: 4, name: 9, systemName: 9, filename: 7}) +]; + +const heapLocations = [ + new perftools.profiles.Location({line: [heapLines[0]], id: 1}), + new perftools.profiles.Location({line: [heapLines[1]], id: 2}), + new perftools.profiles.Location({line: [heapLines[2]], id: 3}), + new perftools.profiles.Location({line: [heapLines[3]], id: 4}), +]; + +export const heapProfile: perftools.profiles.IProfile = { + sampleType: [ + new perftools.profiles.ValueType({type: 1, unit: 2}), + new perftools.profiles.ValueType({type: 3, unit: 4}), + ], + sample: [ + new perftools.profiles.Sample({locationId: [1], value: [1, 5], label: []}), + new perftools.profiles.Sample({locationId: [1], value: [3, 21], label: []}), + new perftools.profiles.Sample( + {locationId: [3, 2, 1], value: [8, 80], label: []}), + new perftools.profiles.Sample( + {locationId: [3, 2, 1], value: [15, 15 * 72], label: []}), + new perftools.profiles.Sample( + {locationId: [4, 2, 1], value: [5, 5 * 1024], label: []}), + ], + location: heapLocations, + function: heapFunctions, + stringTable: [ + '', + 'samples', + 'count', + 'space', + 'bytes', + 'main', + 'function1', + 'script1', + 'function3', + 'function2', + ], + timeNanos: 0, + durationNanos: 10 * 1000 * 1000 * 1000, + periodType: new perftools.profiles.ValueType({type: 3, unit: 4}), + period: 524288 +}; diff --git a/handwritten/cloud-profiler/test/test-profile-serializer.ts b/handwritten/cloud-profiler/test/test-profile-serializer.ts index 3a27ecc57e8..41147114e98 100644 --- a/handwritten/cloud-profiler/test/test-profile-serializer.ts +++ b/handwritten/cloud-profiler/test/test-profile-serializer.ts @@ -15,16 +15,23 @@ */ import {perftools} from '../src/profile'; -import {serializeTimeProfile} from '../src/profilers/profile-serializer'; +import {serializeHeapProfile, serializeTimeProfile} from '../src/profilers/profile-serializer'; import {TimeProfile, TimeProfileNode} from '../src/v8-types'; - -import {timeProfile, timeProfileTree} from './profile-for-test'; +import {heapProfile, timeProfile, v8HeapProfile, v8TimeProfile} from './profiles-for-tests'; let assert = require('assert'); describe('serializeTimeProfile', () => { it('should produce expected profile', () => { - const timeProfileOut = serializeTimeProfile(timeProfileTree, 1000); - assert.deepEqual(timeProfile, timeProfileOut); + const timeProfileOut = serializeTimeProfile(v8TimeProfile, 1000); + assert.deepEqual(timeProfileOut, timeProfile); + }); +}); + +describe('serializeHeapProfile', () => { + it('should produce expected profile', () => { + const heapProfileOut = serializeHeapProfile( + v8HeapProfile, 0, 10 * 1000 * 1000 * 1000, 512 * 1024); + assert.deepEqual(heapProfileOut, heapProfile); }); }); diff --git a/handwritten/cloud-profiler/test/test-time-profiler.ts b/handwritten/cloud-profiler/test/test-time-profiler.ts index 78f14ae803b..d05bf8e8969 100644 --- a/handwritten/cloud-profiler/test/test-time-profiler.ts +++ b/handwritten/cloud-profiler/test/test-time-profiler.ts @@ -20,7 +20,7 @@ import * as sinon from 'sinon'; import {perftools} from '../src/profile'; import {TimeProfiler} from '../src/profilers/time-profiler'; -import {timeProfile, timeProfileTree} from './profile-for-test'; +import {timeProfile, v8TimeProfile} from './profiles-for-tests'; let assert = require('assert'); const v8TimeProfiler = require('bindings')('time_profiler'); @@ -29,7 +29,7 @@ describe('TimeProfiler', () => { describe('profile', () => { before(() => { sinon.stub(v8TimeProfiler, 'startProfiling'); - sinon.stub(v8TimeProfiler, 'stopProfiling').returns(timeProfileTree); + sinon.stub(v8TimeProfiler, 'stopProfiling').returns(v8TimeProfile); sinon.stub(v8TimeProfiler, 'setSamplingInterval'); }); From a8fc0c0a4aacf94ca774597cefc8fa60e6e0ffaf Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Fri, 27 Oct 2017 17:44:53 -0700 Subject: [PATCH 015/632] chore: reorganize source code (#29) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * The output from proto file compilation is now checked into the repo. The proto compile step does not need to be run on each compile/test. Instead we can regenerate the output files whenever the proto is updated. For this to work, we needed to ensure that the relative path to the generated files remains the same between compile time and runtime – these files are needed at both times. * Reorganize the source code so that we no longer change the path relative to the root directory as part of the compilation process. * TypeScript wants all source files to be in the `rootDir` which necessitated the move of third_party/types. Hopefully we can get rid of this file completely soon. * Drop types/gcp-metadata-types.ts as gcp-metadata now ships with types. * Drop third_party from package.json/files. Not sure why it needed to shipped. * exclude build and proto directories from coverage --- handwritten/cloud-profiler/.gitignore | 2 - handwritten/cloud-profiler/package.json | 14 +- handwritten/cloud-profiler/proto/README.md | 3 + handwritten/cloud-profiler/proto/profile.d.ts | 945 ++++++ handwritten/cloud-profiler/proto/profile.js | 2989 +++++++++++++++++ .../cloud-profiler/{ => ts}/src/config.ts | 0 .../cloud-profiler/{ => ts}/src/index.ts | 0 .../cloud-profiler/{ => ts}/src/profiler.ts | 0 .../{ => ts}/src/profilers/heap-profiler.ts | 0 .../src/profilers/profile-serializer.ts | 2 +- .../{ => ts}/src/profilers/time-profiler.ts | 2 +- .../cloud-profiler/{ => ts}/src/v8-types.ts | 0 .../{ => ts}/test/fixtures/test-config.json | 0 .../{ => ts}/test/profiles-for-tests.ts | 2 +- .../{ => ts}/test/test-init-config.ts | 9 +- .../{ => ts}/test/test-profile-serializer.ts | 2 +- .../{ => ts}/test/test-time-profiler.ts | 2 +- .../{ => ts}/third_party/types/LICENSE | 0 .../{ => ts}/third_party/types/README.google | 0 .../third_party/types/common-types.ts | 0 handwritten/cloud-profiler/tsconfig.json | 8 +- 21 files changed, 3960 insertions(+), 20 deletions(-) create mode 100644 handwritten/cloud-profiler/proto/README.md create mode 100644 handwritten/cloud-profiler/proto/profile.d.ts create mode 100644 handwritten/cloud-profiler/proto/profile.js rename handwritten/cloud-profiler/{ => ts}/src/config.ts (100%) rename handwritten/cloud-profiler/{ => ts}/src/index.ts (100%) rename handwritten/cloud-profiler/{ => ts}/src/profiler.ts (100%) rename handwritten/cloud-profiler/{ => ts}/src/profilers/heap-profiler.ts (100%) rename handwritten/cloud-profiler/{ => ts}/src/profilers/profile-serializer.ts (99%) rename handwritten/cloud-profiler/{ => ts}/src/profilers/time-profiler.ts (96%) rename handwritten/cloud-profiler/{ => ts}/src/v8-types.ts (100%) rename handwritten/cloud-profiler/{ => ts}/test/fixtures/test-config.json (100%) rename handwritten/cloud-profiler/{ => ts}/test/profiles-for-tests.ts (99%) rename handwritten/cloud-profiler/{ => ts}/test/test-init-config.ts (96%) rename handwritten/cloud-profiler/{ => ts}/test/test-profile-serializer.ts (96%) rename handwritten/cloud-profiler/{ => ts}/test/test-time-profiler.ts (97%) rename handwritten/cloud-profiler/{ => ts}/third_party/types/LICENSE (100%) rename handwritten/cloud-profiler/{ => ts}/third_party/types/README.google (100%) rename handwritten/cloud-profiler/{ => ts}/third_party/types/common-types.ts (100%) diff --git a/handwritten/cloud-profiler/.gitignore b/handwritten/cloud-profiler/.gitignore index 8f21f7baddf..30f101fb652 100644 --- a/handwritten/cloud-profiler/.gitignore +++ b/handwritten/cloud-profiler/.gitignore @@ -1,5 +1,3 @@ .vscode build node_modules -src/profile.d.ts -src/profile.js diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 36550b660a0..638dc2f6c40 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -9,12 +9,12 @@ "check": "gts check", "clean": "gts clean", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json", - "compile": "npm run proto && tsc -p .", + "compile": "tsc -p .", "fix": "gts fix", "prepare": "npm run compile", "pretest": "npm run compile", "posttest": "npm run check", - "proto": "mkdir -p build/src && pbjs -t static-module -w commonjs -o src/profile.js third_party/proto/profile.proto && pbts -o src/profile.d.ts src/profile.js && cp src/profile.js build/src" + "proto:profile": "mkdir -p proto && pbjs -t static-module -w commonjs -o proto/profile.js third_party/proto/profile.proto && pbts -o proto/profile.d.ts proto/profile.js" }, "author": { "name": "Google Inc." @@ -52,10 +52,16 @@ "build/src", "build/types", "bindings", - "third_party", + "proto", "binding.gyp", "package-lock.json", "package.json", "README.md" - ] + ], + "nyc": { + "exclude": [ + "build", + "proto" + ] + } } diff --git a/handwritten/cloud-profiler/proto/README.md b/handwritten/cloud-profiler/proto/README.md new file mode 100644 index 00000000000..6fc1c9f679d --- /dev/null +++ b/handwritten/cloud-profiler/proto/README.md @@ -0,0 +1,3 @@ +Files in this directory are generated files. Do not edit. + +To regenerate, use the `proto:*` run scripts in package.json. diff --git a/handwritten/cloud-profiler/proto/profile.d.ts b/handwritten/cloud-profiler/proto/profile.d.ts new file mode 100644 index 00000000000..2be99b6880c --- /dev/null +++ b/handwritten/cloud-profiler/proto/profile.d.ts @@ -0,0 +1,945 @@ +import * as $protobuf from "protobufjs"; + +/** Namespace perftools. */ +export namespace perftools { + + /** Namespace profiles. */ + namespace profiles { + + /** Properties of a Profile. */ + interface IProfile { + + /** Profile sampleType */ + sampleType?: perftools.profiles.IValueType[]; + + /** Profile sample */ + sample?: perftools.profiles.ISample[]; + + /** Profile mapping */ + mapping?: perftools.profiles.IMapping[]; + + /** Profile location */ + location?: perftools.profiles.ILocation[]; + + /** Profile function */ + "function"?: perftools.profiles.IFunction[]; + + /** Profile stringTable */ + stringTable?: string[]; + + /** Profile dropFrames */ + dropFrames?: (number|Long); + + /** Profile keepFrames */ + keepFrames?: (number|Long); + + /** Profile timeNanos */ + timeNanos?: (number|Long); + + /** Profile durationNanos */ + durationNanos?: (number|Long); + + /** Profile periodType */ + periodType?: perftools.profiles.IValueType; + + /** Profile period */ + period?: (number|Long); + + /** Profile comment */ + comment?: (number|Long)[]; + + /** Profile defaultSampleType */ + defaultSampleType?: (number|Long); + } + + /** Represents a Profile. */ + class Profile { + + /** + * Constructs a new Profile. + * @param [properties] Properties to set + */ + constructor(properties?: perftools.profiles.IProfile); + + /** Profile sampleType. */ + public sampleType: perftools.profiles.IValueType[]; + + /** Profile sample. */ + public sample: perftools.profiles.ISample[]; + + /** Profile mapping. */ + public mapping: perftools.profiles.IMapping[]; + + /** Profile location. */ + public location: perftools.profiles.ILocation[]; + + /** Profile function. */ + public function_: perftools.profiles.IFunction[]; + + /** Profile stringTable. */ + public stringTable: string[]; + + /** Profile dropFrames. */ + public dropFrames: (number|Long); + + /** Profile keepFrames. */ + public keepFrames: (number|Long); + + /** Profile timeNanos. */ + public timeNanos: (number|Long); + + /** Profile durationNanos. */ + public durationNanos: (number|Long); + + /** Profile periodType. */ + public periodType?: (perftools.profiles.IValueType|null); + + /** Profile period. */ + public period: (number|Long); + + /** Profile comment. */ + public comment: (number|Long)[]; + + /** Profile defaultSampleType. */ + public defaultSampleType: (number|Long); + + /** + * Creates a new Profile instance using the specified properties. + * @param [properties] Properties to set + * @returns Profile instance + */ + public static create(properties?: perftools.profiles.IProfile): perftools.profiles.Profile; + + /** + * Encodes the specified Profile message. Does not implicitly {@link perftools.profiles.Profile.verify|verify} messages. + * @param message Profile message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: perftools.profiles.IProfile, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Profile message, length delimited. Does not implicitly {@link perftools.profiles.Profile.verify|verify} messages. + * @param message Profile message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: perftools.profiles.IProfile, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Profile message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Profile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): perftools.profiles.Profile; + + /** + * Decodes a Profile message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Profile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): perftools.profiles.Profile; + + /** + * Verifies a Profile message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Profile message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Profile + */ + public static fromObject(object: { [k: string]: any }): perftools.profiles.Profile; + + /** + * Creates a plain object from a Profile message. Also converts values to other types if specified. + * @param message Profile + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: perftools.profiles.Profile, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Profile to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ValueType. */ + interface IValueType { + + /** ValueType type */ + type?: (number|Long); + + /** ValueType unit */ + unit?: (number|Long); + } + + /** Represents a ValueType. */ + class ValueType { + + /** + * Constructs a new ValueType. + * @param [properties] Properties to set + */ + constructor(properties?: perftools.profiles.IValueType); + + /** ValueType type. */ + public type: (number|Long); + + /** ValueType unit. */ + public unit: (number|Long); + + /** + * Creates a new ValueType instance using the specified properties. + * @param [properties] Properties to set + * @returns ValueType instance + */ + public static create(properties?: perftools.profiles.IValueType): perftools.profiles.ValueType; + + /** + * Encodes the specified ValueType message. Does not implicitly {@link perftools.profiles.ValueType.verify|verify} messages. + * @param message ValueType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: perftools.profiles.IValueType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ValueType message, length delimited. Does not implicitly {@link perftools.profiles.ValueType.verify|verify} messages. + * @param message ValueType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: perftools.profiles.IValueType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ValueType message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ValueType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): perftools.profiles.ValueType; + + /** + * Decodes a ValueType message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ValueType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): perftools.profiles.ValueType; + + /** + * Verifies a ValueType message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ValueType message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ValueType + */ + public static fromObject(object: { [k: string]: any }): perftools.profiles.ValueType; + + /** + * Creates a plain object from a ValueType message. Also converts values to other types if specified. + * @param message ValueType + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: perftools.profiles.ValueType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ValueType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Sample. */ + interface ISample { + + /** Sample locationId */ + locationId?: (number|Long)[]; + + /** Sample value */ + value?: (number|Long)[]; + + /** Sample label */ + label?: perftools.profiles.ILabel[]; + } + + /** Represents a Sample. */ + class Sample { + + /** + * Constructs a new Sample. + * @param [properties] Properties to set + */ + constructor(properties?: perftools.profiles.ISample); + + /** Sample locationId. */ + public locationId: (number|Long)[]; + + /** Sample value. */ + public value: (number|Long)[]; + + /** Sample label. */ + public label: perftools.profiles.ILabel[]; + + /** + * Creates a new Sample instance using the specified properties. + * @param [properties] Properties to set + * @returns Sample instance + */ + public static create(properties?: perftools.profiles.ISample): perftools.profiles.Sample; + + /** + * Encodes the specified Sample message. Does not implicitly {@link perftools.profiles.Sample.verify|verify} messages. + * @param message Sample message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: perftools.profiles.ISample, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Sample message, length delimited. Does not implicitly {@link perftools.profiles.Sample.verify|verify} messages. + * @param message Sample message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: perftools.profiles.ISample, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Sample message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Sample + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): perftools.profiles.Sample; + + /** + * Decodes a Sample message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Sample + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): perftools.profiles.Sample; + + /** + * Verifies a Sample message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Sample message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Sample + */ + public static fromObject(object: { [k: string]: any }): perftools.profiles.Sample; + + /** + * Creates a plain object from a Sample message. Also converts values to other types if specified. + * @param message Sample + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: perftools.profiles.Sample, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Sample to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Label. */ + interface ILabel { + + /** Label key */ + key?: (number|Long); + + /** Label str */ + str?: (number|Long); + + /** Label num */ + num?: (number|Long); + + /** Label numUnit */ + numUnit?: (number|Long); + } + + /** Represents a Label. */ + class Label { + + /** + * Constructs a new Label. + * @param [properties] Properties to set + */ + constructor(properties?: perftools.profiles.ILabel); + + /** Label key. */ + public key: (number|Long); + + /** Label str. */ + public str: (number|Long); + + /** Label num. */ + public num: (number|Long); + + /** Label numUnit. */ + public numUnit: (number|Long); + + /** + * Creates a new Label instance using the specified properties. + * @param [properties] Properties to set + * @returns Label instance + */ + public static create(properties?: perftools.profiles.ILabel): perftools.profiles.Label; + + /** + * Encodes the specified Label message. Does not implicitly {@link perftools.profiles.Label.verify|verify} messages. + * @param message Label message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: perftools.profiles.ILabel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Label message, length delimited. Does not implicitly {@link perftools.profiles.Label.verify|verify} messages. + * @param message Label message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: perftools.profiles.ILabel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Label message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Label + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): perftools.profiles.Label; + + /** + * Decodes a Label message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Label + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): perftools.profiles.Label; + + /** + * Verifies a Label message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Label message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Label + */ + public static fromObject(object: { [k: string]: any }): perftools.profiles.Label; + + /** + * Creates a plain object from a Label message. Also converts values to other types if specified. + * @param message Label + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: perftools.profiles.Label, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Label to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Mapping. */ + interface IMapping { + + /** Mapping id */ + id?: (number|Long); + + /** Mapping memoryStart */ + memoryStart?: (number|Long); + + /** Mapping memoryLimit */ + memoryLimit?: (number|Long); + + /** Mapping fileOffset */ + fileOffset?: (number|Long); + + /** Mapping filename */ + filename?: (number|Long); + + /** Mapping buildId */ + buildId?: (number|Long); + + /** Mapping hasFunctions */ + hasFunctions?: boolean; + + /** Mapping hasFilenames */ + hasFilenames?: boolean; + + /** Mapping hasLineNumbers */ + hasLineNumbers?: boolean; + + /** Mapping hasInlineFrames */ + hasInlineFrames?: boolean; + } + + /** Represents a Mapping. */ + class Mapping { + + /** + * Constructs a new Mapping. + * @param [properties] Properties to set + */ + constructor(properties?: perftools.profiles.IMapping); + + /** Mapping id. */ + public id: (number|Long); + + /** Mapping memoryStart. */ + public memoryStart: (number|Long); + + /** Mapping memoryLimit. */ + public memoryLimit: (number|Long); + + /** Mapping fileOffset. */ + public fileOffset: (number|Long); + + /** Mapping filename. */ + public filename: (number|Long); + + /** Mapping buildId. */ + public buildId: (number|Long); + + /** Mapping hasFunctions. */ + public hasFunctions: boolean; + + /** Mapping hasFilenames. */ + public hasFilenames: boolean; + + /** Mapping hasLineNumbers. */ + public hasLineNumbers: boolean; + + /** Mapping hasInlineFrames. */ + public hasInlineFrames: boolean; + + /** + * Creates a new Mapping instance using the specified properties. + * @param [properties] Properties to set + * @returns Mapping instance + */ + public static create(properties?: perftools.profiles.IMapping): perftools.profiles.Mapping; + + /** + * Encodes the specified Mapping message. Does not implicitly {@link perftools.profiles.Mapping.verify|verify} messages. + * @param message Mapping message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: perftools.profiles.IMapping, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Mapping message, length delimited. Does not implicitly {@link perftools.profiles.Mapping.verify|verify} messages. + * @param message Mapping message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: perftools.profiles.IMapping, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Mapping message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Mapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): perftools.profiles.Mapping; + + /** + * Decodes a Mapping message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Mapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): perftools.profiles.Mapping; + + /** + * Verifies a Mapping message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Mapping message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Mapping + */ + public static fromObject(object: { [k: string]: any }): perftools.profiles.Mapping; + + /** + * Creates a plain object from a Mapping message. Also converts values to other types if specified. + * @param message Mapping + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: perftools.profiles.Mapping, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Mapping to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Location. */ + interface ILocation { + + /** Location id */ + id?: (number|Long); + + /** Location mappingId */ + mappingId?: (number|Long); + + /** Location address */ + address?: (number|Long); + + /** Location line */ + line?: perftools.profiles.ILine[]; + } + + /** Represents a Location. */ + class Location { + + /** + * Constructs a new Location. + * @param [properties] Properties to set + */ + constructor(properties?: perftools.profiles.ILocation); + + /** Location id. */ + public id: (number|Long); + + /** Location mappingId. */ + public mappingId: (number|Long); + + /** Location address. */ + public address: (number|Long); + + /** Location line. */ + public line: perftools.profiles.ILine[]; + + /** + * Creates a new Location instance using the specified properties. + * @param [properties] Properties to set + * @returns Location instance + */ + public static create(properties?: perftools.profiles.ILocation): perftools.profiles.Location; + + /** + * Encodes the specified Location message. Does not implicitly {@link perftools.profiles.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: perftools.profiles.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link perftools.profiles.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: perftools.profiles.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Location message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): perftools.profiles.Location; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): perftools.profiles.Location; + + /** + * Verifies a Location message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Location + */ + public static fromObject(object: { [k: string]: any }): perftools.profiles.Location; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @param message Location + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: perftools.profiles.Location, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Location to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Line. */ + interface ILine { + + /** Line functionId */ + functionId?: (number|Long); + + /** Line line */ + line?: (number|Long); + } + + /** Represents a Line. */ + class Line { + + /** + * Constructs a new Line. + * @param [properties] Properties to set + */ + constructor(properties?: perftools.profiles.ILine); + + /** Line functionId. */ + public functionId: (number|Long); + + /** Line line. */ + public line: (number|Long); + + /** + * Creates a new Line instance using the specified properties. + * @param [properties] Properties to set + * @returns Line instance + */ + public static create(properties?: perftools.profiles.ILine): perftools.profiles.Line; + + /** + * Encodes the specified Line message. Does not implicitly {@link perftools.profiles.Line.verify|verify} messages. + * @param message Line message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: perftools.profiles.ILine, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Line message, length delimited. Does not implicitly {@link perftools.profiles.Line.verify|verify} messages. + * @param message Line message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: perftools.profiles.ILine, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Line message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): perftools.profiles.Line; + + /** + * Decodes a Line message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): perftools.profiles.Line; + + /** + * Verifies a Line message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Line message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Line + */ + public static fromObject(object: { [k: string]: any }): perftools.profiles.Line; + + /** + * Creates a plain object from a Line message. Also converts values to other types if specified. + * @param message Line + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: perftools.profiles.Line, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Line to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Function. */ + interface IFunction { + + /** Function id */ + id?: (number|Long); + + /** Function name */ + name?: (number|Long); + + /** Function systemName */ + systemName?: (number|Long); + + /** Function filename */ + filename?: (number|Long); + + /** Function startLine */ + startLine?: (number|Long); + } + + /** Represents a Function. */ + class Function { + + /** + * Constructs a new Function. + * @param [properties] Properties to set + */ + constructor(properties?: perftools.profiles.IFunction); + + /** Function id. */ + public id: (number|Long); + + /** Function name. */ + public name: (number|Long); + + /** Function systemName. */ + public systemName: (number|Long); + + /** Function filename. */ + public filename: (number|Long); + + /** Function startLine. */ + public startLine: (number|Long); + + /** + * Creates a new Function instance using the specified properties. + * @param [properties] Properties to set + * @returns Function instance + */ + public static create(properties?: perftools.profiles.IFunction): perftools.profiles.Function; + + /** + * Encodes the specified Function message. Does not implicitly {@link perftools.profiles.Function.verify|verify} messages. + * @param message Function message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: perftools.profiles.IFunction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Function message, length delimited. Does not implicitly {@link perftools.profiles.Function.verify|verify} messages. + * @param message Function message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: perftools.profiles.IFunction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Function message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): perftools.profiles.Function; + + /** + * Decodes a Function message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): perftools.profiles.Function; + + /** + * Verifies a Function message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Function message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Function + */ + public static fromObject(object: { [k: string]: any }): perftools.profiles.Function; + + /** + * Creates a plain object from a Function message. Also converts values to other types if specified. + * @param message Function + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: perftools.profiles.Function, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Function to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } +} diff --git a/handwritten/cloud-profiler/proto/profile.js b/handwritten/cloud-profiler/proto/profile.js new file mode 100644 index 00000000000..78877771e56 --- /dev/null +++ b/handwritten/cloud-profiler/proto/profile.js @@ -0,0 +1,2989 @@ +/*eslint-disable block-scoped-var, no-redeclare, no-control-regex, no-prototype-builtins*/ +"use strict"; + +var $protobuf = require("protobufjs/minimal"); + +// Common aliases +var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + +// Exported root namespace +var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + +$root.perftools = (function() { + + /** + * Namespace perftools. + * @exports perftools + * @namespace + */ + var perftools = {}; + + perftools.profiles = (function() { + + /** + * Namespace profiles. + * @memberof perftools + * @namespace + */ + var profiles = {}; + + profiles.Profile = (function() { + + /** + * Properties of a Profile. + * @memberof perftools.profiles + * @interface IProfile + * @property {Array.} [sampleType] Profile sampleType + * @property {Array.} [sample] Profile sample + * @property {Array.} [mapping] Profile mapping + * @property {Array.} [location] Profile location + * @property {Array.} ["function"] Profile function + * @property {Array.} [stringTable] Profile stringTable + * @property {number|Long} [dropFrames] Profile dropFrames + * @property {number|Long} [keepFrames] Profile keepFrames + * @property {number|Long} [timeNanos] Profile timeNanos + * @property {number|Long} [durationNanos] Profile durationNanos + * @property {perftools.profiles.IValueType} [periodType] Profile periodType + * @property {number|Long} [period] Profile period + * @property {Array.} [comment] Profile comment + * @property {number|Long} [defaultSampleType] Profile defaultSampleType + */ + + /** + * Constructs a new Profile. + * @memberof perftools.profiles + * @classdesc Represents a Profile. + * @constructor + * @param {perftools.profiles.IProfile=} [properties] Properties to set + */ + function Profile(properties) { + this.sampleType = []; + this.sample = []; + this.mapping = []; + this.location = []; + this["function"] = []; + this.stringTable = []; + this.comment = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Profile sampleType. + * @member {Array.}sampleType + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.sampleType = $util.emptyArray; + + /** + * Profile sample. + * @member {Array.}sample + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.sample = $util.emptyArray; + + /** + * Profile mapping. + * @member {Array.}mapping + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.mapping = $util.emptyArray; + + /** + * Profile location. + * @member {Array.}location + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.location = $util.emptyArray; + + /** + * Profile function. + * @member {Array.}function_ + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype["function"] = $util.emptyArray; + + /** + * Profile stringTable. + * @member {Array.}stringTable + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.stringTable = $util.emptyArray; + + /** + * Profile dropFrames. + * @member {number|Long}dropFrames + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.dropFrames = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Profile keepFrames. + * @member {number|Long}keepFrames + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.keepFrames = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Profile timeNanos. + * @member {number|Long}timeNanos + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.timeNanos = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Profile durationNanos. + * @member {number|Long}durationNanos + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.durationNanos = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Profile periodType. + * @member {(perftools.profiles.IValueType|null|undefined)}periodType + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.periodType = null; + + /** + * Profile period. + * @member {number|Long}period + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.period = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Profile comment. + * @member {Array.}comment + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.comment = $util.emptyArray; + + /** + * Profile defaultSampleType. + * @member {number|Long}defaultSampleType + * @memberof perftools.profiles.Profile + * @instance + */ + Profile.prototype.defaultSampleType = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Profile instance using the specified properties. + * @function create + * @memberof perftools.profiles.Profile + * @static + * @param {perftools.profiles.IProfile=} [properties] Properties to set + * @returns {perftools.profiles.Profile} Profile instance + */ + Profile.create = function create(properties) { + return new Profile(properties); + }; + + /** + * Encodes the specified Profile message. Does not implicitly {@link perftools.profiles.Profile.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.Profile + * @static + * @param {perftools.profiles.IProfile} message Profile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Profile.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sampleType != null && message.sampleType.length) + for (var i = 0; i < message.sampleType.length; ++i) + $root.perftools.profiles.ValueType.encode(message.sampleType[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.sample != null && message.sample.length) + for (var i = 0; i < message.sample.length; ++i) + $root.perftools.profiles.Sample.encode(message.sample[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.mapping != null && message.mapping.length) + for (var i = 0; i < message.mapping.length; ++i) + $root.perftools.profiles.Mapping.encode(message.mapping[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.location != null && message.location.length) + for (var i = 0; i < message.location.length; ++i) + $root.perftools.profiles.Location.encode(message.location[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message["function"] != null && message["function"].length) + for (var i = 0; i < message["function"].length; ++i) + $root.perftools.profiles.Function.encode(message["function"][i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.stringTable != null && message.stringTable.length) + for (var i = 0; i < message.stringTable.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.stringTable[i]); + if (message.dropFrames != null && message.hasOwnProperty("dropFrames")) + writer.uint32(/* id 7, wireType 0 =*/56).int64(message.dropFrames); + if (message.keepFrames != null && message.hasOwnProperty("keepFrames")) + writer.uint32(/* id 8, wireType 0 =*/64).int64(message.keepFrames); + if (message.timeNanos != null && message.hasOwnProperty("timeNanos")) + writer.uint32(/* id 9, wireType 0 =*/72).int64(message.timeNanos); + if (message.durationNanos != null && message.hasOwnProperty("durationNanos")) + writer.uint32(/* id 10, wireType 0 =*/80).int64(message.durationNanos); + if (message.periodType != null && message.hasOwnProperty("periodType")) + $root.perftools.profiles.ValueType.encode(message.periodType, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.period != null && message.hasOwnProperty("period")) + writer.uint32(/* id 12, wireType 0 =*/96).int64(message.period); + if (message.comment != null && message.comment.length) { + writer.uint32(/* id 13, wireType 2 =*/106).fork(); + for (var i = 0; i < message.comment.length; ++i) + writer.int64(message.comment[i]); + writer.ldelim(); + } + if (message.defaultSampleType != null && message.hasOwnProperty("defaultSampleType")) + writer.uint32(/* id 14, wireType 0 =*/112).int64(message.defaultSampleType); + return writer; + }; + + /** + * Encodes the specified Profile message, length delimited. Does not implicitly {@link perftools.profiles.Profile.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.Profile + * @static + * @param {perftools.profiles.IProfile} message Profile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Profile.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Profile message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.Profile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.Profile} Profile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Profile.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.Profile(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.sampleType && message.sampleType.length)) + message.sampleType = []; + message.sampleType.push($root.perftools.profiles.ValueType.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.sample && message.sample.length)) + message.sample = []; + message.sample.push($root.perftools.profiles.Sample.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.mapping && message.mapping.length)) + message.mapping = []; + message.mapping.push($root.perftools.profiles.Mapping.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.location && message.location.length)) + message.location = []; + message.location.push($root.perftools.profiles.Location.decode(reader, reader.uint32())); + break; + case 5: + if (!(message["function"] && message["function"].length)) + message["function"] = []; + message["function"].push($root.perftools.profiles.Function.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.stringTable && message.stringTable.length)) + message.stringTable = []; + message.stringTable.push(reader.string()); + break; + case 7: + message.dropFrames = reader.int64(); + break; + case 8: + message.keepFrames = reader.int64(); + break; + case 9: + message.timeNanos = reader.int64(); + break; + case 10: + message.durationNanos = reader.int64(); + break; + case 11: + message.periodType = $root.perftools.profiles.ValueType.decode(reader, reader.uint32()); + break; + case 12: + message.period = reader.int64(); + break; + case 13: + if (!(message.comment && message.comment.length)) + message.comment = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.comment.push(reader.int64()); + } else + message.comment.push(reader.int64()); + break; + case 14: + message.defaultSampleType = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Profile message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.Profile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.Profile} Profile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Profile.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Profile message. + * @function verify + * @memberof perftools.profiles.Profile + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Profile.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sampleType != null && message.hasOwnProperty("sampleType")) { + if (!Array.isArray(message.sampleType)) + return "sampleType: array expected"; + for (var i = 0; i < message.sampleType.length; ++i) { + var error = $root.perftools.profiles.ValueType.verify(message.sampleType[i]); + if (error) + return "sampleType." + error; + } + } + if (message.sample != null && message.hasOwnProperty("sample")) { + if (!Array.isArray(message.sample)) + return "sample: array expected"; + for (var i = 0; i < message.sample.length; ++i) { + error = $root.perftools.profiles.Sample.verify(message.sample[i]); + if (error) + return "sample." + error; + } + } + if (message.mapping != null && message.hasOwnProperty("mapping")) { + if (!Array.isArray(message.mapping)) + return "mapping: array expected"; + for (var i = 0; i < message.mapping.length; ++i) { + error = $root.perftools.profiles.Mapping.verify(message.mapping[i]); + if (error) + return "mapping." + error; + } + } + if (message.location != null && message.hasOwnProperty("location")) { + if (!Array.isArray(message.location)) + return "location: array expected"; + for (var i = 0; i < message.location.length; ++i) { + error = $root.perftools.profiles.Location.verify(message.location[i]); + if (error) + return "location." + error; + } + } + if (message["function"] != null && message.hasOwnProperty("function")) { + if (!Array.isArray(message["function"])) + return "function: array expected"; + for (var i = 0; i < message["function"].length; ++i) { + error = $root.perftools.profiles.Function.verify(message["function"][i]); + if (error) + return "function." + error; + } + } + if (message.stringTable != null && message.hasOwnProperty("stringTable")) { + if (!Array.isArray(message.stringTable)) + return "stringTable: array expected"; + for (var i = 0; i < message.stringTable.length; ++i) + if (!$util.isString(message.stringTable[i])) + return "stringTable: string[] expected"; + } + if (message.dropFrames != null && message.hasOwnProperty("dropFrames")) + if (!$util.isInteger(message.dropFrames) && !(message.dropFrames && $util.isInteger(message.dropFrames.low) && $util.isInteger(message.dropFrames.high))) + return "dropFrames: integer|Long expected"; + if (message.keepFrames != null && message.hasOwnProperty("keepFrames")) + if (!$util.isInteger(message.keepFrames) && !(message.keepFrames && $util.isInteger(message.keepFrames.low) && $util.isInteger(message.keepFrames.high))) + return "keepFrames: integer|Long expected"; + if (message.timeNanos != null && message.hasOwnProperty("timeNanos")) + if (!$util.isInteger(message.timeNanos) && !(message.timeNanos && $util.isInteger(message.timeNanos.low) && $util.isInteger(message.timeNanos.high))) + return "timeNanos: integer|Long expected"; + if (message.durationNanos != null && message.hasOwnProperty("durationNanos")) + if (!$util.isInteger(message.durationNanos) && !(message.durationNanos && $util.isInteger(message.durationNanos.low) && $util.isInteger(message.durationNanos.high))) + return "durationNanos: integer|Long expected"; + if (message.periodType != null && message.hasOwnProperty("periodType")) { + error = $root.perftools.profiles.ValueType.verify(message.periodType); + if (error) + return "periodType." + error; + } + if (message.period != null && message.hasOwnProperty("period")) + if (!$util.isInteger(message.period) && !(message.period && $util.isInteger(message.period.low) && $util.isInteger(message.period.high))) + return "period: integer|Long expected"; + if (message.comment != null && message.hasOwnProperty("comment")) { + if (!Array.isArray(message.comment)) + return "comment: array expected"; + for (var i = 0; i < message.comment.length; ++i) + if (!$util.isInteger(message.comment[i]) && !(message.comment[i] && $util.isInteger(message.comment[i].low) && $util.isInteger(message.comment[i].high))) + return "comment: integer|Long[] expected"; + } + if (message.defaultSampleType != null && message.hasOwnProperty("defaultSampleType")) + if (!$util.isInteger(message.defaultSampleType) && !(message.defaultSampleType && $util.isInteger(message.defaultSampleType.low) && $util.isInteger(message.defaultSampleType.high))) + return "defaultSampleType: integer|Long expected"; + return null; + }; + + /** + * Creates a Profile message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.Profile + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.Profile} Profile + */ + Profile.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.Profile) + return object; + var message = new $root.perftools.profiles.Profile(); + if (object.sampleType) { + if (!Array.isArray(object.sampleType)) + throw TypeError(".perftools.profiles.Profile.sampleType: array expected"); + message.sampleType = []; + for (var i = 0; i < object.sampleType.length; ++i) { + if (typeof object.sampleType[i] !== "object") + throw TypeError(".perftools.profiles.Profile.sampleType: object expected"); + message.sampleType[i] = $root.perftools.profiles.ValueType.fromObject(object.sampleType[i]); + } + } + if (object.sample) { + if (!Array.isArray(object.sample)) + throw TypeError(".perftools.profiles.Profile.sample: array expected"); + message.sample = []; + for (var i = 0; i < object.sample.length; ++i) { + if (typeof object.sample[i] !== "object") + throw TypeError(".perftools.profiles.Profile.sample: object expected"); + message.sample[i] = $root.perftools.profiles.Sample.fromObject(object.sample[i]); + } + } + if (object.mapping) { + if (!Array.isArray(object.mapping)) + throw TypeError(".perftools.profiles.Profile.mapping: array expected"); + message.mapping = []; + for (var i = 0; i < object.mapping.length; ++i) { + if (typeof object.mapping[i] !== "object") + throw TypeError(".perftools.profiles.Profile.mapping: object expected"); + message.mapping[i] = $root.perftools.profiles.Mapping.fromObject(object.mapping[i]); + } + } + if (object.location) { + if (!Array.isArray(object.location)) + throw TypeError(".perftools.profiles.Profile.location: array expected"); + message.location = []; + for (var i = 0; i < object.location.length; ++i) { + if (typeof object.location[i] !== "object") + throw TypeError(".perftools.profiles.Profile.location: object expected"); + message.location[i] = $root.perftools.profiles.Location.fromObject(object.location[i]); + } + } + if (object["function"]) { + if (!Array.isArray(object["function"])) + throw TypeError(".perftools.profiles.Profile.function: array expected"); + message["function"] = []; + for (var i = 0; i < object["function"].length; ++i) { + if (typeof object["function"][i] !== "object") + throw TypeError(".perftools.profiles.Profile.function: object expected"); + message["function"][i] = $root.perftools.profiles.Function.fromObject(object["function"][i]); + } + } + if (object.stringTable) { + if (!Array.isArray(object.stringTable)) + throw TypeError(".perftools.profiles.Profile.stringTable: array expected"); + message.stringTable = []; + for (var i = 0; i < object.stringTable.length; ++i) + message.stringTable[i] = String(object.stringTable[i]); + } + if (object.dropFrames != null) + if ($util.Long) + (message.dropFrames = $util.Long.fromValue(object.dropFrames)).unsigned = false; + else if (typeof object.dropFrames === "string") + message.dropFrames = parseInt(object.dropFrames, 10); + else if (typeof object.dropFrames === "number") + message.dropFrames = object.dropFrames; + else if (typeof object.dropFrames === "object") + message.dropFrames = new $util.LongBits(object.dropFrames.low >>> 0, object.dropFrames.high >>> 0).toNumber(); + if (object.keepFrames != null) + if ($util.Long) + (message.keepFrames = $util.Long.fromValue(object.keepFrames)).unsigned = false; + else if (typeof object.keepFrames === "string") + message.keepFrames = parseInt(object.keepFrames, 10); + else if (typeof object.keepFrames === "number") + message.keepFrames = object.keepFrames; + else if (typeof object.keepFrames === "object") + message.keepFrames = new $util.LongBits(object.keepFrames.low >>> 0, object.keepFrames.high >>> 0).toNumber(); + if (object.timeNanos != null) + if ($util.Long) + (message.timeNanos = $util.Long.fromValue(object.timeNanos)).unsigned = false; + else if (typeof object.timeNanos === "string") + message.timeNanos = parseInt(object.timeNanos, 10); + else if (typeof object.timeNanos === "number") + message.timeNanos = object.timeNanos; + else if (typeof object.timeNanos === "object") + message.timeNanos = new $util.LongBits(object.timeNanos.low >>> 0, object.timeNanos.high >>> 0).toNumber(); + if (object.durationNanos != null) + if ($util.Long) + (message.durationNanos = $util.Long.fromValue(object.durationNanos)).unsigned = false; + else if (typeof object.durationNanos === "string") + message.durationNanos = parseInt(object.durationNanos, 10); + else if (typeof object.durationNanos === "number") + message.durationNanos = object.durationNanos; + else if (typeof object.durationNanos === "object") + message.durationNanos = new $util.LongBits(object.durationNanos.low >>> 0, object.durationNanos.high >>> 0).toNumber(); + if (object.periodType != null) { + if (typeof object.periodType !== "object") + throw TypeError(".perftools.profiles.Profile.periodType: object expected"); + message.periodType = $root.perftools.profiles.ValueType.fromObject(object.periodType); + } + if (object.period != null) + if ($util.Long) + (message.period = $util.Long.fromValue(object.period)).unsigned = false; + else if (typeof object.period === "string") + message.period = parseInt(object.period, 10); + else if (typeof object.period === "number") + message.period = object.period; + else if (typeof object.period === "object") + message.period = new $util.LongBits(object.period.low >>> 0, object.period.high >>> 0).toNumber(); + if (object.comment) { + if (!Array.isArray(object.comment)) + throw TypeError(".perftools.profiles.Profile.comment: array expected"); + message.comment = []; + for (var i = 0; i < object.comment.length; ++i) + if ($util.Long) + (message.comment[i] = $util.Long.fromValue(object.comment[i])).unsigned = false; + else if (typeof object.comment[i] === "string") + message.comment[i] = parseInt(object.comment[i], 10); + else if (typeof object.comment[i] === "number") + message.comment[i] = object.comment[i]; + else if (typeof object.comment[i] === "object") + message.comment[i] = new $util.LongBits(object.comment[i].low >>> 0, object.comment[i].high >>> 0).toNumber(); + } + if (object.defaultSampleType != null) + if ($util.Long) + (message.defaultSampleType = $util.Long.fromValue(object.defaultSampleType)).unsigned = false; + else if (typeof object.defaultSampleType === "string") + message.defaultSampleType = parseInt(object.defaultSampleType, 10); + else if (typeof object.defaultSampleType === "number") + message.defaultSampleType = object.defaultSampleType; + else if (typeof object.defaultSampleType === "object") + message.defaultSampleType = new $util.LongBits(object.defaultSampleType.low >>> 0, object.defaultSampleType.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a Profile message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.Profile + * @static + * @param {perftools.profiles.Profile} message Profile + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Profile.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.sampleType = []; + object.sample = []; + object.mapping = []; + object.location = []; + object["function"] = []; + object.stringTable = []; + object.comment = []; + } + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.dropFrames = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.dropFrames = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.keepFrames = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.keepFrames = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.timeNanos = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timeNanos = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.durationNanos = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.durationNanos = options.longs === String ? "0" : 0; + object.periodType = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.period = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.defaultSampleType = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.defaultSampleType = options.longs === String ? "0" : 0; + } + if (message.sampleType && message.sampleType.length) { + object.sampleType = []; + for (var j = 0; j < message.sampleType.length; ++j) + object.sampleType[j] = $root.perftools.profiles.ValueType.toObject(message.sampleType[j], options); + } + if (message.sample && message.sample.length) { + object.sample = []; + for (var j = 0; j < message.sample.length; ++j) + object.sample[j] = $root.perftools.profiles.Sample.toObject(message.sample[j], options); + } + if (message.mapping && message.mapping.length) { + object.mapping = []; + for (var j = 0; j < message.mapping.length; ++j) + object.mapping[j] = $root.perftools.profiles.Mapping.toObject(message.mapping[j], options); + } + if (message.location && message.location.length) { + object.location = []; + for (var j = 0; j < message.location.length; ++j) + object.location[j] = $root.perftools.profiles.Location.toObject(message.location[j], options); + } + if (message["function"] && message["function"].length) { + object["function"] = []; + for (var j = 0; j < message["function"].length; ++j) + object["function"][j] = $root.perftools.profiles.Function.toObject(message["function"][j], options); + } + if (message.stringTable && message.stringTable.length) { + object.stringTable = []; + for (var j = 0; j < message.stringTable.length; ++j) + object.stringTable[j] = message.stringTable[j]; + } + if (message.dropFrames != null && message.hasOwnProperty("dropFrames")) + if (typeof message.dropFrames === "number") + object.dropFrames = options.longs === String ? String(message.dropFrames) : message.dropFrames; + else + object.dropFrames = options.longs === String ? $util.Long.prototype.toString.call(message.dropFrames) : options.longs === Number ? new $util.LongBits(message.dropFrames.low >>> 0, message.dropFrames.high >>> 0).toNumber() : message.dropFrames; + if (message.keepFrames != null && message.hasOwnProperty("keepFrames")) + if (typeof message.keepFrames === "number") + object.keepFrames = options.longs === String ? String(message.keepFrames) : message.keepFrames; + else + object.keepFrames = options.longs === String ? $util.Long.prototype.toString.call(message.keepFrames) : options.longs === Number ? new $util.LongBits(message.keepFrames.low >>> 0, message.keepFrames.high >>> 0).toNumber() : message.keepFrames; + if (message.timeNanos != null && message.hasOwnProperty("timeNanos")) + if (typeof message.timeNanos === "number") + object.timeNanos = options.longs === String ? String(message.timeNanos) : message.timeNanos; + else + object.timeNanos = options.longs === String ? $util.Long.prototype.toString.call(message.timeNanos) : options.longs === Number ? new $util.LongBits(message.timeNanos.low >>> 0, message.timeNanos.high >>> 0).toNumber() : message.timeNanos; + if (message.durationNanos != null && message.hasOwnProperty("durationNanos")) + if (typeof message.durationNanos === "number") + object.durationNanos = options.longs === String ? String(message.durationNanos) : message.durationNanos; + else + object.durationNanos = options.longs === String ? $util.Long.prototype.toString.call(message.durationNanos) : options.longs === Number ? new $util.LongBits(message.durationNanos.low >>> 0, message.durationNanos.high >>> 0).toNumber() : message.durationNanos; + if (message.periodType != null && message.hasOwnProperty("periodType")) + object.periodType = $root.perftools.profiles.ValueType.toObject(message.periodType, options); + if (message.period != null && message.hasOwnProperty("period")) + if (typeof message.period === "number") + object.period = options.longs === String ? String(message.period) : message.period; + else + object.period = options.longs === String ? $util.Long.prototype.toString.call(message.period) : options.longs === Number ? new $util.LongBits(message.period.low >>> 0, message.period.high >>> 0).toNumber() : message.period; + if (message.comment && message.comment.length) { + object.comment = []; + for (var j = 0; j < message.comment.length; ++j) + if (typeof message.comment[j] === "number") + object.comment[j] = options.longs === String ? String(message.comment[j]) : message.comment[j]; + else + object.comment[j] = options.longs === String ? $util.Long.prototype.toString.call(message.comment[j]) : options.longs === Number ? new $util.LongBits(message.comment[j].low >>> 0, message.comment[j].high >>> 0).toNumber() : message.comment[j]; + } + if (message.defaultSampleType != null && message.hasOwnProperty("defaultSampleType")) + if (typeof message.defaultSampleType === "number") + object.defaultSampleType = options.longs === String ? String(message.defaultSampleType) : message.defaultSampleType; + else + object.defaultSampleType = options.longs === String ? $util.Long.prototype.toString.call(message.defaultSampleType) : options.longs === Number ? new $util.LongBits(message.defaultSampleType.low >>> 0, message.defaultSampleType.high >>> 0).toNumber() : message.defaultSampleType; + return object; + }; + + /** + * Converts this Profile to JSON. + * @function toJSON + * @memberof perftools.profiles.Profile + * @instance + * @returns {Object.} JSON object + */ + Profile.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Profile; + })(); + + profiles.ValueType = (function() { + + /** + * Properties of a ValueType. + * @memberof perftools.profiles + * @interface IValueType + * @property {number|Long} [type] ValueType type + * @property {number|Long} [unit] ValueType unit + */ + + /** + * Constructs a new ValueType. + * @memberof perftools.profiles + * @classdesc Represents a ValueType. + * @constructor + * @param {perftools.profiles.IValueType=} [properties] Properties to set + */ + function ValueType(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValueType type. + * @member {number|Long}type + * @memberof perftools.profiles.ValueType + * @instance + */ + ValueType.prototype.type = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ValueType unit. + * @member {number|Long}unit + * @memberof perftools.profiles.ValueType + * @instance + */ + ValueType.prototype.unit = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new ValueType instance using the specified properties. + * @function create + * @memberof perftools.profiles.ValueType + * @static + * @param {perftools.profiles.IValueType=} [properties] Properties to set + * @returns {perftools.profiles.ValueType} ValueType instance + */ + ValueType.create = function create(properties) { + return new ValueType(properties); + }; + + /** + * Encodes the specified ValueType message. Does not implicitly {@link perftools.profiles.ValueType.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.ValueType + * @static + * @param {perftools.profiles.IValueType} message ValueType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValueType.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.type); + if (message.unit != null && message.hasOwnProperty("unit")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unit); + return writer; + }; + + /** + * Encodes the specified ValueType message, length delimited. Does not implicitly {@link perftools.profiles.ValueType.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.ValueType + * @static + * @param {perftools.profiles.IValueType} message ValueType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValueType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValueType message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.ValueType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.ValueType} ValueType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValueType.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.ValueType(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.int64(); + break; + case 2: + message.unit = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValueType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.ValueType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.ValueType} ValueType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValueType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValueType message. + * @function verify + * @memberof perftools.profiles.ValueType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValueType.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isInteger(message.type) && !(message.type && $util.isInteger(message.type.low) && $util.isInteger(message.type.high))) + return "type: integer|Long expected"; + if (message.unit != null && message.hasOwnProperty("unit")) + if (!$util.isInteger(message.unit) && !(message.unit && $util.isInteger(message.unit.low) && $util.isInteger(message.unit.high))) + return "unit: integer|Long expected"; + return null; + }; + + /** + * Creates a ValueType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.ValueType + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.ValueType} ValueType + */ + ValueType.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.ValueType) + return object; + var message = new $root.perftools.profiles.ValueType(); + if (object.type != null) + if ($util.Long) + (message.type = $util.Long.fromValue(object.type)).unsigned = false; + else if (typeof object.type === "string") + message.type = parseInt(object.type, 10); + else if (typeof object.type === "number") + message.type = object.type; + else if (typeof object.type === "object") + message.type = new $util.LongBits(object.type.low >>> 0, object.type.high >>> 0).toNumber(); + if (object.unit != null) + if ($util.Long) + (message.unit = $util.Long.fromValue(object.unit)).unsigned = false; + else if (typeof object.unit === "string") + message.unit = parseInt(object.unit, 10); + else if (typeof object.unit === "number") + message.unit = object.unit; + else if (typeof object.unit === "object") + message.unit = new $util.LongBits(object.unit.low >>> 0, object.unit.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ValueType message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.ValueType + * @static + * @param {perftools.profiles.ValueType} message ValueType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValueType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.type = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.type = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.unit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.unit = options.longs === String ? "0" : 0; + } + if (message.type != null && message.hasOwnProperty("type")) + if (typeof message.type === "number") + object.type = options.longs === String ? String(message.type) : message.type; + else + object.type = options.longs === String ? $util.Long.prototype.toString.call(message.type) : options.longs === Number ? new $util.LongBits(message.type.low >>> 0, message.type.high >>> 0).toNumber() : message.type; + if (message.unit != null && message.hasOwnProperty("unit")) + if (typeof message.unit === "number") + object.unit = options.longs === String ? String(message.unit) : message.unit; + else + object.unit = options.longs === String ? $util.Long.prototype.toString.call(message.unit) : options.longs === Number ? new $util.LongBits(message.unit.low >>> 0, message.unit.high >>> 0).toNumber() : message.unit; + return object; + }; + + /** + * Converts this ValueType to JSON. + * @function toJSON + * @memberof perftools.profiles.ValueType + * @instance + * @returns {Object.} JSON object + */ + ValueType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValueType; + })(); + + profiles.Sample = (function() { + + /** + * Properties of a Sample. + * @memberof perftools.profiles + * @interface ISample + * @property {Array.} [locationId] Sample locationId + * @property {Array.} [value] Sample value + * @property {Array.} [label] Sample label + */ + + /** + * Constructs a new Sample. + * @memberof perftools.profiles + * @classdesc Represents a Sample. + * @constructor + * @param {perftools.profiles.ISample=} [properties] Properties to set + */ + function Sample(properties) { + this.locationId = []; + this.value = []; + this.label = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Sample locationId. + * @member {Array.}locationId + * @memberof perftools.profiles.Sample + * @instance + */ + Sample.prototype.locationId = $util.emptyArray; + + /** + * Sample value. + * @member {Array.}value + * @memberof perftools.profiles.Sample + * @instance + */ + Sample.prototype.value = $util.emptyArray; + + /** + * Sample label. + * @member {Array.}label + * @memberof perftools.profiles.Sample + * @instance + */ + Sample.prototype.label = $util.emptyArray; + + /** + * Creates a new Sample instance using the specified properties. + * @function create + * @memberof perftools.profiles.Sample + * @static + * @param {perftools.profiles.ISample=} [properties] Properties to set + * @returns {perftools.profiles.Sample} Sample instance + */ + Sample.create = function create(properties) { + return new Sample(properties); + }; + + /** + * Encodes the specified Sample message. Does not implicitly {@link perftools.profiles.Sample.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.Sample + * @static + * @param {perftools.profiles.ISample} message Sample message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Sample.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.locationId != null && message.locationId.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.locationId.length; ++i) + writer.uint64(message.locationId[i]); + writer.ldelim(); + } + if (message.value != null && message.value.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.value.length; ++i) + writer.int64(message.value[i]); + writer.ldelim(); + } + if (message.label != null && message.label.length) + for (var i = 0; i < message.label.length; ++i) + $root.perftools.profiles.Label.encode(message.label[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Sample message, length delimited. Does not implicitly {@link perftools.profiles.Sample.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.Sample + * @static + * @param {perftools.profiles.ISample} message Sample message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Sample.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Sample message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.Sample + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.Sample} Sample + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Sample.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.Sample(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.locationId && message.locationId.length)) + message.locationId = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.locationId.push(reader.uint64()); + } else + message.locationId.push(reader.uint64()); + break; + case 2: + if (!(message.value && message.value.length)) + message.value = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.value.push(reader.int64()); + } else + message.value.push(reader.int64()); + break; + case 3: + if (!(message.label && message.label.length)) + message.label = []; + message.label.push($root.perftools.profiles.Label.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Sample message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.Sample + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.Sample} Sample + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Sample.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Sample message. + * @function verify + * @memberof perftools.profiles.Sample + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Sample.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.locationId != null && message.hasOwnProperty("locationId")) { + if (!Array.isArray(message.locationId)) + return "locationId: array expected"; + for (var i = 0; i < message.locationId.length; ++i) + if (!$util.isInteger(message.locationId[i]) && !(message.locationId[i] && $util.isInteger(message.locationId[i].low) && $util.isInteger(message.locationId[i].high))) + return "locationId: integer|Long[] expected"; + } + if (message.value != null && message.hasOwnProperty("value")) { + if (!Array.isArray(message.value)) + return "value: array expected"; + for (var i = 0; i < message.value.length; ++i) + if (!$util.isInteger(message.value[i]) && !(message.value[i] && $util.isInteger(message.value[i].low) && $util.isInteger(message.value[i].high))) + return "value: integer|Long[] expected"; + } + if (message.label != null && message.hasOwnProperty("label")) { + if (!Array.isArray(message.label)) + return "label: array expected"; + for (var i = 0; i < message.label.length; ++i) { + var error = $root.perftools.profiles.Label.verify(message.label[i]); + if (error) + return "label." + error; + } + } + return null; + }; + + /** + * Creates a Sample message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.Sample + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.Sample} Sample + */ + Sample.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.Sample) + return object; + var message = new $root.perftools.profiles.Sample(); + if (object.locationId) { + if (!Array.isArray(object.locationId)) + throw TypeError(".perftools.profiles.Sample.locationId: array expected"); + message.locationId = []; + for (var i = 0; i < object.locationId.length; ++i) + if ($util.Long) + (message.locationId[i] = $util.Long.fromValue(object.locationId[i])).unsigned = true; + else if (typeof object.locationId[i] === "string") + message.locationId[i] = parseInt(object.locationId[i], 10); + else if (typeof object.locationId[i] === "number") + message.locationId[i] = object.locationId[i]; + else if (typeof object.locationId[i] === "object") + message.locationId[i] = new $util.LongBits(object.locationId[i].low >>> 0, object.locationId[i].high >>> 0).toNumber(true); + } + if (object.value) { + if (!Array.isArray(object.value)) + throw TypeError(".perftools.profiles.Sample.value: array expected"); + message.value = []; + for (var i = 0; i < object.value.length; ++i) + if ($util.Long) + (message.value[i] = $util.Long.fromValue(object.value[i])).unsigned = false; + else if (typeof object.value[i] === "string") + message.value[i] = parseInt(object.value[i], 10); + else if (typeof object.value[i] === "number") + message.value[i] = object.value[i]; + else if (typeof object.value[i] === "object") + message.value[i] = new $util.LongBits(object.value[i].low >>> 0, object.value[i].high >>> 0).toNumber(); + } + if (object.label) { + if (!Array.isArray(object.label)) + throw TypeError(".perftools.profiles.Sample.label: array expected"); + message.label = []; + for (var i = 0; i < object.label.length; ++i) { + if (typeof object.label[i] !== "object") + throw TypeError(".perftools.profiles.Sample.label: object expected"); + message.label[i] = $root.perftools.profiles.Label.fromObject(object.label[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Sample message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.Sample + * @static + * @param {perftools.profiles.Sample} message Sample + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Sample.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.locationId = []; + object.value = []; + object.label = []; + } + if (message.locationId && message.locationId.length) { + object.locationId = []; + for (var j = 0; j < message.locationId.length; ++j) + if (typeof message.locationId[j] === "number") + object.locationId[j] = options.longs === String ? String(message.locationId[j]) : message.locationId[j]; + else + object.locationId[j] = options.longs === String ? $util.Long.prototype.toString.call(message.locationId[j]) : options.longs === Number ? new $util.LongBits(message.locationId[j].low >>> 0, message.locationId[j].high >>> 0).toNumber(true) : message.locationId[j]; + } + if (message.value && message.value.length) { + object.value = []; + for (var j = 0; j < message.value.length; ++j) + if (typeof message.value[j] === "number") + object.value[j] = options.longs === String ? String(message.value[j]) : message.value[j]; + else + object.value[j] = options.longs === String ? $util.Long.prototype.toString.call(message.value[j]) : options.longs === Number ? new $util.LongBits(message.value[j].low >>> 0, message.value[j].high >>> 0).toNumber() : message.value[j]; + } + if (message.label && message.label.length) { + object.label = []; + for (var j = 0; j < message.label.length; ++j) + object.label[j] = $root.perftools.profiles.Label.toObject(message.label[j], options); + } + return object; + }; + + /** + * Converts this Sample to JSON. + * @function toJSON + * @memberof perftools.profiles.Sample + * @instance + * @returns {Object.} JSON object + */ + Sample.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Sample; + })(); + + profiles.Label = (function() { + + /** + * Properties of a Label. + * @memberof perftools.profiles + * @interface ILabel + * @property {number|Long} [key] Label key + * @property {number|Long} [str] Label str + * @property {number|Long} [num] Label num + * @property {number|Long} [numUnit] Label numUnit + */ + + /** + * Constructs a new Label. + * @memberof perftools.profiles + * @classdesc Represents a Label. + * @constructor + * @param {perftools.profiles.ILabel=} [properties] Properties to set + */ + function Label(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Label key. + * @member {number|Long}key + * @memberof perftools.profiles.Label + * @instance + */ + Label.prototype.key = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Label str. + * @member {number|Long}str + * @memberof perftools.profiles.Label + * @instance + */ + Label.prototype.str = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Label num. + * @member {number|Long}num + * @memberof perftools.profiles.Label + * @instance + */ + Label.prototype.num = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Label numUnit. + * @member {number|Long}numUnit + * @memberof perftools.profiles.Label + * @instance + */ + Label.prototype.numUnit = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Label instance using the specified properties. + * @function create + * @memberof perftools.profiles.Label + * @static + * @param {perftools.profiles.ILabel=} [properties] Properties to set + * @returns {perftools.profiles.Label} Label instance + */ + Label.create = function create(properties) { + return new Label(properties); + }; + + /** + * Encodes the specified Label message. Does not implicitly {@link perftools.profiles.Label.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.Label + * @static + * @param {perftools.profiles.ILabel} message Label message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Label.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && message.hasOwnProperty("key")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.key); + if (message.str != null && message.hasOwnProperty("str")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.str); + if (message.num != null && message.hasOwnProperty("num")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.num); + if (message.numUnit != null && message.hasOwnProperty("numUnit")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.numUnit); + return writer; + }; + + /** + * Encodes the specified Label message, length delimited. Does not implicitly {@link perftools.profiles.Label.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.Label + * @static + * @param {perftools.profiles.ILabel} message Label message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Label.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Label message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.Label + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.Label} Label + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Label.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.Label(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.int64(); + break; + case 2: + message.str = reader.int64(); + break; + case 3: + message.num = reader.int64(); + break; + case 4: + message.numUnit = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Label message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.Label + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.Label} Label + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Label.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Label message. + * @function verify + * @memberof perftools.profiles.Label + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Label.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isInteger(message.key) && !(message.key && $util.isInteger(message.key.low) && $util.isInteger(message.key.high))) + return "key: integer|Long expected"; + if (message.str != null && message.hasOwnProperty("str")) + if (!$util.isInteger(message.str) && !(message.str && $util.isInteger(message.str.low) && $util.isInteger(message.str.high))) + return "str: integer|Long expected"; + if (message.num != null && message.hasOwnProperty("num")) + if (!$util.isInteger(message.num) && !(message.num && $util.isInteger(message.num.low) && $util.isInteger(message.num.high))) + return "num: integer|Long expected"; + if (message.numUnit != null && message.hasOwnProperty("numUnit")) + if (!$util.isInteger(message.numUnit) && !(message.numUnit && $util.isInteger(message.numUnit.low) && $util.isInteger(message.numUnit.high))) + return "numUnit: integer|Long expected"; + return null; + }; + + /** + * Creates a Label message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.Label + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.Label} Label + */ + Label.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.Label) + return object; + var message = new $root.perftools.profiles.Label(); + if (object.key != null) + if ($util.Long) + (message.key = $util.Long.fromValue(object.key)).unsigned = false; + else if (typeof object.key === "string") + message.key = parseInt(object.key, 10); + else if (typeof object.key === "number") + message.key = object.key; + else if (typeof object.key === "object") + message.key = new $util.LongBits(object.key.low >>> 0, object.key.high >>> 0).toNumber(); + if (object.str != null) + if ($util.Long) + (message.str = $util.Long.fromValue(object.str)).unsigned = false; + else if (typeof object.str === "string") + message.str = parseInt(object.str, 10); + else if (typeof object.str === "number") + message.str = object.str; + else if (typeof object.str === "object") + message.str = new $util.LongBits(object.str.low >>> 0, object.str.high >>> 0).toNumber(); + if (object.num != null) + if ($util.Long) + (message.num = $util.Long.fromValue(object.num)).unsigned = false; + else if (typeof object.num === "string") + message.num = parseInt(object.num, 10); + else if (typeof object.num === "number") + message.num = object.num; + else if (typeof object.num === "object") + message.num = new $util.LongBits(object.num.low >>> 0, object.num.high >>> 0).toNumber(); + if (object.numUnit != null) + if ($util.Long) + (message.numUnit = $util.Long.fromValue(object.numUnit)).unsigned = false; + else if (typeof object.numUnit === "string") + message.numUnit = parseInt(object.numUnit, 10); + else if (typeof object.numUnit === "number") + message.numUnit = object.numUnit; + else if (typeof object.numUnit === "object") + message.numUnit = new $util.LongBits(object.numUnit.low >>> 0, object.numUnit.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a Label message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.Label + * @static + * @param {perftools.profiles.Label} message Label + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Label.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.key = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.key = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.str = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.str = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.num = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.num = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.numUnit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.numUnit = options.longs === String ? "0" : 0; + } + if (message.key != null && message.hasOwnProperty("key")) + if (typeof message.key === "number") + object.key = options.longs === String ? String(message.key) : message.key; + else + object.key = options.longs === String ? $util.Long.prototype.toString.call(message.key) : options.longs === Number ? new $util.LongBits(message.key.low >>> 0, message.key.high >>> 0).toNumber() : message.key; + if (message.str != null && message.hasOwnProperty("str")) + if (typeof message.str === "number") + object.str = options.longs === String ? String(message.str) : message.str; + else + object.str = options.longs === String ? $util.Long.prototype.toString.call(message.str) : options.longs === Number ? new $util.LongBits(message.str.low >>> 0, message.str.high >>> 0).toNumber() : message.str; + if (message.num != null && message.hasOwnProperty("num")) + if (typeof message.num === "number") + object.num = options.longs === String ? String(message.num) : message.num; + else + object.num = options.longs === String ? $util.Long.prototype.toString.call(message.num) : options.longs === Number ? new $util.LongBits(message.num.low >>> 0, message.num.high >>> 0).toNumber() : message.num; + if (message.numUnit != null && message.hasOwnProperty("numUnit")) + if (typeof message.numUnit === "number") + object.numUnit = options.longs === String ? String(message.numUnit) : message.numUnit; + else + object.numUnit = options.longs === String ? $util.Long.prototype.toString.call(message.numUnit) : options.longs === Number ? new $util.LongBits(message.numUnit.low >>> 0, message.numUnit.high >>> 0).toNumber() : message.numUnit; + return object; + }; + + /** + * Converts this Label to JSON. + * @function toJSON + * @memberof perftools.profiles.Label + * @instance + * @returns {Object.} JSON object + */ + Label.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Label; + })(); + + profiles.Mapping = (function() { + + /** + * Properties of a Mapping. + * @memberof perftools.profiles + * @interface IMapping + * @property {number|Long} [id] Mapping id + * @property {number|Long} [memoryStart] Mapping memoryStart + * @property {number|Long} [memoryLimit] Mapping memoryLimit + * @property {number|Long} [fileOffset] Mapping fileOffset + * @property {number|Long} [filename] Mapping filename + * @property {number|Long} [buildId] Mapping buildId + * @property {boolean} [hasFunctions] Mapping hasFunctions + * @property {boolean} [hasFilenames] Mapping hasFilenames + * @property {boolean} [hasLineNumbers] Mapping hasLineNumbers + * @property {boolean} [hasInlineFrames] Mapping hasInlineFrames + */ + + /** + * Constructs a new Mapping. + * @memberof perftools.profiles + * @classdesc Represents a Mapping. + * @constructor + * @param {perftools.profiles.IMapping=} [properties] Properties to set + */ + function Mapping(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Mapping id. + * @member {number|Long}id + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Mapping memoryStart. + * @member {number|Long}memoryStart + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.memoryStart = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Mapping memoryLimit. + * @member {number|Long}memoryLimit + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.memoryLimit = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Mapping fileOffset. + * @member {number|Long}fileOffset + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.fileOffset = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Mapping filename. + * @member {number|Long}filename + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.filename = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Mapping buildId. + * @member {number|Long}buildId + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.buildId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Mapping hasFunctions. + * @member {boolean}hasFunctions + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.hasFunctions = false; + + /** + * Mapping hasFilenames. + * @member {boolean}hasFilenames + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.hasFilenames = false; + + /** + * Mapping hasLineNumbers. + * @member {boolean}hasLineNumbers + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.hasLineNumbers = false; + + /** + * Mapping hasInlineFrames. + * @member {boolean}hasInlineFrames + * @memberof perftools.profiles.Mapping + * @instance + */ + Mapping.prototype.hasInlineFrames = false; + + /** + * Creates a new Mapping instance using the specified properties. + * @function create + * @memberof perftools.profiles.Mapping + * @static + * @param {perftools.profiles.IMapping=} [properties] Properties to set + * @returns {perftools.profiles.Mapping} Mapping instance + */ + Mapping.create = function create(properties) { + return new Mapping(properties); + }; + + /** + * Encodes the specified Mapping message. Does not implicitly {@link perftools.profiles.Mapping.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.Mapping + * @static + * @param {perftools.profiles.IMapping} message Mapping message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Mapping.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && message.hasOwnProperty("id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.id); + if (message.memoryStart != null && message.hasOwnProperty("memoryStart")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.memoryStart); + if (message.memoryLimit != null && message.hasOwnProperty("memoryLimit")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.memoryLimit); + if (message.fileOffset != null && message.hasOwnProperty("fileOffset")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.fileOffset); + if (message.filename != null && message.hasOwnProperty("filename")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.filename); + if (message.buildId != null && message.hasOwnProperty("buildId")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.buildId); + if (message.hasFunctions != null && message.hasOwnProperty("hasFunctions")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.hasFunctions); + if (message.hasFilenames != null && message.hasOwnProperty("hasFilenames")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.hasFilenames); + if (message.hasLineNumbers != null && message.hasOwnProperty("hasLineNumbers")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.hasLineNumbers); + if (message.hasInlineFrames != null && message.hasOwnProperty("hasInlineFrames")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.hasInlineFrames); + return writer; + }; + + /** + * Encodes the specified Mapping message, length delimited. Does not implicitly {@link perftools.profiles.Mapping.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.Mapping + * @static + * @param {perftools.profiles.IMapping} message Mapping message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Mapping.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Mapping message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.Mapping + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.Mapping} Mapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Mapping.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.Mapping(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint64(); + break; + case 2: + message.memoryStart = reader.uint64(); + break; + case 3: + message.memoryLimit = reader.uint64(); + break; + case 4: + message.fileOffset = reader.uint64(); + break; + case 5: + message.filename = reader.int64(); + break; + case 6: + message.buildId = reader.int64(); + break; + case 7: + message.hasFunctions = reader.bool(); + break; + case 8: + message.hasFilenames = reader.bool(); + break; + case 9: + message.hasLineNumbers = reader.bool(); + break; + case 10: + message.hasInlineFrames = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Mapping message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.Mapping + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.Mapping} Mapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Mapping.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Mapping message. + * @function verify + * @memberof perftools.profiles.Mapping + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Mapping.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) + return "id: integer|Long expected"; + if (message.memoryStart != null && message.hasOwnProperty("memoryStart")) + if (!$util.isInteger(message.memoryStart) && !(message.memoryStart && $util.isInteger(message.memoryStart.low) && $util.isInteger(message.memoryStart.high))) + return "memoryStart: integer|Long expected"; + if (message.memoryLimit != null && message.hasOwnProperty("memoryLimit")) + if (!$util.isInteger(message.memoryLimit) && !(message.memoryLimit && $util.isInteger(message.memoryLimit.low) && $util.isInteger(message.memoryLimit.high))) + return "memoryLimit: integer|Long expected"; + if (message.fileOffset != null && message.hasOwnProperty("fileOffset")) + if (!$util.isInteger(message.fileOffset) && !(message.fileOffset && $util.isInteger(message.fileOffset.low) && $util.isInteger(message.fileOffset.high))) + return "fileOffset: integer|Long expected"; + if (message.filename != null && message.hasOwnProperty("filename")) + if (!$util.isInteger(message.filename) && !(message.filename && $util.isInteger(message.filename.low) && $util.isInteger(message.filename.high))) + return "filename: integer|Long expected"; + if (message.buildId != null && message.hasOwnProperty("buildId")) + if (!$util.isInteger(message.buildId) && !(message.buildId && $util.isInteger(message.buildId.low) && $util.isInteger(message.buildId.high))) + return "buildId: integer|Long expected"; + if (message.hasFunctions != null && message.hasOwnProperty("hasFunctions")) + if (typeof message.hasFunctions !== "boolean") + return "hasFunctions: boolean expected"; + if (message.hasFilenames != null && message.hasOwnProperty("hasFilenames")) + if (typeof message.hasFilenames !== "boolean") + return "hasFilenames: boolean expected"; + if (message.hasLineNumbers != null && message.hasOwnProperty("hasLineNumbers")) + if (typeof message.hasLineNumbers !== "boolean") + return "hasLineNumbers: boolean expected"; + if (message.hasInlineFrames != null && message.hasOwnProperty("hasInlineFrames")) + if (typeof message.hasInlineFrames !== "boolean") + return "hasInlineFrames: boolean expected"; + return null; + }; + + /** + * Creates a Mapping message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.Mapping + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.Mapping} Mapping + */ + Mapping.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.Mapping) + return object; + var message = new $root.perftools.profiles.Mapping(); + if (object.id != null) + if ($util.Long) + (message.id = $util.Long.fromValue(object.id)).unsigned = true; + else if (typeof object.id === "string") + message.id = parseInt(object.id, 10); + else if (typeof object.id === "number") + message.id = object.id; + else if (typeof object.id === "object") + message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(true); + if (object.memoryStart != null) + if ($util.Long) + (message.memoryStart = $util.Long.fromValue(object.memoryStart)).unsigned = true; + else if (typeof object.memoryStart === "string") + message.memoryStart = parseInt(object.memoryStart, 10); + else if (typeof object.memoryStart === "number") + message.memoryStart = object.memoryStart; + else if (typeof object.memoryStart === "object") + message.memoryStart = new $util.LongBits(object.memoryStart.low >>> 0, object.memoryStart.high >>> 0).toNumber(true); + if (object.memoryLimit != null) + if ($util.Long) + (message.memoryLimit = $util.Long.fromValue(object.memoryLimit)).unsigned = true; + else if (typeof object.memoryLimit === "string") + message.memoryLimit = parseInt(object.memoryLimit, 10); + else if (typeof object.memoryLimit === "number") + message.memoryLimit = object.memoryLimit; + else if (typeof object.memoryLimit === "object") + message.memoryLimit = new $util.LongBits(object.memoryLimit.low >>> 0, object.memoryLimit.high >>> 0).toNumber(true); + if (object.fileOffset != null) + if ($util.Long) + (message.fileOffset = $util.Long.fromValue(object.fileOffset)).unsigned = true; + else if (typeof object.fileOffset === "string") + message.fileOffset = parseInt(object.fileOffset, 10); + else if (typeof object.fileOffset === "number") + message.fileOffset = object.fileOffset; + else if (typeof object.fileOffset === "object") + message.fileOffset = new $util.LongBits(object.fileOffset.low >>> 0, object.fileOffset.high >>> 0).toNumber(true); + if (object.filename != null) + if ($util.Long) + (message.filename = $util.Long.fromValue(object.filename)).unsigned = false; + else if (typeof object.filename === "string") + message.filename = parseInt(object.filename, 10); + else if (typeof object.filename === "number") + message.filename = object.filename; + else if (typeof object.filename === "object") + message.filename = new $util.LongBits(object.filename.low >>> 0, object.filename.high >>> 0).toNumber(); + if (object.buildId != null) + if ($util.Long) + (message.buildId = $util.Long.fromValue(object.buildId)).unsigned = false; + else if (typeof object.buildId === "string") + message.buildId = parseInt(object.buildId, 10); + else if (typeof object.buildId === "number") + message.buildId = object.buildId; + else if (typeof object.buildId === "object") + message.buildId = new $util.LongBits(object.buildId.low >>> 0, object.buildId.high >>> 0).toNumber(); + if (object.hasFunctions != null) + message.hasFunctions = Boolean(object.hasFunctions); + if (object.hasFilenames != null) + message.hasFilenames = Boolean(object.hasFilenames); + if (object.hasLineNumbers != null) + message.hasLineNumbers = Boolean(object.hasLineNumbers); + if (object.hasInlineFrames != null) + message.hasInlineFrames = Boolean(object.hasInlineFrames); + return message; + }; + + /** + * Creates a plain object from a Mapping message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.Mapping + * @static + * @param {perftools.profiles.Mapping} message Mapping + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Mapping.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.id = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.memoryStart = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.memoryStart = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.memoryLimit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.memoryLimit = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.fileOffset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.fileOffset = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.filename = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.filename = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.buildId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.buildId = options.longs === String ? "0" : 0; + object.hasFunctions = false; + object.hasFilenames = false; + object.hasLineNumbers = false; + object.hasInlineFrames = false; + } + if (message.id != null && message.hasOwnProperty("id")) + if (typeof message.id === "number") + object.id = options.longs === String ? String(message.id) : message.id; + else + object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber(true) : message.id; + if (message.memoryStart != null && message.hasOwnProperty("memoryStart")) + if (typeof message.memoryStart === "number") + object.memoryStart = options.longs === String ? String(message.memoryStart) : message.memoryStart; + else + object.memoryStart = options.longs === String ? $util.Long.prototype.toString.call(message.memoryStart) : options.longs === Number ? new $util.LongBits(message.memoryStart.low >>> 0, message.memoryStart.high >>> 0).toNumber(true) : message.memoryStart; + if (message.memoryLimit != null && message.hasOwnProperty("memoryLimit")) + if (typeof message.memoryLimit === "number") + object.memoryLimit = options.longs === String ? String(message.memoryLimit) : message.memoryLimit; + else + object.memoryLimit = options.longs === String ? $util.Long.prototype.toString.call(message.memoryLimit) : options.longs === Number ? new $util.LongBits(message.memoryLimit.low >>> 0, message.memoryLimit.high >>> 0).toNumber(true) : message.memoryLimit; + if (message.fileOffset != null && message.hasOwnProperty("fileOffset")) + if (typeof message.fileOffset === "number") + object.fileOffset = options.longs === String ? String(message.fileOffset) : message.fileOffset; + else + object.fileOffset = options.longs === String ? $util.Long.prototype.toString.call(message.fileOffset) : options.longs === Number ? new $util.LongBits(message.fileOffset.low >>> 0, message.fileOffset.high >>> 0).toNumber(true) : message.fileOffset; + if (message.filename != null && message.hasOwnProperty("filename")) + if (typeof message.filename === "number") + object.filename = options.longs === String ? String(message.filename) : message.filename; + else + object.filename = options.longs === String ? $util.Long.prototype.toString.call(message.filename) : options.longs === Number ? new $util.LongBits(message.filename.low >>> 0, message.filename.high >>> 0).toNumber() : message.filename; + if (message.buildId != null && message.hasOwnProperty("buildId")) + if (typeof message.buildId === "number") + object.buildId = options.longs === String ? String(message.buildId) : message.buildId; + else + object.buildId = options.longs === String ? $util.Long.prototype.toString.call(message.buildId) : options.longs === Number ? new $util.LongBits(message.buildId.low >>> 0, message.buildId.high >>> 0).toNumber() : message.buildId; + if (message.hasFunctions != null && message.hasOwnProperty("hasFunctions")) + object.hasFunctions = message.hasFunctions; + if (message.hasFilenames != null && message.hasOwnProperty("hasFilenames")) + object.hasFilenames = message.hasFilenames; + if (message.hasLineNumbers != null && message.hasOwnProperty("hasLineNumbers")) + object.hasLineNumbers = message.hasLineNumbers; + if (message.hasInlineFrames != null && message.hasOwnProperty("hasInlineFrames")) + object.hasInlineFrames = message.hasInlineFrames; + return object; + }; + + /** + * Converts this Mapping to JSON. + * @function toJSON + * @memberof perftools.profiles.Mapping + * @instance + * @returns {Object.} JSON object + */ + Mapping.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Mapping; + })(); + + profiles.Location = (function() { + + /** + * Properties of a Location. + * @memberof perftools.profiles + * @interface ILocation + * @property {number|Long} [id] Location id + * @property {number|Long} [mappingId] Location mappingId + * @property {number|Long} [address] Location address + * @property {Array.} [line] Location line + */ + + /** + * Constructs a new Location. + * @memberof perftools.profiles + * @classdesc Represents a Location. + * @constructor + * @param {perftools.profiles.ILocation=} [properties] Properties to set + */ + function Location(properties) { + this.line = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Location id. + * @member {number|Long}id + * @memberof perftools.profiles.Location + * @instance + */ + Location.prototype.id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Location mappingId. + * @member {number|Long}mappingId + * @memberof perftools.profiles.Location + * @instance + */ + Location.prototype.mappingId = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Location address. + * @member {number|Long}address + * @memberof perftools.profiles.Location + * @instance + */ + Location.prototype.address = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Location line. + * @member {Array.}line + * @memberof perftools.profiles.Location + * @instance + */ + Location.prototype.line = $util.emptyArray; + + /** + * Creates a new Location instance using the specified properties. + * @function create + * @memberof perftools.profiles.Location + * @static + * @param {perftools.profiles.ILocation=} [properties] Properties to set + * @returns {perftools.profiles.Location} Location instance + */ + Location.create = function create(properties) { + return new Location(properties); + }; + + /** + * Encodes the specified Location message. Does not implicitly {@link perftools.profiles.Location.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.Location + * @static + * @param {perftools.profiles.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && message.hasOwnProperty("id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.id); + if (message.mappingId != null && message.hasOwnProperty("mappingId")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.mappingId); + if (message.address != null && message.hasOwnProperty("address")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.address); + if (message.line != null && message.line.length) + for (var i = 0; i < message.line.length; ++i) + $root.perftools.profiles.Line.encode(message.line[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link perftools.profiles.Location.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.Location + * @static + * @param {perftools.profiles.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Location message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.Location(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint64(); + break; + case 2: + message.mappingId = reader.uint64(); + break; + case 3: + message.address = reader.uint64(); + break; + case 4: + if (!(message.line && message.line.length)) + message.line = []; + message.line.push($root.perftools.profiles.Line.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Location message. + * @function verify + * @memberof perftools.profiles.Location + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Location.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) + return "id: integer|Long expected"; + if (message.mappingId != null && message.hasOwnProperty("mappingId")) + if (!$util.isInteger(message.mappingId) && !(message.mappingId && $util.isInteger(message.mappingId.low) && $util.isInteger(message.mappingId.high))) + return "mappingId: integer|Long expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!$util.isInteger(message.address) && !(message.address && $util.isInteger(message.address.low) && $util.isInteger(message.address.high))) + return "address: integer|Long expected"; + if (message.line != null && message.hasOwnProperty("line")) { + if (!Array.isArray(message.line)) + return "line: array expected"; + for (var i = 0; i < message.line.length; ++i) { + var error = $root.perftools.profiles.Line.verify(message.line[i]); + if (error) + return "line." + error; + } + } + return null; + }; + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.Location + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.Location} Location + */ + Location.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.Location) + return object; + var message = new $root.perftools.profiles.Location(); + if (object.id != null) + if ($util.Long) + (message.id = $util.Long.fromValue(object.id)).unsigned = true; + else if (typeof object.id === "string") + message.id = parseInt(object.id, 10); + else if (typeof object.id === "number") + message.id = object.id; + else if (typeof object.id === "object") + message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(true); + if (object.mappingId != null) + if ($util.Long) + (message.mappingId = $util.Long.fromValue(object.mappingId)).unsigned = true; + else if (typeof object.mappingId === "string") + message.mappingId = parseInt(object.mappingId, 10); + else if (typeof object.mappingId === "number") + message.mappingId = object.mappingId; + else if (typeof object.mappingId === "object") + message.mappingId = new $util.LongBits(object.mappingId.low >>> 0, object.mappingId.high >>> 0).toNumber(true); + if (object.address != null) + if ($util.Long) + (message.address = $util.Long.fromValue(object.address)).unsigned = true; + else if (typeof object.address === "string") + message.address = parseInt(object.address, 10); + else if (typeof object.address === "number") + message.address = object.address; + else if (typeof object.address === "object") + message.address = new $util.LongBits(object.address.low >>> 0, object.address.high >>> 0).toNumber(true); + if (object.line) { + if (!Array.isArray(object.line)) + throw TypeError(".perftools.profiles.Location.line: array expected"); + message.line = []; + for (var i = 0; i < object.line.length; ++i) { + if (typeof object.line[i] !== "object") + throw TypeError(".perftools.profiles.Location.line: object expected"); + message.line[i] = $root.perftools.profiles.Line.fromObject(object.line[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.Location + * @static + * @param {perftools.profiles.Location} message Location + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Location.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.line = []; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.id = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.mappingId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.mappingId = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.address = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.address = options.longs === String ? "0" : 0; + } + if (message.id != null && message.hasOwnProperty("id")) + if (typeof message.id === "number") + object.id = options.longs === String ? String(message.id) : message.id; + else + object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber(true) : message.id; + if (message.mappingId != null && message.hasOwnProperty("mappingId")) + if (typeof message.mappingId === "number") + object.mappingId = options.longs === String ? String(message.mappingId) : message.mappingId; + else + object.mappingId = options.longs === String ? $util.Long.prototype.toString.call(message.mappingId) : options.longs === Number ? new $util.LongBits(message.mappingId.low >>> 0, message.mappingId.high >>> 0).toNumber(true) : message.mappingId; + if (message.address != null && message.hasOwnProperty("address")) + if (typeof message.address === "number") + object.address = options.longs === String ? String(message.address) : message.address; + else + object.address = options.longs === String ? $util.Long.prototype.toString.call(message.address) : options.longs === Number ? new $util.LongBits(message.address.low >>> 0, message.address.high >>> 0).toNumber(true) : message.address; + if (message.line && message.line.length) { + object.line = []; + for (var j = 0; j < message.line.length; ++j) + object.line[j] = $root.perftools.profiles.Line.toObject(message.line[j], options); + } + return object; + }; + + /** + * Converts this Location to JSON. + * @function toJSON + * @memberof perftools.profiles.Location + * @instance + * @returns {Object.} JSON object + */ + Location.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Location; + })(); + + profiles.Line = (function() { + + /** + * Properties of a Line. + * @memberof perftools.profiles + * @interface ILine + * @property {number|Long} [functionId] Line functionId + * @property {number|Long} [line] Line line + */ + + /** + * Constructs a new Line. + * @memberof perftools.profiles + * @classdesc Represents a Line. + * @constructor + * @param {perftools.profiles.ILine=} [properties] Properties to set + */ + function Line(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Line functionId. + * @member {number|Long}functionId + * @memberof perftools.profiles.Line + * @instance + */ + Line.prototype.functionId = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Line line. + * @member {number|Long}line + * @memberof perftools.profiles.Line + * @instance + */ + Line.prototype.line = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Line instance using the specified properties. + * @function create + * @memberof perftools.profiles.Line + * @static + * @param {perftools.profiles.ILine=} [properties] Properties to set + * @returns {perftools.profiles.Line} Line instance + */ + Line.create = function create(properties) { + return new Line(properties); + }; + + /** + * Encodes the specified Line message. Does not implicitly {@link perftools.profiles.Line.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.Line + * @static + * @param {perftools.profiles.ILine} message Line message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Line.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.functionId != null && message.hasOwnProperty("functionId")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.functionId); + if (message.line != null && message.hasOwnProperty("line")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.line); + return writer; + }; + + /** + * Encodes the specified Line message, length delimited. Does not implicitly {@link perftools.profiles.Line.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.Line + * @static + * @param {perftools.profiles.ILine} message Line message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Line.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Line message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.Line + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.Line} Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Line.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.Line(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.functionId = reader.uint64(); + break; + case 2: + message.line = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Line message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.Line + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.Line} Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Line.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Line message. + * @function verify + * @memberof perftools.profiles.Line + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Line.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.functionId != null && message.hasOwnProperty("functionId")) + if (!$util.isInteger(message.functionId) && !(message.functionId && $util.isInteger(message.functionId.low) && $util.isInteger(message.functionId.high))) + return "functionId: integer|Long expected"; + if (message.line != null && message.hasOwnProperty("line")) + if (!$util.isInteger(message.line) && !(message.line && $util.isInteger(message.line.low) && $util.isInteger(message.line.high))) + return "line: integer|Long expected"; + return null; + }; + + /** + * Creates a Line message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.Line + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.Line} Line + */ + Line.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.Line) + return object; + var message = new $root.perftools.profiles.Line(); + if (object.functionId != null) + if ($util.Long) + (message.functionId = $util.Long.fromValue(object.functionId)).unsigned = true; + else if (typeof object.functionId === "string") + message.functionId = parseInt(object.functionId, 10); + else if (typeof object.functionId === "number") + message.functionId = object.functionId; + else if (typeof object.functionId === "object") + message.functionId = new $util.LongBits(object.functionId.low >>> 0, object.functionId.high >>> 0).toNumber(true); + if (object.line != null) + if ($util.Long) + (message.line = $util.Long.fromValue(object.line)).unsigned = false; + else if (typeof object.line === "string") + message.line = parseInt(object.line, 10); + else if (typeof object.line === "number") + message.line = object.line; + else if (typeof object.line === "object") + message.line = new $util.LongBits(object.line.low >>> 0, object.line.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a Line message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.Line + * @static + * @param {perftools.profiles.Line} message Line + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Line.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.functionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.functionId = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.line = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.line = options.longs === String ? "0" : 0; + } + if (message.functionId != null && message.hasOwnProperty("functionId")) + if (typeof message.functionId === "number") + object.functionId = options.longs === String ? String(message.functionId) : message.functionId; + else + object.functionId = options.longs === String ? $util.Long.prototype.toString.call(message.functionId) : options.longs === Number ? new $util.LongBits(message.functionId.low >>> 0, message.functionId.high >>> 0).toNumber(true) : message.functionId; + if (message.line != null && message.hasOwnProperty("line")) + if (typeof message.line === "number") + object.line = options.longs === String ? String(message.line) : message.line; + else + object.line = options.longs === String ? $util.Long.prototype.toString.call(message.line) : options.longs === Number ? new $util.LongBits(message.line.low >>> 0, message.line.high >>> 0).toNumber() : message.line; + return object; + }; + + /** + * Converts this Line to JSON. + * @function toJSON + * @memberof perftools.profiles.Line + * @instance + * @returns {Object.} JSON object + */ + Line.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Line; + })(); + + profiles.Function = (function() { + + /** + * Properties of a Function. + * @memberof perftools.profiles + * @interface IFunction + * @property {number|Long} [id] Function id + * @property {number|Long} [name] Function name + * @property {number|Long} [systemName] Function systemName + * @property {number|Long} [filename] Function filename + * @property {number|Long} [startLine] Function startLine + */ + + /** + * Constructs a new Function. + * @memberof perftools.profiles + * @classdesc Represents a Function. + * @constructor + * @param {perftools.profiles.IFunction=} [properties] Properties to set + */ + function Function(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Function id. + * @member {number|Long}id + * @memberof perftools.profiles.Function + * @instance + */ + Function.prototype.id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Function name. + * @member {number|Long}name + * @memberof perftools.profiles.Function + * @instance + */ + Function.prototype.name = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Function systemName. + * @member {number|Long}systemName + * @memberof perftools.profiles.Function + * @instance + */ + Function.prototype.systemName = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Function filename. + * @member {number|Long}filename + * @memberof perftools.profiles.Function + * @instance + */ + Function.prototype.filename = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Function startLine. + * @member {number|Long}startLine + * @memberof perftools.profiles.Function + * @instance + */ + Function.prototype.startLine = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Function instance using the specified properties. + * @function create + * @memberof perftools.profiles.Function + * @static + * @param {perftools.profiles.IFunction=} [properties] Properties to set + * @returns {perftools.profiles.Function} Function instance + */ + Function.create = function create(properties) { + return new Function(properties); + }; + + /** + * Encodes the specified Function message. Does not implicitly {@link perftools.profiles.Function.verify|verify} messages. + * @function encode + * @memberof perftools.profiles.Function + * @static + * @param {perftools.profiles.IFunction} message Function message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Function.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && message.hasOwnProperty("id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.id); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.name); + if (message.systemName != null && message.hasOwnProperty("systemName")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.systemName); + if (message.filename != null && message.hasOwnProperty("filename")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.filename); + if (message.startLine != null && message.hasOwnProperty("startLine")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.startLine); + return writer; + }; + + /** + * Encodes the specified Function message, length delimited. Does not implicitly {@link perftools.profiles.Function.verify|verify} messages. + * @function encodeDelimited + * @memberof perftools.profiles.Function + * @static + * @param {perftools.profiles.IFunction} message Function message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Function.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Function message from the specified reader or buffer. + * @function decode + * @memberof perftools.profiles.Function + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {perftools.profiles.Function} Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Function.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.perftools.profiles.Function(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint64(); + break; + case 2: + message.name = reader.int64(); + break; + case 3: + message.systemName = reader.int64(); + break; + case 4: + message.filename = reader.int64(); + break; + case 5: + message.startLine = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Function message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof perftools.profiles.Function + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {perftools.profiles.Function} Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Function.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Function message. + * @function verify + * @memberof perftools.profiles.Function + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Function.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) + return "id: integer|Long expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isInteger(message.name) && !(message.name && $util.isInteger(message.name.low) && $util.isInteger(message.name.high))) + return "name: integer|Long expected"; + if (message.systemName != null && message.hasOwnProperty("systemName")) + if (!$util.isInteger(message.systemName) && !(message.systemName && $util.isInteger(message.systemName.low) && $util.isInteger(message.systemName.high))) + return "systemName: integer|Long expected"; + if (message.filename != null && message.hasOwnProperty("filename")) + if (!$util.isInteger(message.filename) && !(message.filename && $util.isInteger(message.filename.low) && $util.isInteger(message.filename.high))) + return "filename: integer|Long expected"; + if (message.startLine != null && message.hasOwnProperty("startLine")) + if (!$util.isInteger(message.startLine) && !(message.startLine && $util.isInteger(message.startLine.low) && $util.isInteger(message.startLine.high))) + return "startLine: integer|Long expected"; + return null; + }; + + /** + * Creates a Function message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof perftools.profiles.Function + * @static + * @param {Object.} object Plain object + * @returns {perftools.profiles.Function} Function + */ + Function.fromObject = function fromObject(object) { + if (object instanceof $root.perftools.profiles.Function) + return object; + var message = new $root.perftools.profiles.Function(); + if (object.id != null) + if ($util.Long) + (message.id = $util.Long.fromValue(object.id)).unsigned = true; + else if (typeof object.id === "string") + message.id = parseInt(object.id, 10); + else if (typeof object.id === "number") + message.id = object.id; + else if (typeof object.id === "object") + message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(true); + if (object.name != null) + if ($util.Long) + (message.name = $util.Long.fromValue(object.name)).unsigned = false; + else if (typeof object.name === "string") + message.name = parseInt(object.name, 10); + else if (typeof object.name === "number") + message.name = object.name; + else if (typeof object.name === "object") + message.name = new $util.LongBits(object.name.low >>> 0, object.name.high >>> 0).toNumber(); + if (object.systemName != null) + if ($util.Long) + (message.systemName = $util.Long.fromValue(object.systemName)).unsigned = false; + else if (typeof object.systemName === "string") + message.systemName = parseInt(object.systemName, 10); + else if (typeof object.systemName === "number") + message.systemName = object.systemName; + else if (typeof object.systemName === "object") + message.systemName = new $util.LongBits(object.systemName.low >>> 0, object.systemName.high >>> 0).toNumber(); + if (object.filename != null) + if ($util.Long) + (message.filename = $util.Long.fromValue(object.filename)).unsigned = false; + else if (typeof object.filename === "string") + message.filename = parseInt(object.filename, 10); + else if (typeof object.filename === "number") + message.filename = object.filename; + else if (typeof object.filename === "object") + message.filename = new $util.LongBits(object.filename.low >>> 0, object.filename.high >>> 0).toNumber(); + if (object.startLine != null) + if ($util.Long) + (message.startLine = $util.Long.fromValue(object.startLine)).unsigned = false; + else if (typeof object.startLine === "string") + message.startLine = parseInt(object.startLine, 10); + else if (typeof object.startLine === "number") + message.startLine = object.startLine; + else if (typeof object.startLine === "object") + message.startLine = new $util.LongBits(object.startLine.low >>> 0, object.startLine.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a Function message. Also converts values to other types if specified. + * @function toObject + * @memberof perftools.profiles.Function + * @static + * @param {perftools.profiles.Function} message Function + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Function.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.id = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.name = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.name = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.systemName = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.systemName = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.filename = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.filename = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.startLine = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.startLine = options.longs === String ? "0" : 0; + } + if (message.id != null && message.hasOwnProperty("id")) + if (typeof message.id === "number") + object.id = options.longs === String ? String(message.id) : message.id; + else + object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber(true) : message.id; + if (message.name != null && message.hasOwnProperty("name")) + if (typeof message.name === "number") + object.name = options.longs === String ? String(message.name) : message.name; + else + object.name = options.longs === String ? $util.Long.prototype.toString.call(message.name) : options.longs === Number ? new $util.LongBits(message.name.low >>> 0, message.name.high >>> 0).toNumber() : message.name; + if (message.systemName != null && message.hasOwnProperty("systemName")) + if (typeof message.systemName === "number") + object.systemName = options.longs === String ? String(message.systemName) : message.systemName; + else + object.systemName = options.longs === String ? $util.Long.prototype.toString.call(message.systemName) : options.longs === Number ? new $util.LongBits(message.systemName.low >>> 0, message.systemName.high >>> 0).toNumber() : message.systemName; + if (message.filename != null && message.hasOwnProperty("filename")) + if (typeof message.filename === "number") + object.filename = options.longs === String ? String(message.filename) : message.filename; + else + object.filename = options.longs === String ? $util.Long.prototype.toString.call(message.filename) : options.longs === Number ? new $util.LongBits(message.filename.low >>> 0, message.filename.high >>> 0).toNumber() : message.filename; + if (message.startLine != null && message.hasOwnProperty("startLine")) + if (typeof message.startLine === "number") + object.startLine = options.longs === String ? String(message.startLine) : message.startLine; + else + object.startLine = options.longs === String ? $util.Long.prototype.toString.call(message.startLine) : options.longs === Number ? new $util.LongBits(message.startLine.low >>> 0, message.startLine.high >>> 0).toNumber() : message.startLine; + return object; + }; + + /** + * Converts this Function to JSON. + * @function toJSON + * @memberof perftools.profiles.Function + * @instance + * @returns {Object.} JSON object + */ + Function.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Function; + })(); + + return profiles; + })(); + + return perftools; +})(); + +module.exports = $root; diff --git a/handwritten/cloud-profiler/src/config.ts b/handwritten/cloud-profiler/ts/src/config.ts similarity index 100% rename from handwritten/cloud-profiler/src/config.ts rename to handwritten/cloud-profiler/ts/src/config.ts diff --git a/handwritten/cloud-profiler/src/index.ts b/handwritten/cloud-profiler/ts/src/index.ts similarity index 100% rename from handwritten/cloud-profiler/src/index.ts rename to handwritten/cloud-profiler/ts/src/index.ts diff --git a/handwritten/cloud-profiler/src/profiler.ts b/handwritten/cloud-profiler/ts/src/profiler.ts similarity index 100% rename from handwritten/cloud-profiler/src/profiler.ts rename to handwritten/cloud-profiler/ts/src/profiler.ts diff --git a/handwritten/cloud-profiler/src/profilers/heap-profiler.ts b/handwritten/cloud-profiler/ts/src/profilers/heap-profiler.ts similarity index 100% rename from handwritten/cloud-profiler/src/profilers/heap-profiler.ts rename to handwritten/cloud-profiler/ts/src/profilers/heap-profiler.ts diff --git a/handwritten/cloud-profiler/src/profilers/profile-serializer.ts b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts similarity index 99% rename from handwritten/cloud-profiler/src/profilers/profile-serializer.ts rename to handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts index 650c72c4e35..0d23cccde75 100644 --- a/handwritten/cloud-profiler/src/profilers/profile-serializer.ts +++ b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import {perftools} from '../profile'; +import {perftools} from '../../../proto/profile'; import {AllocationProfileNode, ProfileNode, TimeProfile, TimeProfileNode} from '../v8-types'; /** diff --git a/handwritten/cloud-profiler/src/profilers/time-profiler.ts b/handwritten/cloud-profiler/ts/src/profilers/time-profiler.ts similarity index 96% rename from handwritten/cloud-profiler/src/profilers/time-profiler.ts rename to handwritten/cloud-profiler/ts/src/profilers/time-profiler.ts index 5948cfbb803..9cc72497375 100644 --- a/handwritten/cloud-profiler/src/profilers/time-profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profilers/time-profiler.ts @@ -16,7 +16,7 @@ import * as delay from 'delay'; -import {perftools} from '../profile'; +import {perftools} from '../../../proto/profile'; import {serializeTimeProfile} from './profile-serializer'; const profiler = require('bindings')('time_profiler'); diff --git a/handwritten/cloud-profiler/src/v8-types.ts b/handwritten/cloud-profiler/ts/src/v8-types.ts similarity index 100% rename from handwritten/cloud-profiler/src/v8-types.ts rename to handwritten/cloud-profiler/ts/src/v8-types.ts diff --git a/handwritten/cloud-profiler/test/fixtures/test-config.json b/handwritten/cloud-profiler/ts/test/fixtures/test-config.json similarity index 100% rename from handwritten/cloud-profiler/test/fixtures/test-config.json rename to handwritten/cloud-profiler/ts/test/fixtures/test-config.json diff --git a/handwritten/cloud-profiler/test/profiles-for-tests.ts b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts similarity index 99% rename from handwritten/cloud-profiler/test/profiles-for-tests.ts rename to handwritten/cloud-profiler/ts/test/profiles-for-tests.ts index e4ffd72c067..3183b3d4a92 100644 --- a/handwritten/cloud-profiler/test/profiles-for-tests.ts +++ b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import {perftools} from '../src/profile'; +import {perftools} from '../../proto/profile'; import {TimeProfile, TimeProfileNode} from '../src/v8-types'; const timeLeaf1 = { diff --git a/handwritten/cloud-profiler/test/test-init-config.ts b/handwritten/cloud-profiler/ts/test/test-init-config.ts similarity index 96% rename from handwritten/cloud-profiler/test/test-init-config.ts rename to handwritten/cloud-profiler/ts/test/test-init-config.ts index cff652dd176..16891914330 100644 --- a/handwritten/cloud-profiler/test/test-init-config.ts +++ b/handwritten/cloud-profiler/ts/test/test-init-config.ts @@ -168,7 +168,8 @@ describe('initConfig', () => { process.env.GCLOUD_PROFILER_LOGLEVEL = '4'; process.env.GAE_SERVICE = 'process-service'; process.env.GAE_VERSION = 'process-version'; - process.env.GCLOUD_PROFILER_CONFIG = './test/fixtures/test-config.json'; + process.env.GCLOUD_PROFILER_CONFIG = + './ts/test/fixtures/test-config.json'; sinon.stub(gcpMetadata, 'instance') .withArgs('name') .callsArgWith(1, null, undefined, 'gce-instance') @@ -196,7 +197,8 @@ describe('initConfig', () => { process.env.GCLOUD_PROFILER_LOGLEVEL = '4'; process.env.GAE_SERVICE = 'process-service'; process.env.GAE_VERSION = 'process-version'; - process.env.GCLOUD_PROFILER_CONFIG = './test/fixtures/test-config.json'; + process.env.GCLOUD_PROFILER_CONFIG = + './ts/test/fixtures/test-config.json'; sinon.stub(gcpMetadata, 'instance') .withArgs('name') .callsArgWith(1, null, undefined, 'gce-instance') @@ -221,7 +223,8 @@ describe('initConfig', () => { async () => { sinon.stub(gcpMetadata, 'instance') .throwsException('cannot access metadata'); - process.env.GCLOUD_PROFILER_CONFIG = './test/fixtures/test-config.json'; + process.env.GCLOUD_PROFILER_CONFIG = + './ts/test/fixtures/test-config.json'; const expConfig = { logLevel: 3, diff --git a/handwritten/cloud-profiler/test/test-profile-serializer.ts b/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts similarity index 96% rename from handwritten/cloud-profiler/test/test-profile-serializer.ts rename to handwritten/cloud-profiler/ts/test/test-profile-serializer.ts index 41147114e98..f4c6beb924c 100644 --- a/handwritten/cloud-profiler/test/test-profile-serializer.ts +++ b/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import {perftools} from '../src/profile'; +import {perftools} from '../../proto/profile'; import {serializeHeapProfile, serializeTimeProfile} from '../src/profilers/profile-serializer'; import {TimeProfile, TimeProfileNode} from '../src/v8-types'; import {heapProfile, timeProfile, v8HeapProfile, v8TimeProfile} from './profiles-for-tests'; diff --git a/handwritten/cloud-profiler/test/test-time-profiler.ts b/handwritten/cloud-profiler/ts/test/test-time-profiler.ts similarity index 97% rename from handwritten/cloud-profiler/test/test-time-profiler.ts rename to handwritten/cloud-profiler/ts/test/test-time-profiler.ts index d05bf8e8969..1b4d0bbce59 100644 --- a/handwritten/cloud-profiler/test/test-time-profiler.ts +++ b/handwritten/cloud-profiler/ts/test/test-time-profiler.ts @@ -17,7 +17,7 @@ import * as delay from 'delay'; import * as sinon from 'sinon'; -import {perftools} from '../src/profile'; +import {perftools} from '../../proto/profile'; import {TimeProfiler} from '../src/profilers/time-profiler'; import {timeProfile, v8TimeProfile} from './profiles-for-tests'; diff --git a/handwritten/cloud-profiler/third_party/types/LICENSE b/handwritten/cloud-profiler/ts/third_party/types/LICENSE similarity index 100% rename from handwritten/cloud-profiler/third_party/types/LICENSE rename to handwritten/cloud-profiler/ts/third_party/types/LICENSE diff --git a/handwritten/cloud-profiler/third_party/types/README.google b/handwritten/cloud-profiler/ts/third_party/types/README.google similarity index 100% rename from handwritten/cloud-profiler/third_party/types/README.google rename to handwritten/cloud-profiler/ts/third_party/types/README.google diff --git a/handwritten/cloud-profiler/third_party/types/common-types.ts b/handwritten/cloud-profiler/ts/third_party/types/common-types.ts similarity index 100% rename from handwritten/cloud-profiler/third_party/types/common-types.ts rename to handwritten/cloud-profiler/ts/third_party/types/common-types.ts diff --git a/handwritten/cloud-profiler/tsconfig.json b/handwritten/cloud-profiler/tsconfig.json index 7affdd7a0fc..7c1bd582cc9 100644 --- a/handwritten/cloud-profiler/tsconfig.json +++ b/handwritten/cloud-profiler/tsconfig.json @@ -1,16 +1,12 @@ { "extends": "./node_modules/gts/tsconfig-google.json", "compilerOptions": { - "rootDir": ".", + "rootDir": "ts", "outDir": "build", "lib": [ "es2015" ] }, "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "third_party/types/*.ts" + "ts/**/*.ts" ], "exclude": [ "node_modules" From 9b42065a5caa8bbbd266721cd11d702d244e2808 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Fri, 27 Oct 2017 23:11:02 -0700 Subject: [PATCH 016/632] chore: remove unnecessary jshintrc --- handwritten/cloud-profiler/.gitignore | 1 + handwritten/cloud-profiler/.jshintrc | 28 --------------------------- 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 handwritten/cloud-profiler/.jshintrc diff --git a/handwritten/cloud-profiler/.gitignore b/handwritten/cloud-profiler/.gitignore index 30f101fb652..e8b24972b36 100644 --- a/handwritten/cloud-profiler/.gitignore +++ b/handwritten/cloud-profiler/.gitignore @@ -1,3 +1,4 @@ +.nyc_output .vscode build node_modules diff --git a/handwritten/cloud-profiler/.jshintrc b/handwritten/cloud-profiler/.jshintrc deleted file mode 100644 index a4f50d1c821..00000000000 --- a/handwritten/cloud-profiler/.jshintrc +++ /dev/null @@ -1,28 +0,0 @@ -{ - "bitwise": true, - "curly": true, - "eqeqeq": true, - "esnext": true, - "freeze": true, - "immed": true, - "indent": 2, - "latedef": "nofunc", - "maxlen": 100, - "newcap": true, - "node": true, - "noarg": true, - "quotmark": "single", - "strict": true, - "trailing": true, - "undef": true, - "unused": true, - "globals": { - /* Mocha-provided globals */ - "describe": false, - "it": false, - "before": false, - "beforeEach": false, - "after": false, - "afterEach": false - } -} From 7b37ef183b5e9b7c8e1e244472992d492542df8d Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Sat, 28 Oct 2017 09:01:28 -0700 Subject: [PATCH 017/632] Squashed 'third_party/googleapis/' content from commit 95496dc6 git-subtree-dir: third_party/googleapis git-subtree-split: 95496dc69e37580425a78920633006b14ca154bb --- .../cloud-profiler/.circleci/config.yml | 40 + handwritten/cloud-profiler/.gitignore | 6 + handwritten/cloud-profiler/.gitmodules | 12 + handwritten/cloud-profiler/BUILD | 1 + handwritten/cloud-profiler/CONTRIBUTING.md | 28 + handwritten/cloud-profiler/LICENSE | 201 ++ handwritten/cloud-profiler/Makefile | 49 + handwritten/cloud-profiler/PACKAGES.md | 80 + handwritten/cloud-profiler/README.md | 83 + handwritten/cloud-profiler/WORKSPACE | 73 + .../cloud-profiler/gapic/batch/common.yaml | 25 + .../cloud-profiler/gapic/lang/common.yaml | 28 + .../gapic/lang/csharp_gapic.yaml | 5 + .../cloud-profiler/gapic/lang/doc.yaml | 15 + .../cloud-profiler/gapic/lang/go_gapic.yaml | 5 + .../cloud-profiler/gapic/lang/java_gapic.yaml | 5 + .../cloud-profiler/gapic/lang/nodejs_doc.yaml | 5 + .../gapic/lang/nodejs_gapic.yaml | 5 + .../cloud-profiler/gapic/lang/php_gapic.yaml | 5 + .../cloud-profiler/gapic/lang/python_doc.yaml | 5 + .../gapic/lang/python_gapic.yaml | 5 + .../cloud-profiler/gapic/lang/ruby_doc.yaml | 5 + .../cloud-profiler/gapic/lang/ruby_gapic.yaml | 5 + .../gapic/packaging/api_defaults.yaml | 46 + .../gapic/packaging/common_protos.yaml | 36 + .../gapic/packaging/dependencies.yaml | 106 + .../cloud-profiler/google/api/README.md | 5 + .../google/api/annotations.proto | 31 + .../cloud-profiler/google/api/auth.proto | 187 ++ .../cloud-profiler/google/api/backend.proto | 47 + .../cloud-profiler/google/api/billing.proto | 67 + .../google/api/config_change.proto | 85 + .../cloud-profiler/google/api/consumer.proto | 83 + .../cloud-profiler/google/api/context.proto | 63 + .../cloud-profiler/google/api/control.proto | 33 + .../google/api/distribution.proto | 185 ++ .../google/api/documentation.proto | 159 ++ .../cloud-profiler/google/api/endpoint.proto | 74 + .../experimental/authorization_config.proto | 40 + .../api/experimental/experimental.proto | 34 + .../cloud-profiler/google/api/http.proto | 291 +++ .../cloud-profiler/google/api/httpbody.proto | 70 + .../cloud-profiler/google/api/label.proto | 49 + .../cloud-profiler/google/api/log.proto | 55 + .../cloud-profiler/google/api/logging.proto | 83 + .../cloud-profiler/google/api/metric.proto | 196 ++ .../google/api/monitored_resource.proto | 91 + .../google/api/monitoring.proto | 89 + .../cloud-profiler/google/api/quota.proto | 259 +++ .../cloud-profiler/google/api/service.proto | 178 ++ .../google/api/servicecontrol/README.md | 126 ++ .../api/servicecontrol/v1/check_error.proto | 95 + .../api/servicecontrol/v1/distribution.proto | 159 ++ .../api/servicecontrol/v1/log_entry.proto | 67 + .../api/servicecontrol/v1/metric_value.proto | 78 + .../api/servicecontrol/v1/operation.proto | 112 + .../servicecontrol/v1/quota_controller.proto | 202 ++ .../v1/service_controller.proto | 185 ++ .../google/api/servicemanagement/README.md | 102 + .../api/servicemanagement/v1/resources.proto | 286 +++ .../servicemanagement/v1/servicemanager.proto | 438 ++++ .../google/api/source_info.proto | 32 + .../google/api/system_parameter.proto | 96 + .../cloud-profiler/google/api/usage.proto | 89 + .../cloud-profiler/google/appengine/README.md | 12 + .../google/appengine/artman_appengine.yaml | 40 + .../google/appengine/legacy/audit_data.proto | 34 + .../appengine/logging/v1/request_log.proto | 190 ++ .../google/appengine/v1/app_yaml.proto | 285 +++ .../google/appengine/v1/appengine.proto | 341 +++ .../google/appengine/v1/application.proto | 112 + .../google/appengine/v1/audit_data.proto | 53 + .../google/appengine/v1/deploy.proto | 78 + .../google/appengine/v1/instance.proto | 121 ++ .../google/appengine/v1/location.proto | 39 + .../google/appengine/v1/operation.proto | 56 + .../google/appengine/v1/service.proto | 83 + .../google/appengine/v1/version.proto | 378 ++++ .../cloud-profiler/google/artman_core.yaml | 34 + .../google/artman_logging_external_types.yaml | 36 + .../google/assistant/embedded/README.md | 3 + .../v1alpha1/embedded_assistant.proto | 281 +++ .../bigtable/admin/artman_bigtable_admin.yaml | 94 + .../google/bigtable/admin/bigtableadmin.yaml | 85 + .../admin/cluster/bigtableclusteradmin.yaml | 39 + .../cluster/v1/bigtable_cluster_data.proto | 94 + .../cluster/v1/bigtable_cluster_service.proto | 130 ++ .../bigtable_cluster_service_messages.proto | 141 ++ .../admin/table/bigtabletableadmin.yaml | 27 + .../admin/table/v1/bigtable_table_data.proto | 126 ++ .../table/v1/bigtable_table_service.proto | 80 + .../v1/bigtable_table_service_messages.proto | 116 + .../admin/v2/bigtable_admin_gapic.yaml | 411 ++++ .../admin/v2/bigtable_instance_admin.proto | 246 +++ .../admin/v2/bigtable_table_admin.proto | 218 ++ .../google/bigtable/admin/v2/common.proto | 39 + .../google/bigtable/admin/v2/instance.proto | 140 ++ .../google/bigtable/admin/v2/table.proto | 119 + .../google/bigtable/artman_bigtable.yaml | 105 + .../google/bigtable/bigtable.yaml | 33 + .../google/bigtable/v1/bigtable_data.proto | 516 +++++ .../google/bigtable/v1/bigtable_service.proto | 74 + .../v1/bigtable_service_messages.proto | 218 ++ .../google/bigtable/v2/bigtable.proto | 323 +++ .../google/bigtable/v2/bigtable_gapic.yaml | 163 ++ .../google/bigtable/v2/data.proto | 534 +++++ .../google/bytestream/bytestream.proto | 181 ++ .../google/cloud/audit/audit_log.proto | 128 ++ .../bigquery/logging/v1/audit_data.proto | 525 +++++ .../cloud/billing/v1/cloud_billing.proto | 214 ++ .../google/cloud/dataproc/v1/clusters.proto | 444 ++++ .../google/cloud/dataproc/v1/jobs.proto | 573 +++++ .../google/cloud/dataproc/v1/operations.proto | 79 + .../google/cloud/functions/README.md | 2 + .../cloud/functions/artman_functions.yaml | 94 + .../google/cloud/functions/functions.yaml | 20 + .../cloud/functions/v1beta2/functions.proto | 295 +++ .../functions/v1beta2/functions_gapic.yaml | 157 ++ .../cloud/functions/v1beta2/operations.proto | 54 + .../google/cloud/language/README.md | 0 .../cloud/language/artman_language_v1.yaml | 112 + .../language/artman_language_v1beta2.yaml | 112 + .../google/cloud/language/language.yaml | 30 + .../google/cloud/language/language_v1.yaml | 19 + .../cloud/language/language_v1beta2.yaml | 19 + .../cloud/language/v1/language_gapic.yaml | 120 + .../cloud/language/v1/language_service.proto | 1040 +++++++++ .../language/v1beta1/language_gapic.yaml | 84 + .../language/v1beta1/language_service.proto | 950 ++++++++ .../language/v1beta2/language_gapic.yaml | 118 + .../language/v1beta2/language_service.proto | 1040 +++++++++ .../google/cloud/location/location.yaml | 14 + .../google/cloud/location/locations.proto | 91 + .../google/cloud/ml/v1/job_service.proto | 605 ++++++ .../google/cloud/ml/v1/model_service.proto | 371 ++++ .../cloud/ml/v1/operation_metadata.proto | 72 + .../cloud/ml/v1/prediction_service.proto | 240 ++ .../google/cloud/ml/v1/project_service.proto | 59 + .../google/cloud/ml/v1beta1/job_service.proto | 605 ++++++ .../cloud/ml/v1beta1/model_service.proto | 371 ++++ .../cloud/ml/v1beta1/operation_metadata.proto | 72 + .../cloud/ml/v1beta1/prediction_service.proto | 240 ++ .../cloud/ml/v1beta1/project_service.proto | 59 + .../google/cloud/runtimeconfig/README.md | 39 + .../cloud/runtimeconfig/runtimeconfig.yaml | 49 + .../runtimeconfig/v1beta1/resources.proto | 208 ++ .../runtimeconfig/v1beta1/runtimeconfig.proto | 410 ++++ .../google/cloud/speech/README.md | 3 + .../google/cloud/speech/artman_speech_v1.yaml | 112 + .../cloud/speech/artman_speech_v1beta1.yaml | 94 + .../google/cloud/speech/cloud_speech_v1.yaml | 20 + .../cloud/speech/cloud_speech_v1_1beta1.yaml | 20 + .../cloud/speech/cloud_speech_v1beta1.yaml | 20 + .../google/cloud/speech/speech.yaml | 56 + .../google/cloud/speech/v1/cloud_speech.proto | 445 ++++ .../cloud/speech/v1/cloud_speech_gapic.yaml | 98 + .../cloud/speech/v1_1beta1/cloud_speech.proto | 607 ++++++ .../speech/v1_1beta1/cloud_speech_gapic.yaml | 96 + .../cloud/speech/v1beta1/cloud_speech.proto | 421 ++++ .../speech/v1beta1/cloud_speech_gapic.yaml | 93 + .../google/cloud/support/common.proto | 334 +++ .../support/v1alpha1/cloud_support.proto | 199 ++ .../artman_videointelligence_v1beta1.yaml | 116 + .../artman_videointelligence_v1beta2.yaml | 116 + .../v1beta1/video_intelligence.proto | 340 +++ .../v1beta1/videointelligence_gapic.yaml | 64 + .../v1beta2/video_intelligence.proto | 390 ++++ .../v1beta2/videointelligence_gapic.yaml | 61 + .../videointelligence/videointelligence.yaml | 35 + .../videointelligence_v1beta2.yaml | 37 + .../google/cloud/vision/artman_vision.yaml | 118 + .../google/cloud/vision/v1/geometry.proto | 54 + .../cloud/vision/v1/image_annotator.proto | 569 +++++ .../cloud/vision/v1/text_annotation.proto | 237 ++ .../google/cloud/vision/v1/vision_gapic.yaml | 59 + .../cloud/vision/v1/web_detection.proto | 78 + .../google/cloud/vision/vision.yaml | 19 + .../cloud-profiler/google/container/README.md | 1 + .../google/container/container.yaml | 21 + .../google/container/v1/cluster_service.proto | 1681 ++++++++++++++ .../container/v1alpha1/cluster_service.proto | 1932 +++++++++++++++++ .../container/v1beta1/cluster_service.proto | 1657 ++++++++++++++ .../cloud-profiler/google/datastore/README.md | 1 + .../admin/v1beta1/datastore_admin.proto | 323 +++ .../google/datastore/artman_datastore.yaml | 109 + .../google/datastore/datastore.yaml | 20 + .../google/datastore/v1/datastore.proto | 373 ++++ .../google/datastore/v1/datastore_gapic.yaml | 135 ++ .../google/datastore/v1/entity.proto | 203 ++ .../google/datastore/v1/query.proto | 309 +++ .../google/datastore/v1beta3/datastore.proto | 373 ++++ .../google/datastore/v1beta3/entity.proto | 203 ++ .../google/datastore/v1beta3/query.proto | 309 +++ .../google/devtools/artman_clouddebugger.yaml | 95 + .../devtools/build/v1/build_events.proto | 186 ++ .../devtools/build/v1/build_status.proto | 66 + .../build/v1/publish_build_event.proto | 160 ++ .../google/devtools/cloudbuild/README.md | 1 + .../devtools/cloudbuild/cloudbuild.yaml | 26 + .../devtools/cloudbuild/v1/cloudbuild.proto | 643 ++++++ .../devtools/clouddebugger/clouddebugger.yaml | 36 + .../clouddebugger/v2/clouddebugger_gapic.yaml | 167 ++ .../clouddebugger/v2/controller.proto | 164 ++ .../devtools/clouddebugger/v2/data.proto | 446 ++++ .../devtools/clouddebugger/v2/debugger.proto | 196 ++ .../devtools/clouderrorreporting/README.md | 1 + .../artman_errorreporting.yaml | 109 + .../clouderrorreporting/errorreporting.yaml | 24 + .../clouderrorreporting/v1beta1/common.proto | 164 ++ .../v1beta1/error_group_service.proto | 60 + .../v1beta1/error_stats_service.proto | 341 +++ .../v1beta1/errorreporting_gapic.yaml | 223 ++ .../v1beta1/report_errors_service.proto | 81 + .../devtools/cloudprofiler/cloudprofiler.yaml | 22 + .../devtools/cloudprofiler/v2/profiler.proto | 169 ++ .../cloudtrace/artman_cloudtrace_v1.yaml | 34 + .../cloudtrace/artman_cloudtrace_v2.yaml | 34 + .../devtools/cloudtrace/artman_trace.yaml | 108 + .../devtools/cloudtrace/cloudtrace.yaml | 30 + .../devtools/cloudtrace/cloudtrace_v1.yaml | 29 + .../devtools/cloudtrace/cloudtrace_v2.yaml | 22 + .../google/devtools/cloudtrace/trace.yaml | 32 + .../cloudtrace/v1/cloudtrace_gapic.yaml | 148 ++ .../google/devtools/cloudtrace/v1/trace.proto | 282 +++ .../devtools/cloudtrace/v1/trace_gapic.yaml | 88 + .../cloudtrace/v2/cloudtrace_gapic.yaml | 141 ++ .../google/devtools/cloudtrace/v2/trace.proto | 332 +++ .../devtools/cloudtrace/v2/tracing.proto | 60 + .../v1test/remote_execution.proto | 957 ++++++++ .../v1test/remote_execution.yaml | 19 + .../devtools/source/v1/source_context.proto | 181 ++ .../devtools/sourcerepo/v1/sourcerepo.proto | 163 ++ .../google/example/library/README.md | 4 + .../google/example/library/library.yaml | 7 + .../google/example/library/library_gapic.yaml | 199 ++ .../google/example/library/v1/library.proto | 254 +++ .../cloud-profiler/google/firestore/README.md | 0 .../admin/v1beta1/firestore_admin.proto | 203 ++ .../firestore/admin/v1beta1/index.proto | 97 + .../google/firestore/artman_firestore.yaml | 49 + .../google/firestore/firestore.yaml | 19 + .../google/firestore/v1beta1/common.proto | 82 + .../google/firestore/v1beta1/document.proto | 148 ++ .../google/firestore/v1beta1/firestore.proto | 718 ++++++ .../firestore/v1beta1/firestore_gapic.yaml | 314 +++ .../google/firestore/v1beta1/query.proto | 231 ++ .../google/firestore/v1beta1/write.proto | 184 ++ .../cloud-profiler/google/genomics/README.md | 14 + .../google/genomics/v1/annotations.proto | 672 ++++++ .../google/genomics/v1/cigar.proto | 99 + .../google/genomics/v1/datasets.proto | 212 ++ .../google/genomics/v1/operations.proto | 77 + .../google/genomics/v1/position.proto | 42 + .../google/genomics/v1/range.proto | 39 + .../google/genomics/v1/readalignment.proto | 221 ++ .../google/genomics/v1/readgroup.proto | 106 + .../google/genomics/v1/readgroupset.proto | 64 + .../google/genomics/v1/reads.proto | 468 ++++ .../google/genomics/v1/references.proto | 282 +++ .../google/genomics/v1/variants.proto | 903 ++++++++ .../google/genomics/v1alpha2/pipelines.proto | 614 ++++++ .../cloud-profiler/google/iam/README.md | 14 + .../google/iam/admin/v1/iam.proto | 772 +++++++ .../google/iam/admin/v1/iam_gapic.yaml | 251 +++ .../cloud-profiler/google/iam/artman_iam.yaml | 40 + .../cloud-profiler/google/iam/iam.yaml | 21 + .../google/iam/v1/iam_gapic.yaml | 31 + .../google/iam/v1/iam_policy.proto | 118 + .../google/iam/v1/logging/audit_data.proto | 35 + .../cloud-profiler/google/iam/v1/policy.proto | 149 ++ .../cloud-profiler/google/logging/README.md | 3 + .../google/logging/artman_logging.yaml | 114 + .../google/logging/logging.yaml | 80 + .../google/logging/type/http_request.proto | 91 + .../google/logging/type/log_severity.proto | 71 + .../google/logging/v2/log_entry.proto | 164 ++ .../google/logging/v2/logging.proto | 301 +++ .../google/logging/v2/logging_config.proto | 449 ++++ .../google/logging/v2/logging_gapic.yaml | 596 +++++ .../google/logging/v2/logging_metrics.proto | 250 +++ .../google/longrunning/README.md | 5 + .../longrunning/artman_longrunning.yaml | 90 + .../google/longrunning/longrunning.yaml | 12 + .../google/longrunning/longrunning_gapic.yaml | 98 + .../google/longrunning/operations.proto | 159 ++ .../google/monitoring/artman_monitoring.yaml | 112 + .../google/monitoring/monitoring.yaml | 83 + .../cloud-profiler/google/monitoring/v3/BUILD | 42 + .../google/monitoring/v3/common.proto | 323 +++ .../google/monitoring/v3/group.proto | 74 + .../google/monitoring/v3/group_service.proto | 206 ++ .../google/monitoring/v3/metric.proto | 87 + .../google/monitoring/v3/metric_service.proto | 286 +++ .../monitoring/v3/monitoring_gapic.yaml | 371 ++++ .../google/privacy/dlp/README.md | 7 + .../google/privacy/dlp/artman_dlp.yaml | 110 + .../google/privacy/dlp/dlp.yaml | 72 + .../google/privacy/dlp/v2beta1/dlp.proto | 1325 +++++++++++ .../google/privacy/dlp/v2beta1/dlp_gapic.yaml | 197 ++ .../google/privacy/dlp/v2beta1/storage.proto | 228 ++ .../google/pubsub/artman_pubsub.yaml | 112 + .../cloud-profiler/google/pubsub/pubsub.yaml | 42 + .../google/pubsub/v1/pubsub.proto | 790 +++++++ .../google/pubsub/v1/pubsub_gapic.yaml | 719 ++++++ .../google/pubsub/v1beta2/README.md | 136 ++ .../google/pubsub/v1beta2/pubsub.proto | 384 ++++ .../cloud-profiler/google/rpc/README.md | 5 + .../cloud-profiler/google/rpc/code.proto | 186 ++ .../google/rpc/error_details.proto | 200 ++ .../google/rpc/rpc_publish.yaml | 28 + .../cloud-profiler/google/rpc/status.proto | 92 + .../artman_spanner_admin_database.yaml | 94 + .../database/spanner_admin_database.yaml | 41 + .../v1/spanner_admin_database_gapic.yaml | 222 ++ .../database/v1/spanner_database_admin.proto | 278 +++ .../artman_spanner_admin_instance.yaml | 94 + .../instance/spanner_admin_instance.yaml | 41 + .../v1/spanner_admin_instance_gapic.yaml | 249 +++ .../instance/v1/spanner_instance_admin.proto | 449 ++++ .../google/spanner/artman_spanner.yaml | 109 + .../google/spanner/spanner.yaml | 56 + .../google/spanner/v1/keys.proto | 162 ++ .../google/spanner/v1/mutation.proto | 92 + .../google/spanner/v1/query_plan.proto | 128 ++ .../google/spanner/v1/result_set.proto | 187 ++ .../google/spanner/v1/spanner.proto | 412 ++++ .../google/spanner/v1/spanner_gapic.yaml | 248 +++ .../google/spanner/v1/transaction.proto | 383 ++++ .../google/spanner/v1/type.proto | 111 + .../google/storagetransfer/v1/transfer.proto | 168 ++ .../storagetransfer/v1/transfer_types.proto | 443 ++++ .../google/streetview/publish/README.md | 1 + .../publish/artman_streetview_publish.yaml | 27 + .../publish/streetview_publish.yaml | 27 + .../publish/streetview_publish_gapic.yaml | 152 ++ .../streetview/publish/v1/resources.proto | 144 ++ .../streetview/publish/v1/rpcmessages.proto | 199 ++ .../publish/v1/streetview_publish.proto | 132 ++ .../cloud-profiler/google/tracing/trace.proto | 247 +++ .../cloud-profiler/google/type/README.md | 16 + .../cloud-profiler/google/type/color.proto | 164 ++ .../cloud-profiler/google/type/date.proto | 45 + .../google/type/dayofweek.proto | 51 + .../cloud-profiler/google/type/latlng.proto | 71 + .../cloud-profiler/google/type/money.proto | 42 + .../google/type/postal_address.proto | 132 ++ .../google/type/timeofday.proto | 43 + .../google/watcher/v1/watch.proto | 284 +++ .../google/watcher/v1/watcher.yaml | 7 + third_party/boringssl-with-bazel | 1 + third_party/nanopb | 1 + third_party/protobuf | 1 + third_party/zlib | 1 + 353 files changed, 62371 insertions(+) create mode 100644 handwritten/cloud-profiler/.circleci/config.yml create mode 100644 handwritten/cloud-profiler/.gitignore create mode 100644 handwritten/cloud-profiler/.gitmodules create mode 100644 handwritten/cloud-profiler/BUILD create mode 100644 handwritten/cloud-profiler/CONTRIBUTING.md create mode 100644 handwritten/cloud-profiler/LICENSE create mode 100644 handwritten/cloud-profiler/Makefile create mode 100644 handwritten/cloud-profiler/PACKAGES.md create mode 100644 handwritten/cloud-profiler/README.md create mode 100644 handwritten/cloud-profiler/WORKSPACE create mode 100644 handwritten/cloud-profiler/gapic/batch/common.yaml create mode 100644 handwritten/cloud-profiler/gapic/lang/common.yaml create mode 100644 handwritten/cloud-profiler/gapic/lang/csharp_gapic.yaml create mode 100644 handwritten/cloud-profiler/gapic/lang/doc.yaml create mode 100644 handwritten/cloud-profiler/gapic/lang/go_gapic.yaml create mode 100644 handwritten/cloud-profiler/gapic/lang/java_gapic.yaml create mode 100644 handwritten/cloud-profiler/gapic/lang/nodejs_doc.yaml create mode 100644 handwritten/cloud-profiler/gapic/lang/nodejs_gapic.yaml create mode 100644 handwritten/cloud-profiler/gapic/lang/php_gapic.yaml create mode 100644 handwritten/cloud-profiler/gapic/lang/python_doc.yaml create mode 100644 handwritten/cloud-profiler/gapic/lang/python_gapic.yaml create mode 100644 handwritten/cloud-profiler/gapic/lang/ruby_doc.yaml create mode 100644 handwritten/cloud-profiler/gapic/lang/ruby_gapic.yaml create mode 100644 handwritten/cloud-profiler/gapic/packaging/api_defaults.yaml create mode 100644 handwritten/cloud-profiler/gapic/packaging/common_protos.yaml create mode 100644 handwritten/cloud-profiler/gapic/packaging/dependencies.yaml create mode 100644 handwritten/cloud-profiler/google/api/README.md create mode 100644 handwritten/cloud-profiler/google/api/annotations.proto create mode 100644 handwritten/cloud-profiler/google/api/auth.proto create mode 100644 handwritten/cloud-profiler/google/api/backend.proto create mode 100644 handwritten/cloud-profiler/google/api/billing.proto create mode 100644 handwritten/cloud-profiler/google/api/config_change.proto create mode 100644 handwritten/cloud-profiler/google/api/consumer.proto create mode 100644 handwritten/cloud-profiler/google/api/context.proto create mode 100644 handwritten/cloud-profiler/google/api/control.proto create mode 100644 handwritten/cloud-profiler/google/api/distribution.proto create mode 100644 handwritten/cloud-profiler/google/api/documentation.proto create mode 100644 handwritten/cloud-profiler/google/api/endpoint.proto create mode 100644 handwritten/cloud-profiler/google/api/experimental/authorization_config.proto create mode 100644 handwritten/cloud-profiler/google/api/experimental/experimental.proto create mode 100644 handwritten/cloud-profiler/google/api/http.proto create mode 100644 handwritten/cloud-profiler/google/api/httpbody.proto create mode 100644 handwritten/cloud-profiler/google/api/label.proto create mode 100644 handwritten/cloud-profiler/google/api/log.proto create mode 100644 handwritten/cloud-profiler/google/api/logging.proto create mode 100644 handwritten/cloud-profiler/google/api/metric.proto create mode 100644 handwritten/cloud-profiler/google/api/monitored_resource.proto create mode 100644 handwritten/cloud-profiler/google/api/monitoring.proto create mode 100644 handwritten/cloud-profiler/google/api/quota.proto create mode 100644 handwritten/cloud-profiler/google/api/service.proto create mode 100644 handwritten/cloud-profiler/google/api/servicecontrol/README.md create mode 100644 handwritten/cloud-profiler/google/api/servicecontrol/v1/check_error.proto create mode 100644 handwritten/cloud-profiler/google/api/servicecontrol/v1/distribution.proto create mode 100644 handwritten/cloud-profiler/google/api/servicecontrol/v1/log_entry.proto create mode 100644 handwritten/cloud-profiler/google/api/servicecontrol/v1/metric_value.proto create mode 100644 handwritten/cloud-profiler/google/api/servicecontrol/v1/operation.proto create mode 100644 handwritten/cloud-profiler/google/api/servicecontrol/v1/quota_controller.proto create mode 100644 handwritten/cloud-profiler/google/api/servicecontrol/v1/service_controller.proto create mode 100644 handwritten/cloud-profiler/google/api/servicemanagement/README.md create mode 100644 handwritten/cloud-profiler/google/api/servicemanagement/v1/resources.proto create mode 100644 handwritten/cloud-profiler/google/api/servicemanagement/v1/servicemanager.proto create mode 100644 handwritten/cloud-profiler/google/api/source_info.proto create mode 100644 handwritten/cloud-profiler/google/api/system_parameter.proto create mode 100644 handwritten/cloud-profiler/google/api/usage.proto create mode 100644 handwritten/cloud-profiler/google/appengine/README.md create mode 100644 handwritten/cloud-profiler/google/appengine/artman_appengine.yaml create mode 100644 handwritten/cloud-profiler/google/appengine/legacy/audit_data.proto create mode 100644 handwritten/cloud-profiler/google/appengine/logging/v1/request_log.proto create mode 100644 handwritten/cloud-profiler/google/appengine/v1/app_yaml.proto create mode 100644 handwritten/cloud-profiler/google/appengine/v1/appengine.proto create mode 100644 handwritten/cloud-profiler/google/appengine/v1/application.proto create mode 100644 handwritten/cloud-profiler/google/appengine/v1/audit_data.proto create mode 100644 handwritten/cloud-profiler/google/appengine/v1/deploy.proto create mode 100644 handwritten/cloud-profiler/google/appengine/v1/instance.proto create mode 100644 handwritten/cloud-profiler/google/appengine/v1/location.proto create mode 100644 handwritten/cloud-profiler/google/appengine/v1/operation.proto create mode 100644 handwritten/cloud-profiler/google/appengine/v1/service.proto create mode 100644 handwritten/cloud-profiler/google/appengine/v1/version.proto create mode 100644 handwritten/cloud-profiler/google/artman_core.yaml create mode 100644 handwritten/cloud-profiler/google/artman_logging_external_types.yaml create mode 100644 handwritten/cloud-profiler/google/assistant/embedded/README.md create mode 100644 handwritten/cloud-profiler/google/assistant/embedded/v1alpha1/embedded_assistant.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/artman_bigtable_admin.yaml create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/bigtableadmin.yaml create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/cluster/bigtableclusteradmin.yaml create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/cluster/v1/bigtable_cluster_service.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/cluster/v1/bigtable_cluster_service_messages.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/table/bigtabletableadmin.yaml create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/table/v1/bigtable_table_data.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/table/v1/bigtable_table_service.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/table/v1/bigtable_table_service_messages.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/v2/bigtable_admin_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/v2/bigtable_instance_admin.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/v2/bigtable_table_admin.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/v2/common.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/v2/instance.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/admin/v2/table.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/artman_bigtable.yaml create mode 100644 handwritten/cloud-profiler/google/bigtable/bigtable.yaml create mode 100644 handwritten/cloud-profiler/google/bigtable/v1/bigtable_data.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/v1/bigtable_service.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/v1/bigtable_service_messages.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/v2/bigtable.proto create mode 100644 handwritten/cloud-profiler/google/bigtable/v2/bigtable_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/bigtable/v2/data.proto create mode 100644 handwritten/cloud-profiler/google/bytestream/bytestream.proto create mode 100644 handwritten/cloud-profiler/google/cloud/audit/audit_log.proto create mode 100644 handwritten/cloud-profiler/google/cloud/bigquery/logging/v1/audit_data.proto create mode 100644 handwritten/cloud-profiler/google/cloud/billing/v1/cloud_billing.proto create mode 100644 handwritten/cloud-profiler/google/cloud/dataproc/v1/clusters.proto create mode 100644 handwritten/cloud-profiler/google/cloud/dataproc/v1/jobs.proto create mode 100644 handwritten/cloud-profiler/google/cloud/dataproc/v1/operations.proto create mode 100644 handwritten/cloud-profiler/google/cloud/functions/README.md create mode 100644 handwritten/cloud-profiler/google/cloud/functions/artman_functions.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/functions/functions.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/functions/v1beta2/functions.proto create mode 100644 handwritten/cloud-profiler/google/cloud/functions/v1beta2/functions_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/functions/v1beta2/operations.proto create mode 100644 handwritten/cloud-profiler/google/cloud/language/README.md create mode 100644 handwritten/cloud-profiler/google/cloud/language/artman_language_v1.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/language/artman_language_v1beta2.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/language/language.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/language/language_v1.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/language/language_v1beta2.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/language/v1/language_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/language/v1/language_service.proto create mode 100644 handwritten/cloud-profiler/google/cloud/language/v1beta1/language_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/language/v1beta1/language_service.proto create mode 100644 handwritten/cloud-profiler/google/cloud/language/v1beta2/language_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/language/v1beta2/language_service.proto create mode 100644 handwritten/cloud-profiler/google/cloud/location/location.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/location/locations.proto create mode 100644 handwritten/cloud-profiler/google/cloud/ml/v1/job_service.proto create mode 100644 handwritten/cloud-profiler/google/cloud/ml/v1/model_service.proto create mode 100644 handwritten/cloud-profiler/google/cloud/ml/v1/operation_metadata.proto create mode 100644 handwritten/cloud-profiler/google/cloud/ml/v1/prediction_service.proto create mode 100644 handwritten/cloud-profiler/google/cloud/ml/v1/project_service.proto create mode 100644 handwritten/cloud-profiler/google/cloud/ml/v1beta1/job_service.proto create mode 100644 handwritten/cloud-profiler/google/cloud/ml/v1beta1/model_service.proto create mode 100644 handwritten/cloud-profiler/google/cloud/ml/v1beta1/operation_metadata.proto create mode 100644 handwritten/cloud-profiler/google/cloud/ml/v1beta1/prediction_service.proto create mode 100644 handwritten/cloud-profiler/google/cloud/ml/v1beta1/project_service.proto create mode 100644 handwritten/cloud-profiler/google/cloud/runtimeconfig/README.md create mode 100644 handwritten/cloud-profiler/google/cloud/runtimeconfig/runtimeconfig.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/runtimeconfig/v1beta1/resources.proto create mode 100644 handwritten/cloud-profiler/google/cloud/runtimeconfig/v1beta1/runtimeconfig.proto create mode 100644 handwritten/cloud-profiler/google/cloud/speech/README.md create mode 100644 handwritten/cloud-profiler/google/cloud/speech/artman_speech_v1.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/speech/artman_speech_v1beta1.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/speech/cloud_speech_v1.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/speech/cloud_speech_v1_1beta1.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/speech/cloud_speech_v1beta1.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/speech/speech.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/speech/v1/cloud_speech.proto create mode 100644 handwritten/cloud-profiler/google/cloud/speech/v1/cloud_speech_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/speech/v1_1beta1/cloud_speech.proto create mode 100644 handwritten/cloud-profiler/google/cloud/speech/v1_1beta1/cloud_speech_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/speech/v1beta1/cloud_speech.proto create mode 100644 handwritten/cloud-profiler/google/cloud/speech/v1beta1/cloud_speech_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/support/common.proto create mode 100644 handwritten/cloud-profiler/google/cloud/support/v1alpha1/cloud_support.proto create mode 100644 handwritten/cloud-profiler/google/cloud/videointelligence/artman_videointelligence_v1beta1.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/videointelligence/artman_videointelligence_v1beta2.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/videointelligence/v1beta1/video_intelligence.proto create mode 100644 handwritten/cloud-profiler/google/cloud/videointelligence/v1beta1/videointelligence_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/videointelligence/v1beta2/video_intelligence.proto create mode 100644 handwritten/cloud-profiler/google/cloud/videointelligence/v1beta2/videointelligence_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/videointelligence/videointelligence.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/videointelligence/videointelligence_v1beta2.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/vision/artman_vision.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/vision/v1/geometry.proto create mode 100644 handwritten/cloud-profiler/google/cloud/vision/v1/image_annotator.proto create mode 100644 handwritten/cloud-profiler/google/cloud/vision/v1/text_annotation.proto create mode 100644 handwritten/cloud-profiler/google/cloud/vision/v1/vision_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/cloud/vision/v1/web_detection.proto create mode 100644 handwritten/cloud-profiler/google/cloud/vision/vision.yaml create mode 100644 handwritten/cloud-profiler/google/container/README.md create mode 100644 handwritten/cloud-profiler/google/container/container.yaml create mode 100644 handwritten/cloud-profiler/google/container/v1/cluster_service.proto create mode 100644 handwritten/cloud-profiler/google/container/v1alpha1/cluster_service.proto create mode 100644 handwritten/cloud-profiler/google/container/v1beta1/cluster_service.proto create mode 100644 handwritten/cloud-profiler/google/datastore/README.md create mode 100644 handwritten/cloud-profiler/google/datastore/admin/v1beta1/datastore_admin.proto create mode 100644 handwritten/cloud-profiler/google/datastore/artman_datastore.yaml create mode 100644 handwritten/cloud-profiler/google/datastore/datastore.yaml create mode 100644 handwritten/cloud-profiler/google/datastore/v1/datastore.proto create mode 100644 handwritten/cloud-profiler/google/datastore/v1/datastore_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/datastore/v1/entity.proto create mode 100644 handwritten/cloud-profiler/google/datastore/v1/query.proto create mode 100644 handwritten/cloud-profiler/google/datastore/v1beta3/datastore.proto create mode 100644 handwritten/cloud-profiler/google/datastore/v1beta3/entity.proto create mode 100644 handwritten/cloud-profiler/google/datastore/v1beta3/query.proto create mode 100644 handwritten/cloud-profiler/google/devtools/artman_clouddebugger.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/build/v1/build_events.proto create mode 100644 handwritten/cloud-profiler/google/devtools/build/v1/build_status.proto create mode 100644 handwritten/cloud-profiler/google/devtools/build/v1/publish_build_event.proto create mode 100644 handwritten/cloud-profiler/google/devtools/cloudbuild/README.md create mode 100644 handwritten/cloud-profiler/google/devtools/cloudbuild/cloudbuild.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/cloudbuild/v1/cloudbuild.proto create mode 100644 handwritten/cloud-profiler/google/devtools/clouddebugger/clouddebugger.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/clouddebugger/v2/clouddebugger_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/clouddebugger/v2/controller.proto create mode 100644 handwritten/cloud-profiler/google/devtools/clouddebugger/v2/data.proto create mode 100644 handwritten/cloud-profiler/google/devtools/clouddebugger/v2/debugger.proto create mode 100644 handwritten/cloud-profiler/google/devtools/clouderrorreporting/README.md create mode 100644 handwritten/cloud-profiler/google/devtools/clouderrorreporting/artman_errorreporting.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/clouderrorreporting/errorreporting.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/common.proto create mode 100644 handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/error_group_service.proto create mode 100644 handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/error_stats_service.proto create mode 100644 handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/errorreporting_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/report_errors_service.proto create mode 100644 handwritten/cloud-profiler/google/devtools/cloudprofiler/cloudprofiler.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/cloudprofiler/v2/profiler.proto create mode 100644 handwritten/cloud-profiler/google/devtools/cloudtrace/artman_cloudtrace_v1.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/cloudtrace/artman_cloudtrace_v2.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/cloudtrace/artman_trace.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/cloudtrace/cloudtrace.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/cloudtrace/cloudtrace_v1.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/cloudtrace/cloudtrace_v2.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/cloudtrace/trace.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/cloudtrace/v1/cloudtrace_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/cloudtrace/v1/trace.proto create mode 100644 handwritten/cloud-profiler/google/devtools/cloudtrace/v1/trace_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/cloudtrace/v2/cloudtrace_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/cloudtrace/v2/trace.proto create mode 100644 handwritten/cloud-profiler/google/devtools/cloudtrace/v2/tracing.proto create mode 100644 handwritten/cloud-profiler/google/devtools/remoteexecution/v1test/remote_execution.proto create mode 100644 handwritten/cloud-profiler/google/devtools/remoteexecution/v1test/remote_execution.yaml create mode 100644 handwritten/cloud-profiler/google/devtools/source/v1/source_context.proto create mode 100644 handwritten/cloud-profiler/google/devtools/sourcerepo/v1/sourcerepo.proto create mode 100644 handwritten/cloud-profiler/google/example/library/README.md create mode 100644 handwritten/cloud-profiler/google/example/library/library.yaml create mode 100755 handwritten/cloud-profiler/google/example/library/library_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/example/library/v1/library.proto create mode 100644 handwritten/cloud-profiler/google/firestore/README.md create mode 100644 handwritten/cloud-profiler/google/firestore/admin/v1beta1/firestore_admin.proto create mode 100644 handwritten/cloud-profiler/google/firestore/admin/v1beta1/index.proto create mode 100644 handwritten/cloud-profiler/google/firestore/artman_firestore.yaml create mode 100644 handwritten/cloud-profiler/google/firestore/firestore.yaml create mode 100644 handwritten/cloud-profiler/google/firestore/v1beta1/common.proto create mode 100644 handwritten/cloud-profiler/google/firestore/v1beta1/document.proto create mode 100644 handwritten/cloud-profiler/google/firestore/v1beta1/firestore.proto create mode 100644 handwritten/cloud-profiler/google/firestore/v1beta1/firestore_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/firestore/v1beta1/query.proto create mode 100644 handwritten/cloud-profiler/google/firestore/v1beta1/write.proto create mode 100644 handwritten/cloud-profiler/google/genomics/README.md create mode 100644 handwritten/cloud-profiler/google/genomics/v1/annotations.proto create mode 100644 handwritten/cloud-profiler/google/genomics/v1/cigar.proto create mode 100644 handwritten/cloud-profiler/google/genomics/v1/datasets.proto create mode 100644 handwritten/cloud-profiler/google/genomics/v1/operations.proto create mode 100644 handwritten/cloud-profiler/google/genomics/v1/position.proto create mode 100644 handwritten/cloud-profiler/google/genomics/v1/range.proto create mode 100644 handwritten/cloud-profiler/google/genomics/v1/readalignment.proto create mode 100644 handwritten/cloud-profiler/google/genomics/v1/readgroup.proto create mode 100644 handwritten/cloud-profiler/google/genomics/v1/readgroupset.proto create mode 100644 handwritten/cloud-profiler/google/genomics/v1/reads.proto create mode 100644 handwritten/cloud-profiler/google/genomics/v1/references.proto create mode 100644 handwritten/cloud-profiler/google/genomics/v1/variants.proto create mode 100644 handwritten/cloud-profiler/google/genomics/v1alpha2/pipelines.proto create mode 100644 handwritten/cloud-profiler/google/iam/README.md create mode 100644 handwritten/cloud-profiler/google/iam/admin/v1/iam.proto create mode 100644 handwritten/cloud-profiler/google/iam/admin/v1/iam_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/iam/artman_iam.yaml create mode 100644 handwritten/cloud-profiler/google/iam/iam.yaml create mode 100644 handwritten/cloud-profiler/google/iam/v1/iam_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/iam/v1/iam_policy.proto create mode 100644 handwritten/cloud-profiler/google/iam/v1/logging/audit_data.proto create mode 100644 handwritten/cloud-profiler/google/iam/v1/policy.proto create mode 100644 handwritten/cloud-profiler/google/logging/README.md create mode 100644 handwritten/cloud-profiler/google/logging/artman_logging.yaml create mode 100644 handwritten/cloud-profiler/google/logging/logging.yaml create mode 100644 handwritten/cloud-profiler/google/logging/type/http_request.proto create mode 100644 handwritten/cloud-profiler/google/logging/type/log_severity.proto create mode 100644 handwritten/cloud-profiler/google/logging/v2/log_entry.proto create mode 100644 handwritten/cloud-profiler/google/logging/v2/logging.proto create mode 100644 handwritten/cloud-profiler/google/logging/v2/logging_config.proto create mode 100644 handwritten/cloud-profiler/google/logging/v2/logging_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/logging/v2/logging_metrics.proto create mode 100644 handwritten/cloud-profiler/google/longrunning/README.md create mode 100644 handwritten/cloud-profiler/google/longrunning/artman_longrunning.yaml create mode 100644 handwritten/cloud-profiler/google/longrunning/longrunning.yaml create mode 100644 handwritten/cloud-profiler/google/longrunning/longrunning_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/longrunning/operations.proto create mode 100644 handwritten/cloud-profiler/google/monitoring/artman_monitoring.yaml create mode 100644 handwritten/cloud-profiler/google/monitoring/monitoring.yaml create mode 100644 handwritten/cloud-profiler/google/monitoring/v3/BUILD create mode 100644 handwritten/cloud-profiler/google/monitoring/v3/common.proto create mode 100644 handwritten/cloud-profiler/google/monitoring/v3/group.proto create mode 100644 handwritten/cloud-profiler/google/monitoring/v3/group_service.proto create mode 100644 handwritten/cloud-profiler/google/monitoring/v3/metric.proto create mode 100644 handwritten/cloud-profiler/google/monitoring/v3/metric_service.proto create mode 100644 handwritten/cloud-profiler/google/monitoring/v3/monitoring_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/privacy/dlp/README.md create mode 100644 handwritten/cloud-profiler/google/privacy/dlp/artman_dlp.yaml create mode 100644 handwritten/cloud-profiler/google/privacy/dlp/dlp.yaml create mode 100644 handwritten/cloud-profiler/google/privacy/dlp/v2beta1/dlp.proto create mode 100644 handwritten/cloud-profiler/google/privacy/dlp/v2beta1/dlp_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/privacy/dlp/v2beta1/storage.proto create mode 100644 handwritten/cloud-profiler/google/pubsub/artman_pubsub.yaml create mode 100644 handwritten/cloud-profiler/google/pubsub/pubsub.yaml create mode 100644 handwritten/cloud-profiler/google/pubsub/v1/pubsub.proto create mode 100644 handwritten/cloud-profiler/google/pubsub/v1/pubsub_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/pubsub/v1beta2/README.md create mode 100644 handwritten/cloud-profiler/google/pubsub/v1beta2/pubsub.proto create mode 100644 handwritten/cloud-profiler/google/rpc/README.md create mode 100644 handwritten/cloud-profiler/google/rpc/code.proto create mode 100644 handwritten/cloud-profiler/google/rpc/error_details.proto create mode 100644 handwritten/cloud-profiler/google/rpc/rpc_publish.yaml create mode 100644 handwritten/cloud-profiler/google/rpc/status.proto create mode 100644 handwritten/cloud-profiler/google/spanner/admin/database/artman_spanner_admin_database.yaml create mode 100644 handwritten/cloud-profiler/google/spanner/admin/database/spanner_admin_database.yaml create mode 100644 handwritten/cloud-profiler/google/spanner/admin/database/v1/spanner_admin_database_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/spanner/admin/database/v1/spanner_database_admin.proto create mode 100644 handwritten/cloud-profiler/google/spanner/admin/instance/artman_spanner_admin_instance.yaml create mode 100644 handwritten/cloud-profiler/google/spanner/admin/instance/spanner_admin_instance.yaml create mode 100644 handwritten/cloud-profiler/google/spanner/admin/instance/v1/spanner_admin_instance_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/spanner/admin/instance/v1/spanner_instance_admin.proto create mode 100644 handwritten/cloud-profiler/google/spanner/artman_spanner.yaml create mode 100644 handwritten/cloud-profiler/google/spanner/spanner.yaml create mode 100644 handwritten/cloud-profiler/google/spanner/v1/keys.proto create mode 100644 handwritten/cloud-profiler/google/spanner/v1/mutation.proto create mode 100644 handwritten/cloud-profiler/google/spanner/v1/query_plan.proto create mode 100644 handwritten/cloud-profiler/google/spanner/v1/result_set.proto create mode 100644 handwritten/cloud-profiler/google/spanner/v1/spanner.proto create mode 100644 handwritten/cloud-profiler/google/spanner/v1/spanner_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/spanner/v1/transaction.proto create mode 100644 handwritten/cloud-profiler/google/spanner/v1/type.proto create mode 100644 handwritten/cloud-profiler/google/storagetransfer/v1/transfer.proto create mode 100644 handwritten/cloud-profiler/google/storagetransfer/v1/transfer_types.proto create mode 100644 handwritten/cloud-profiler/google/streetview/publish/README.md create mode 100644 handwritten/cloud-profiler/google/streetview/publish/artman_streetview_publish.yaml create mode 100644 handwritten/cloud-profiler/google/streetview/publish/streetview_publish.yaml create mode 100644 handwritten/cloud-profiler/google/streetview/publish/streetview_publish_gapic.yaml create mode 100644 handwritten/cloud-profiler/google/streetview/publish/v1/resources.proto create mode 100644 handwritten/cloud-profiler/google/streetview/publish/v1/rpcmessages.proto create mode 100644 handwritten/cloud-profiler/google/streetview/publish/v1/streetview_publish.proto create mode 100644 handwritten/cloud-profiler/google/tracing/trace.proto create mode 100644 handwritten/cloud-profiler/google/type/README.md create mode 100644 handwritten/cloud-profiler/google/type/color.proto create mode 100644 handwritten/cloud-profiler/google/type/date.proto create mode 100644 handwritten/cloud-profiler/google/type/dayofweek.proto create mode 100644 handwritten/cloud-profiler/google/type/latlng.proto create mode 100644 handwritten/cloud-profiler/google/type/money.proto create mode 100644 handwritten/cloud-profiler/google/type/postal_address.proto create mode 100644 handwritten/cloud-profiler/google/type/timeofday.proto create mode 100644 handwritten/cloud-profiler/google/watcher/v1/watch.proto create mode 100644 handwritten/cloud-profiler/google/watcher/v1/watcher.yaml create mode 160000 third_party/boringssl-with-bazel create mode 160000 third_party/nanopb create mode 160000 third_party/protobuf create mode 160000 third_party/zlib diff --git a/handwritten/cloud-profiler/.circleci/config.yml b/handwritten/cloud-profiler/.circleci/config.yml new file mode 100644 index 00000000000..d31a7cce1e6 --- /dev/null +++ b/handwritten/cloud-profiler/.circleci/config.yml @@ -0,0 +1,40 @@ +--- +version: 2 +jobs: + build: + docker: + - image: googleapis/git + steps: + - checkout + - run: + command: | + if [ "$CIRCLE_BRANCH" == "master" ]; then + git remote add private https://googleapis-publisher:${GITHUB_TOKEN}@github.com/googleapis/googleapis-private.git + git push private HEAD:master + fi + working_directory: /var/code/googleapis/ + smoke-all: + docker: + - image: googleapis/artman:stable + steps: + - checkout + - run: + name: Run smoke tests + command: | + mkdir /tmp/reports + export RUNNING_IN_ARTMAN_DOCKER=True + smoketest_artman.py --root-dir=/var/code/googleapis/ --log=/tmp/reports/smoketest.log + - store_test_results: + path: /tmp/reports + - store_artifacts: + path: /tmp/reports + working_directory: /var/code/googleapis/ + +workflows: + version: 2 + smoketests: + jobs: + - smoke-all: + filters: + branches: + only: master diff --git a/handwritten/cloud-profiler/.gitignore b/handwritten/cloud-profiler/.gitignore new file mode 100644 index 00000000000..359b2818f49 --- /dev/null +++ b/handwritten/cloud-profiler/.gitignore @@ -0,0 +1,6 @@ +OWNERS +README.google +google/internal +google/protobuf +.project +artman-genfiles/ diff --git a/handwritten/cloud-profiler/.gitmodules b/handwritten/cloud-profiler/.gitmodules new file mode 100644 index 00000000000..a25fa8ce827 --- /dev/null +++ b/handwritten/cloud-profiler/.gitmodules @@ -0,0 +1,12 @@ +[submodule "third_party/protobuf"] + path = third_party/protobuf + url = https://github.com/google/protobuf +[submodule "third_party/zlib"] + path = third_party/zlib + url = https://github.com/makdharma/zlib +[submodule "third_party/boringssl-with-bazel"] + path = third_party/boringssl-with-bazel + url = https://boringssl.googlesource.com/boringssl +[submodule "third_party/nanopb"] + path = third_party/nanopb + url = https://github.com/nanopb/nanopb diff --git a/handwritten/cloud-profiler/BUILD b/handwritten/cloud-profiler/BUILD new file mode 100644 index 00000000000..da25e642522 --- /dev/null +++ b/handwritten/cloud-profiler/BUILD @@ -0,0 +1 @@ +# empty BUILD file diff --git a/handwritten/cloud-profiler/CONTRIBUTING.md b/handwritten/cloud-profiler/CONTRIBUTING.md new file mode 100644 index 00000000000..87dfaadd3ee --- /dev/null +++ b/handwritten/cloud-profiler/CONTRIBUTING.md @@ -0,0 +1,28 @@ +# How to contribute + +We definitely welcome feedback and contribution to Google APIs! Here +is some guideline and information about how to do so. + +## Legal requirements + +In order to protect both you and ourselves, you will need to sign the +[Contributor License Agreement](https://cla.developers.google.com/clas). + +## Technical requirements + +You will need several tools to work with this repository. At minimum, +you need both [Protocol Buffers](https://github.com/google/protobuf) +and [gRPC](https://github.com/grpc) in order to compile this +repository and generate client library source code in various +programming languages. + +To compile the generated code into usable client libraries, you will +need to use appropriate development environments and setup proper +build configurations. + +## Additional note + +Currently, the root's Makefile only lets you generate source code for +the client library in the programming languages supported by +[gRPC](https://github.com/grpc). It does not generate the ready-to-use +client libraries yet. diff --git a/handwritten/cloud-profiler/LICENSE b/handwritten/cloud-profiler/LICENSE new file mode 100644 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/handwritten/cloud-profiler/LICENSE @@ -0,0 +1,201 @@ + 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/handwritten/cloud-profiler/Makefile b/handwritten/cloud-profiler/Makefile new file mode 100644 index 00000000000..26801adac71 --- /dev/null +++ b/handwritten/cloud-profiler/Makefile @@ -0,0 +1,49 @@ +# This is a simple Makefile that generates client library source code +# for Google APIs using Protocol Buffers and gRPC for any supported +# language. However, it does not compile the generated code into final +# libraries that can be directly used with application code. +# +# Syntax example: make OUTPUT=./output LANGUAGE=java +# + +# Choose the output directory +OUTPUT ?= ./gens + +# Choose the target language. +LANGUAGE ?= cpp + +# Choose grpc plugin +GRPCPLUGIN ?= /usr/local/bin/grpc_$(LANGUAGE)_plugin + +# Choose the proto include directory. +PROTOINCLUDE ?= /usr/local/include + +# Choose protoc binary +PROTOC ?= protoc + +# Compile the entire repository +# +# NOTE: if "protoc" command is not in the PATH, you need to modify this file. +# + +ifeq ($(LANGUAGE),go) +$(error Go source files are not generated from this repository. See: https://github.com/google/go-genproto) +endif + +FLAGS+= --proto_path=.:$(PROTOINCLUDE) +FLAGS+= --$(LANGUAGE)_out=$(OUTPUT) --grpc_out=$(OUTPUT) +FLAGS+= --plugin=protoc-gen-grpc=$(GRPCPLUGIN) + +SUFFIX:= pb.cc + +DEPS:= $(shell find google $(PROTOINCLUDE)/google/protobuf -type f -name '*.proto' | sed "s/proto$$/$(SUFFIX)/") + +all: $(DEPS) + +%.$(SUFFIX): %.proto + mkdir -p $(OUTPUT) + $(PROTOC) $(FLAGS) $*.proto + +clean: + rm $(patsubst %,$(OUTPUT)/%,$(DEPS)) 2> /dev/null + rm -rd $(OUTPUT) diff --git a/handwritten/cloud-profiler/PACKAGES.md b/handwritten/cloud-profiler/PACKAGES.md new file mode 100644 index 00000000000..d67cc31bd63 --- /dev/null +++ b/handwritten/cloud-profiler/PACKAGES.md @@ -0,0 +1,80 @@ +# Auto-Generated Packages for Google Cloud Platform + +This indexes the gRPC and GAPIC packages delivered to the the [Google Cloud +Platform](https://github.com/GoogleCloudPlatform) teams and where they can be +found. Currently, package delivery is only being done for Python. + +## [Python](https://github.com/GoogleCloudPlatform/gcloud-python) + +### Common +- [GAX core library](https://pypi.python.org/pypi/google-gax) ([source](https://github.com/googleapis/gax-python)) +- [gRPC for common protos](https://pypi.python.org/pypi/googleapis-common-protos) ([source](https://github.com/googleapis/googleapis)) +- [Long-running operations](https://github.com/googleapis/googleapis/blob/master/google/longrunning/operations.proto) + - [GAPIC](https://pypi.python.org/pypi/gapic-google-longrunning) + - gRPC: Part of [gRPC for common protos](https://pypi.python.org/pypi/googleapis-common-protos) + - Documentation: TBD + +### [Cloud Bigtable](https://cloud.google.com/bigtable/) +- GAPIC: TBD +- gRPC: TBD +- Documentation: TBD + +### [Cloud Datastore](https://cloud.google.com/datastore/) +- [GAPIC](https://pypi.python.org/pypi/gapic-google-cloud-datastore-v1) +- [gRPC](https://pypi.python.org/pypi/grpc-google-cloud-datastore-v1) +- Documentation: TBD + +### [Cloud Identity and Access Management (IAM)](https://cloud.google.com/iam/) +- Admin API + - [GAPIC](https://pypi.python.org/pypi/gapic-google-iam-admin-v1) + - [gRPC](https://pypi.python.org/pypi/grpc-google-iam-admin-v1) + - Documentation: TBD +- Policy Mixin (used by Pub/Sub and others) + - [gRPC](https://pypi.python.org/pypi/grpc-google-iam-v1) + +### [Cloud Natural Language](https://cloud.google.com/natural-language/) +- [GAPIC](https://pypi.python.org/pypi/gapic-google-cloud-language-v1beta1) +- [gRPC](https://pypi.python.org/pypi/grpc-google-cloud-language-v1beta1) +- Documentation: TBD + +### [Cloud Pub/Sub](https://cloud.google.com/pubsub/) +- [GAPIC](https://pypi.python.org/pypi/gapic-google-cloud-pubsub-v1) +- [gRPC](https://pypi.python.org/pypi/grpc-google-cloud-pubsub-v1) +- [Documentation](http://pythonhosted.org/gax-google-pubsub-v1/): + For old `gax` namespace... will be updated soon for `gapic` namespace. + +### [Cloud Speech](https://cloud.google.com/speech/) +- [GAPIC](https://pypi.python.org/pypi/gapic-google-cloud-speech-v1beta1) +- [gRPC](https://pypi.python.org/pypi/grpc-google-cloud-speech-v1beta1) +- Documentation: TBD + +### [Cloud Vision](https://cloud.google.com/vision/) +- [GAPIC](https://pypi.python.org/pypi/gapic-google-cloud-vision-v1) +- [gRPC](https://pypi.python.org/pypi/grpc-google-cloud-vision-v1) +- [Documentation](http://pythonhosted.org/gax-google-cloud-vision-v1/): + For old `gax` namespace... will be updated soon for `gapic` namespace. + +### [Stackdriver Debugger](https://cloud.google.com/debugger/) +- GAPIC: TBD +- gRPC: TBD +- Documentation: TBD + +### [Stackdriver Error Reporting](https://cloud.google.com/error-reporting/) +- [GAPIC](https://pypi.python.org/pypi/gapic-google-cloud-error-reporting-v1beta1) +- [gRPC](https://pypi.python.org/pypi/grpc-google-cloud-error-reporting-v1beta1) +- Documentation: TBD + +### [Stackdriver Logging](https://cloud.google.com/logging/) +- [GAPIC](https://pypi.python.org/pypi/gapic-google-cloud-logging-v2) +- [gRPC](https://pypi.python.org/pypi/grpc-google-cloud-logging-v2) +- [Documentation](http://gapic-google-cloud-logging-v2.readthedocs.io) + +### [Stackdriver Monitoring](https://cloud.google.com/monitoring/) +- [GAPIC](https://pypi.python.org/pypi/gapic-google-monitoring-v3) +- [gRPC](https://pypi.python.org/pypi/grpc-google-monitoring-v3) +- Documentation: TBD + +### [Stackdriver Trace](https://cloud.google.com/trace/) +- GAPIC: TBD +- gRPC: TBD +- Documentation: TBD diff --git a/handwritten/cloud-profiler/README.md b/handwritten/cloud-profiler/README.md new file mode 100644 index 00000000000..884b7394feb --- /dev/null +++ b/handwritten/cloud-profiler/README.md @@ -0,0 +1,83 @@ +# Google APIs + +This repository contains the original interface definitions of public +Google APIs that support both REST and gRPC protocols. Reading the +original interface definitions can provide a better understanding of +Google APIs and help you to utilize them more efficiently. You can also +use these definitions with open source tools to generate client +libraries, documentation, and other artifacts. + +API client libraries can be built directly from files in this repo using +[Artman](https://github.com/googleapis/artman). The latest generation status can +be tracked [here](https://circleci.com/gh/googleapis/googleapis) which currently +has status [![CircleCI](https://circleci.com/gh/googleapis/googleapis.svg?style=svg)](https://circleci.com/gh/googleapis/googleapis). + +For more details on all Google APIs and developer tools, see the [Google +Developers](https://developers.google.com/products/) site. + +## Overview + +Google APIs are typically deployed as API services that are hosted +under different DNS names. One API service may implement multiple APIs +and multiple versions of the same API. + +Google APIs use [Protocol Buffers](https://github.com/google/protobuf) +version 3 (proto3) as their Interface Definition Language (IDL) to +define the API interface and the structure of the payload messages. The +same interface definition is used for both REST and RPC versions of the +API, which can be accessed over different wire protocols. + +There are several ways of accessing Google APIs: + +1. JSON over HTTP: You can access all Google APIs directly using JSON +over HTTP, using +[Google API client library](https://developers.google.com/api-client-library) +or third-party API client libraries. + +2. Protocol Buffers over gRPC: You can access Google APIs published +in this repository through [GRPC](https://github.com/grpc), which is +a high-performance binary RPC protocol over HTTP/2. It offers many +useful features, including request/response multiplex and full-duplex +streaming. + +3. [Google Cloud Client Libraries](https://cloud.google.com/apis/docs/cloud-client-libraries): +You can use these libraries to access Google Cloud APIs. They are based +on gRPC for better performance and provide idiomatic client surface for +better developer experience. + +## Discussions + +Please use GitHub Issues to discuss bugs and features related to this +repository. + +## Repository Structure + +This repository uses a directory hierarchy that reflects the Google +API product structure. In general, every API has its own root +directory, and each major version of the API has its own subdirectory. +The proto package names exactly match the directory: this makes it +easy to locate the proto definitions and ensures that the generated +client libraries have idiomatic namespaces in most programming +languages. Alongside the API directories live the configuration files +for the [GAPIC toolkit](https://github.com/googleapis/toolkit). + +**NOTE:** The major version of an API is used to indicate breaking +change to the API. + +## Generate gRPC Source Code + +To generate gRPC source code for Google APIs in this repository, you +first need to install both Protocol Buffers and gRPC on your local +machine, then you can run `make LANGUAGE=xxx all` to generate the +source code. You need to integrated the generated source code into +your application build system. + +**NOTE:** The Makefile is only intended to generate source code for the +entire repository. It is not for generating linkable client library +for a specific API. Please see other repositories under +https://github.com/googleapis for generating linkable client libraries. + +### Go gRPC Source Code +It is difficult to generate Go gRPC source code from this repository, +since Go has different directory structure. +Please use [this repository](https://github.com/google/go-genproto) instead. diff --git a/handwritten/cloud-profiler/WORKSPACE b/handwritten/cloud-profiler/WORKSPACE new file mode 100644 index 00000000000..c403fc73ffb --- /dev/null +++ b/handwritten/cloud-profiler/WORKSPACE @@ -0,0 +1,73 @@ +# nanopb +bind( + name = "nanopb", + actual = "//third_party/nanopb", +) + +# Boringssl +bind( + name = "libssl", + actual = "@submodule_boringssl//:ssl", +) + +new_local_repository( + name = "submodule_boringssl", + build_file = "third_party/boringssl-with-bazel/BUILD", + path = "third_party/boringssl-with-bazel", +) + +# Zlib +bind( + name = "zlib", + actual = "@submodule_zlib//:z", +) + +local_repository( + name = "submodule_zlib", + path = "third_party/zlib", +) + +# Protobuf +bind( + name = "protobuf", + actual = "@submodule_protobuf//:protobuf", +) + +bind( + name = "protobuf_clib", + actual = "@submodule_protobuf//:protoc_lib", +) + +bind( + name = "protocol_compiler", + actual = "@submodule_protobuf//:protoc", +) + +new_local_repository( + name = "submodule_protobuf", + build_file = "third_party/protobuf/BUILD", + path = "third_party/protobuf", +) + +# grpc +bind( + name = "grpc++", + actual = "@submodule_grpc//:grpc++", +) + +bind( + name = "grpc++_codegen_proto", + actual = "@submodule_grpc//:grpc++_codegen_proto", +) + +bind( + name = "grpc_cpp_plugin", + actual = "@submodule_grpc//:grpc_cpp_plugin", +) + +git_repository( + name = "submodule_grpc", + remote = "https://github.com/grpc/grpc", + # TODO(makdharma): replace with version when bazel file fix is released + commit = "eb064ec7b81b60c5e1eb47d6124d0c05056b3097", +) diff --git a/handwritten/cloud-profiler/gapic/batch/common.yaml b/handwritten/cloud-profiler/gapic/batch/common.yaml new file mode 100644 index 00000000000..1c9342d5194 --- /dev/null +++ b/handwritten/cloud-profiler/gapic/batch/common.yaml @@ -0,0 +1,25 @@ +common: + batch_apis: '*' + api_config_patterns: + - ${GOOGLEAPIS}/gapic/api/artman_${API_SHORT_NAME}.yaml + - ${GOOGLEAPIS}/gapic/core/artman_${API_SHORT_NAME}.yaml + artman_language_yaml: ${GOOGLEAPIS}/gapic/lang/common.yaml + exclude_apis: + - ${GOOGLEAPIS}/gapic/api/artman_appengine.yaml + - ${GOOGLEAPIS}/gapic/api/artman_bigtable.yaml + - ${GOOGLEAPIS}/gapic/api/artman_bigtable_admin.yaml + - ${GOOGLEAPIS}/gapic/api/artman_clouddebugger.yaml + - ${GOOGLEAPIS}/gapic/api/artman_datastore.yaml + - ${GOOGLEAPIS}/gapic/api/artman_functions.yaml + - ${GOOGLEAPIS}/gapic/api/artman_genomics.yaml + - ${GOOGLEAPIS}/gapic/api/artman_iam.yaml + - ${GOOGLEAPIS}/gapic/api/artman_streetview_publish.yaml +go: + exclude_apis: + - ${GOOGLEAPIS}/gapic/core/artman_core.yaml + - ${GOOGLEAPIS}/gapic/core/artman_iam.yaml + - ${GOOGLEAPIS}/gapic/api/artman_bigtable.yaml + - ${GOOGLEAPIS}/gapic/api/artman_bigtable_admin.yaml + - ${GOOGLEAPIS}/gapic/api/artman_datastore.yaml + - ${GOOGLEAPIS}/gapic/api/artman_functions.yaml + - ${GOOGLEAPIS}/gapic/api/artman_genomics.yaml diff --git a/handwritten/cloud-profiler/gapic/lang/common.yaml b/handwritten/cloud-profiler/gapic/lang/common.yaml new file mode 100644 index 00000000000..59916210b02 --- /dev/null +++ b/handwritten/cloud-profiler/gapic/lang/common.yaml @@ -0,0 +1,28 @@ +common: + toolkit_path: ${TOOLKIT} + staging_repo_dir: ${REPOROOT}/api-client-staging/generated + # common gRPC package generation parameters + package_dependencies_yaml: ${GOOGLEAPIS}/gapic/packaging/dependencies.yaml + package_defaults_yaml: ${GOOGLEAPIS}/gapic/packaging/api_defaults.yaml + common_protos_yaml: ${GOOGLEAPIS}/gapic/packaging/common_protos.yaml +java: + gapic_language_yaml: + - ${GOOGLEAPIS}/gapic/lang/java_gapic.yaml +python: + gapic_language_yaml: + - ${GOOGLEAPIS}/gapic/lang/python_gapic.yaml +go: + gapic_language_yaml: + - ${GOOGLEAPIS}/gapic/lang/go_gapic.yaml +csharp: + gapic_language_yaml: + - ${GOOGLEAPIS}/gapic/lang/csharp_gapic.yaml +php: + gapic_language_yaml: + - ${GOOGLEAPIS}/gapic/lang/php_gapic.yaml +ruby: + gapic_language_yaml: + - ${GOOGLEAPIS}/gapic/lang/ruby_gapic.yaml +nodejs: + gapic_language_yaml: + - ${GOOGLEAPIS}/gapic/lang/nodejs_gapic.yaml diff --git a/handwritten/cloud-profiler/gapic/lang/csharp_gapic.yaml b/handwritten/cloud-profiler/gapic/lang/csharp_gapic.yaml new file mode 100644 index 00000000000..b5abad139e2 --- /dev/null +++ b/handwritten/cloud-profiler/gapic/lang/csharp_gapic.yaml @@ -0,0 +1,5 @@ +type: com.google.api.codegen.ConfigProto +language: csharp +generator: + factory: com.google.api.codegen.gapic.MainGapicProviderFactory + id: csharp diff --git a/handwritten/cloud-profiler/gapic/lang/doc.yaml b/handwritten/cloud-profiler/gapic/lang/doc.yaml new file mode 100644 index 00000000000..7c041e7ee06 --- /dev/null +++ b/handwritten/cloud-profiler/gapic/lang/doc.yaml @@ -0,0 +1,15 @@ +common: + toolkit_path: ${TOOLKIT} + # common gRPC package generation parameters + package_dependencies_yaml: ${GOOGLEAPIS}/gapic/packaging/dependencies.yaml + package_defaults_yaml: ${GOOGLEAPIS}/gapic/packaging/api_defaults.yaml + common_protos_yaml: ${GOOGLEAPIS}/gapic/packaging/common_protos.yaml +python: + gapic_language_yaml: + - ${GOOGLEAPIS}/gapic/lang/python_doc.yaml +ruby: + gapic_language_yaml: + - ${GOOGLEAPIS}/gapic/lang/ruby_doc.yaml +nodejs: + gapic_language_yaml: + - ${GOOGLEAPIS}/gapic/lang/nodejs_doc.yaml diff --git a/handwritten/cloud-profiler/gapic/lang/go_gapic.yaml b/handwritten/cloud-profiler/gapic/lang/go_gapic.yaml new file mode 100644 index 00000000000..0e976110003 --- /dev/null +++ b/handwritten/cloud-profiler/gapic/lang/go_gapic.yaml @@ -0,0 +1,5 @@ +type: com.google.api.codegen.ConfigProto +language: go +generator: + factory: com.google.api.codegen.gapic.MainGapicProviderFactory + id: go diff --git a/handwritten/cloud-profiler/gapic/lang/java_gapic.yaml b/handwritten/cloud-profiler/gapic/lang/java_gapic.yaml new file mode 100644 index 00000000000..27c6ca28110 --- /dev/null +++ b/handwritten/cloud-profiler/gapic/lang/java_gapic.yaml @@ -0,0 +1,5 @@ +type: com.google.api.codegen.ConfigProto +language: java +generator: + factory: com.google.api.codegen.gapic.MainGapicProviderFactory + id: java diff --git a/handwritten/cloud-profiler/gapic/lang/nodejs_doc.yaml b/handwritten/cloud-profiler/gapic/lang/nodejs_doc.yaml new file mode 100644 index 00000000000..dacc7a2a65e --- /dev/null +++ b/handwritten/cloud-profiler/gapic/lang/nodejs_doc.yaml @@ -0,0 +1,5 @@ +type: com.google.api.codegen.ConfigProto +language: nodejs +generator: + factory: com.google.api.codegen.gapic.MainGapicProviderFactory + id: nodejs_doc diff --git a/handwritten/cloud-profiler/gapic/lang/nodejs_gapic.yaml b/handwritten/cloud-profiler/gapic/lang/nodejs_gapic.yaml new file mode 100644 index 00000000000..cbe8594b689 --- /dev/null +++ b/handwritten/cloud-profiler/gapic/lang/nodejs_gapic.yaml @@ -0,0 +1,5 @@ +type: com.google.api.codegen.ConfigProto +language: nodejs +generator: + factory: com.google.api.codegen.gapic.MainGapicProviderFactory + id: nodejs diff --git a/handwritten/cloud-profiler/gapic/lang/php_gapic.yaml b/handwritten/cloud-profiler/gapic/lang/php_gapic.yaml new file mode 100644 index 00000000000..d6aeda00aba --- /dev/null +++ b/handwritten/cloud-profiler/gapic/lang/php_gapic.yaml @@ -0,0 +1,5 @@ +type: com.google.api.codegen.ConfigProto +language: php +generator: + factory: com.google.api.codegen.gapic.MainGapicProviderFactory + id: php diff --git a/handwritten/cloud-profiler/gapic/lang/python_doc.yaml b/handwritten/cloud-profiler/gapic/lang/python_doc.yaml new file mode 100644 index 00000000000..9c01dbba7dd --- /dev/null +++ b/handwritten/cloud-profiler/gapic/lang/python_doc.yaml @@ -0,0 +1,5 @@ +type: com.google.api.codegen.ConfigProto +language: python +generator: + factory: com.google.api.codegen.gapic.MainGapicProviderFactory + id: python_doc diff --git a/handwritten/cloud-profiler/gapic/lang/python_gapic.yaml b/handwritten/cloud-profiler/gapic/lang/python_gapic.yaml new file mode 100644 index 00000000000..3d63b534508 --- /dev/null +++ b/handwritten/cloud-profiler/gapic/lang/python_gapic.yaml @@ -0,0 +1,5 @@ +type: com.google.api.codegen.ConfigProto +language: python +generator: + factory: com.google.api.codegen.gapic.MainGapicProviderFactory + id: py diff --git a/handwritten/cloud-profiler/gapic/lang/ruby_doc.yaml b/handwritten/cloud-profiler/gapic/lang/ruby_doc.yaml new file mode 100644 index 00000000000..4dbeebc92ce --- /dev/null +++ b/handwritten/cloud-profiler/gapic/lang/ruby_doc.yaml @@ -0,0 +1,5 @@ +type: com.google.api.codegen.ConfigProto +language: ruby +generator: + factory: com.google.api.codegen.gapic.MainGapicProviderFactory + id: ruby_doc diff --git a/handwritten/cloud-profiler/gapic/lang/ruby_gapic.yaml b/handwritten/cloud-profiler/gapic/lang/ruby_gapic.yaml new file mode 100644 index 00000000000..f566442a531 --- /dev/null +++ b/handwritten/cloud-profiler/gapic/lang/ruby_gapic.yaml @@ -0,0 +1,5 @@ +type: com.google.api.codegen.ConfigProto +language: ruby +generator: + factory: com.google.api.codegen.gapic.MainGapicProviderFactory + id: ruby diff --git a/handwritten/cloud-profiler/gapic/packaging/api_defaults.yaml b/handwritten/cloud-profiler/gapic/packaging/api_defaults.yaml new file mode 100644 index 00000000000..04da16116a1 --- /dev/null +++ b/handwritten/cloud-profiler/gapic/packaging/api_defaults.yaml @@ -0,0 +1,46 @@ +# 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. + + +# Provides default values used as metadata when constructing various packages. + +author: Google Inc +email: googleapis-packages@google.com +homepage: https://github.com/googleapis/googleapis +license: Apache-2.0 +release_level: + python: alpha + java: alpha + ruby: alpha + nodejs: alpha +generated_package_version: + # TODO: Python must go to 1.0.20 or 1.1.0 when we GA, due to mistakenly + # publishing some 1.0.x versions to pypi already. They are now + # deleted but files still exist on the pypi servers and can prevent + # us from using the version number again. + python: + lower: '0.15.4' + upper: '0.16dev' + nodejs: + lower: '0.7.1' + php: + lower: '0.1.0' + ruby: + lower: '0.1.0' + java: + lower: '0.1.22' + +generated_ga_package_version: + java: + lower: '1.0.0' diff --git a/handwritten/cloud-profiler/gapic/packaging/common_protos.yaml b/handwritten/cloud-profiler/gapic/packaging/common_protos.yaml new file mode 100644 index 00000000000..1f8aea86885 --- /dev/null +++ b/handwritten/cloud-profiler/gapic/packaging/common_protos.yaml @@ -0,0 +1,36 @@ +# 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. + +# packages are the directories in the Google APIs repo that contain shared +# protos. name is the path below google, version is an optional path below +# name. +packages: + - + name: 'api' + version: '' + - + name: 'longrunning' + version: '' + - + name: 'rpc' + version: '' + - + name: 'type' + version: '' + - + name: 'logging/type' + version: '' + +# semver is the semantic version of the common protos package. +semver: 1.5.0 diff --git a/handwritten/cloud-profiler/gapic/packaging/dependencies.yaml b/handwritten/cloud-profiler/gapic/packaging/dependencies.yaml new file mode 100644 index 00000000000..feea6154f02 --- /dev/null +++ b/handwritten/cloud-profiler/gapic/packaging/dependencies.yaml @@ -0,0 +1,106 @@ +# 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. + + +# Configures the version of the dependencies of various generated packages, and +# related information. + +auth_version: + python: + lower: '1.0.2' + upper: '2.0dev' + nodejs: + lower: '0.9.8' + ruby: + lower: '0.6.1' + +grpc_version: + csharp: + lower: '1.7.0' + python: + lower: '1.0.2' + upper: '2.0dev' + nodejs: + lower: '1.1.2' + php: + lower: '1.4.0' + ruby: + lower: '1.0' + java: + lower: '1.6.1' + +gax_version: + python: + lower: '0.15.7' + upper: '0.16dev' + nodejs: + lower: '0.14.2' + php: + lower: '0.25.0' + ruby: + lower: '0.8.6' + java: + lower: '1.8.1' + +gax_grpc_version: + csharp: + lower: '2.2.0' + java: + lower: '0.25.1' + +proto_version: + python: + lower: '3.0.0' + upper: '4.0dev' + nodejs: + # This is the version of ProtoBuf.js. + lower: '5.0.1' + php: + lower: '3.4.0' + ruby: + lower: '3.0' + java: + lower: '3.3.0' + +# Dependencies on gRPC/proto packages referenced in the proto_deps +# field of the Artman config. + +google-common-protos_version: + python: + name_override: googleapis-common-protos + lower: '1.5.2' + upper: '2.0dev' + ruby: + name_override: googleapis-common-protos + lower: '1.3.1' + java: + lower: '0.1.22' + +google-iam-v1_version: + csharp: + name_override: Google.Cloud.Iam.V1 + lower: '1.0.0-beta12' + python: + name_override: grpc-google-iam-v1 + lower: '0.11.1' + upper: '0.12dev' + ruby: + name_override: grpc-google-iam-v1 + lower: '0.6.8' + java: + lower: '0.1.22' + +api_common_version: + java: + lower: '1.1.0' diff --git a/handwritten/cloud-profiler/google/api/README.md b/handwritten/cloud-profiler/google/api/README.md new file mode 100644 index 00000000000..eafe5880223 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/README.md @@ -0,0 +1,5 @@ +This folder contains the schema of the configuration model for the API services +platform. + +**Note**: Protos under this directory are in Alpha status, and therefore are +subject to breaking changes. diff --git a/handwritten/cloud-profiler/google/api/annotations.proto b/handwritten/cloud-profiler/google/api/annotations.proto new file mode 100644 index 00000000000..85c361b47fe --- /dev/null +++ b/handwritten/cloud-profiler/google/api/annotations.proto @@ -0,0 +1,31 @@ +// Copyright (c) 2015, Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +import "google/api/http.proto"; +import "google/protobuf/descriptor.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "AnnotationsProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +extend google.protobuf.MethodOptions { + // See `HttpRule`. + HttpRule http = 72295728; +} diff --git a/handwritten/cloud-profiler/google/api/auth.proto b/handwritten/cloud-profiler/google/api/auth.proto new file mode 100644 index 00000000000..5dd42155476 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/auth.proto @@ -0,0 +1,187 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "AuthProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// `Authentication` defines the authentication configuration for an API. +// +// Example for an API targeted for external use: +// +// name: calendar.googleapis.com +// authentication: +// providers: +// - id: google_calendar_auth +// jwks_uri: https://www.googleapis.com/oauth2/v1/certs +// issuer: https://securetoken.google.com +// rules: +// - selector: "*" +// requirements: +// provider_id: google_calendar_auth +message Authentication { + // A list of authentication rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated AuthenticationRule rules = 3; + + // Defines a set of authentication providers that a service supports. + repeated AuthProvider providers = 4; +} + +// Authentication rules for the service. +// +// By default, if a method has any authentication requirements, every request +// must include a valid credential matching one of the requirements. +// It's an error to include more than one kind of credential in a single +// request. +// +// If a method doesn't have any auth requirements, request credentials will be +// ignored. +message AuthenticationRule { + // Selects the methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // The requirements for OAuth credentials. + OAuthRequirements oauth = 2; + + // Whether to allow requests without a credential. The credential can be + // an OAuth token, Google cookies (first-party auth) or EndUserCreds. + // + // For requests without credentials, if the service control environment is + // specified, each incoming request **must** be associated with a service + // consumer. This can be done by passing an API key that belongs to a consumer + // project. + bool allow_without_credential = 5; + + // Requirements for additional authentication providers. + repeated AuthRequirement requirements = 7; +} + +// Configuration for an anthentication provider, including support for +// [JSON Web Token (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32). +message AuthProvider { + // The unique identifier of the auth provider. It will be referred to by + // `AuthRequirement.provider_id`. + // + // Example: "bookstore_auth". + string id = 1; + + // Identifies the principal that issued the JWT. See + // https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1 + // Usually a URL or an email address. + // + // Example: https://securetoken.google.com + // Example: 1234567-compute@developer.gserviceaccount.com + string issuer = 2; + + // URL of the provider's public key set to validate signature of the JWT. See + // [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata). + // Optional if the key set document: + // - can be retrieved from + // [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html + // of the issuer. + // - can be inferred from the email domain of the issuer (e.g. a Google service account). + // + // Example: https://www.googleapis.com/oauth2/v1/certs + string jwks_uri = 3; + + // The list of JWT + // [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). + // that are allowed to access. A JWT containing any of these audiences will + // be accepted. When this setting is absent, only JWTs with audience + // "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" + // will be accepted. For example, if no audiences are in the setting, + // LibraryService API will only accept JWTs with the following audience + // "https://library-example.googleapis.com/google.example.library.v1.LibraryService". + // + // Example: + // + // audiences: bookstore_android.apps.googleusercontent.com, + // bookstore_web.apps.googleusercontent.com + string audiences = 4; + + // Redirect URL if JWT token is required but no present or is expired. + // Implement authorizationUrl of securityDefinitions in OpenAPI spec. + string authorization_url = 5; +} + +// OAuth scopes are a way to define data and permissions on data. For example, +// there are scopes defined for "Read-only access to Google Calendar" and +// "Access to Cloud Platform". Users can consent to a scope for an application, +// giving it permission to access that data on their behalf. +// +// OAuth scope specifications should be fairly coarse grained; a user will need +// to see and understand the text description of what your scope means. +// +// In most cases: use one or at most two OAuth scopes for an entire family of +// products. If your product has multiple APIs, you should probably be sharing +// the OAuth scope across all of those APIs. +// +// When you need finer grained OAuth consent screens: talk with your product +// management about how developers will use them in practice. +// +// Please note that even though each of the canonical scopes is enough for a +// request to be accepted and passed to the backend, a request can still fail +// due to the backend requiring additional scopes or permissions. +message OAuthRequirements { + // The list of publicly documented OAuth scopes that are allowed access. An + // OAuth token containing any of these scopes will be accepted. + // + // Example: + // + // canonical_scopes: https://www.googleapis.com/auth/calendar, + // https://www.googleapis.com/auth/calendar.read + string canonical_scopes = 1; +} + +// User-defined authentication requirements, including support for +// [JSON Web Token (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32). +message AuthRequirement { + // [id][google.api.AuthProvider.id] from authentication provider. + // + // Example: + // + // provider_id: bookstore_auth + string provider_id = 1; + + // NOTE: This will be deprecated soon, once AuthProvider.audiences is + // implemented and accepted in all the runtime components. + // + // The list of JWT + // [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). + // that are allowed to access. A JWT containing any of these audiences will + // be accepted. When this setting is absent, only JWTs with audience + // "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" + // will be accepted. For example, if no audiences are in the setting, + // LibraryService API will only accept JWTs with the following audience + // "https://library-example.googleapis.com/google.example.library.v1.LibraryService". + // + // Example: + // + // audiences: bookstore_android.apps.googleusercontent.com, + // bookstore_web.apps.googleusercontent.com + string audiences = 2; +} diff --git a/handwritten/cloud-profiler/google/api/backend.proto b/handwritten/cloud-profiler/google/api/backend.proto new file mode 100644 index 00000000000..61a72e14d19 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/backend.proto @@ -0,0 +1,47 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "BackendProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// `Backend` defines the backend configuration for a service. +message Backend { + // A list of API backend rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated BackendRule rules = 1; +} + +// A backend rule provides configuration for an individual API element. +message BackendRule { + // Selects the methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // The address of the API backend. + string address = 2; + + // The number of seconds to wait for a response from a request. The + // default depends on the deployment context. + double deadline = 3; +} diff --git a/handwritten/cloud-profiler/google/api/billing.proto b/handwritten/cloud-profiler/google/api/billing.proto new file mode 100644 index 00000000000..efba179f085 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/billing.proto @@ -0,0 +1,67 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +import "google/api/annotations.proto"; +import "google/api/metric.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "BillingProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Billing related configuration of the service. +// +// The following example shows how to configure monitored resources and metrics +// for billing: +// monitored_resources: +// - type: library.googleapis.com/branch +// labels: +// - key: /city +// description: The city where the library branch is located in. +// - key: /name +// description: The name of the branch. +// metrics: +// - name: library.googleapis.com/book/borrowed_count +// metric_kind: DELTA +// value_type: INT64 +// billing: +// consumer_destinations: +// - monitored_resource: library.googleapis.com/branch +// metrics: +// - library.googleapis.com/book/borrowed_count +message Billing { + // Configuration of a specific billing destination (Currently only support + // bill against consumer project). + message BillingDestination { + // The monitored resource type. The type must be defined in + // [Service.monitored_resources][google.api.Service.monitored_resources] section. + string monitored_resource = 1; + + // Names of the metrics to report to this billing destination. + // Each name must be defined in [Service.metrics][google.api.Service.metrics] section. + repeated string metrics = 2; + } + + // Billing configurations for sending metrics to the consumer project. + // There can be multiple consumer destinations per service, each one must have + // a different monitored resource type. A metric can be used in at most + // one consumer destination. + repeated BillingDestination consumer_destinations = 8; +} diff --git a/handwritten/cloud-profiler/google/api/config_change.proto b/handwritten/cloud-profiler/google/api/config_change.proto new file mode 100644 index 00000000000..3c416164ec5 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/config_change.proto @@ -0,0 +1,85 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +option go_package = "google.golang.org/genproto/googleapis/api/configchange;configchange"; +option java_multiple_files = true; +option java_outer_classname = "ConfigChangeProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Output generated from semantically comparing two versions of a service +// configuration. +// +// Includes detailed information about a field that have changed with +// applicable advice about potential consequences for the change, such as +// backwards-incompatibility. +message ConfigChange { + // Object hierarchy path to the change, with levels separated by a '.' + // character. For repeated fields, an applicable unique identifier field is + // used for the index (usually selector, name, or id). For maps, the term + // 'key' is used. If the field has no unique identifier, the numeric index + // is used. + // Examples: + // - visibility.rules[selector=="google.LibraryService.CreateBook"].restriction + // - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value + // - logging.producer_destinations[0] + string element = 1; + + // Value of the changed object in the old Service configuration, + // in JSON format. This field will not be populated if ChangeType == ADDED. + string old_value = 2; + + // Value of the changed object in the new Service configuration, + // in JSON format. This field will not be populated if ChangeType == REMOVED. + string new_value = 3; + + // The type for this change, either ADDED, REMOVED, or MODIFIED. + ChangeType change_type = 4; + + // Collection of advice provided for this change, useful for determining the + // possible impact of this change. + repeated Advice advices = 5; +} + +// Generated advice about this change, used for providing more +// information about how a change will affect the existing service. +message Advice { + // Useful description for why this advice was applied and what actions should + // be taken to mitigate any implied risks. + string description = 2; +} + +// Classifies set of possible modifications to an object in the service +// configuration. +enum ChangeType { + // No value was provided. + CHANGE_TYPE_UNSPECIFIED = 0; + + // The changed object exists in the 'new' service configuration, but not + // in the 'old' service configuration. + ADDED = 1; + + // The changed object exists in the 'old' service configuration, but not + // in the 'new' service configuration. + REMOVED = 2; + + // The changed object exists in both service configurations, but its value + // is different. + MODIFIED = 3; +} diff --git a/handwritten/cloud-profiler/google/api/consumer.proto b/handwritten/cloud-profiler/google/api/consumer.proto new file mode 100644 index 00000000000..4e963168efc --- /dev/null +++ b/handwritten/cloud-profiler/google/api/consumer.proto @@ -0,0 +1,83 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "ConsumerProto"; +option java_package = "com.google.api"; + + +// A descriptor for defining project properties for a service. One service may +// have many consumer projects, and the service may want to behave differently +// depending on some properties on the project. For example, a project may be +// associated with a school, or a business, or a government agency, a business +// type property on the project may affect how a service responds to the client. +// This descriptor defines which properties are allowed to be set on a project. +// +// Example: +// +// project_properties: +// properties: +// - name: NO_WATERMARK +// type: BOOL +// description: Allows usage of the API without watermarks. +// - name: EXTENDED_TILE_CACHE_PERIOD +// type: INT64 +message ProjectProperties { + // List of per consumer project-specific properties. + repeated Property properties = 1; +} + +// Defines project properties. +// +// API services can define properties that can be assigned to consumer projects +// so that backends can perform response customization without having to make +// additional calls or maintain additional storage. For example, Maps API +// defines properties that controls map tile cache period, or whether to embed a +// watermark in a result. +// +// These values can be set via API producer console. Only API providers can +// define and set these properties. +message Property { + // Supported data type of the property values + enum PropertyType { + // The type is unspecified, and will result in an error. + UNSPECIFIED = 0; + + // The type is `int64`. + INT64 = 1; + + // The type is `bool`. + BOOL = 2; + + // The type is `string`. + STRING = 3; + + // The type is 'double'. + DOUBLE = 4; + } + + // The name of the property (a.k.a key). + string name = 1; + + // The type of this property. + PropertyType type = 2; + + // The description of the property + string description = 3; +} diff --git a/handwritten/cloud-profiler/google/api/context.proto b/handwritten/cloud-profiler/google/api/context.proto new file mode 100644 index 00000000000..fd03fcae916 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/context.proto @@ -0,0 +1,63 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "ContextProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// `Context` defines which contexts an API requests. +// +// Example: +// +// context: +// rules: +// - selector: "*" +// requested: +// - google.rpc.context.ProjectContext +// - google.rpc.context.OriginContext +// +// The above specifies that all methods in the API request +// `google.rpc.context.ProjectContext` and +// `google.rpc.context.OriginContext`. +// +// Available context types are defined in package +// `google.rpc.context`. +message Context { + // A list of RPC context rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated ContextRule rules = 1; +} + +// A context rule provides information about the context for an individual API +// element. +message ContextRule { + // Selects the methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // A list of full type names of requested contexts. + repeated string requested = 2; + + // A list of full type names of provided contexts. + repeated string provided = 3; +} diff --git a/handwritten/cloud-profiler/google/api/control.proto b/handwritten/cloud-profiler/google/api/control.proto new file mode 100644 index 00000000000..acad56cbdde --- /dev/null +++ b/handwritten/cloud-profiler/google/api/control.proto @@ -0,0 +1,33 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "ControlProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Selects and configures the service controller used by the service. The +// service controller handles features like abuse, quota, billing, logging, +// monitoring, etc. +message Control { + // The service control environment to use. If empty, no control plane + // feature (like quota and billing) will be enabled. + string environment = 1; +} diff --git a/handwritten/cloud-profiler/google/api/distribution.proto b/handwritten/cloud-profiler/google/api/distribution.proto new file mode 100644 index 00000000000..2861e9b6f3a --- /dev/null +++ b/handwritten/cloud-profiler/google/api/distribution.proto @@ -0,0 +1,185 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +import "google/api/annotations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/distribution;distribution"; +option java_multiple_files = true; +option java_outer_classname = "DistributionProto"; +option java_package = "com.google.api"; + + +// Distribution contains summary statistics for a population of values and, +// optionally, a histogram representing the distribution of those values across +// a specified set of histogram buckets. +// +// The summary statistics are the count, mean, sum of the squared deviation from +// the mean, the minimum, and the maximum of the set of population of values. +// +// The histogram is based on a sequence of buckets and gives a count of values +// that fall into each bucket. The boundaries of the buckets are given either +// explicitly or by specifying parameters for a method of computing them +// (buckets of fixed width or buckets of exponentially increasing width). +// +// Although it is not forbidden, it is generally a bad idea to include +// non-finite values (infinities or NaNs) in the population of values, as this +// will render the `mean` and `sum_of_squared_deviation` fields meaningless. +message Distribution { + // The range of the population values. + message Range { + // The minimum of the population values. + double min = 1; + + // The maximum of the population values. + double max = 2; + } + + // A Distribution may optionally contain a histogram of the values in the + // population. The histogram is given in `bucket_counts` as counts of values + // that fall into one of a sequence of non-overlapping buckets. The sequence + // of buckets is described by `bucket_options`. + // + // A bucket specifies an inclusive lower bound and exclusive upper bound for + // the values that are counted for that bucket. The upper bound of a bucket + // is strictly greater than the lower bound. + // + // The sequence of N buckets for a Distribution consists of an underflow + // bucket (number 0), zero or more finite buckets (number 1 through N - 2) and + // an overflow bucket (number N - 1). The buckets are contiguous: the lower + // bound of bucket i (i > 0) is the same as the upper bound of bucket i - 1. + // The buckets span the whole range of finite values: lower bound of the + // underflow bucket is -infinity and the upper bound of the overflow bucket is + // +infinity. The finite buckets are so-called because both bounds are + // finite. + // + // `BucketOptions` describes bucket boundaries in one of three ways. Two + // describe the boundaries by giving parameters for a formula to generate + // boundaries and one gives the bucket boundaries explicitly. + // + // If `bucket_boundaries` is not given, then no `bucket_counts` may be given. + message BucketOptions { + // Specify a sequence of buckets that all have the same width (except + // overflow and underflow). Each bucket represents a constant absolute + // uncertainty on the specific value in the bucket. + // + // Defines `num_finite_buckets + 2` (= N) buckets with these boundaries for + // bucket `i`: + // + // Upper bound (0 <= i < N-1): offset + (width * i). + // Lower bound (1 <= i < N): offset + (width * (i - 1)). + message Linear { + // Must be greater than 0. + int32 num_finite_buckets = 1; + + // Must be greater than 0. + double width = 2; + + // Lower bound of the first bucket. + double offset = 3; + } + + // Specify a sequence of buckets that have a width that is proportional to + // the value of the lower bound. Each bucket represents a constant relative + // uncertainty on a specific value in the bucket. + // + // Defines `num_finite_buckets + 2` (= N) buckets with these boundaries for + // bucket i: + // + // Upper bound (0 <= i < N-1): scale * (growth_factor ^ i). + // Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)). + message Exponential { + // Must be greater than 0. + int32 num_finite_buckets = 1; + + // Must be greater than 1. + double growth_factor = 2; + + // Must be greater than 0. + double scale = 3; + } + + // A set of buckets with arbitrary widths. + // + // Defines `size(bounds) + 1` (= N) buckets with these boundaries for + // bucket i: + // + // Upper bound (0 <= i < N-1): bounds[i] + // Lower bound (1 <= i < N); bounds[i - 1] + // + // There must be at least one element in `bounds`. If `bounds` has only one + // element, there are no finite buckets, and that single element is the + // common boundary of the overflow and underflow buckets. + message Explicit { + // The values must be monotonically increasing. + repeated double bounds = 1; + } + + // Exactly one of these three fields must be set. + oneof options { + // The linear bucket. + Linear linear_buckets = 1; + + // The exponential buckets. + Exponential exponential_buckets = 2; + + // The explicit buckets. + Explicit explicit_buckets = 3; + } + } + + // The number of values in the population. Must be non-negative. + int64 count = 1; + + // The arithmetic mean of the values in the population. If `count` is zero + // then this field must be zero. + double mean = 2; + + // The sum of squared deviations from the mean of the values in the + // population. For values x_i this is: + // + // Sum[i=1..n]((x_i - mean)^2) + // + // Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition + // describes Welford's method for accumulating this sum in one pass. + // + // If `count` is zero then this field must be zero. + double sum_of_squared_deviation = 3; + + // If specified, contains the range of the population values. The field + // must not be present if the `count` is zero. + Range range = 4; + + // Defines the histogram bucket boundaries. + BucketOptions bucket_options = 6; + + // If `bucket_options` is given, then the sum of the values in `bucket_counts` + // must equal the value in `count`. If `bucket_options` is not given, no + // `bucket_counts` fields may be given. + // + // Bucket counts are given in order under the numbering scheme described + // above (the underflow bucket has number 0; the finite buckets, if any, + // have numbers 1 through N-2; the overflow bucket has number N-1). + // + // The size of `bucket_counts` must be no greater than N as defined in + // `bucket_options`. + // + // Any suffix of trailing zero bucket_count fields may be omitted. + repeated int64 bucket_counts = 7; +} diff --git a/handwritten/cloud-profiler/google/api/documentation.proto b/handwritten/cloud-profiler/google/api/documentation.proto new file mode 100644 index 00000000000..0b85eca51e5 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/documentation.proto @@ -0,0 +1,159 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "DocumentationProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// `Documentation` provides the information for describing a service. +// +// Example: +//
documentation:
+//   summary: >
+//     The Google Calendar API gives access
+//     to most calendar features.
+//   pages:
+//   - name: Overview
+//     content: (== include google/foo/overview.md ==)
+//   - name: Tutorial
+//     content: (== include google/foo/tutorial.md ==)
+//     subpages;
+//     - name: Java
+//       content: (== include google/foo/tutorial_java.md ==)
+//   rules:
+//   - selector: google.calendar.Calendar.Get
+//     description: >
+//       ...
+//   - selector: google.calendar.Calendar.Put
+//     description: >
+//       ...
+// 
+// Documentation is provided in markdown syntax. In addition to +// standard markdown features, definition lists, tables and fenced +// code blocks are supported. Section headers can be provided and are +// interpreted relative to the section nesting of the context where +// a documentation fragment is embedded. +// +// Documentation from the IDL is merged with documentation defined +// via the config at normalization time, where documentation provided +// by config rules overrides IDL provided. +// +// A number of constructs specific to the API platform are supported +// in documentation text. +// +// In order to reference a proto element, the following +// notation can be used: +//
[fully.qualified.proto.name][]
+// To override the display text used for the link, this can be used: +//
[display text][fully.qualified.proto.name]
+// Text can be excluded from doc using the following notation: +//
(-- internal comment --)
+// Comments can be made conditional using a visibility label. The below +// text will be only rendered if the `BETA` label is available: +//
(--BETA: comment for BETA users --)
+// A few directives are available in documentation. Note that +// directives must appear on a single line to be properly +// identified. The `include` directive includes a markdown file from +// an external source: +//
(== include path/to/file ==)
+// The `resource_for` directive marks a message to be the resource of +// a collection in REST view. If it is not specified, tools attempt +// to infer the resource from the operations in a collection: +//
(== resource_for v1.shelves.books ==)
+// The directive `suppress_warning` does not directly affect documentation +// and is documented together with service config validation. +message Documentation { + // A short summary of what the service does. Can only be provided by + // plain text. + string summary = 1; + + // The top level pages for the documentation set. + repeated Page pages = 5; + + // A list of documentation rules that apply to individual API elements. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated DocumentationRule rules = 3; + + // The URL to the root of documentation. + string documentation_root_url = 4; + + // Declares a single overview page. For example: + //
documentation:
+  //   summary: ...
+  //   overview: (== include overview.md ==)
+  // 
+ // This is a shortcut for the following declaration (using pages style): + //
documentation:
+  //   summary: ...
+  //   pages:
+  //   - name: Overview
+  //     content: (== include overview.md ==)
+  // 
+ // Note: you cannot specify both `overview` field and `pages` field. + string overview = 2; +} + +// A documentation rule provides information about individual API elements. +message DocumentationRule { + // The selector is a comma-separated list of patterns. Each pattern is a + // qualified name of the element which may end in "*", indicating a wildcard. + // Wildcards are only allowed at the end and for a whole component of the + // qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". To + // specify a default for all applicable elements, the whole pattern "*" + // is used. + string selector = 1; + + // Description of the selected API(s). + string description = 2; + + // Deprecation description of the selected element(s). It can be provided if an + // element is marked as `deprecated`. + string deprecation_description = 3; +} + +// Represents a documentation page. A page can contain subpages to represent +// nested documentation set structure. +message Page { + // The name of the page. It will be used as an identity of the page to + // generate URI of the page, text of the link to this page in navigation, + // etc. The full page name (start from the root page name to this page + // concatenated with `.`) can be used as reference to the page in your + // documentation. For example: + //
pages:
+  // - name: Tutorial
+  //   content: (== include tutorial.md ==)
+  //   subpages:
+  //   - name: Java
+  //     content: (== include tutorial_java.md ==)
+  // 
+ // You can reference `Java` page using Markdown reference link syntax: + // `[Java][Tutorial.Java]`. + string name = 1; + + // The Markdown content of the page. You can use (== include {path} ==) + // to include content from a Markdown file. + string content = 2; + + // Subpages of this page. The order of subpages specified here will be + // honored in the generated docset. + repeated Page subpages = 3; +} diff --git a/handwritten/cloud-profiler/google/api/endpoint.proto b/handwritten/cloud-profiler/google/api/endpoint.proto new file mode 100644 index 00000000000..68655b26a08 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/endpoint.proto @@ -0,0 +1,74 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "EndpointProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// `Endpoint` describes a network endpoint that serves a set of APIs. +// A service may expose any number of endpoints, and all endpoints share the +// same service configuration, such as quota configuration and monitoring +// configuration. +// +// Example service configuration: +// +// name: library-example.googleapis.com +// endpoints: +// # Below entry makes 'google.example.library.v1.Library' +// # API be served from endpoint address library-example.googleapis.com. +// # It also allows HTTP OPTIONS calls to be passed to the backend, for +// # it to decide whether the subsequent cross-origin request is +// # allowed to proceed. +// - name: library-example.googleapis.com +// allow_cors: true +message Endpoint { + // The canonical name of this endpoint. + string name = 1; + + // DEPRECATED: This field is no longer supported. Instead of using aliases, + // please specify multiple [google.api.Endpoint][google.api.Endpoint] for each of the intented + // alias. + // + // Additional names that this endpoint will be hosted on. + repeated string aliases = 2; + + // The list of APIs served by this endpoint. + repeated string apis = 3; + + // The list of features enabled on this endpoint. + repeated string features = 4; + + // The specification of an Internet routable address of API frontend that will + // handle requests to this [API Endpoint](https://cloud.google.com/apis/design/glossary). + // It should be either a valid IPv4 address or a fully-qualified domain name. + // For example, "8.8.8.8" or "myservice.appspot.com". + string target = 101; + + // Allowing + // [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka + // cross-domain traffic, would allow the backends served from this endpoint to + // receive and respond to HTTP OPTIONS requests. The response will be used by + // the browser to determine whether the subsequent cross-origin request is + // allowed to proceed. + bool allow_cors = 5; +} diff --git a/handwritten/cloud-profiler/google/api/experimental/authorization_config.proto b/handwritten/cloud-profiler/google/api/experimental/authorization_config.proto new file mode 100644 index 00000000000..5c213c62531 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/experimental/authorization_config.proto @@ -0,0 +1,40 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +option go_package = "google.golang.org/genproto/googleapis/api;api"; +option java_multiple_files = true; +option java_outer_classname = "AuthorizationConfigProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Configuration of authorization. +// +// This section determines the authorization provider, if unspecified, then no +// authorization check will be done. +// +// Example: +// +// experimental: +// authorization: +// provider: firebaserules.googleapis.com +message AuthorizationConfig { + // The name of the authorization provider, such as + // firebaserules.googleapis.com. + string provider = 1; +} diff --git a/handwritten/cloud-profiler/google/api/experimental/experimental.proto b/handwritten/cloud-profiler/google/api/experimental/experimental.proto new file mode 100644 index 00000000000..b98097df54a --- /dev/null +++ b/handwritten/cloud-profiler/google/api/experimental/experimental.proto @@ -0,0 +1,34 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +import "google/api/annotations.proto"; +import "google/api/experimental/authorization_config.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api;api"; +option java_multiple_files = true; +option java_outer_classname = "ExperimentalProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Experimental service configuration. These configuration options can +// only be used by whitelisted users. +message Experimental { + // Authorization configuration. + AuthorizationConfig authorization = 8; +} diff --git a/handwritten/cloud-profiler/google/api/http.proto b/handwritten/cloud-profiler/google/api/http.proto new file mode 100644 index 00000000000..5f8538a0164 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/http.proto @@ -0,0 +1,291 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "HttpProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Defines the HTTP configuration for a service. It contains a list of +// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method +// to one or more HTTP REST API methods. +message Http { + // A list of HTTP configuration rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated HttpRule rules = 1; +} + +// `HttpRule` defines the mapping of an RPC method to one or more HTTP +// REST APIs. The mapping determines what portions of the request +// message are populated from the path, query parameters, or body of +// the HTTP request. The mapping is typically specified as an +// `google.api.http` annotation, see "google/api/annotations.proto" +// for details. +// +// The mapping consists of a field specifying the path template and +// method kind. The path template can refer to fields in the request +// message, as in the example below which describes a REST GET +// operation on a resource collection of messages: +// +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; +// } +// } +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // mapped to the URL +// SubMessage sub = 2; // `sub.subfield` is url-mapped +// } +// message Message { +// string text = 1; // content of the resource +// } +// +// The same http annotation can alternatively be expressed inside the +// `GRPC API Configuration` YAML file. +// +// http: +// rules: +// - selector: .Messaging.GetMessage +// get: /v1/messages/{message_id}/{sub.subfield} +// +// This definition enables an automatic, bidrectional mapping of HTTP +// JSON to RPC. Example: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` +// +// In general, not only fields but also field paths can be referenced +// from a path pattern. Fields mapped to the path pattern cannot be +// repeated and must have a primitive (non-message) type. +// +// Any fields in the request message which are not bound by the path +// pattern automatically become (optional) HTTP query +// parameters. Assume the following definition of the request message: +// +// +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // mapped to the URL +// int64 revision = 2; // becomes a parameter +// SubMessage sub = 3; // `sub.subfield` becomes a parameter +// } +// +// +// This enables a HTTP JSON to RPC mapping as below: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` +// +// Note that fields which are mapped to HTTP parameters must have a +// primitive type or a repeated primitive type. Message types are not +// allowed. In the case of a repeated type, the parameter can be +// repeated in the URL, as in `...?param=A¶m=B`. +// +// For HTTP method kinds which allow a request body, the `body` field +// specifies the mapping. Consider a REST update method on the +// message resource collection: +// +// +// service Messaging { +// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { +// option (google.api.http) = { +// put: "/v1/messages/{message_id}" +// body: "message" +// }; +// } +// } +// message UpdateMessageRequest { +// string message_id = 1; // mapped to the URL +// Message message = 2; // mapped to the body +// } +// +// +// The following HTTP JSON to RPC mapping is enabled, where the +// representation of the JSON in the request body is determined by +// protos JSON encoding: +// +// HTTP | RPC +// -----|----- +// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` +// +// The special name `*` can be used in the body mapping to define that +// every field not bound by the path template should be mapped to the +// request body. This enables the following alternative definition of +// the update method: +// +// service Messaging { +// rpc UpdateMessage(Message) returns (Message) { +// option (google.api.http) = { +// put: "/v1/messages/{message_id}" +// body: "*" +// }; +// } +// } +// message Message { +// string message_id = 1; +// string text = 2; +// } +// +// +// The following HTTP JSON to RPC mapping is enabled: +// +// HTTP | RPC +// -----|----- +// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` +// +// Note that when using `*` in the body mapping, it is not possible to +// have HTTP parameters, as all fields not bound by the path end in +// the body. This makes this option more rarely used in practice of +// defining REST APIs. The common usage of `*` is in custom methods +// which don't use the URL at all for transferring data. +// +// It is possible to define multiple HTTP methods for one RPC by using +// the `additional_bindings` option. Example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get: "/v1/messages/{message_id}" +// additional_bindings { +// get: "/v1/users/{user_id}/messages/{message_id}" +// } +// }; +// } +// } +// message GetMessageRequest { +// string message_id = 1; +// string user_id = 2; +// } +// +// +// This enables the following two alternative HTTP JSON to RPC +// mappings: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` +// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` +// +// # Rules for HTTP mapping +// +// The rules for mapping HTTP path, query parameters, and body fields +// to the request message are as follows: +// +// 1. The `body` field specifies either `*` or a field path, or is +// omitted. If omitted, it assumes there is no HTTP body. +// 2. Leaf fields (recursive expansion of nested messages in the +// request) can be classified into three types: +// (a) Matched in the URL template. +// (b) Covered by body (if body is `*`, everything except (a) fields; +// else everything under the body field) +// (c) All other fields. +// 3. URL query parameters found in the HTTP request are mapped to (c) fields. +// 4. Any body sent with an HTTP request can contain only (b) fields. +// +// The syntax of the path template is as follows: +// +// Template = "/" Segments [ Verb ] ; +// Segments = Segment { "/" Segment } ; +// Segment = "*" | "**" | LITERAL | Variable ; +// Variable = "{" FieldPath [ "=" Segments ] "}" ; +// FieldPath = IDENT { "." IDENT } ; +// Verb = ":" LITERAL ; +// +// The syntax `*` matches a single path segment. It follows the semantics of +// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String +// Expansion. +// +// The syntax `**` matches zero or more path segments. It follows the semantics +// of [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.3 Reserved +// Expansion. NOTE: it must be the last segment in the path except the Verb. +// +// The syntax `LITERAL` matches literal text in the URL path. +// +// The syntax `Variable` matches the entire path as specified by its template; +// this nested template must not contain further variables. If a variable +// matches a single path segment, its template may be omitted, e.g. `{var}` +// is equivalent to `{var=*}`. +// +// NOTE: the field paths in variables and in the `body` must not refer to +// repeated fields or map fields. +// +// Use CustomHttpPattern to specify any HTTP method that is not included in the +// `pattern` field, such as HEAD, or "*" to leave the HTTP method unspecified for +// a given URL path rule. The wild-card rule is useful for services that provide +// content to Web (HTML) clients. +message HttpRule { + // Selects methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // Determines the URL pattern is matched by this rules. This pattern can be + // used with any of the {get|put|post|delete|patch} methods. A custom method + // can be defined using the 'custom' field. + oneof pattern { + // Used for listing and getting information about resources. + string get = 2; + + // Used for updating a resource. + string put = 3; + + // Used for creating a resource. + string post = 4; + + // Used for deleting a resource. + string delete = 5; + + // Used for updating a resource. + string patch = 6; + + // Custom pattern is used for defining custom verbs. + CustomHttpPattern custom = 8; + } + + // The name of the request field whose value is mapped to the HTTP body, or + // `*` for mapping all fields not captured by the path pattern to the HTTP + // body. NOTE: the referred field must not be a repeated field and must be + // present at the top-level of request message type. + string body = 7; + + // Additional HTTP bindings for the selector. Nested bindings must + // not contain an `additional_bindings` field themselves (that is, + // the nesting may only be one level deep). + repeated HttpRule additional_bindings = 11; +} + +// A custom pattern is used for defining custom HTTP verb. +message CustomHttpPattern { + // The name of this custom HTTP verb. + string kind = 1; + + // The path matched by this custom verb. + string path = 2; +} diff --git a/handwritten/cloud-profiler/google/api/httpbody.proto b/handwritten/cloud-profiler/google/api/httpbody.proto new file mode 100644 index 00000000000..f5176634b0b --- /dev/null +++ b/handwritten/cloud-profiler/google/api/httpbody.proto @@ -0,0 +1,70 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody"; +option java_multiple_files = true; +option java_outer_classname = "HttpBodyProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Message that represents an arbitrary HTTP body. It should only be used for +// payload formats that can't be represented as JSON, such as raw binary or +// an HTML page. +// +// +// This message can be used both in streaming and non-streaming API methods in +// the request as well as the response. +// +// It can be used as a top-level request field, which is convenient if one +// wants to extract parameters from either the URL or HTTP template into the +// request fields and also want access to the raw HTTP body. +// +// Example: +// +// message GetResourceRequest { +// // A unique request id. +// string request_id = 1; +// +// // The raw HTTP body is bound to this field. +// google.api.HttpBody http_body = 2; +// } +// +// service ResourceService { +// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); +// rpc UpdateResource(google.api.HttpBody) returns (google.protobuf.Empty); +// } +// +// Example with streaming methods: +// +// service CaldavService { +// rpc GetCalendar(stream google.api.HttpBody) +// returns (stream google.api.HttpBody); +// rpc UpdateCalendar(stream google.api.HttpBody) +// returns (stream google.api.HttpBody); +// } +// +// Use of this type only changes how the request and response bodies are +// handled, all other features will continue to work unchanged. +message HttpBody { + // The HTTP Content-Type string representing the content type of the body. + string content_type = 1; + + // HTTP body binary data. + bytes data = 2; +} diff --git a/handwritten/cloud-profiler/google/api/label.proto b/handwritten/cloud-profiler/google/api/label.proto new file mode 100644 index 00000000000..ec2c14f0c35 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/label.proto @@ -0,0 +1,49 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/label;label"; +option java_multiple_files = true; +option java_outer_classname = "LabelProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// A description of a label. +message LabelDescriptor { + // Value types that can be used as label values. + enum ValueType { + // A variable-length string. This is the default. + STRING = 0; + + // Boolean; true or false. + BOOL = 1; + + // A 64-bit signed integer. + INT64 = 2; + } + + // The label key. + string key = 1; + + // The type of data that can be assigned to the label. + ValueType value_type = 2; + + // A human-readable description for the label. + string description = 3; +} diff --git a/handwritten/cloud-profiler/google/api/log.proto b/handwritten/cloud-profiler/google/api/log.proto new file mode 100644 index 00000000000..d64f2439581 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/log.proto @@ -0,0 +1,55 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +import "google/api/label.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "LogProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// A description of a log type. Example in YAML format: +// +// - name: library.googleapis.com/activity_history +// description: The history of borrowing and returning library items. +// display_name: Activity +// labels: +// - key: /customer_id +// description: Identifier of a library customer +message LogDescriptor { + // The name of the log. It must be less than 512 characters long and can + // include the following characters: upper- and lower-case alphanumeric + // characters [A-Za-z0-9], and punctuation characters including + // slash, underscore, hyphen, period [/_-.]. + string name = 1; + + // The set of labels that are available to describe a specific log entry. + // Runtime requests that contain labels not specified here are + // considered invalid. + repeated LabelDescriptor labels = 2; + + // A human-readable description of this log. This information appears in + // the documentation and can contain details. + string description = 3; + + // The human-readable name for this log. This information appears on + // the user interface and should be concise. + string display_name = 4; +} diff --git a/handwritten/cloud-profiler/google/api/logging.proto b/handwritten/cloud-profiler/google/api/logging.proto new file mode 100644 index 00000000000..15c8a996e97 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/logging.proto @@ -0,0 +1,83 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "LoggingProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Logging configuration of the service. +// +// The following example shows how to configure logs to be sent to the +// producer and consumer projects. In the example, the `activity_history` +// log is sent to both the producer and consumer projects, whereas the +// `purchase_history` log is only sent to the producer project. +// +// monitored_resources: +// - type: library.googleapis.com/branch +// labels: +// - key: /city +// description: The city where the library branch is located in. +// - key: /name +// description: The name of the branch. +// logs: +// - name: activity_history +// labels: +// - key: /customer_id +// - name: purchase_history +// logging: +// producer_destinations: +// - monitored_resource: library.googleapis.com/branch +// logs: +// - activity_history +// - purchase_history +// consumer_destinations: +// - monitored_resource: library.googleapis.com/branch +// logs: +// - activity_history +message Logging { + // Configuration of a specific logging destination (the producer project + // or the consumer project). + message LoggingDestination { + // The monitored resource type. The type must be defined in the + // [Service.monitored_resources][google.api.Service.monitored_resources] section. + string monitored_resource = 3; + + // Names of the logs to be sent to this destination. Each name must + // be defined in the [Service.logs][google.api.Service.logs] section. If the log name is + // not a domain scoped name, it will be automatically prefixed with + // the service name followed by "/". + repeated string logs = 1; + } + + // Logging configurations for sending logs to the producer project. + // There can be multiple producer destinations, each one must have a + // different monitored resource type. A log can be used in at most + // one producer destination. + repeated LoggingDestination producer_destinations = 1; + + // Logging configurations for sending logs to the consumer project. + // There can be multiple consumer destinations, each one must have a + // different monitored resource type. A log can be used in at most + // one consumer destination. + repeated LoggingDestination consumer_destinations = 2; +} diff --git a/handwritten/cloud-profiler/google/api/metric.proto b/handwritten/cloud-profiler/google/api/metric.proto new file mode 100644 index 00000000000..17b7263a334 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/metric.proto @@ -0,0 +1,196 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +import "google/api/label.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/metric;metric"; +option java_multiple_files = true; +option java_outer_classname = "MetricProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Defines a metric type and its schema. Once a metric descriptor is created, +// deleting or altering it stops data collection and makes the metric type's +// existing data unusable. +message MetricDescriptor { + // The kind of measurement. It describes how the data is reported. + enum MetricKind { + // Do not use this default value. + METRIC_KIND_UNSPECIFIED = 0; + + // An instantaneous measurement of a value. + GAUGE = 1; + + // The change in a value during a time interval. + DELTA = 2; + + // A value accumulated over a time interval. Cumulative + // measurements in a time series should have the same start time + // and increasing end times, until an event resets the cumulative + // value to zero and sets a new start time for the following + // points. + CUMULATIVE = 3; + } + + // The value type of a metric. + enum ValueType { + // Do not use this default value. + VALUE_TYPE_UNSPECIFIED = 0; + + // The value is a boolean. + // This value type can be used only if the metric kind is `GAUGE`. + BOOL = 1; + + // The value is a signed 64-bit integer. + INT64 = 2; + + // The value is a double precision floating point number. + DOUBLE = 3; + + // The value is a text string. + // This value type can be used only if the metric kind is `GAUGE`. + STRING = 4; + + // The value is a [`Distribution`][google.api.Distribution]. + DISTRIBUTION = 5; + + // The value is money. + MONEY = 6; + } + + // The resource name of the metric descriptor. Depending on the + // implementation, the name typically includes: (1) the parent resource name + // that defines the scope of the metric type or of its data; and (2) the + // metric's URL-encoded type, which also appears in the `type` field of this + // descriptor. For example, following is the resource name of a custom + // metric within the GCP project `my-project-id`: + // + // "projects/my-project-id/metricDescriptors/custom.googleapis.com%2Finvoice%2Fpaid%2Famount" + string name = 1; + + // The metric type, including its DNS name prefix. The type is not + // URL-encoded. All user-defined custom metric types have the DNS name + // `custom.googleapis.com`. Metric types should use a natural hierarchical + // grouping. For example: + // + // "custom.googleapis.com/invoice/paid/amount" + // "appengine.googleapis.com/http/server/response_latencies" + string type = 8; + + // The set of labels that can be used to describe a specific + // instance of this metric type. For example, the + // `appengine.googleapis.com/http/server/response_latencies` metric + // type has a label for the HTTP response code, `response_code`, so + // you can look at latencies for successful responses or just + // for responses that failed. + repeated LabelDescriptor labels = 2; + + // Whether the metric records instantaneous values, changes to a value, etc. + // Some combinations of `metric_kind` and `value_type` might not be supported. + MetricKind metric_kind = 3; + + // Whether the measurement is an integer, a floating-point number, etc. + // Some combinations of `metric_kind` and `value_type` might not be supported. + ValueType value_type = 4; + + // The unit in which the metric value is reported. It is only applicable + // if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The + // supported units are a subset of [The Unified Code for Units of + // Measure](http://unitsofmeasure.org/ucum.html) standard: + // + // **Basic units (UNIT)** + // + // * `bit` bit + // * `By` byte + // * `s` second + // * `min` minute + // * `h` hour + // * `d` day + // + // **Prefixes (PREFIX)** + // + // * `k` kilo (10**3) + // * `M` mega (10**6) + // * `G` giga (10**9) + // * `T` tera (10**12) + // * `P` peta (10**15) + // * `E` exa (10**18) + // * `Z` zetta (10**21) + // * `Y` yotta (10**24) + // * `m` milli (10**-3) + // * `u` micro (10**-6) + // * `n` nano (10**-9) + // * `p` pico (10**-12) + // * `f` femto (10**-15) + // * `a` atto (10**-18) + // * `z` zepto (10**-21) + // * `y` yocto (10**-24) + // * `Ki` kibi (2**10) + // * `Mi` mebi (2**20) + // * `Gi` gibi (2**30) + // * `Ti` tebi (2**40) + // + // **Grammar** + // + // The grammar includes the dimensionless unit `1`, such as `1/s`. + // + // The grammar also includes these connectors: + // + // * `/` division (as an infix operator, e.g. `1/s`). + // * `.` multiplication (as an infix operator, e.g. `GBy.d`) + // + // The grammar for a unit is as follows: + // + // Expression = Component { "." Component } { "/" Component } ; + // + // Component = [ PREFIX ] UNIT [ Annotation ] + // | Annotation + // | "1" + // ; + // + // Annotation = "{" NAME "}" ; + // + // Notes: + // + // * `Annotation` is just a comment if it follows a `UNIT` and is + // equivalent to `1` if it is used alone. For examples, + // `{requests}/s == 1/s`, `By{transmitted}/s == By/s`. + // * `NAME` is a sequence of non-blank printable ASCII characters not + // containing '{' or '}'. + string unit = 5; + + // A detailed description of the metric, which can be used in documentation. + string description = 6; + + // A concise name for the metric, which can be displayed in user interfaces. + // Use sentence case without an ending period, for example "Request count". + string display_name = 7; +} + +// A specific metric, identified by specifying values for all of the +// labels of a [`MetricDescriptor`][google.api.MetricDescriptor]. +message Metric { + // An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor]. + // For example, `custom.googleapis.com/invoice/paid/amount`. + string type = 3; + + // The set of label values that uniquely identify this metric. All + // labels listed in the `MetricDescriptor` must be assigned values. + map labels = 2; +} diff --git a/handwritten/cloud-profiler/google/api/monitored_resource.proto b/handwritten/cloud-profiler/google/api/monitored_resource.proto new file mode 100644 index 00000000000..612ffa18da4 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/monitored_resource.proto @@ -0,0 +1,91 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +import "google/api/label.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/monitoredres;monitoredres"; +option java_multiple_files = true; +option java_outer_classname = "MonitoredResourceProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a +// type name and a set of labels. For example, the monitored resource +// descriptor for Google Compute Engine VM instances has a type of +// `"gce_instance"` and specifies the use of the labels `"instance_id"` and +// `"zone"` to identify particular VM instances. +// +// Different APIs can support different monitored resource types. APIs generally +// provide a `list` method that returns the monitored resource descriptors used +// by the API. +message MonitoredResourceDescriptor { + // Optional. The resource name of the monitored resource descriptor: + // `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where + // {type} is the value of the `type` field in this object and + // {project_id} is a project ID that provides API-specific context for + // accessing the type. APIs that do not use project information can use the + // resource name format `"monitoredResourceDescriptors/{type}"`. + string name = 5; + + // Required. The monitored resource type. For example, the type + // `"cloudsql_database"` represents databases in Google Cloud SQL. + // The maximum length of this value is 256 characters. + string type = 1; + + // Optional. A concise name for the monitored resource type that might be + // displayed in user interfaces. It should be a Title Cased Noun Phrase, + // without any article or other determiners. For example, + // `"Google Cloud SQL Database"`. + string display_name = 2; + + // Optional. A detailed description of the monitored resource type that might + // be used in documentation. + string description = 3; + + // Required. A set of labels used to describe instances of this monitored + // resource type. For example, an individual Google Cloud SQL database is + // identified by values for the labels `"database_id"` and `"zone"`. + repeated LabelDescriptor labels = 4; +} + +// An object representing a resource that can be used for monitoring, logging, +// billing, or other purposes. Examples include virtual machine instances, +// databases, and storage devices such as disks. The `type` field identifies a +// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object that describes the resource's +// schema. Information in the `labels` field identifies the actual resource and +// its attributes according to the schema. For example, a particular Compute +// Engine VM instance could be represented by the following object, because the +// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for `"gce_instance"` has labels +// `"instance_id"` and `"zone"`: +// +// { "type": "gce_instance", +// "labels": { "instance_id": "12345678901234", +// "zone": "us-central1-a" }} +message MonitoredResource { + // Required. The monitored resource type. This field must match + // the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For + // example, the type of a Cloud SQL database is `"cloudsql_database"`. + string type = 1; + + // Required. Values for all of the labels listed in the associated monitored + // resource descriptor. For example, Cloud SQL databases use the labels + // `"database_id"` and `"zone"`. + map labels = 2; +} diff --git a/handwritten/cloud-profiler/google/api/monitoring.proto b/handwritten/cloud-profiler/google/api/monitoring.proto new file mode 100644 index 00000000000..f49c85f85ee --- /dev/null +++ b/handwritten/cloud-profiler/google/api/monitoring.proto @@ -0,0 +1,89 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "MonitoringProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Monitoring configuration of the service. +// +// The example below shows how to configure monitored resources and metrics +// for monitoring. In the example, a monitored resource and two metrics are +// defined. The `library.googleapis.com/book/returned_count` metric is sent +// to both producer and consumer projects, whereas the +// `library.googleapis.com/book/overdue_count` metric is only sent to the +// consumer project. +// +// monitored_resources: +// - type: library.googleapis.com/branch +// labels: +// - key: /city +// description: The city where the library branch is located in. +// - key: /name +// description: The name of the branch. +// metrics: +// - name: library.googleapis.com/book/returned_count +// metric_kind: DELTA +// value_type: INT64 +// labels: +// - key: /customer_id +// - name: library.googleapis.com/book/overdue_count +// metric_kind: GAUGE +// value_type: INT64 +// labels: +// - key: /customer_id +// monitoring: +// producer_destinations: +// - monitored_resource: library.googleapis.com/branch +// metrics: +// - library.googleapis.com/book/returned_count +// consumer_destinations: +// - monitored_resource: library.googleapis.com/branch +// metrics: +// - library.googleapis.com/book/returned_count +// - library.googleapis.com/book/overdue_count +message Monitoring { + // Configuration of a specific monitoring destination (the producer project + // or the consumer project). + message MonitoringDestination { + // The monitored resource type. The type must be defined in + // [Service.monitored_resources][google.api.Service.monitored_resources] section. + string monitored_resource = 1; + + // Names of the metrics to report to this monitoring destination. + // Each name must be defined in [Service.metrics][google.api.Service.metrics] section. + repeated string metrics = 2; + } + + // Monitoring configurations for sending metrics to the producer project. + // There can be multiple producer destinations, each one must have a + // different monitored resource type. A metric can be used in at most + // one producer destination. + repeated MonitoringDestination producer_destinations = 1; + + // Monitoring configurations for sending metrics to the consumer project. + // There can be multiple consumer destinations, each one must have a + // different monitored resource type. A metric can be used in at most + // one consumer destination. + repeated MonitoringDestination consumer_destinations = 2; +} diff --git a/handwritten/cloud-profiler/google/api/quota.proto b/handwritten/cloud-profiler/google/api/quota.proto new file mode 100644 index 00000000000..aa327a19694 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/quota.proto @@ -0,0 +1,259 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "QuotaProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Quota configuration helps to achieve fairness and budgeting in service +// usage. +// +// The quota configuration works this way: +// - The service configuration defines a set of metrics. +// - For API calls, the quota.metric_rules maps methods to metrics with +// corresponding costs. +// - The quota.limits defines limits on the metrics, which will be used for +// quota checks at runtime. +// +// An example quota configuration in yaml format: +// +// quota: +// limits: +// +// - name: apiWriteQpsPerProject +// metric: library.googleapis.com/write_calls +// unit: "1/min/{project}" # rate limit for consumer projects +// values: +// STANDARD: 10000 +// +// # The metric rules bind all methods to the read_calls metric, +// # except for the UpdateBook and DeleteBook methods. These two methods +// # are mapped to the write_calls metric, with the UpdateBook method +// # consuming at twice rate as the DeleteBook method. +// metric_rules: +// - selector: "*" +// metric_costs: +// library.googleapis.com/read_calls: 1 +// - selector: google.example.library.v1.LibraryService.UpdateBook +// metric_costs: +// library.googleapis.com/write_calls: 2 +// - selector: google.example.library.v1.LibraryService.DeleteBook +// metric_costs: +// library.googleapis.com/write_calls: 1 +// +// Corresponding Metric definition: +// +// metrics: +// - name: library.googleapis.com/read_calls +// display_name: Read requests +// metric_kind: DELTA +// value_type: INT64 +// +// - name: library.googleapis.com/write_calls +// display_name: Write requests +// metric_kind: DELTA +// value_type: INT64 +// +message Quota { + // List of `QuotaLimit` definitions for the service. + // + // Used by metric-based quotas only. + repeated QuotaLimit limits = 3; + + // List of `MetricRule` definitions, each one mapping a selected method to one + // or more metrics. + // + // Used by metric-based quotas only. + repeated MetricRule metric_rules = 4; +} + +// Bind API methods to metrics. Binding a method to a metric causes that +// metric's configured quota, billing, and monitoring behaviors to apply to the +// method call. +// +// Used by metric-based quotas only. +message MetricRule { + // Selects the methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // Metrics to update when the selected methods are called, and the associated + // cost applied to each metric. + // + // The key of the map is the metric name, and the values are the amount + // increased for the metric against which the quota limits are defined. + // The value must not be negative. + map metric_costs = 2; +} + +// `QuotaLimit` defines a specific limit that applies over a specified duration +// for a limit type. There can be at most one limit for a duration and limit +// type combination defined within a `QuotaGroup`. +message QuotaLimit { + // Name of the quota limit. The name is used to refer to the limit when + // overriding the default limit on per-consumer basis. + // + // For group-based quota limits, the name must be unique within the quota + // group. If a name is not provided, it will be generated from the limit_by + // and duration fields. + // + // For metric-based quota limits, the name must be provided, and it must be + // unique within the service. The name can only include alphanumeric + // characters as well as '-'. + // + // The maximum length of the limit name is 64 characters. + // + // The name of a limit is used as a unique identifier for this limit. + // Therefore, once a limit has been put into use, its name should be + // immutable. You can use the display_name field to provide a user-friendly + // name for the limit. The display name can be evolved over time without + // affecting the identity of the limit. + string name = 6; + + // Optional. User-visible, extended description for this quota limit. + // Should be used only when more context is needed to understand this limit + // than provided by the limit's display name (see: `display_name`). + string description = 2; + + // Default number of tokens that can be consumed during the specified + // duration. This is the number of tokens assigned when a client + // application developer activates the service for his/her project. + // + // Specifying a value of 0 will block all requests. This can be used if you + // are provisioning quota to selected consumers and blocking others. + // Similarly, a value of -1 will indicate an unlimited quota. No other + // negative values are allowed. + // + // Used by group-based quotas only. + int64 default_limit = 3; + + // Maximum number of tokens that can be consumed during the specified + // duration. Client application developers can override the default limit up + // to this maximum. If specified, this value cannot be set to a value less + // than the default limit. If not specified, it is set to the default limit. + // + // To allow clients to apply overrides with no upper bound, set this to -1, + // indicating unlimited maximum quota. + // + // Used by group-based quotas only. + int64 max_limit = 4; + + // Free tier value displayed in the Developers Console for this limit. + // The free tier is the number of tokens that will be subtracted from the + // billed amount when billing is enabled. + // This field can only be set on a limit with duration "1d", in a billable + // group; it is invalid on any other limit. If this field is not set, it + // defaults to 0, indicating that there is no free tier for this service. + // + // Used by group-based quotas only. + int64 free_tier = 7; + + // Duration of this limit in textual notation. Example: "100s", "24h", "1d". + // For duration longer than a day, only multiple of days is supported. We + // support only "100s" and "1d" for now. Additional support will be added in + // the future. "0" indicates indefinite duration. + // + // Used by group-based quotas only. + string duration = 5; + + // The name of the metric this quota limit applies to. The quota limits with + // the same metric will be checked together during runtime. The metric must be + // defined within the service config. + // + // Used by metric-based quotas only. + string metric = 8; + + // Specify the unit of the quota limit. It uses the same syntax as + // [Metric.unit][]. The supported unit kinds are determined by the quota + // backend system. + // + // The [Google Service Control](https://cloud.google.com/service-control) + // supports the following unit components: + // * One of the time intevals: + // * "/min" for quota every minute. + // * "/d" for quota every 24 hours, starting 00:00 US Pacific Time. + // * Otherwise the quota won't be reset by time, such as storage limit. + // * One and only one of the granted containers: + // * "/{organization}" quota for an organization. + // * "/{project}" quota for a project. + // * "/{folder}" quota for a folder. + // * "/{resource}" quota for a universal resource. + // * Zero or more quota segmentation dimension. Not all combos are valid. + // * "/{region}" quota for every region. Not to be used with time intervals. + // * Otherwise the resources granted on the target is not segmented. + // * "/{zone}" quota for every zone. Not to be used with time intervals. + // * Otherwise the resources granted on the target is not segmented. + // * "/{resource}" quota for a resource associated with a project or org. + // + // Here are some examples: + // * "1/min/{project}" for quota per minute per project. + // * "1/min/{user}" for quota per minute per user. + // * "1/min/{organization}" for quota per minute per organization. + // + // Note: the order of unit components is insignificant. + // The "1" at the beginning is required to follow the metric unit syntax. + // + // Used by metric-based quotas only. + string unit = 9; + + // Tiered limit values. Also allows for regional or zone overrides for these + // values if "/{region}" or "/{zone}" is specified in the unit field. + // + // Currently supported tiers from low to high: + // VERY_LOW, LOW, STANDARD, HIGH, VERY_HIGH + // + // To apply different limit values for users according to their tiers, specify + // the values for the tiers you want to differentiate. For example: + // {LOW:100, STANDARD:500, HIGH:1000, VERY_HIGH:5000} + // + // The limit value for each tier is optional except for the tier STANDARD. + // The limit value for an unspecified tier falls to the value of its next + // tier towards tier STANDARD. For the above example, the limit value for tier + // STANDARD is 500. + // + // To apply the same limit value for all users, just specify limit value for + // tier STANDARD. For example: {STANDARD:500}. + // + // To apply a regional overide for a tier, add a map entry with key + // "/", where is a region name. Similarly, for a zone + // override, add a map entry with key "/{zone}". + // Further, a wildcard can be used at the end of a zone name in order to + // specify zone level overrides. For example: + // LOW: 10, STANDARD: 50, HIGH: 100, + // LOW/us-central1: 20, STANDARD/us-central1: 60, HIGH/us-central1: 200, + // LOW/us-central1-*: 10, STANDARD/us-central1-*: 20, HIGH/us-central1-*: 80 + // + // The regional overrides tier set for each region must be the same as + // the tier set for default limit values. Same rule applies for zone overrides + // tier as well. + // + // Used by metric-based quotas only. + map values = 10; + + // User-visible display name for this limit. + // Optional. If not set, the UI will provide a default display name based on + // the quota configuration. This field can be used to override the default + // display name generated from the configuration. + string display_name = 12; +} diff --git a/handwritten/cloud-profiler/google/api/service.proto b/handwritten/cloud-profiler/google/api/service.proto new file mode 100644 index 00000000000..87fba7ba665 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/service.proto @@ -0,0 +1,178 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +import "google/api/annotations.proto"; +import "google/api/auth.proto"; +import "google/api/backend.proto"; +import "google/api/billing.proto"; +import "google/api/context.proto"; +import "google/api/control.proto"; +import "google/api/documentation.proto"; +import "google/api/endpoint.proto"; +import "google/api/experimental/experimental.proto"; +import "google/api/http.proto"; +import "google/api/label.proto"; +import "google/api/log.proto"; +import "google/api/logging.proto"; +import "google/api/metric.proto"; +import "google/api/monitored_resource.proto"; +import "google/api/monitoring.proto"; +import "google/api/quota.proto"; +import "google/api/source_info.proto"; +import "google/api/system_parameter.proto"; +import "google/api/usage.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/api.proto"; +import "google/protobuf/type.proto"; +import "google/protobuf/wrappers.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "ServiceProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// `Service` is the root object of Google service configuration schema. It +// describes basic information about a service, such as the name and the +// title, and delegates other aspects to sub-sections. Each sub-section is +// either a proto message or a repeated proto message that configures a +// specific aspect, such as auth. See each proto message definition for details. +// +// Example: +// +// type: google.api.Service +// config_version: 3 +// name: calendar.googleapis.com +// title: Google Calendar API +// apis: +// - name: google.calendar.v3.Calendar +// authentication: +// providers: +// - id: google_calendar_auth +// jwks_uri: https://www.googleapis.com/oauth2/v1/certs +// issuer: https://securetoken.google.com +// rules: +// - selector: "*" +// requirements: +// provider_id: google_calendar_auth +message Service { + // The semantic version of the service configuration. The config version + // affects the interpretation of the service configuration. For example, + // certain features are enabled by default for certain config versions. + // The latest config version is `3`. + google.protobuf.UInt32Value config_version = 20; + + // The DNS address at which this service is available, + // e.g. `calendar.googleapis.com`. + string name = 1; + + // A unique ID for a specific instance of this message, typically assigned + // by the client for tracking purpose. If empty, the server may choose to + // generate one instead. + string id = 33; + + // The product title for this service. + string title = 2; + + // The Google project that owns this service. + string producer_project_id = 22; + + // A list of API interfaces exported by this service. Only the `name` field + // of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration + // author, as the remaining fields will be derived from the IDL during the + // normalization process. It is an error to specify an API interface here + // which cannot be resolved against the associated IDL files. + repeated google.protobuf.Api apis = 3; + + // A list of all proto message types included in this API service. + // Types referenced directly or indirectly by the `apis` are + // automatically included. Messages which are not referenced but + // shall be included, such as types used by the `google.protobuf.Any` type, + // should be listed here by name. Example: + // + // types: + // - name: google.protobuf.Int32 + repeated google.protobuf.Type types = 4; + + // A list of all enum types included in this API service. Enums + // referenced directly or indirectly by the `apis` are automatically + // included. Enums which are not referenced but shall be included + // should be listed here by name. Example: + // + // enums: + // - name: google.someapi.v1.SomeEnum + repeated google.protobuf.Enum enums = 5; + + // Additional API documentation. + Documentation documentation = 6; + + // API backend configuration. + Backend backend = 8; + + // HTTP configuration. + Http http = 9; + + // Quota configuration. + Quota quota = 10; + + // Auth configuration. + Authentication authentication = 11; + + // Context configuration. + Context context = 12; + + // Configuration controlling usage of this service. + Usage usage = 15; + + // Configuration for network endpoints. If this is empty, then an endpoint + // with the same name as the service is automatically generated to service all + // defined APIs. + repeated Endpoint endpoints = 18; + + // Configuration for the service control plane. + Control control = 21; + + // Defines the logs used by this service. + repeated LogDescriptor logs = 23; + + // Defines the metrics used by this service. + repeated MetricDescriptor metrics = 24; + + // Defines the monitored resources used by this service. This is required + // by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations. + repeated MonitoredResourceDescriptor monitored_resources = 25; + + // Billing configuration. + Billing billing = 26; + + // Logging configuration. + Logging logging = 27; + + // Monitoring configuration. + Monitoring monitoring = 28; + + // System parameter configuration. + SystemParameters system_parameters = 29; + + // Output only. The source information for this configuration if available. + SourceInfo source_info = 37; + + // Experimental configuration. + Experimental experimental = 101; +} diff --git a/handwritten/cloud-profiler/google/api/servicecontrol/README.md b/handwritten/cloud-profiler/google/api/servicecontrol/README.md new file mode 100644 index 00000000000..3d9590ee029 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/servicecontrol/README.md @@ -0,0 +1,126 @@ +Google Service Control provides control plane functionality to managed services, +such as logging, monitoring, and status checks. This page provides an overview +of what it does and how it works. + +## Why use Service Control? + +When you develop a cloud service, you typically start with the business +requirements and the architecture design, then proceed with API definition +and implementation. Before you put your service into production, you +need to deal with many control plane issues: + +* How to control access to your service. +* How to send logging and monitoring data to both consumers and producers. +* How to create and manage dashboards to visualize this data. +* How to automatically scale the control plane components with your service. + +Service Control is a mature and feature-rich control plane provider +that addresses these needs with high efficiency, high scalability, +and high availability. It provides a simple public API that can be accessed +from anywhere using JSON REST and gRPC clients, so when you move your service +from on-premise to a cloud provider, or from one cloud provider to another, +you don't need to change the control plane provider. + +Services built using Google Cloud Endpoints already take advantage of +Service Control. Cloud Endpoints sends logging and monitoring data +through Google Service Control for every request arriving at its +proxy. If you need to report any additional logging and monitoring data for +your Cloud Endpoints service, you can call the Service Control API directly +from your service. + +The Service Control API definition is open sourced and available on +[GitHub](https://github.com/googleapis/googleapis/tree/master/google/api/servicecontrol). +By changing the DNS name, you can easily use alternative implementations of +the Service Control API. + +## Architecture + +Google Service Control works with a set of *managed services* and their +*operations* (activities), *checks* whether an operation is allowed to proceed, +and *reports* completed operations. Behind the scenes, it leverages other +Google Cloud services, such as +[Google Service Management](/service-management), +[Stackdriver Logging](/logging), and [Stackdriver Monitoring](/monitoring), +while hiding their complexity from service producers. It enables service +producers to send telemetry data to their consumers. It uses caching, +batching, aggregation, and retries to deliver higher performance and +availability than the individual backend systems it encapsulates. + +
+
+ The overall architecture of a service that uses Google Service Control. +
+
Figure 1: Using Google Service Control.
+
+ +The Service Control API provides two methods: + +* [`services.check`](/service-control/reference/rest/v1/services/check), used for: + * Ensuring valid consumer status + * Validating API keys +* [`services.report`](/service-control/reference/rest/v1/services/report), used for: + * Sending logs to Stackdriver Logging + * Sending metrics to Stackdriver Monitoring + +We’ll look at these in more detail in the rest of this overview. + +## Managed services + +A [managed service](/service-management/reference/rest/v1/services) is +a network service managed by +[Google Service Management](/service-management). Each managed service has a +unique name, such as `example.googleapis.com`, which must be a valid +fully-qualified DNS name, as per RFC 1035. + +For example: + +* Google Cloud Pub/Sub (`pubsub.googleapis.com`) +* Google Cloud Vision (`vision.googleapis.com`) +* Google Cloud Bigtable (`bigtable.googleapis.com`) +* Google Cloud Datastore (`datastore.googleapis.com`) + +Google Service Management manages the lifecycle of each service’s +configuration, which is used to customize Google Service Control's behavior. +Service configurations are also used by Google Cloud Console +for displaying APIs and their settings, enabling/disabling APIs, and more. + +## Operations + +Google Service Control uses the generic concept of an *operation* +to represent the +activities of a managed service, such as API calls and resource usage. Each +operation is associated with a managed service and a specific service +consumer, and has a set of properties that describe the operation, such as +the API method name and resource usage amount. For more information, see the +[Operation definition](/service-control/rest/v1/Operation). + +## Check + +The [`services.check`](/service-control/reference/rest/v1/services/check) +method determines whether an operation should be allowed to proceed +for a managed service. + +For example: + +* Check if the consumer is still active. +* Check if the consumer has enabled the service. +* Check if the API key is still valid. + +By performing multiple checks within a single method call, it provides +better performance, higher reliability, and reduced development cost to +service producers compared to checking with multiple backend systems. + +## Report + +The [`services.report`](/service-control/reference/rest/v1/services/report) +method reports completed operations for +a managed service to backend systems, such as logging and monitoring. The +reported data can be seen in Google API Console and Google Cloud Console, +and retrieved with appropriate APIs, such as the Stackdriver Logging and +Stackdriver Monitoring APIs. + +## Next steps + +* Read our [Getting Started guide](/service-control/getting-started) to find out + how to set up and use the Google Service Control API. diff --git a/handwritten/cloud-profiler/google/api/servicecontrol/v1/check_error.proto b/handwritten/cloud-profiler/google/api/servicecontrol/v1/check_error.proto new file mode 100644 index 00000000000..7d0d7adad1c --- /dev/null +++ b/handwritten/cloud-profiler/google/api/servicecontrol/v1/check_error.proto @@ -0,0 +1,95 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "CheckErrorProto"; +option java_package = "com.google.api.servicecontrol.v1"; + + +// Defines the errors to be returned in +// [google.api.servicecontrol.v1.CheckResponse.check_errors][google.api.servicecontrol.v1.CheckResponse.check_errors]. +message CheckError { + // Error codes for Check responses. + enum Code { + // This is never used in `CheckResponse`. + ERROR_CODE_UNSPECIFIED = 0; + + // The consumer's project id was not found. + // Same as [google.rpc.Code.NOT_FOUND][]. + NOT_FOUND = 5; + + // The consumer doesn't have access to the specified resource. + // Same as [google.rpc.Code.PERMISSION_DENIED][]. + PERMISSION_DENIED = 7; + + // Quota check failed. Same as [google.rpc.Code.RESOURCE_EXHAUSTED][]. + RESOURCE_EXHAUSTED = 8; + + // The consumer hasn't activated the service. + SERVICE_NOT_ACTIVATED = 104; + + // The consumer cannot access the service because billing is disabled. + BILLING_DISABLED = 107; + + // The consumer's project has been marked as deleted (soft deletion). + PROJECT_DELETED = 108; + + // The consumer's project number or id does not represent a valid project. + PROJECT_INVALID = 114; + + // The IP address of the consumer is invalid for the specific consumer + // project. + IP_ADDRESS_BLOCKED = 109; + + // The referer address of the consumer request is invalid for the specific + // consumer project. + REFERER_BLOCKED = 110; + + // The client application of the consumer request is invalid for the + // specific consumer project. + CLIENT_APP_BLOCKED = 111; + + // The consumer's API key is invalid. + API_KEY_INVALID = 105; + + // The consumer's API Key has expired. + API_KEY_EXPIRED = 112; + + // The consumer's API Key was not found in config record. + API_KEY_NOT_FOUND = 113; + + // The backend server for looking up project id/number is unavailable. + NAMESPACE_LOOKUP_UNAVAILABLE = 300; + + // The backend server for checking service status is unavailable. + SERVICE_STATUS_UNAVAILABLE = 301; + + // The backend server for checking billing status is unavailable. + BILLING_STATUS_UNAVAILABLE = 302; + } + + // The error code. + Code code = 1; + + // Free-form text providing details on the error cause of the error. + string detail = 2; +} diff --git a/handwritten/cloud-profiler/google/api/servicecontrol/v1/distribution.proto b/handwritten/cloud-profiler/google/api/servicecontrol/v1/distribution.proto new file mode 100644 index 00000000000..757bbfc0ed4 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/servicecontrol/v1/distribution.proto @@ -0,0 +1,159 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "DistributionProto"; +option java_package = "com.google.api.servicecontrol.v1"; + + +// Distribution represents a frequency distribution of double-valued sample +// points. It contains the size of the population of sample points plus +// additional optional information: +// +// - the arithmetic mean of the samples +// - the minimum and maximum of the samples +// - the sum-squared-deviation of the samples, used to compute variance +// - a histogram of the values of the sample points +message Distribution { + // Describing buckets with constant width. + message LinearBuckets { + // The number of finite buckets. With the underflow and overflow buckets, + // the total number of buckets is `num_finite_buckets` + 2. + // See comments on `bucket_options` for details. + int32 num_finite_buckets = 1; + + // The i'th linear bucket covers the interval + // [offset + (i-1) * width, offset + i * width) + // where i ranges from 1 to num_finite_buckets, inclusive. + // Must be strictly positive. + double width = 2; + + // The i'th linear bucket covers the interval + // [offset + (i-1) * width, offset + i * width) + // where i ranges from 1 to num_finite_buckets, inclusive. + double offset = 3; + } + + // Describing buckets with exponentially growing width. + message ExponentialBuckets { + // The number of finite buckets. With the underflow and overflow buckets, + // the total number of buckets is `num_finite_buckets` + 2. + // See comments on `bucket_options` for details. + int32 num_finite_buckets = 1; + + // The i'th exponential bucket covers the interval + // [scale * growth_factor^(i-1), scale * growth_factor^i) + // where i ranges from 1 to num_finite_buckets inclusive. + // Must be larger than 1.0. + double growth_factor = 2; + + // The i'th exponential bucket covers the interval + // [scale * growth_factor^(i-1), scale * growth_factor^i) + // where i ranges from 1 to num_finite_buckets inclusive. + // Must be > 0. + double scale = 3; + } + + // Describing buckets with arbitrary user-provided width. + message ExplicitBuckets { + // 'bound' is a list of strictly increasing boundaries between + // buckets. Note that a list of length N-1 defines N buckets because + // of fenceposting. See comments on `bucket_options` for details. + // + // The i'th finite bucket covers the interval + // [bound[i-1], bound[i]) + // where i ranges from 1 to bound_size() - 1. Note that there are no + // finite buckets at all if 'bound' only contains a single element; in + // that special case the single bound defines the boundary between the + // underflow and overflow buckets. + // + // bucket number lower bound upper bound + // i == 0 (underflow) -inf bound[i] + // 0 < i < bound_size() bound[i-1] bound[i] + // i == bound_size() (overflow) bound[i-1] +inf + repeated double bounds = 1; + } + + // The total number of samples in the distribution. Must be >= 0. + int64 count = 1; + + // The arithmetic mean of the samples in the distribution. If `count` is + // zero then this field must be zero. + double mean = 2; + + // The minimum of the population of values. Ignored if `count` is zero. + double minimum = 3; + + // The maximum of the population of values. Ignored if `count` is zero. + double maximum = 4; + + // The sum of squared deviations from the mean: + // Sum[i=1..count]((x_i - mean)^2) + // where each x_i is a sample values. If `count` is zero then this field + // must be zero, otherwise validation of the request fails. + double sum_of_squared_deviation = 5; + + // The number of samples in each histogram bucket. `bucket_counts` are + // optional. If present, they must sum to the `count` value. + // + // The buckets are defined below in `bucket_option`. There are N buckets. + // `bucket_counts[0]` is the number of samples in the underflow bucket. + // `bucket_counts[1]` to `bucket_counts[N-1]` are the numbers of samples + // in each of the finite buckets. And `bucket_counts[N] is the number + // of samples in the overflow bucket. See the comments of `bucket_option` + // below for more details. + // + // Any suffix of trailing zeros may be omitted. + repeated int64 bucket_counts = 6; + + // Defines the buckets in the histogram. `bucket_option` and `bucket_counts` + // must be both set, or both unset. + // + // Buckets are numbered in the range of [0, N], with a total of N+1 buckets. + // There must be at least two buckets (a single-bucket histogram gives + // no information that isn't already provided by `count`). + // + // The first bucket is the underflow bucket which has a lower bound + // of -inf. The last bucket is the overflow bucket which has an + // upper bound of +inf. All other buckets (if any) are called "finite" + // buckets because they have finite lower and upper bounds. As described + // below, there are three ways to define the finite buckets. + // + // (1) Buckets with constant width. + // (2) Buckets with exponentially growing widths. + // (3) Buckets with arbitrary user-provided widths. + // + // In all cases, the buckets cover the entire real number line (-inf, + // +inf). Bucket upper bounds are exclusive and lower bounds are + // inclusive. The upper bound of the underflow bucket is equal to the + // lower bound of the smallest finite bucket; the lower bound of the + // overflow bucket is equal to the upper bound of the largest finite + // bucket. + oneof bucket_option { + // Buckets with constant width. + LinearBuckets linear_buckets = 7; + + // Buckets with exponentially growing width. + ExponentialBuckets exponential_buckets = 8; + + // Buckets with arbitrary user-provided width. + ExplicitBuckets explicit_buckets = 9; + } +} diff --git a/handwritten/cloud-profiler/google/api/servicecontrol/v1/log_entry.proto b/handwritten/cloud-profiler/google/api/servicecontrol/v1/log_entry.proto new file mode 100644 index 00000000000..c06232f3d18 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/servicecontrol/v1/log_entry.proto @@ -0,0 +1,67 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/annotations.proto"; +import "google/logging/type/log_severity.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "LogEntryProto"; +option java_package = "com.google.api.servicecontrol.v1"; + + +// An individual log entry. +message LogEntry { + // Required. The log to which this log entry belongs. Examples: `"syslog"`, + // `"book_log"`. + string name = 10; + + // The time the event described by the log entry occurred. If + // omitted, defaults to operation start time. + google.protobuf.Timestamp timestamp = 11; + + // The severity of the log entry. The default value is + // `LogSeverity.DEFAULT`. + google.logging.type.LogSeverity severity = 12; + + // A unique ID for the log entry used for deduplication. If omitted, + // the implementation will generate one based on operation_id. + string insert_id = 4; + + // A set of user-defined (key, value) data that provides additional + // information about the log entry. + map labels = 13; + + // The log entry payload, which can be one of multiple types. + oneof payload { + // The log entry payload, represented as a protocol buffer that is + // expressed as a JSON object. The only accepted type currently is + // [AuditLog][google.cloud.audit.AuditLog]. + google.protobuf.Any proto_payload = 2; + + // The log entry payload, represented as a Unicode string (UTF-8). + string text_payload = 3; + + // The log entry payload, represented as a structure that + // is expressed as a JSON object. + google.protobuf.Struct struct_payload = 6; + } +} diff --git a/handwritten/cloud-profiler/google/api/servicecontrol/v1/metric_value.proto b/handwritten/cloud-profiler/google/api/servicecontrol/v1/metric_value.proto new file mode 100644 index 00000000000..bfc40a8fb2e --- /dev/null +++ b/handwritten/cloud-profiler/google/api/servicecontrol/v1/metric_value.proto @@ -0,0 +1,78 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/annotations.proto"; +import "google/api/servicecontrol/v1/distribution.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/money.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "MetricValueSetProto"; +option java_package = "com.google.api.servicecontrol.v1"; + + +// Represents a single metric value. +message MetricValue { + // The labels describing the metric value. + // See comments on [google.api.servicecontrol.v1.Operation.labels][google.api.servicecontrol.v1.Operation.labels] for + // the overriding relationship. + map labels = 1; + + // The start of the time period over which this metric value's measurement + // applies. The time period has different semantics for different metric + // types (cumulative, delta, and gauge). See the metric definition + // documentation in the service configuration for details. + google.protobuf.Timestamp start_time = 2; + + // The end of the time period over which this metric value's measurement + // applies. + google.protobuf.Timestamp end_time = 3; + + // The value. The type of value used in the request must + // agree with the metric definition in the service configuration, otherwise + // the MetricValue is rejected. + oneof value { + // A boolean value. + bool bool_value = 4; + + // A signed 64-bit integer value. + int64 int64_value = 5; + + // A double precision floating point value. + double double_value = 6; + + // A text string value. + string string_value = 7; + + // A distribution value. + Distribution distribution_value = 8; + } +} + +// Represents a set of metric values in the same metric. +// Each metric value in the set should have a unique combination of start time, +// end time, and label values. +message MetricValueSet { + // The metric name defined in the service configuration. + string metric_name = 1; + + // The values in this metric. + repeated MetricValue metric_values = 2; +} diff --git a/handwritten/cloud-profiler/google/api/servicecontrol/v1/operation.proto b/handwritten/cloud-profiler/google/api/servicecontrol/v1/operation.proto new file mode 100644 index 00000000000..37aa81fbed4 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/servicecontrol/v1/operation.proto @@ -0,0 +1,112 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/annotations.proto"; +import "google/api/servicecontrol/v1/log_entry.proto"; +import "google/api/servicecontrol/v1/metric_value.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "OperationProto"; +option java_package = "com.google.api.servicecontrol.v1"; + + +// Represents information regarding an operation. +message Operation { + // Defines the importance of the data contained in the operation. + enum Importance { + // The API implementation may cache and aggregate the data. + // The data may be lost when rare and unexpected system failures occur. + LOW = 0; + + // The API implementation doesn't cache and aggregate the data. + // If the method returns successfully, it's guaranteed that the data has + // been persisted in durable storage. + HIGH = 1; + } + + // Identity of the operation. This must be unique within the scope of the + // service that generated the operation. If the service calls + // Check() and Report() on the same operation, the two calls should carry + // the same id. + // + // UUID version 4 is recommended, though not required. + // In scenarios where an operation is computed from existing information + // and an idempotent id is desirable for deduplication purpose, UUID version 5 + // is recommended. See RFC 4122 for details. + string operation_id = 1; + + // Fully qualified name of the operation. Reserved for future use. + string operation_name = 2; + + // Identity of the consumer who is using the service. + // This field should be filled in for the operations initiated by a + // consumer, but not for service-initiated operations that are + // not related to a specific consumer. + // + // This can be in one of the following formats: + // project:, + // project_number:, + // api_key:. + string consumer_id = 3; + + // Required. Start time of the operation. + google.protobuf.Timestamp start_time = 4; + + // End time of the operation. + // Required when the operation is used in [ServiceController.Report][google.api.servicecontrol.v1.ServiceController.Report], + // but optional when the operation is used in [ServiceController.Check][google.api.servicecontrol.v1.ServiceController.Check]. + google.protobuf.Timestamp end_time = 5; + + // Labels describing the operation. Only the following labels are allowed: + // + // - Labels describing monitored resources as defined in + // the service configuration. + // - Default labels of metric values. When specified, labels defined in the + // metric value override these default. + // - The following labels defined by Google Cloud Platform: + // - `cloud.googleapis.com/location` describing the location where the + // operation happened, + // - `servicecontrol.googleapis.com/user_agent` describing the user agent + // of the API request, + // - `servicecontrol.googleapis.com/service_agent` describing the service + // used to handle the API request (e.g. ESP), + // - `servicecontrol.googleapis.com/platform` describing the platform + // where the API is served (e.g. GAE, GCE, GKE). + map labels = 6; + + // Represents information about this operation. Each MetricValueSet + // corresponds to a metric defined in the service configuration. + // The data type used in the MetricValueSet must agree with + // the data type specified in the metric definition. + // + // Within a single operation, it is not allowed to have more than one + // MetricValue instances that have the same metric names and identical + // label value combinations. If a request has such duplicated MetricValue + // instances, the entire request is rejected with + // an invalid argument error. + repeated MetricValueSet metric_value_sets = 7; + + // Represents information to be logged. + repeated LogEntry log_entries = 8; + + // DO NOT USE. This is an experimental field. + Importance importance = 11; +} diff --git a/handwritten/cloud-profiler/google/api/servicecontrol/v1/quota_controller.proto b/handwritten/cloud-profiler/google/api/servicecontrol/v1/quota_controller.proto new file mode 100644 index 00000000000..3d48620d838 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/servicecontrol/v1/quota_controller.proto @@ -0,0 +1,202 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/annotations.proto"; +import "google/api/servicecontrol/v1/metric_value.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "QuotaControllerProto"; +option java_package = "com.google.api.servicecontrol.v1"; + + +// [Google Quota Control API](/service-control/overview) +// +// Allows clients to allocate and release quota against a [managed +// service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). +service QuotaController { + // Attempts to allocate quota for the specified consumer. It should be called + // before the operation is executed. + // + // This method requires the `servicemanagement.services.quota` + // permission on the specified service. For more information, see + // [Cloud IAM](https://cloud.google.com/iam). + // + // **NOTE:** The client **must** fail-open on server errors `INTERNAL`, + // `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system + // reliability, the server may inject these errors to prohibit any hard + // dependency on the quota functionality. + rpc AllocateQuota(AllocateQuotaRequest) returns (AllocateQuotaResponse) { + option (google.api.http) = { post: "/v1/services/{service_name}:allocateQuota" body: "*" }; + } +} + +// Request message for the AllocateQuota method. +message AllocateQuotaRequest { + // Name of the service as specified in the service configuration. For example, + // `"pubsub.googleapis.com"`. + // + // See [google.api.Service][google.api.Service] for the definition of a service name. + string service_name = 1; + + // Operation that describes the quota allocation. + QuotaOperation allocate_operation = 2; + + // Specifies which version of service configuration should be used to process + // the request. If unspecified or no matching version can be found, the latest + // one will be used. + string service_config_id = 4; +} + +// Represents information regarding a quota operation. +message QuotaOperation { + // Supported quota modes. + enum QuotaMode { + // Guard against implicit default. Must not be used. + UNSPECIFIED = 0; + + // For AllocateQuota request, allocates quota for the amount specified in + // the service configuration or specified using the quota metrics. If the + // amount is higher than the available quota, allocation error will be + // returned and no quota will be allocated. + NORMAL = 1; + + // The operation allocates quota for the amount specified in the service + // configuration or specified using the quota metrics. If the amount is + // higher than the available quota, request does not fail but all available + // quota will be allocated. + BEST_EFFORT = 2; + + // For AllocateQuota request, only checks if there is enough quota + // available and does not change the available quota. No lock is placed on + // the available quota either. + CHECK_ONLY = 3; + } + + // Identity of the operation. This is expected to be unique within the scope + // of the service that generated the operation, and guarantees idempotency in + // case of retries. + // + // UUID version 4 is recommended, though not required. In scenarios where an + // operation is computed from existing information and an idempotent id is + // desirable for deduplication purpose, UUID version 5 is recommended. See + // RFC 4122 for details. + string operation_id = 1; + + // Fully qualified name of the API method for which this quota operation is + // requested. This name is used for matching quota rules or metric rules and + // billing status rules defined in service configuration. This field is not + // required if the quota operation is performed on non-API resources. + // + // Example of an RPC method name: + // google.example.library.v1.LibraryService.CreateShelf + string method_name = 2; + + // Identity of the consumer for whom this quota operation is being performed. + // + // This can be in one of the following formats: + // project:, + // project_number:, + // api_key:. + string consumer_id = 3; + + // Labels describing the operation. + map labels = 4; + + // Represents information about this operation. Each MetricValueSet + // corresponds to a metric defined in the service configuration. + // The data type used in the MetricValueSet must agree with + // the data type specified in the metric definition. + // + // Within a single operation, it is not allowed to have more than one + // MetricValue instances that have the same metric names and identical + // label value combinations. If a request has such duplicated MetricValue + // instances, the entire request is rejected with + // an invalid argument error. + repeated MetricValueSet quota_metrics = 5; + + // Quota mode for this operation. + QuotaMode quota_mode = 6; +} + +// Response message for the AllocateQuota method. +message AllocateQuotaResponse { + // The same operation_id value used in the AllocateQuotaRequest. Used for + // logging and diagnostics purposes. + string operation_id = 1; + + // Indicates the decision of the allocate. + repeated QuotaError allocate_errors = 2; + + // Quota metrics to indicate the result of allocation. Depending on the + // request, one or more of the following metrics will be included: + // + // 1. Per quota group or per quota metric incremental usage will be specified + // using the following delta metric : + // "serviceruntime.googleapis.com/api/consumer/quota_used_count" + // + // 2. The quota limit reached condition will be specified using the following + // boolean metric : + // "serviceruntime.googleapis.com/quota/exceeded" + repeated MetricValueSet quota_metrics = 3; + + // ID of the actual config used to process the request. + string service_config_id = 4; +} + +// Represents error information for [QuotaOperation][google.api.servicecontrol.v1.QuotaOperation]. +message QuotaError { + // Error codes related to project config validations are deprecated since the + // quota controller methods do not perform these validations. Instead services + // have to call the Check method, without quota_properties field, to perform + // these validations before calling the quota controller methods. These + // methods check only for project deletion to be wipe out compliant. + enum Code { + // This is never used. + UNSPECIFIED = 0; + + // Quota allocation failed. + // Same as [google.rpc.Code.RESOURCE_EXHAUSTED][]. + RESOURCE_EXHAUSTED = 8; + + // Consumer cannot access the service because the service requires active + // billing. + BILLING_NOT_ACTIVE = 107; + + // Consumer's project has been marked as deleted (soft deletion). + PROJECT_DELETED = 108; + + // Specified API key is invalid. + API_KEY_INVALID = 105; + + // Specified API Key has expired. + API_KEY_EXPIRED = 112; + } + + // Error code. + Code code = 1; + + // Subject to whom this error applies. See the specific enum for more details + // on this field. For example, "clientip:" or + // "project:". + string subject = 2; + + // Free-form text that provides details on the cause of the error. + string description = 3; +} diff --git a/handwritten/cloud-profiler/google/api/servicecontrol/v1/service_controller.proto b/handwritten/cloud-profiler/google/api/servicecontrol/v1/service_controller.proto new file mode 100644 index 00000000000..38171ba587e --- /dev/null +++ b/handwritten/cloud-profiler/google/api/servicecontrol/v1/service_controller.proto @@ -0,0 +1,185 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/annotations.proto"; +import "google/api/servicecontrol/v1/check_error.proto"; +import "google/api/servicecontrol/v1/operation.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "ServiceControllerProto"; +option java_package = "com.google.api.servicecontrol.v1"; +option objc_class_prefix = "GASC"; + + +// [Google Service Control API](/service-control/overview) +// +// Lets clients check and report operations against a [managed +// service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). +service ServiceController { + // Checks an operation with Google Service Control to decide whether + // the given operation should proceed. It should be called before the + // operation is executed. + // + // If feasible, the client should cache the check results and reuse them for + // 60 seconds. In case of server errors, the client can rely on the cached + // results for longer time. + // + // NOTE: the [CheckRequest][google.api.servicecontrol.v1.CheckRequest] has the size limit of 64KB. + // + // This method requires the `servicemanagement.services.check` permission + // on the specified service. For more information, see + // [Google Cloud IAM](https://cloud.google.com/iam). + rpc Check(CheckRequest) returns (CheckResponse) { + option (google.api.http) = { post: "/v1/services/{service_name}:check" body: "*" }; + } + + // Reports operation results to Google Service Control, such as logs and + // metrics. It should be called after an operation is completed. + // + // If feasible, the client should aggregate reporting data for up to 5 + // seconds to reduce API traffic. Limiting aggregation to 5 seconds is to + // reduce data loss during client crashes. Clients should carefully choose + // the aggregation time window to avoid data loss risk more than 0.01% + // for business and compliance reasons. + // + // NOTE: the [ReportRequest][google.api.servicecontrol.v1.ReportRequest] has the size limit of 1MB. + // + // This method requires the `servicemanagement.services.report` permission + // on the specified service. For more information, see + // [Google Cloud IAM](https://cloud.google.com/iam). + rpc Report(ReportRequest) returns (ReportResponse) { + option (google.api.http) = { post: "/v1/services/{service_name}:report" body: "*" }; + } +} + +// Request message for the Check method. +message CheckRequest { + // The service name as specified in its service configuration. For example, + // `"pubsub.googleapis.com"`. + // + // See + // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + // for the definition of a service name. + string service_name = 1; + + // The operation to be checked. + Operation operation = 2; + + // Specifies which version of service configuration should be used to process + // the request. + // + // If unspecified or no matching version can be found, the + // latest one will be used. + string service_config_id = 4; +} + +// Response message for the Check method. +message CheckResponse { + message CheckInfo { + // Consumer info of this check. + ConsumerInfo consumer_info = 2; + } + + // `ConsumerInfo` provides information about the consumer project. + message ConsumerInfo { + // The Google cloud project number, e.g. 1234567890. A value of 0 indicates + // no project number is found. + int64 project_number = 1; + } + + // The same operation_id value used in the [CheckRequest][google.api.servicecontrol.v1.CheckRequest]. + // Used for logging and diagnostics purposes. + string operation_id = 1; + + // Indicate the decision of the check. + // + // If no check errors are present, the service should process the operation. + // Otherwise the service should use the list of errors to determine the + // appropriate action. + repeated CheckError check_errors = 2; + + // The actual config id used to process the request. + string service_config_id = 5; + + // Feedback data returned from the server during processing a Check request. + CheckInfo check_info = 6; +} + +// Request message for the Report method. +message ReportRequest { + // The service name as specified in its service configuration. For example, + // `"pubsub.googleapis.com"`. + // + // See + // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + // for the definition of a service name. + string service_name = 1; + + // Operations to be reported. + // + // Typically the service should report one operation per request. + // Putting multiple operations into a single request is allowed, but should + // be used only when multiple operations are natually available at the time + // of the report. + // + // If multiple operations are in a single request, the total request size + // should be no larger than 1MB. See [ReportResponse.report_errors][google.api.servicecontrol.v1.ReportResponse.report_errors] for + // partial failure behavior. + repeated Operation operations = 2; + + // Specifies which version of service config should be used to process the + // request. + // + // If unspecified or no matching version can be found, the + // latest one will be used. + string service_config_id = 3; +} + +// Response message for the Report method. +message ReportResponse { + // Represents the processing error of one [Operation][google.api.servicecontrol.v1.Operation] in the request. + message ReportError { + // The [Operation.operation_id][google.api.servicecontrol.v1.Operation.operation_id] value from the request. + string operation_id = 1; + + // Details of the error when processing the [Operation][google.api.servicecontrol.v1.Operation]. + google.rpc.Status status = 2; + } + + // Partial failures, one for each `Operation` in the request that failed + // processing. There are three possible combinations of the RPC status: + // + // 1. The combination of a successful RPC status and an empty `report_errors` + // list indicates a complete success where all `Operations` in the + // request are processed successfully. + // 2. The combination of a successful RPC status and a non-empty + // `report_errors` list indicates a partial success where some + // `Operations` in the request succeeded. Each + // `Operation` that failed processing has a corresponding item + // in this list. + // 3. A failed RPC status indicates a general non-deterministic failure. + // When this happens, it's impossible to know which of the + // 'Operations' in the request succeeded or failed. + repeated ReportError report_errors = 1; + + // The actual config id used to process the request. + string service_config_id = 2; +} diff --git a/handwritten/cloud-profiler/google/api/servicemanagement/README.md b/handwritten/cloud-profiler/google/api/servicemanagement/README.md new file mode 100644 index 00000000000..e3e36df498d --- /dev/null +++ b/handwritten/cloud-profiler/google/api/servicemanagement/README.md @@ -0,0 +1,102 @@ +Google Service Management manages a set of *services*. Service +Management allows *service producers* to +publish their services on Google Cloud Platform so that they can be discovered +and used by *service consumers*. It also handles the tasks of tracking +service lifecycle and programming various backend systems -- such as +[Stackdriver Logging](https://cloud.google.com/stackdriver), +[Stackdriver Monitoring](https://cloud.google.com/stackdriver) -- to support +the managed services. + +If you are a service producer, you can use the Google Service Management API +and [Google Cloud SDK (gcloud)](/sdk) to publish and manage your services. +Each managed service has a service configuration which declares various aspects +of the service such as its API surface, along with parameters to configure the +supporting backend +systems, such as logging and monitoring. If you build your service using +[Google Cloud Endpoints](https://cloud.google.com/endpoints/), the service +configuration will be handled automatically. + +If you are a service consumer and want to use a managed service, you can use the +Google Service Management API or [Google Cloud Console](https://console.cloud.google.com) +to activate the +service for your [Google developer project](https://developers.google.com/console/help/new/), +then start using its APIs and functions. + +## Managed services + +REST URL: `https://servicemanagement.googleapis.com/v1/services/{service-name}`
+REST schema is defined [here](/service-management/reference/rest/v1/services). + +A managed service refers to a network service managed by +Service Management. Each managed service has a unique name, such as +`example.googleapis.com`, which must be a valid fully-qualified DNS name, as per +RFC 1035. + +A managed service typically provides some REST APIs and/or other +functions to their service consumers, such as mobile apps or cloud services. + +Service producers can use methods, such as +[services.create](/service-management/reference/rest/v1/services/create), +[services.delete](/service-management/reference/rest/v1/services/delete), +[services.undelete](/service-management/reference/rest/v1/services/undelete), +to manipulate their managed services. + +## Service producers + +A service producer is the Google developer project responsible for publishing +and maintaining a managed service. Each managed service is owned by exactly one +service producer. + +## Service consumers + +A service consumer is a Google developer project that has enabled and can +invoke APIs on a managed service. A managed service can have many service +consumers. + +## Service configuration + +REST URL: `https://servicemanagement.googleapis.com/v1/services/{service-name}/configs/{config_id}`
+REST schema is defined [here](/service-management/reference/rest/v1/services.configs). + +Each managed service is described by a service configuration which covers a wide +range of features, including its name, title, RPC API definitions, +REST API definitions, documentation, authentication, and more. + +To change the configuration of a managed service, the service producer needs to +publish an updated service configuration to Service Management. +Service Management keeps a history of published +service configurations, making it possible to easily retrace how a service's +configuration evolved over time. Service configurations can be published using +the +[services.configs.create](/service-management/reference/rest/v1/services.configs/create) +or [services.configs.submit](/service-management/reference/rest/v1/services.configs/submit) +methods. + +Alternatively, `services.configs.submit` allows publishing an +[OpenAPI](https://github.com/OAI/OpenAPI-Specification) specification, formerly +known as the Swagger Specification, which is automatically converted to a +corresponding service configuration. + +## Service rollout + +REST URL: `https://servicemanagement.googleapis.com/v1/services/{service-name}/rollouts/{rollout-id}`
+REST schema is defined [here](/service-management/reference/rest/v1/services.rollouts). + +A `Rollout` defines how Google Service Management should deploy service +configurations to backend systems and how the configurations take effect at +runtime. It lets service producers specify multiple service configuration +versions to be deployed together, and a strategy that indicates how they +should be used. + +Updating a managed service's configuration can be dangerous, as a configuration +error can lead to a service outage. To mitigate risks, Service Management +supports gradual rollout of service configuration changes. This feature gives +service producers time to identity potential issues and rollback service +configuration changes in case of errors, thus minimizing the customer +impact of bad configurations. For example, you could specify that 5% of traffic +uses configuration 1, while the remaining 95% uses configuration 2. + +Service Management keeps a history of rollouts so that service +producers can undo to previous configuration versions. You can rollback a configuration +by initiating a new `Rollout` that clones a previously submitted +rollout record. \ No newline at end of file diff --git a/handwritten/cloud-profiler/google/api/servicemanagement/v1/resources.proto b/handwritten/cloud-profiler/google/api/servicemanagement/v1/resources.proto new file mode 100644 index 00000000000..0d0f34d62ef --- /dev/null +++ b/handwritten/cloud-profiler/google/api/servicemanagement/v1/resources.proto @@ -0,0 +1,286 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api.servicemanagement.v1; + +import "google/api/annotations.proto"; +import "google/api/config_change.proto"; +import "google/api/service.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/servicemanagement/v1;servicemanagement"; +option java_multiple_files = true; +option java_outer_classname = "ResourcesProto"; +option java_package = "com.google.api.servicemanagement.v1"; +option objc_class_prefix = "GASM"; + + +// The full representation of a Service that is managed by +// Google Service Management. +message ManagedService { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. + string service_name = 2; + + // ID of the project that produces and owns this service. + string producer_project_id = 3; +} + +// The metadata associated with a long running operation resource. +message OperationMetadata { + // Represents the status of one operation step. + message Step { + // The short description of the step. + string description = 2; + + // The status code. + Status status = 4; + } + + // Code describes the status of one operation step. + enum Status { + // Unspecifed code. + STATUS_UNSPECIFIED = 0; + + // The step has completed without errors. + DONE = 1; + + // The step has not started yet. + NOT_STARTED = 2; + + // The step is in progress. + IN_PROGRESS = 3; + + // The step has completed with errors. + FAILED = 4; + + // The step has completed with cancellation. + CANCELLED = 5; + } + + // The full name of the resources that this operation is directly + // associated with. + repeated string resource_names = 1; + + // Detailed status information for each step. The order is undetermined. + repeated Step steps = 2; + + // Percentage of completion of this operation, ranging from 0 to 100. + int32 progress_percentage = 3; + + // The start time of the operation. + google.protobuf.Timestamp start_time = 4; +} + +// Represents a diagnostic message (error or warning) +message Diagnostic { + // The kind of diagnostic information possible. + enum Kind { + // Warnings and errors + WARNING = 0; + + // Only errors + ERROR = 1; + } + + // File name and line number of the error or warning. + string location = 1; + + // The kind of diagnostic information provided. + Kind kind = 2; + + // Message describing the error or warning. + string message = 3; +} + +// Represents a source file which is used to generate the service configuration +// defined by `google.api.Service`. +message ConfigSource { + // A unique ID for a specific instance of this message, typically assigned + // by the client for tracking purpose. If empty, the server may choose to + // generate one instead. + string id = 5; + + // Set of source configuration files that are used to generate a service + // configuration (`google.api.Service`). + repeated ConfigFile files = 2; +} + +// Generic specification of a source configuration file +message ConfigFile { + enum FileType { + // Unknown file type. + FILE_TYPE_UNSPECIFIED = 0; + + // YAML-specification of service. + SERVICE_CONFIG_YAML = 1; + + // OpenAPI specification, serialized in JSON. + OPEN_API_JSON = 2; + + // OpenAPI specification, serialized in YAML. + OPEN_API_YAML = 3; + + // FileDescriptorSet, generated by protoc. + // + // To generate, use protoc with imports and source info included. + // For an example test.proto file, the following command would put the value + // in a new file named out.pb. + // + // $protoc --include_imports --include_source_info test.proto -o out.pb + FILE_DESCRIPTOR_SET_PROTO = 4; + } + + // The file name of the configuration file (full or relative path). + string file_path = 1; + + // The bytes that constitute the file. + bytes file_contents = 3; + + // The type of configuration file this represents. + FileType file_type = 4; +} + +// Represents a service configuration with its name and id. +message ConfigRef { + // Resource name of a service config. It must have the following + // format: "services/{service name}/configs/{config id}". + string name = 1; +} + +// Change report associated with a particular service configuration. +// +// It contains a list of ConfigChanges based on the comparison between +// two service configurations. +message ChangeReport { + // List of changes between two service configurations. + // The changes will be alphabetically sorted based on the identifier + // of each change. + // A ConfigChange identifier is a dot separated path to the configuration. + // Example: visibility.rules[selector='LibraryService.CreateBook'].restriction + repeated google.api.ConfigChange config_changes = 1; +} + +// A rollout resource that defines how service configuration versions are pushed +// to control plane systems. Typically, you create a new version of the +// service config, and then create a Rollout to push the service config. +message Rollout { + // Strategy that specifies how Google Service Control should select + // different + // versions of service configurations based on traffic percentage. + // + // One example of how to gradually rollout a new service configuration using + // this + // strategy: + // Day 1 + // + // Rollout { + // id: "example.googleapis.com/rollout_20160206" + // traffic_percent_strategy { + // percentages: { + // "example.googleapis.com/20160201": 70.00 + // "example.googleapis.com/20160206": 30.00 + // } + // } + // } + // + // Day 2 + // + // Rollout { + // id: "example.googleapis.com/rollout_20160207" + // traffic_percent_strategy: { + // percentages: { + // "example.googleapis.com/20160206": 100.00 + // } + // } + // } + message TrafficPercentStrategy { + // Maps service configuration IDs to their corresponding traffic percentage. + // Key is the service configuration ID, Value is the traffic percentage + // which must be greater than 0.0 and the sum must equal to 100.0. + map percentages = 1; + } + + // Strategy used to delete a service. This strategy is a placeholder only + // used by the system generated rollout to delete a service. + message DeleteServiceStrategy { + + } + + // Status of a Rollout. + enum RolloutStatus { + // No status specified. + ROLLOUT_STATUS_UNSPECIFIED = 0; + + // The Rollout is in progress. + IN_PROGRESS = 1; + + // The Rollout has completed successfully. + SUCCESS = 2; + + // The Rollout has been cancelled. This can happen if you have overlapping + // Rollout pushes, and the previous ones will be cancelled. + CANCELLED = 3; + + // The Rollout has failed. It is typically caused by configuration errors. + FAILED = 4; + + // The Rollout has not started yet and is pending for execution. + PENDING = 5; + } + + // Optional unique identifier of this Rollout. Only lower case letters, digits + // and '-' are allowed. + // + // If not specified by client, the server will generate one. The generated id + // will have the form of , where "date" is the create + // date in ISO 8601 format. "revision number" is a monotonically increasing + // positive number that is reset every day for each service. + // An example of the generated rollout_id is '2016-02-16r1' + string rollout_id = 1; + + // Creation time of the rollout. Readonly. + google.protobuf.Timestamp create_time = 2; + + // The user who created the Rollout. Readonly. + string created_by = 3; + + // The status of this rollout. Readonly. In case of a failed rollout, + // the system will automatically rollback to the current Rollout + // version. Readonly. + RolloutStatus status = 4; + + // Strategy that defines which versions of service configurations should be + // pushed + // and how they should be used at runtime. + oneof strategy { + // Google Service Control selects service configurations based on + // traffic percentage. + TrafficPercentStrategy traffic_percent_strategy = 5; + + // The strategy associated with a rollout to delete a `ManagedService`. + // Readonly. + DeleteServiceStrategy delete_service_strategy = 200; + } + + // The name of the service associated with this Rollout. + string service_name = 8; +} diff --git a/handwritten/cloud-profiler/google/api/servicemanagement/v1/servicemanager.proto b/handwritten/cloud-profiler/google/api/servicemanagement/v1/servicemanager.proto new file mode 100644 index 00000000000..b767a6a0502 --- /dev/null +++ b/handwritten/cloud-profiler/google/api/servicemanagement/v1/servicemanager.proto @@ -0,0 +1,438 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api.servicemanagement.v1; + +import "google/api/annotations.proto"; +import "google/api/auth.proto"; +import "google/api/service.proto"; +import "google/api/servicemanagement/v1/resources.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/rpc/status.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/servicemanagement/v1;servicemanagement"; +option java_multiple_files = true; +option java_outer_classname = "ServiceManagerProto"; +option java_package = "com.google.api.servicemanagement.v1"; +option objc_class_prefix = "GASM"; + + +// [Google Service Management API](/service-management/overview) +service ServiceManager { + // Lists managed services. + // + // Returns all public services. For authenticated users, also returns all + // services the calling user has "servicemanagement.services.get" permission + // for. + // + // **BETA:** If the caller specifies the `consumer_id`, it returns only the + // services enabled on the consumer. The `consumer_id` must have the format + // of "project:{PROJECT-ID}". + rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { + option (google.api.http) = { get: "/v1/services" }; + } + + // Gets a managed service. Authentication is required unless the service is + // public. + rpc GetService(GetServiceRequest) returns (ManagedService) { + option (google.api.http) = { get: "/v1/services/{service_name}" }; + } + + // Creates a new managed service. + // Please note one producer project can own no more than 20 services. + // + // Operation + rpc CreateService(CreateServiceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/services" body: "service" }; + } + + // Deletes a managed service. This method will change the service to the + // `Soft-Delete` state for 30 days. Within this period, service producers may + // call [UndeleteService][google.api.servicemanagement.v1.ServiceManager.UndeleteService] to restore the service. + // After 30 days, the service will be permanently deleted. + // + // Operation + rpc DeleteService(DeleteServiceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { delete: "/v1/services/{service_name}" }; + } + + // Revives a previously deleted managed service. The method restores the + // service using the configuration at the time the service was deleted. + // The target service must exist and must have been deleted within the + // last 30 days. + // + // Operation + rpc UndeleteService(UndeleteServiceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/services/{service_name}:undelete" body: "" }; + } + + // Lists the history of the service configuration for a managed service, + // from the newest to the oldest. + rpc ListServiceConfigs(ListServiceConfigsRequest) returns (ListServiceConfigsResponse) { + option (google.api.http) = { get: "/v1/services/{service_name}/configs" }; + } + + // Gets a service configuration (version) for a managed service. + rpc GetServiceConfig(GetServiceConfigRequest) returns (google.api.Service) { + option (google.api.http) = { get: "/v1/services/{service_name}/configs/{config_id}" }; + } + + // Creates a new service configuration (version) for a managed service. + // This method only stores the service configuration. To roll out the service + // configuration to backend systems please call + // [CreateServiceRollout][google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout]. + rpc CreateServiceConfig(CreateServiceConfigRequest) returns (google.api.Service) { + option (google.api.http) = { post: "/v1/services/{service_name}/configs" body: "service_config" }; + } + + // Creates a new service configuration (version) for a managed service based + // on + // user-supplied configuration source files (for example: OpenAPI + // Specification). This method stores the source configurations as well as the + // generated service configuration. To rollout the service configuration to + // other services, + // please call [CreateServiceRollout][google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout]. + // + // Operation + rpc SubmitConfigSource(SubmitConfigSourceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/services/{service_name}/configs:submit" body: "*" }; + } + + // Lists the history of the service configuration rollouts for a managed + // service, from the newest to the oldest. + rpc ListServiceRollouts(ListServiceRolloutsRequest) returns (ListServiceRolloutsResponse) { + option (google.api.http) = { get: "/v1/services/{service_name}/rollouts" }; + } + + // Gets a service configuration [rollout][google.api.servicemanagement.v1.Rollout]. + rpc GetServiceRollout(GetServiceRolloutRequest) returns (Rollout) { + option (google.api.http) = { get: "/v1/services/{service_name}/rollouts/{rollout_id}" }; + } + + // Creates a new service configuration rollout. Based on rollout, the + // Google Service Management will roll out the service configurations to + // different backend services. For example, the logging configuration will be + // pushed to Google Cloud Logging. + // + // Please note that any previous pending and running Rollouts and associated + // Operations will be automatically cancelled so that the latest Rollout will + // not be blocked by previous Rollouts. + // + // Operation + rpc CreateServiceRollout(CreateServiceRolloutRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/services/{service_name}/rollouts" body: "rollout" }; + } + + // Generates and returns a report (errors, warnings and changes from + // existing configurations) associated with + // GenerateConfigReportRequest.new_value + // + // If GenerateConfigReportRequest.old_value is specified, + // GenerateConfigReportRequest will contain a single ChangeReport based on the + // comparison between GenerateConfigReportRequest.new_value and + // GenerateConfigReportRequest.old_value. + // If GenerateConfigReportRequest.old_value is not specified, this method + // will compare GenerateConfigReportRequest.new_value with the last pushed + // service configuration. + rpc GenerateConfigReport(GenerateConfigReportRequest) returns (GenerateConfigReportResponse) { + option (google.api.http) = { post: "/v1/services:generateConfigReport" body: "*" }; + } + + // Enables a [service][google.api.servicemanagement.v1.ManagedService] for a project, so it can be used + // for the project. See + // [Cloud Auth Guide](https://cloud.google.com/docs/authentication) for + // more information. + // + // Operation + rpc EnableService(EnableServiceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/services/{service_name}:enable" body: "*" }; + } + + // Disables a [service][google.api.servicemanagement.v1.ManagedService] for a project, so it can no longer be + // be used for the project. It prevents accidental usage that may cause + // unexpected billing charges or security leaks. + // + // Operation + rpc DisableService(DisableServiceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/services/{service_name}:disable" body: "*" }; + } +} + +// Request message for `ListServices` method. +message ListServicesRequest { + // Include services produced by the specified project. + string producer_project_id = 1; + + // Requested size of the next page of data. + int32 page_size = 5; + + // Token identifying which result to start with; returned by a previous list + // call. + string page_token = 6; + + // Include services consumed by the specified consumer. + // + // The Google Service Management implementation accepts the following + // forms: + // - project: + string consumer_id = 7; +} + +// Response message for `ListServices` method. +message ListServicesResponse { + // The returned services will only have the name field set. + repeated ManagedService services = 1; + + // Token that can be passed to `ListServices` to resume a paginated query. + string next_page_token = 2; +} + +// Request message for `GetService` method. +message GetServiceRequest { + // The name of the service. See the `ServiceManager` overview for naming + // requirements. For example: `example.googleapis.com`. + string service_name = 1; +} + +// Request message for CreateService method. +message CreateServiceRequest { + // Initial values for the service resource. + ManagedService service = 1; +} + +// Request message for DeleteService method. +message DeleteServiceRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; +} + +// Request message for UndeleteService method. +message UndeleteServiceRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; +} + +// Response message for UndeleteService method. +message UndeleteServiceResponse { + // Revived service resource. + ManagedService service = 1; +} + +// Request message for GetServiceConfig method. +message GetServiceConfigRequest { + enum ConfigView { + // Server response includes all fields except SourceInfo. + BASIC = 0; + + // Server response includes all fields including SourceInfo. + // SourceFiles are of type 'google.api.servicemanagement.v1.ConfigFile' + // and are only available for configs created using the + // SubmitConfigSource method. + FULL = 1; + } + + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; + + // The id of the service configuration resource. + string config_id = 2; + + // Specifies which parts of the Service Config should be returned in the + // response. + ConfigView view = 3; +} + +// Request message for ListServiceConfigs method. +message ListServiceConfigsRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; + + // The token of the page to retrieve. + string page_token = 2; + + // The max number of items to include in the response list. + int32 page_size = 3; +} + +// Response message for ListServiceConfigs method. +message ListServiceConfigsResponse { + // The list of service configuration resources. + repeated google.api.Service service_configs = 1; + + // The token of the next page of results. + string next_page_token = 2; +} + +// Request message for CreateServiceConfig method. +message CreateServiceConfigRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; + + // The service configuration resource. + google.api.Service service_config = 2; +} + +// Request message for SubmitConfigSource method. +message SubmitConfigSourceRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; + + // The source configuration for the service. + ConfigSource config_source = 2; + + // Optional. If set, this will result in the generation of a + // `google.api.Service` configuration based on the `ConfigSource` provided, + // but the generated config and the sources will NOT be persisted. + bool validate_only = 3; +} + +// Response message for SubmitConfigSource method. +message SubmitConfigSourceResponse { + // The generated service configuration. + google.api.Service service_config = 1; +} + +// Request message for 'CreateServiceRollout' +message CreateServiceRolloutRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; + + // The rollout resource. The `service_name` field is output only. + Rollout rollout = 2; +} + +// Request message for 'ListServiceRollouts' +message ListServiceRolloutsRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; + + // The token of the page to retrieve. + string page_token = 2; + + // The max number of items to include in the response list. + int32 page_size = 3; + + // Use `filter` to return subset of rollouts. + // The following filters are supported: + // -- To limit the results to only those in + // [status](google.api.servicemanagement.v1.RolloutStatus) 'SUCCESS', + // use filter='status=SUCCESS' + // -- To limit the results to those in + // [status](google.api.servicemanagement.v1.RolloutStatus) 'CANCELLED' + // or 'FAILED', use filter='status=CANCELLED OR status=FAILED' + string filter = 4; +} + +// Response message for ListServiceRollouts method. +message ListServiceRolloutsResponse { + // The list of rollout resources. + repeated Rollout rollouts = 1; + + // The token of the next page of results. + string next_page_token = 2; +} + +// Request message for GetServiceRollout method. +message GetServiceRolloutRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; + + // The id of the rollout resource. + string rollout_id = 2; +} + +// Request message for EnableService method. +message EnableServiceRequest { + // Name of the service to enable. Specifying an unknown service name will + // cause the request to fail. + string service_name = 1; + + // The identity of consumer resource which service enablement will be + // applied to. + // + // The Google Service Management implementation accepts the following + // forms: + // - "project:" + // + // Note: this is made compatible with + // google.api.servicecontrol.v1.Operation.consumer_id. + string consumer_id = 2; +} + +// Request message for DisableService method. +message DisableServiceRequest { + // Name of the service to disable. Specifying an unknown service name + // will cause the request to fail. + string service_name = 1; + + // The identity of consumer resource which service disablement will be + // applied to. + // + // The Google Service Management implementation accepts the following + // forms: + // - "project:" + // + // Note: this is made compatible with + // google.api.servicecontrol.v1.Operation.consumer_id. + string consumer_id = 2; +} + +// Request message for GenerateConfigReport method. +message GenerateConfigReportRequest { + // Service configuration for which we want to generate the report. + // For this version of API, the supported types are + // [google.api.servicemanagement.v1.ConfigRef][google.api.servicemanagement.v1.ConfigRef], + // [google.api.servicemanagement.v1.ConfigSource][google.api.servicemanagement.v1.ConfigSource], + // and [google.api.Service][google.api.Service] + google.protobuf.Any new_config = 1; + + // Service configuration against which the comparison will be done. + // For this version of API, the supported types are + // [google.api.servicemanagement.v1.ConfigRef][google.api.servicemanagement.v1.ConfigRef], + // [google.api.servicemanagement.v1.ConfigSource][google.api.servicemanagement.v1.ConfigSource], + // and [google.api.Service][google.api.Service] + google.protobuf.Any old_config = 2; +} + +// Response message for GenerateConfigReport method. +message GenerateConfigReportResponse { + // Name of the service this report belongs to. + string service_name = 1; + + // ID of the service configuration this report belongs to. + string id = 2; + + // list of ChangeReport, each corresponding to comparison between two + // service configurations. + repeated ChangeReport change_reports = 3; + + // Errors / Linter warnings associated with the service definition this + // report + // belongs to. + repeated Diagnostic diagnostics = 4; +} diff --git a/handwritten/cloud-profiler/google/api/source_info.proto b/handwritten/cloud-profiler/google/api/source_info.proto new file mode 100644 index 00000000000..5d0f7bd721f --- /dev/null +++ b/handwritten/cloud-profiler/google/api/source_info.proto @@ -0,0 +1,32 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +import "google/protobuf/any.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "SourceInfoProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Source information used to create a Service Config +message SourceInfo { + // All files used during config generation. + repeated google.protobuf.Any source_files = 1; +} diff --git a/handwritten/cloud-profiler/google/api/system_parameter.proto b/handwritten/cloud-profiler/google/api/system_parameter.proto new file mode 100644 index 00000000000..ed36a3d0bce --- /dev/null +++ b/handwritten/cloud-profiler/google/api/system_parameter.proto @@ -0,0 +1,96 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "SystemParameterProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// ### System parameter configuration +// +// A system parameter is a special kind of parameter defined by the API +// system, not by an individual API. It is typically mapped to an HTTP header +// and/or a URL query parameter. This configuration specifies which methods +// change the names of the system parameters. +message SystemParameters { + // Define system parameters. + // + // The parameters defined here will override the default parameters + // implemented by the system. If this field is missing from the service + // config, default system parameters will be used. Default system parameters + // and names is implementation-dependent. + // + // Example: define api key for all methods + // + // system_parameters + // rules: + // - selector: "*" + // parameters: + // - name: api_key + // url_query_parameter: api_key + // + // + // Example: define 2 api key names for a specific method. + // + // system_parameters + // rules: + // - selector: "/ListShelves" + // parameters: + // - name: api_key + // http_header: Api-Key1 + // - name: api_key + // http_header: Api-Key2 + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated SystemParameterRule rules = 1; +} + +// Define a system parameter rule mapping system parameter definitions to +// methods. +message SystemParameterRule { + // Selects the methods to which this rule applies. Use '*' to indicate all + // methods in all APIs. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // Define parameters. Multiple names may be defined for a parameter. + // For a given method call, only one of them should be used. If multiple + // names are used the behavior is implementation-dependent. + // If none of the specified names are present the behavior is + // parameter-dependent. + repeated SystemParameter parameters = 2; +} + +// Define a parameter's name and location. The parameter may be passed as either +// an HTTP header or a URL query parameter, and if both are passed the behavior +// is implementation-dependent. +message SystemParameter { + // Define the name of the parameter, such as "api_key" . It is case sensitive. + string name = 1; + + // Define the HTTP header name to use for the parameter. It is case + // insensitive. + string http_header = 2; + + // Define the URL query parameter name to use for the parameter. It is case + // sensitive. + string url_query_parameter = 3; +} diff --git a/handwritten/cloud-profiler/google/api/usage.proto b/handwritten/cloud-profiler/google/api/usage.proto new file mode 100644 index 00000000000..44e8880746b --- /dev/null +++ b/handwritten/cloud-profiler/google/api/usage.proto @@ -0,0 +1,89 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.api; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "UsageProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Configuration controlling usage of a service. +message Usage { + // Requirements that must be satisfied before a consumer project can use the + // service. Each requirement is of the form /; + // for example 'serviceusage.googleapis.com/billing-enabled'. + repeated string requirements = 1; + + // A list of usage rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated UsageRule rules = 6; + + // The full resource name of a channel used for sending notifications to the + // service producer. + // + // Google Service Management currently only supports + // [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification + // channel. To use Google Cloud Pub/Sub as the channel, this must be the name + // of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format + // documented in https://cloud.google.com/pubsub/docs/overview. + string producer_notification_channel = 7; +} + +// Usage configuration rules for the service. +// +// NOTE: Under development. +// +// +// Use this rule to configure unregistered calls for the service. Unregistered +// calls are calls that do not contain consumer project identity. +// (Example: calls that do not contain an API key). +// By default, API methods do not allow unregistered calls, and each method call +// must be identified by a consumer project identity. Use this rule to +// allow/disallow unregistered calls. +// +// Example of an API that wants to allow unregistered calls for entire service. +// +// usage: +// rules: +// - selector: "*" +// allow_unregistered_calls: true +// +// Example of a method that wants to allow unregistered calls. +// +// usage: +// rules: +// - selector: "google.example.library.v1.LibraryService.CreateBook" +// allow_unregistered_calls: true +message UsageRule { + // Selects the methods to which this rule applies. Use '*' to indicate all + // methods in all APIs. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // True, if the method allows unregistered calls; false otherwise. + bool allow_unregistered_calls = 2; + + // True, if the method should skip service control. If so, no control plane + // feature (like quota and billing) will be enabled. + bool skip_service_control = 3; +} diff --git a/handwritten/cloud-profiler/google/appengine/README.md b/handwritten/cloud-profiler/google/appengine/README.md new file mode 100644 index 00000000000..54e45e6f8d6 --- /dev/null +++ b/handwritten/cloud-profiler/google/appengine/README.md @@ -0,0 +1,12 @@ +# Google App Engine Admin API + +## Overview + +The Google App Engine Admin API is a RESTful API for managing App Engine +applications. The Admin API provides programmatic access to several of the App +Engine administrative operations that are found in the +[Google Cloud Platform Console](https://cloud.google.com/appengine/docs/developers-console). + +## Documentation + +[Google App Engine Admin API Documentation](https://cloud.google.com/appengine/docs/admin-api/) \ No newline at end of file diff --git a/handwritten/cloud-profiler/google/appengine/artman_appengine.yaml b/handwritten/cloud-profiler/google/appengine/artman_appengine.yaml new file mode 100644 index 00000000000..e8cc71e329c --- /dev/null +++ b/handwritten/cloud-profiler/google/appengine/artman_appengine.yaml @@ -0,0 +1,40 @@ +common: + api_name: appengine + api_version: v1 + organization_name: google + src_proto_paths: + - v1 + proto_deps: + - name: google-common-protos + - name: google-iam-v1 +artifacts: +- name: java_proto + type: PROTOBUF + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - name: proto + dest: generated/java/proto-google-appengine +- name: java_grpc + type: GRPC + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - name: grpc + dest: generated/java/grpc-google-appengine +- name: php_grpc + type: GRPC + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - name: grpc + dest: generated/php/google-appengine diff --git a/handwritten/cloud-profiler/google/appengine/legacy/audit_data.proto b/handwritten/cloud-profiler/google/appengine/legacy/audit_data.proto new file mode 100644 index 00000000000..75c2a9b2084 --- /dev/null +++ b/handwritten/cloud-profiler/google/appengine/legacy/audit_data.proto @@ -0,0 +1,34 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.appengine.legacy; + +option go_package = "google.golang.org/genproto/googleapis/appengine/legacy;legacy"; +option java_multiple_files = true; +option java_outer_classname = "AuditDataProto"; +option java_package = "com.google.appengine.legacy"; + + +// Admin Console legacy audit log. +message AuditData { + // Text description of the admin event. + // This is the "Event" column in Admin Console's Admin Logs. + string event_message = 1; + + // Arbitrary event data. + // This is the "Result" column in Admin Console's Admin Logs. + map event_data = 2; +} diff --git a/handwritten/cloud-profiler/google/appengine/logging/v1/request_log.proto b/handwritten/cloud-profiler/google/appengine/logging/v1/request_log.proto new file mode 100644 index 00000000000..678ea9a5ec6 --- /dev/null +++ b/handwritten/cloud-profiler/google/appengine/logging/v1/request_log.proto @@ -0,0 +1,190 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.appengine.logging.v1; + +import "google/logging/type/log_severity.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/appengine/logging/v1;logging"; +option java_multiple_files = true; +option java_outer_classname = "RequestLogProto"; +option java_package = "com.google.appengine.logging.v1"; + + +// Application log line emitted while processing a request. +message LogLine { + // Approximate time when this log entry was made. + google.protobuf.Timestamp time = 1; + + // Severity of this log entry. + google.logging.type.LogSeverity severity = 2; + + // App-provided log message. + string log_message = 3; + + // Where in the source code this log message was written. + SourceLocation source_location = 4; +} + +// Specifies a location in a source code file. +message SourceLocation { + // Source file name. Depending on the runtime environment, this might be a + // simple name or a fully-qualified name. + string file = 1; + + // Line within the source file. + int64 line = 2; + + // Human-readable name of the function or method being invoked, with optional + // context such as the class or package name. This information is used in + // contexts such as the logs viewer, where a file and line number are less + // meaningful. The format can vary by language. For example: + // `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function` + // (Python). + string function_name = 3; +} + +// A reference to a particular snapshot of the source tree used to build and +// deploy an application. +message SourceReference { + // Optional. A URI string identifying the repository. + // Example: "https://github.com/GoogleCloudPlatform/kubernetes.git" + string repository = 1; + + // The canonical and persistent identifier of the deployed revision. + // Example (git): "0035781c50ec7aa23385dc841529ce8a4b70db1b" + string revision_id = 2; +} + +// Complete log information about a single HTTP request to an App Engine +// application. +message RequestLog { + // Application that handled this request. + string app_id = 1; + + // Module of the application that handled this request. + string module_id = 37; + + // Version of the application that handled this request. + string version_id = 2; + + // Globally unique identifier for a request, which is based on the request + // start time. Request IDs for requests which started later will compare + // greater as strings than those for requests which started earlier. + string request_id = 3; + + // Origin IP address. + string ip = 4; + + // Time when the request started. + google.protobuf.Timestamp start_time = 6; + + // Time when the request finished. + google.protobuf.Timestamp end_time = 7; + + // Latency of the request. + google.protobuf.Duration latency = 8; + + // Number of CPU megacycles used to process request. + int64 mega_cycles = 9; + + // Request method. Example: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`, `"DELETE"`. + string method = 10; + + // Contains the path and query portion of the URL that was requested. For + // example, if the URL was "http://example.com/app?name=val", the resource + // would be "/app?name=val". The fragment identifier, which is identified by + // the `#` character, is not included. + string resource = 11; + + // HTTP version of request. Example: `"HTTP/1.1"`. + string http_version = 12; + + // HTTP response status code. Example: 200, 404. + int32 status = 13; + + // Size in bytes sent back to client by request. + int64 response_size = 14; + + // Referrer URL of request. + string referrer = 15; + + // User agent that made the request. + string user_agent = 16; + + // The logged-in user who made the request. + // + // Most likely, this is the part of the user's email before the `@` sign. The + // field value is the same for different requests from the same user, but + // different users can have similar names. This information is also + // available to the application via the App Engine Users API. + // + // This field will be populated starting with App Engine 1.9.21. + string nickname = 40; + + // File or class that handled the request. + string url_map_entry = 17; + + // Internet host and port number of the resource being requested. + string host = 20; + + // An indication of the relative cost of serving this request. + double cost = 21; + + // Queue name of the request, in the case of an offline request. + string task_queue_name = 22; + + // Task name of the request, in the case of an offline request. + string task_name = 23; + + // Whether this was a loading request for the instance. + bool was_loading_request = 24; + + // Time this request spent in the pending request queue. + google.protobuf.Duration pending_time = 25; + + // If the instance processing this request belongs to a manually scaled + // module, then this is the 0-based index of the instance. Otherwise, this + // value is -1. + int32 instance_index = 26; + + // Whether this request is finished or active. + bool finished = 27; + + // Whether this is the first `RequestLog` entry for this request. If an + // active request has several `RequestLog` entries written to Stackdriver + // Logging, then this field will be set for one of them. + bool first = 42; + + // An identifier for the instance that handled the request. + string instance_id = 28; + + // A list of log lines emitted by the application while serving this request. + repeated LogLine line = 29; + + // App Engine release version. + string app_engine_release = 38; + + // Stackdriver Trace identifier for this request. + string trace_id = 39; + + // Source code for the application that handled this request. There can be + // more than one source reference per deployed application if source code is + // distributed among multiple repositories. + repeated SourceReference source_reference = 41; +} diff --git a/handwritten/cloud-profiler/google/appengine/v1/app_yaml.proto b/handwritten/cloud-profiler/google/appengine/v1/app_yaml.proto new file mode 100644 index 00000000000..2892ef30d68 --- /dev/null +++ b/handwritten/cloud-profiler/google/appengine/v1/app_yaml.proto @@ -0,0 +1,285 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.appengine.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/duration.proto"; + +option go_package = "google.golang.org/genproto/googleapis/appengine/v1;appengine"; +option java_multiple_files = true; +option java_outer_classname = "AppYamlProto"; +option java_package = "com.google.appengine.v1"; + + +// [Google Cloud Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/) +// configuration for API handlers. +message ApiConfigHandler { + // Action to take when users access resources that require + // authentication. Defaults to `redirect`. + AuthFailAction auth_fail_action = 1; + + // Level of login required to access this resource. Defaults to + // `optional`. + LoginRequirement login = 2; + + // Path to the script from the application root directory. + string script = 3; + + // Security (HTTPS) enforcement for this URL. + SecurityLevel security_level = 4; + + // URL to serve the endpoint at. + string url = 5; +} + +// Custom static error page to be served when an error occurs. +message ErrorHandler { + // Error codes. + enum ErrorCode { + option allow_alias = true; + // Not specified. ERROR_CODE_DEFAULT is assumed. + ERROR_CODE_UNSPECIFIED = 0; + + // All other error types. + ERROR_CODE_DEFAULT = 0; + + // Application has exceeded a resource quota. + ERROR_CODE_OVER_QUOTA = 1; + + // Client blocked by the application's Denial of Service protection + // configuration. + ERROR_CODE_DOS_API_DENIAL = 2; + + // Deadline reached before the application responds. + ERROR_CODE_TIMEOUT = 3; + } + + // Error condition this handler applies to. + ErrorCode error_code = 1; + + // Static file content to be served for this error. + string static_file = 2; + + // MIME type of file. Defaults to `text/html`. + string mime_type = 3; +} + +// URL pattern and description of how the URL should be handled. App Engine can +// handle URLs by executing application code or by serving static files +// uploaded with the version, such as images, CSS, or JavaScript. +message UrlMap { + // Redirect codes. + enum RedirectHttpResponseCode { + // Not specified. `302` is assumed. + REDIRECT_HTTP_RESPONSE_CODE_UNSPECIFIED = 0; + + // `301 Moved Permanently` code. + REDIRECT_HTTP_RESPONSE_CODE_301 = 1; + + // `302 Moved Temporarily` code. + REDIRECT_HTTP_RESPONSE_CODE_302 = 2; + + // `303 See Other` code. + REDIRECT_HTTP_RESPONSE_CODE_303 = 3; + + // `307 Temporary Redirect` code. + REDIRECT_HTTP_RESPONSE_CODE_307 = 4; + } + + // URL prefix. Uses regular expression syntax, which means regexp + // special characters must be escaped, but should not contain groupings. + // All URLs that begin with this prefix are handled by this handler, using the + // portion of the URL after the prefix as part of the file path. + string url_regex = 1; + + // Type of handler for this URL pattern. + oneof handler_type { + // Returns the contents of a file, such as an image, as the response. + StaticFilesHandler static_files = 2; + + // Executes a script to handle the request that matches this URL + // pattern. + ScriptHandler script = 3; + + // Uses API Endpoints to handle requests. + ApiEndpointHandler api_endpoint = 4; + } + + // Security (HTTPS) enforcement for this URL. + SecurityLevel security_level = 5; + + // Level of login required to access this resource. + LoginRequirement login = 6; + + // Action to take when users access resources that require + // authentication. Defaults to `redirect`. + AuthFailAction auth_fail_action = 7; + + // `30x` code to use when performing redirects for the `secure` field. + // Defaults to `302`. + RedirectHttpResponseCode redirect_http_response_code = 8; +} + +// Files served directly to the user for a given URL, such as images, CSS +// stylesheets, or JavaScript source files. Static file handlers describe which +// files in the application directory are static files, and which URLs serve +// them. +message StaticFilesHandler { + // Path to the static files matched by the URL pattern, from the + // application root directory. The path can refer to text matched in groupings + // in the URL pattern. + string path = 1; + + // Regular expression that matches the file paths for all files that should be + // referenced by this handler. + string upload_path_regex = 2; + + // HTTP headers to use for all responses from these URLs. + map http_headers = 3; + + // MIME type used to serve all files served by this handler. + // + // Defaults to file-specific MIME types, which are derived from each file's + // filename extension. + string mime_type = 4; + + // Time a static file served by this handler should be cached + // by web proxies and browsers. + google.protobuf.Duration expiration = 5; + + // Whether this handler should match the request if the file + // referenced by the handler does not exist. + bool require_matching_file = 6; + + // Whether files should also be uploaded as code data. By default, files + // declared in static file handlers are uploaded as static + // data and are only served to end users; they cannot be read by the + // application. If enabled, uploads are charged against both your code and + // static data storage resource quotas. + bool application_readable = 7; +} + +// Executes a script to handle the request that matches the URL pattern. +message ScriptHandler { + // Path to the script from the application root directory. + string script_path = 1; +} + +// Uses Google Cloud Endpoints to handle requests. +message ApiEndpointHandler { + // Path to the script from the application root directory. + string script_path = 1; +} + +// Health checking configuration for VM instances. Unhealthy instances +// are killed and replaced with new instances. Only applicable for +// instances in App Engine flexible environment. +message HealthCheck { + // Whether to explicitly disable health checks for this instance. + bool disable_health_check = 1; + + // Host header to send when performing an HTTP health check. + // Example: "myapp.appspot.com" + string host = 2; + + // Number of consecutive successful health checks required before receiving + // traffic. + uint32 healthy_threshold = 3; + + // Number of consecutive failed health checks required before removing + // traffic. + uint32 unhealthy_threshold = 4; + + // Number of consecutive failed health checks required before an instance is + // restarted. + uint32 restart_threshold = 5; + + // Interval between health checks. + google.protobuf.Duration check_interval = 6; + + // Time before the health check is considered failed. + google.protobuf.Duration timeout = 7; +} + +// Third-party Python runtime library that is required by the application. +message Library { + // Name of the library. Example: "django". + string name = 1; + + // Version of the library to select, or "latest". + string version = 2; +} + +// Actions to take when the user is not logged in. +enum AuthFailAction { + // Not specified. `AUTH_FAIL_ACTION_REDIRECT` is assumed. + AUTH_FAIL_ACTION_UNSPECIFIED = 0; + + // Redirects user to "accounts.google.com". The user is redirected back to the + // application URL after signing in or creating an account. + AUTH_FAIL_ACTION_REDIRECT = 1; + + // Rejects request with a `401` HTTP status code and an error + // message. + AUTH_FAIL_ACTION_UNAUTHORIZED = 2; +} + +// Methods to restrict access to a URL based on login status. +enum LoginRequirement { + // Not specified. `LOGIN_OPTIONAL` is assumed. + LOGIN_UNSPECIFIED = 0; + + // Does not require that the user is signed in. + LOGIN_OPTIONAL = 1; + + // If the user is not signed in, the `auth_fail_action` is taken. + // In addition, if the user is not an administrator for the + // application, they are given an error message regardless of + // `auth_fail_action`. If the user is an administrator, the handler + // proceeds. + LOGIN_ADMIN = 2; + + // If the user has signed in, the handler proceeds normally. Otherwise, the + // auth_fail_action is taken. + LOGIN_REQUIRED = 3; +} + +// Methods to enforce security (HTTPS) on a URL. +enum SecurityLevel { + option allow_alias = true; + // Not specified. + SECURE_UNSPECIFIED = 0; + + // Both HTTP and HTTPS requests with URLs that match the handler succeed + // without redirects. The application can examine the request to determine + // which protocol was used, and respond accordingly. + SECURE_DEFAULT = 0; + + // Requests for a URL that match this handler that use HTTPS are automatically + // redirected to the HTTP equivalent URL. + SECURE_NEVER = 1; + + // Both HTTP and HTTPS requests with URLs that match the handler succeed + // without redirects. The application can examine the request to determine + // which protocol was used and respond accordingly. + SECURE_OPTIONAL = 2; + + // Requests for a URL that match this handler that do not use HTTPS are + // automatically redirected to the HTTPS URL with the same path. Query + // parameters are reserved for the redirect. + SECURE_ALWAYS = 3; +} diff --git a/handwritten/cloud-profiler/google/appengine/v1/appengine.proto b/handwritten/cloud-profiler/google/appengine/v1/appengine.proto new file mode 100644 index 00000000000..ef947a65b68 --- /dev/null +++ b/handwritten/cloud-profiler/google/appengine/v1/appengine.proto @@ -0,0 +1,341 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.appengine.v1; + +import "google/api/annotations.proto"; +import "google/appengine/v1/application.proto"; +import "google/appengine/v1/instance.proto"; +import "google/appengine/v1/service.proto"; +import "google/appengine/v1/version.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "google.golang.org/genproto/googleapis/appengine/v1;appengine"; +option java_multiple_files = true; +option java_outer_classname = "AppengineProto"; +option java_package = "com.google.appengine.v1"; + + +// Manages instances of a version. +service Instances { + // Lists the instances of a version. + rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { + option (google.api.http) = { get: "/v1/{parent=apps/*/services/*/versions/*}/instances" }; + } + + // Gets instance information. + rpc GetInstance(GetInstanceRequest) returns (Instance) { + option (google.api.http) = { get: "/v1/{name=apps/*/services/*/versions/*/instances/*}" }; + } + + // Stops a running instance. + rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { delete: "/v1/{name=apps/*/services/*/versions/*/instances/*}" }; + } + + // Enables debugging on a VM instance. This allows you to use the SSH + // command to connect to the virtual machine where the instance lives. + // While in "debug mode", the instance continues to serve live traffic. + // You should delete the instance when you are done debugging and then + // allow the system to take over and determine if another instance + // should be started. + // + // Only applicable for instances in App Engine flexible environment. + rpc DebugInstance(DebugInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/{name=apps/*/services/*/versions/*/instances/*}:debug" body: "*" }; + } +} + +// Manages versions of a service. +service Versions { + // Lists the versions of a service. + rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { + option (google.api.http) = { get: "/v1/{parent=apps/*/services/*}/versions" }; + } + + // Gets the specified Version resource. + // By default, only a `BASIC_VIEW` will be returned. + // Specify the `FULL_VIEW` parameter to get the full resource. + rpc GetVersion(GetVersionRequest) returns (Version) { + option (google.api.http) = { get: "/v1/{name=apps/*/services/*/versions/*}" }; + } + + // Deploys code and resource files to a new version. + rpc CreateVersion(CreateVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/{parent=apps/*/services/*}/versions" body: "version" }; + } + + // Updates the specified Version resource. + // You can specify the following fields depending on the App Engine + // environment and type of scaling that the version resource uses: + // + // * [`serving_status`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status): + // For Version resources that use basic scaling, manual scaling, or run in + // the App Engine flexible environment. + // * [`instance_class`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class): + // For Version resources that run in the App Engine standard environment. + // * [`automatic_scaling.min_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): + // For Version resources that use automatic scaling and run in the App + // Engine standard environment. + // * [`automatic_scaling.max_idle_instances`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling): + // For Version resources that use automatic scaling and run in the App + // Engine standard environment. + rpc UpdateVersion(UpdateVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { patch: "/v1/{name=apps/*/services/*/versions/*}" body: "version" }; + } + + // Deletes an existing Version resource. + rpc DeleteVersion(DeleteVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { delete: "/v1/{name=apps/*/services/*/versions/*}" }; + } +} + +// Manages services of an application. +service Services { + // Lists all the services in the application. + rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { + option (google.api.http) = { get: "/v1/{parent=apps/*}/services" }; + } + + // Gets the current configuration of the specified service. + rpc GetService(GetServiceRequest) returns (Service) { + option (google.api.http) = { get: "/v1/{name=apps/*/services/*}" }; + } + + // Updates the configuration of the specified service. + rpc UpdateService(UpdateServiceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { patch: "/v1/{name=apps/*/services/*}" body: "service" }; + } + + // Deletes the specified service and all enclosed versions. + rpc DeleteService(DeleteServiceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { delete: "/v1/{name=apps/*/services/*}" }; + } +} + +// Manages App Engine applications. +service Applications { + // Gets information about an application. + rpc GetApplication(GetApplicationRequest) returns (Application) { + option (google.api.http) = { get: "/v1/{name=apps/*}" }; + } + + // Recreates the required App Engine features for the application in your + // project, for example a Cloud Storage bucket or App Engine service account. + // Use this method if you receive an error message about a missing feature, + // for example "*Error retrieving the App Engine service account*". + rpc RepairApplication(RepairApplicationRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/{name=apps/*}:repair" body: "*" }; + } +} + +// Request message for `Applications.GetApplication`. +message GetApplicationRequest { + // Name of the Application resource to get. Example: `apps/myapp`. + string name = 1; +} + +// Request message for 'Applications.RepairApplication'. +message RepairApplicationRequest { + // Name of the application to repair. Example: `apps/myapp` + string name = 1; +} + +// Request message for `Services.ListServices`. +message ListServicesRequest { + // Name of the parent Application resource. Example: `apps/myapp`. + string parent = 1; + + // Maximum results to return per page. + int32 page_size = 2; + + // Continuation token for fetching the next page of results. + string page_token = 3; +} + +// Response message for `Services.ListServices`. +message ListServicesResponse { + // The services belonging to the requested application. + repeated Service services = 1; + + // Continuation token for fetching the next page of results. + string next_page_token = 2; +} + +// Request message for `Services.GetService`. +message GetServiceRequest { + // Name of the resource requested. Example: `apps/myapp/services/default`. + string name = 1; +} + +// Request message for `Services.UpdateService`. +message UpdateServiceRequest { + // Name of the resource to update. Example: `apps/myapp/services/default`. + string name = 1; + + // A Service resource containing the updated service. Only fields set in the + // field mask will be updated. + Service service = 2; + + // Standard field mask for the set of fields to be updated. + google.protobuf.FieldMask update_mask = 3; + + // Set to `true` to gradually shift traffic from one version to another + // single version. By default, traffic is shifted immediately. + // For gradual traffic migration, the target version + // must be located within instances that are configured for both + // [warmup requests](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#inboundservicetype) + // and + // [automatic scaling](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#automaticscaling). + // You must specify the + // [`shardBy`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services#shardby) + // field in the Service resource. Gradual traffic migration is not + // supported in the App Engine flexible environment. For examples, see + // [Migrating and Splitting Traffic](https://cloud.google.com/appengine/docs/admin-api/migrating-splitting-traffic). + bool migrate_traffic = 4; +} + +// Request message for `Services.DeleteService`. +message DeleteServiceRequest { + // Name of the resource requested. Example: `apps/myapp/services/default`. + string name = 1; +} + +// Request message for `Versions.ListVersions`. +message ListVersionsRequest { + // Name of the parent Service resource. Example: + // `apps/myapp/services/default`. + string parent = 1; + + // Controls the set of fields returned in the `List` response. + VersionView view = 2; + + // Maximum results to return per page. + int32 page_size = 3; + + // Continuation token for fetching the next page of results. + string page_token = 4; +} + +// Response message for `Versions.ListVersions`. +message ListVersionsResponse { + // The versions belonging to the requested service. + repeated Version versions = 1; + + // Continuation token for fetching the next page of results. + string next_page_token = 2; +} + +// Request message for `Versions.GetVersion`. +message GetVersionRequest { + // Name of the resource requested. Example: + // `apps/myapp/services/default/versions/v1`. + string name = 1; + + // Controls the set of fields returned in the `Get` response. + VersionView view = 2; +} + +// Request message for `Versions.CreateVersion`. +message CreateVersionRequest { + // Name of the parent resource to create this version under. Example: + // `apps/myapp/services/default`. + string parent = 1; + + // Application deployment configuration. + Version version = 2; +} + +// Request message for `Versions.UpdateVersion`. +message UpdateVersionRequest { + // Name of the resource to update. Example: + // `apps/myapp/services/default/versions/1`. + string name = 1; + + // A Version containing the updated resource. Only fields set in the field + // mask will be updated. + Version version = 2; + + // Standard field mask for the set of fields to be updated. + google.protobuf.FieldMask update_mask = 3; +} + +// Request message for `Versions.DeleteVersion`. +message DeleteVersionRequest { + // Name of the resource requested. Example: + // `apps/myapp/services/default/versions/v1`. + string name = 1; +} + +// Request message for `Instances.ListInstances`. +message ListInstancesRequest { + // Name of the parent Version resource. Example: + // `apps/myapp/services/default/versions/v1`. + string parent = 1; + + // Maximum results to return per page. + int32 page_size = 2; + + // Continuation token for fetching the next page of results. + string page_token = 3; +} + +// Response message for `Instances.ListInstances`. +message ListInstancesResponse { + // The instances belonging to the requested version. + repeated Instance instances = 1; + + // Continuation token for fetching the next page of results. + string next_page_token = 2; +} + +// Request message for `Instances.GetInstance`. +message GetInstanceRequest { + // Name of the resource requested. Example: + // `apps/myapp/services/default/versions/v1/instances/instance-1`. + string name = 1; +} + +// Request message for `Instances.DeleteInstance`. +message DeleteInstanceRequest { + // Name of the resource requested. Example: + // `apps/myapp/services/default/versions/v1/instances/instance-1`. + string name = 1; +} + +// Request message for `Instances.DebugInstance`. +message DebugInstanceRequest { + // Name of the resource requested. Example: + // `apps/myapp/services/default/versions/v1/instances/instance-1`. + string name = 1; +} + +// Fields that should be returned when [Version][google.appengine.v1.Version] resources +// are retreived. +enum VersionView { + // Basic version information including scaling and inbound services, + // but not detailed deployment information. + BASIC = 0; + + // The information from `BASIC`, plus detailed information about the + // deployment. This format is required when creating resources, but + // is not returned in `Get` or `List` by default. + FULL = 1; +} diff --git a/handwritten/cloud-profiler/google/appengine/v1/application.proto b/handwritten/cloud-profiler/google/appengine/v1/application.proto new file mode 100644 index 00000000000..d962dda6bd3 --- /dev/null +++ b/handwritten/cloud-profiler/google/appengine/v1/application.proto @@ -0,0 +1,112 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.appengine.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/duration.proto"; + +option go_package = "google.golang.org/genproto/googleapis/appengine/v1;appengine"; +option java_multiple_files = true; +option java_outer_classname = "ApplicationProto"; +option java_package = "com.google.appengine.v1"; + + +// An Application resource contains the top-level configuration of an App +// Engine application. +message Application { + // Full path to the Application resource in the API. + // Example: `apps/myapp`. + // + // @OutputOnly + string name = 1; + + // Identifier of the Application resource. This identifier is equivalent + // to the project ID of the Google Cloud Platform project where you want to + // deploy your application. + // Example: `myapp`. + string id = 2; + + // HTTP path dispatch rules for requests to the application that do not + // explicitly target a service or version. Rules are order-dependent. + // + // @OutputOnly + repeated UrlDispatchRule dispatch_rules = 3; + + // Google Apps authentication domain that controls which users can access + // this application. + // + // Defaults to open access for any Google Account. + string auth_domain = 6; + + // Location from which this application will be run. Application instances + // will run out of data centers in the chosen location, which is also where + // all of the application's end user content is stored. + // + // Defaults to `us-central`. + // + // Options are: + // + // `us-central` - Central US + // + // `europe-west` - Western Europe + // + // `us-east1` - Eastern US + string location_id = 7; + + // Google Cloud Storage bucket that can be used for storing files + // associated with this application. This bucket is associated with the + // application and can be used by the gcloud deployment commands. + // + // @OutputOnly + string code_bucket = 8; + + // Cookie expiration policy for this application. + // + // @OutputOnly + google.protobuf.Duration default_cookie_expiration = 9; + + // Hostname used to reach this application, as resolved by App Engine. + // + // @OutputOnly + string default_hostname = 11; + + // Google Cloud Storage bucket that can be used by this application to store + // content. + // + // @OutputOnly + string default_bucket = 12; +} + +// Rules to match an HTTP request and dispatch that request to a service. +message UrlDispatchRule { + // Domain name to match against. The wildcard "`*`" is supported if + // specified before a period: "`*.`". + // + // Defaults to matching all domains: "`*`". + string domain = 1; + + // Pathname within the host. Must start with a "`/`". A + // single "`*`" can be included at the end of the path. The sum + // of the lengths of the domain and path may not exceed 100 + // characters. + string path = 2; + + // Resource ID of a service in this application that should + // serve the matched request. The service must already + // exist. Example: `default`. + string service = 3; +} diff --git a/handwritten/cloud-profiler/google/appengine/v1/audit_data.proto b/handwritten/cloud-profiler/google/appengine/v1/audit_data.proto new file mode 100644 index 00000000000..6318a96004d --- /dev/null +++ b/handwritten/cloud-profiler/google/appengine/v1/audit_data.proto @@ -0,0 +1,53 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.appengine.v1; + +import "google/appengine/v1/appengine.proto"; +import "google/iam/v1/iam_policy.proto"; + +option go_package = "google.golang.org/genproto/googleapis/appengine/v1;appengine"; +option java_multiple_files = true; +option java_outer_classname = "AuditDataProto"; +option java_package = "com.google.appengine.v1"; + + +// App Engine admin service audit log. +message AuditData { + // Detailed information about methods that require it. Does not include + // simple Get, List or Delete methods because all significant information + // (resource name, number of returned elements for List operations) is already + // included in parent audit log message. + oneof method { + // Detailed information about UpdateService call. + UpdateServiceMethod update_service = 1; + + // Detailed information about CreateVersion call. + CreateVersionMethod create_version = 2; + } +} + +// Detailed information about UpdateService call. +message UpdateServiceMethod { + // Update service request. + google.appengine.v1.UpdateServiceRequest request = 1; +} + +// Detailed information about CreateVersion call. +message CreateVersionMethod { + // Create version request. + google.appengine.v1.CreateVersionRequest request = 1; +} diff --git a/handwritten/cloud-profiler/google/appengine/v1/deploy.proto b/handwritten/cloud-profiler/google/appengine/v1/deploy.proto new file mode 100644 index 00000000000..77e6444fdde --- /dev/null +++ b/handwritten/cloud-profiler/google/appengine/v1/deploy.proto @@ -0,0 +1,78 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.appengine.v1; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/appengine/v1;appengine"; +option java_multiple_files = true; +option java_outer_classname = "DeployProto"; +option java_package = "com.google.appengine.v1"; + + +// Code and application artifacts used to deploy a version to App Engine. +message Deployment { + // Manifest of the files stored in Google Cloud Storage that are included + // as part of this version. All files must be readable using the + // credentials supplied with this call. + map files = 1; + + // A Docker image that App Engine uses to run the version. + // Only applicable for instances in App Engine flexible environment. + ContainerInfo container = 2; + + // The zip file for this deployment, if this is a zip deployment. + ZipInfo zip = 3; +} + +// Single source file that is part of the version to be deployed. Each source +// file that is deployed must be specified separately. +message FileInfo { + // URL source to use to fetch this file. Must be a URL to a resource in + // Google Cloud Storage in the form + // 'http(s)://storage.googleapis.com/\/\'. + string source_url = 1; + + // The SHA1 hash of the file, in hex. + string sha1_sum = 2; + + // The MIME type of the file. + // + // Defaults to the value from Google Cloud Storage. + string mime_type = 3; +} + +// Docker image that is used to start a VM container for the version you +// deploy. +message ContainerInfo { + // URI to the hosted container image in a Docker repository. The URI must be + // fully qualified and include a tag or digest. + // Examples: "gcr.io/my-project/image:tag" or "gcr.io/my-project/image@digest" + string image = 1; +} + +message ZipInfo { + // URL of the zip file to deploy from. Must be a URL to a resource in + // Google Cloud Storage in the form + // 'http(s)://storage.googleapis.com/\/\'. + string source_url = 3; + + // An estimate of the number of files in a zip for a zip deployment. + // If set, must be greater than or equal to the actual number of files. + // Used for optimizing performance; if not provided, deployment may be slow. + int32 files_count = 4; +} diff --git a/handwritten/cloud-profiler/google/appengine/v1/instance.proto b/handwritten/cloud-profiler/google/appengine/v1/instance.proto new file mode 100644 index 00000000000..206af26993d --- /dev/null +++ b/handwritten/cloud-profiler/google/appengine/v1/instance.proto @@ -0,0 +1,121 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.appengine.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/appengine/v1;appengine"; +option java_multiple_files = true; +option java_outer_classname = "InstanceProto"; +option java_package = "com.google.appengine.v1"; + + +// An Instance resource is the computing unit that App Engine uses to +// automatically scale an application. +message Instance { + // Availability of the instance. + enum Availability { + UNSPECIFIED = 0; + + RESIDENT = 1; + + DYNAMIC = 2; + } + + // Full path to the Instance resource in the API. + // Example: `apps/myapp/services/default/versions/v1/instances/instance-1`. + // + // @OutputOnly + string name = 1; + + // Relative name of the instance within the version. + // Example: `instance-1`. + // + // @OutputOnly + string id = 2; + + // App Engine release this instance is running on. + // + // @OutputOnly + string app_engine_release = 3; + + // Availability of the instance. + // + // @OutputOnly + Availability availability = 4; + + // Name of the virtual machine where this instance lives. Only applicable + // for instances in App Engine flexible environment. + // + // @OutputOnly + string vm_name = 5; + + // Zone where the virtual machine is located. Only applicable for instances + // in App Engine flexible environment. + // + // @OutputOnly + string vm_zone_name = 6; + + // Virtual machine ID of this instance. Only applicable for instances in + // App Engine flexible environment. + // + // @OutputOnly + string vm_id = 7; + + // Time that this instance was started. + // + // @OutputOnly + google.protobuf.Timestamp start_time = 8; + + // Number of requests since this instance was started. + // + // @OutputOnly + int32 requests = 9; + + // Number of errors since this instance was started. + // + // @OutputOnly + int32 errors = 10; + + // Average queries per second (QPS) over the last minute. + // + // @OutputOnly + float qps = 11; + + // Average latency (ms) over the last minute. + // + // @OutputOnly + int32 average_latency = 12; + + // Total memory in use (bytes). + // + // @OutputOnly + int64 memory_usage = 13; + + // Status of the virtual machine where this instance lives. Only applicable + // for instances in App Engine flexible environment. + // + // @OutputOnly + string vm_status = 14; + + // Whether this instance is in debug mode. Only applicable for instances in + // App Engine flexible environment. + // + // @OutputOnly + bool vm_debug_enabled = 15; +} diff --git a/handwritten/cloud-profiler/google/appengine/v1/location.proto b/handwritten/cloud-profiler/google/appengine/v1/location.proto new file mode 100644 index 00000000000..2a81fb912fe --- /dev/null +++ b/handwritten/cloud-profiler/google/appengine/v1/location.proto @@ -0,0 +1,39 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.appengine.v1; + +import "google/api/annotations.proto"; +import "google/type/latlng.proto"; + +option go_package = "google.golang.org/genproto/googleapis/appengine/v1;appengine"; +option java_multiple_files = true; +option java_outer_classname = "LocationProto"; +option java_package = "com.google.appengine.v1"; + + +// Metadata for the given [google.cloud.location.Location][google.cloud.location.Location]. +message LocationMetadata { + // App Engine Standard Environment is available in the given location. + // + // @OutputOnly + bool standard_environment_available = 2; + + // App Engine Flexible Environment is available in the given location. + // + // @OutputOnly + bool flexible_environment_available = 4; +} diff --git a/handwritten/cloud-profiler/google/appengine/v1/operation.proto b/handwritten/cloud-profiler/google/appengine/v1/operation.proto new file mode 100644 index 00000000000..ec798889273 --- /dev/null +++ b/handwritten/cloud-profiler/google/appengine/v1/operation.proto @@ -0,0 +1,56 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.appengine.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/appengine/v1;appengine"; +option java_multiple_files = true; +option java_outer_classname = "OperationProto"; +option java_package = "com.google.appengine.v1"; + + +// Metadata for the given [google.longrunning.Operation][google.longrunning.Operation]. +message OperationMetadataV1 { + // API method that initiated this operation. Example: + // `google.appengine.v1.Versions.CreateVersion`. + // + // @OutputOnly + string method = 1; + + // Time that this operation was created. + // + // @OutputOnly + google.protobuf.Timestamp insert_time = 2; + + // Time that this operation completed. + // + // @OutputOnly + google.protobuf.Timestamp end_time = 3; + + // User who requested this operation. + // + // @OutputOnly + string user = 4; + + // Name of the resource that this operation is acting on. Example: + // `apps/myapp/services/default`. + // + // @OutputOnly + string target = 5; +} diff --git a/handwritten/cloud-profiler/google/appengine/v1/service.proto b/handwritten/cloud-profiler/google/appengine/v1/service.proto new file mode 100644 index 00000000000..2a24c47fd6c --- /dev/null +++ b/handwritten/cloud-profiler/google/appengine/v1/service.proto @@ -0,0 +1,83 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.appengine.v1; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/appengine/v1;appengine"; +option java_multiple_files = true; +option java_outer_classname = "ServiceProto"; +option java_package = "com.google.appengine.v1"; + + +// A Service resource is a logical component of an application that can share +// state and communicate in a secure fashion with other services. +// For example, an application that handles customer requests might +// include separate services to handle tasks such as backend data +// analysis or API requests from mobile devices. Each service has a +// collection of versions that define a specific set of code used to +// implement the functionality of that service. +message Service { + // Full path to the Service resource in the API. + // Example: `apps/myapp/services/default`. + // + // @OutputOnly + string name = 1; + + // Relative name of the service within the application. + // Example: `default`. + // + // @OutputOnly + string id = 2; + + // Mapping that defines fractional HTTP traffic diversion to + // different versions within the service. + TrafficSplit split = 3; +} + +// Traffic routing configuration for versions within a single service. Traffic +// splits define how traffic directed to the service is assigned to versions. +message TrafficSplit { + // Available sharding mechanisms. + enum ShardBy { + // Diversion method unspecified. + UNSPECIFIED = 0; + + // Diversion based on a specially named cookie, "GOOGAPPUID." The cookie + // must be set by the application itself or no diversion will occur. + COOKIE = 1; + + // Diversion based on applying the modulus operation to a fingerprint + // of the IP address. + IP = 2; + } + + // Mechanism used to determine which version a request is sent to. + // The traffic selection algorithm will + // be stable for either type until allocations are changed. + ShardBy shard_by = 1; + + // Mapping from version IDs within the service to fractional + // (0.000, 1] allocations of traffic for that version. Each version can + // be specified only once, but some versions in the service may not + // have any traffic allocation. Services that have traffic allocated + // cannot be deleted until either the service is deleted or + // their traffic allocation is removed. Allocations must sum to 1. + // Up to two decimal place precision is supported for IP-based splits and + // up to three decimal places is supported for cookie-based splits. + map allocations = 2; +} diff --git a/handwritten/cloud-profiler/google/appengine/v1/version.proto b/handwritten/cloud-profiler/google/appengine/v1/version.proto new file mode 100644 index 00000000000..b32e1ac5fbb --- /dev/null +++ b/handwritten/cloud-profiler/google/appengine/v1/version.proto @@ -0,0 +1,378 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.appengine.v1; + +import "google/api/annotations.proto"; +import "google/appengine/v1/app_yaml.proto"; +import "google/appengine/v1/deploy.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/appengine/v1;appengine"; +option java_multiple_files = true; +option java_outer_classname = "VersionProto"; +option java_package = "com.google.appengine.v1"; + + +// A Version resource is a specific set of source code and configuration files +// that are deployed into a service. +message Version { + // Full path to the Version resource in the API. Example: + // `apps/myapp/services/default/versions/v1`. + // + // @OutputOnly + string name = 1; + + // Relative name of the version within the service. Example: `v1`. + // Version names can contain only lowercase letters, numbers, or hyphens. + // Reserved names: "default", "latest", and any name with the prefix "ah-". + string id = 2; + + // Controls how instances are created. + // + // Defaults to `AutomaticScaling`. + oneof scaling { + // Automatic scaling is based on request rate, response latencies, and other + // application metrics. + AutomaticScaling automatic_scaling = 3; + + // A service with basic scaling will create an instance when the application + // receives a request. The instance will be turned down when the app becomes + // idle. Basic scaling is ideal for work that is intermittent or driven by + // user activity. + BasicScaling basic_scaling = 4; + + // A service with manual scaling runs continuously, allowing you to perform + // complex initialization and rely on the state of its memory over time. + ManualScaling manual_scaling = 5; + } + + // Before an application can receive email or XMPP messages, the application + // must be configured to enable the service. + repeated InboundServiceType inbound_services = 6; + + // Instance class that is used to run this version. Valid values are: + // * AutomaticScaling: `F1`, `F2`, `F4`, `F4_1G` + // * ManualScaling or BasicScaling: `B1`, `B2`, `B4`, `B8`, `B4_1G` + // + // Defaults to `F1` for AutomaticScaling and `B1` for ManualScaling or + // BasicScaling. + string instance_class = 7; + + // Extra network settings. Only applicable for VM runtimes. + Network network = 8; + + // Machine resources for this version. Only applicable for VM runtimes. + Resources resources = 9; + + // Desired runtime. Example: `python27`. + string runtime = 10; + + // Whether multiple requests can be dispatched to this version at once. + bool threadsafe = 11; + + // Whether to deploy this version in a container on a virtual machine. + bool vm = 12; + + // Metadata settings that are supplied to this version to enable + // beta runtime features. + map beta_settings = 13; + + // App Engine execution environment for this version. + // + // Defaults to `standard`. + string env = 14; + + // Current serving status of this version. Only the versions with a + // `SERVING` status create instances and can be billed. + // + // `SERVING_STATUS_UNSPECIFIED` is an invalid value. Defaults to `SERVING`. + ServingStatus serving_status = 15; + + // Email address of the user who created this version. + // + // @OutputOnly + string created_by = 16; + + // Time that this version was created. + // + // @OutputOnly + google.protobuf.Timestamp create_time = 17; + + // Total size in bytes of all the files that are included in this version + // and curerntly hosted on the App Engine disk. + // + // @OutputOnly + int64 disk_usage_bytes = 18; + + // An ordered list of URL-matching patterns that should be applied to incoming + // requests. The first matching URL handles the request and other request + // handlers are not attempted. + // + // Only returned in `GET` requests if `view=FULL` is set. + repeated UrlMap handlers = 100; + + // Custom static error pages. Limited to 10KB per page. + // + // Only returned in `GET` requests if `view=FULL` is set. + repeated ErrorHandler error_handlers = 101; + + // Configuration for third-party Python runtime libraries that are required + // by the application. + // + // Only returned in `GET` requests if `view=FULL` is set. + repeated Library libraries = 102; + + // Serving configuration for + // [Google Cloud Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/). + // + // Only returned in `GET` requests if `view=FULL` is set. + ApiConfigHandler api_config = 103; + + // Environment variables available to the application. + // + // Only returned in `GET` requests if `view=FULL` is set. + map env_variables = 104; + + // Duration that static files should be cached by web proxies and browsers. + // Only applicable if the corresponding + // [StaticFilesHandler](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) + // does not specify its own expiration time. + // + // Only returned in `GET` requests if `view=FULL` is set. + google.protobuf.Duration default_expiration = 105; + + // Configures health checking for VM instances. Unhealthy instances are + // stopped and replaced with new instances. Only applicable for VM + // runtimes. + // + // Only returned in `GET` requests if `view=FULL` is set. + HealthCheck health_check = 106; + + // Files that match this pattern will not be built into this version. + // Only applicable for Go runtimes. + // + // Only returned in `GET` requests if `view=FULL` is set. + string nobuild_files_regex = 107; + + // Code and application artifacts that make up this version. + // + // Only returned in `GET` requests if `view=FULL` is set. + Deployment deployment = 108; + + // Serving URL for this version. Example: + // "https://myversion-dot-myservice-dot-myapp.appspot.com" + // + // @OutputOnly + string version_url = 109; +} + +// Automatic scaling is based on request rate, response latencies, and other +// application metrics. +message AutomaticScaling { + // Amount of time that the + // [Autoscaler](https://cloud.google.com/compute/docs/autoscaler/) + // should wait between changes to the number of virtual machines. + // Only applicable for VM runtimes. + google.protobuf.Duration cool_down_period = 1; + + // Target scaling by CPU usage. + CpuUtilization cpu_utilization = 2; + + // Number of concurrent requests an automatic scaling instance can accept + // before the scheduler spawns a new instance. + // + // Defaults to a runtime-specific value. + int32 max_concurrent_requests = 3; + + // Maximum number of idle instances that should be maintained for this + // version. + int32 max_idle_instances = 4; + + // Maximum number of instances that should be started to handle requests. + int32 max_total_instances = 5; + + // Maximum amount of time that a request should wait in the pending queue + // before starting a new instance to handle it. + google.protobuf.Duration max_pending_latency = 6; + + // Minimum number of idle instances that should be maintained for + // this version. Only applicable for the default version of a service. + int32 min_idle_instances = 7; + + // Minimum number of instances that should be maintained for this version. + int32 min_total_instances = 8; + + // Minimum amount of time a request should wait in the pending queue before + // starting a new instance to handle it. + google.protobuf.Duration min_pending_latency = 9; + + // Target scaling by request utilization. + RequestUtilization request_utilization = 10; + + // Target scaling by disk usage. + DiskUtilization disk_utilization = 11; + + // Target scaling by network usage. + NetworkUtilization network_utilization = 12; +} + +// A service with basic scaling will create an instance when the application +// receives a request. The instance will be turned down when the app becomes +// idle. Basic scaling is ideal for work that is intermittent or driven by +// user activity. +message BasicScaling { + // Duration of time after the last request that an instance must wait before + // the instance is shut down. + google.protobuf.Duration idle_timeout = 1; + + // Maximum number of instances to create for this version. + int32 max_instances = 2; +} + +// A service with manual scaling runs continuously, allowing you to perform +// complex initialization and rely on the state of its memory over time. +message ManualScaling { + // Number of instances to assign to the service at the start. This number + // can later be altered by using the + // [Modules API](https://cloud.google.com/appengine/docs/python/modules/functions) + // `set_num_instances()` function. + int32 instances = 1; +} + +// Target scaling by CPU usage. +message CpuUtilization { + // Period of time over which CPU utilization is calculated. + google.protobuf.Duration aggregation_window_length = 1; + + // Target CPU utilization ratio to maintain when scaling. Must be between 0 + // and 1. + double target_utilization = 2; +} + +// Target scaling by request utilization. Only applicable for VM runtimes. +message RequestUtilization { + // Target requests per second. + int32 target_request_count_per_second = 1; + + // Target number of concurrent requests. + int32 target_concurrent_requests = 2; +} + +// Target scaling by disk usage. Only applicable for VM runtimes. +message DiskUtilization { + // Target bytes written per second. + int32 target_write_bytes_per_second = 14; + + // Target ops written per second. + int32 target_write_ops_per_second = 15; + + // Target bytes read per second. + int32 target_read_bytes_per_second = 16; + + // Target ops read per seconds. + int32 target_read_ops_per_second = 17; +} + +// Target scaling by network usage. Only applicable for VM runtimes. +message NetworkUtilization { + // Target bytes sent per second. + int32 target_sent_bytes_per_second = 1; + + // Target packets sent per second. + int32 target_sent_packets_per_second = 11; + + // Target bytes received per second. + int32 target_received_bytes_per_second = 12; + + // Target packets received per second. + int32 target_received_packets_per_second = 13; +} + +// Extra network settings. Only applicable for VM runtimes. +message Network { + // List of ports, or port pairs, to forward from the virtual machine to the + // application container. + repeated string forwarded_ports = 1; + + // Tag to apply to the VM instance during creation. + string instance_tag = 2; + + // Google Cloud Platform network where the virtual machines are created. + // Specify the short name, not the resource path. + // + // Defaults to `default`. + string name = 3; +} + +// Machine resources for a version. +message Resources { + // Number of CPU cores needed. + double cpu = 1; + + // Disk size (GB) needed. + double disk_gb = 2; + + // Memory (GB) needed. + double memory_gb = 3; +} + +// Available inbound services. +enum InboundServiceType { + // Not specified. + INBOUND_SERVICE_UNSPECIFIED = 0; + + // Allows an application to receive mail. + INBOUND_SERVICE_MAIL = 1; + + // Allows an application to receive email-bound notifications. + INBOUND_SERVICE_MAIL_BOUNCE = 2; + + // Allows an application to receive error stanzas. + INBOUND_SERVICE_XMPP_ERROR = 3; + + // Allows an application to receive instant messages. + INBOUND_SERVICE_XMPP_MESSAGE = 4; + + // Allows an application to receive user subscription POSTs. + INBOUND_SERVICE_XMPP_SUBSCRIBE = 5; + + // Allows an application to receive a user's chat presence. + INBOUND_SERVICE_XMPP_PRESENCE = 6; + + // Registers an application for notifications when a client connects or + // disconnects from a channel. + INBOUND_SERVICE_CHANNEL_PRESENCE = 7; + + // Enables warmup requests. + INBOUND_SERVICE_WARMUP = 9; +} + +// Run states of a version. +enum ServingStatus { + // Not specified. + SERVING_STATUS_UNSPECIFIED = 0; + + // Currently serving. Instances are created according to the + // scaling settings of the version. + SERVING = 1; + + // Disabled. No instances will be created and the scaling + // settings are ignored until the state of the version changes + // to `SERVING`. + STOPPED = 2; +} diff --git a/handwritten/cloud-profiler/google/artman_core.yaml b/handwritten/cloud-profiler/google/artman_core.yaml new file mode 100644 index 00000000000..a83e02f88a0 --- /dev/null +++ b/handwritten/cloud-profiler/google/artman_core.yaml @@ -0,0 +1,34 @@ +common: + api_name: common-protos + organization_name: google + src_proto_paths: + - api + - cloud/audit + - logging/type + - longrunning + - rpc + - type + # Exclusions + - -api/servicemanagement + - -api/servicecontrol +artifacts: +- name: java_proto + type: PROTOBUF + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - name: proto + dest: generated/java/proto-google-common-protos +- name: php_grpc + type: GRPC_COMMON + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - name: grpc + dest: generated/php/google-common-protos diff --git a/handwritten/cloud-profiler/google/artman_logging_external_types.yaml b/handwritten/cloud-profiler/google/artman_logging_external_types.yaml new file mode 100644 index 00000000000..49e00755c9d --- /dev/null +++ b/handwritten/cloud-profiler/google/artman_logging_external_types.yaml @@ -0,0 +1,36 @@ +common: + api_name: logging-external-types + organization_name: google + src_proto_paths: + - appengine/legacy + - appengine/logging/v1 + - cloud/audit + - cloud/bigquery/logging/v1 + - iam/v1/logging + proto_deps: + - name: google-common-protos + - name: google-iam-v1 + - name: google-appengine-v1 +artifacts: +- name: java_grpc + type: GRPC + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - name: proto + dest: generated/java/proto-google-logging-external-types + - name: grpc + dest: generated/java/grpc-google-logging-external-types +- name: php_grpc + type: GRPC + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - name: grpc + dest: generated/php/google-logging-external-types diff --git a/handwritten/cloud-profiler/google/assistant/embedded/README.md b/handwritten/cloud-profiler/google/assistant/embedded/README.md new file mode 100644 index 00000000000..756d9ff3ec4 --- /dev/null +++ b/handwritten/cloud-profiler/google/assistant/embedded/README.md @@ -0,0 +1,3 @@ +The `Google Assistant API` allows developers to embed the Google Assistant into +their devices. It provides an audio-in (spoken user query) and +audio-out (Assistant spoken response). diff --git a/handwritten/cloud-profiler/google/assistant/embedded/v1alpha1/embedded_assistant.proto b/handwritten/cloud-profiler/google/assistant/embedded/v1alpha1/embedded_assistant.proto new file mode 100644 index 00000000000..361c326da7b --- /dev/null +++ b/handwritten/cloud-profiler/google/assistant/embedded/v1alpha1/embedded_assistant.proto @@ -0,0 +1,281 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.assistant.embedded.v1alpha1; + +import "google/api/annotations.proto"; +import "google/rpc/status.proto"; + +option go_package = "google.golang.org/genproto/googleapis/assistant/embedded/v1alpha1;embedded"; +option java_multiple_files = true; +option java_outer_classname = "AssistantProto"; +option java_package = "com.google.assistant.embedded.v1alpha1"; + + +// Service that implements Google Assistant API. +service EmbeddedAssistant { + // Initiates or continues a conversation with the embedded assistant service. + // Each call performs one round-trip, sending an audio request to the service + // and receiving the audio response. Uses bidirectional streaming to receive + // results, such as the `END_OF_UTTERANCE` event, while sending audio. + // + // A conversation is one or more gRPC connections, each consisting of several + // streamed requests and responses. + // For example, the user says *Add to my shopping list* and the assistant + // responds *What do you want to add?*. The sequence of streamed requests and + // responses in the first gRPC message could be: + // + // * ConverseRequest.config + // * ConverseRequest.audio_in + // * ConverseRequest.audio_in + // * ConverseRequest.audio_in + // * ConverseRequest.audio_in + // * ConverseResponse.event_type.END_OF_UTTERANCE + // * ConverseResponse.result.microphone_mode.DIALOG_FOLLOW_ON + // * ConverseResponse.audio_out + // * ConverseResponse.audio_out + // * ConverseResponse.audio_out + // + // The user then says *bagels* and the assistant responds + // *OK, I've added bagels to your shopping list*. This is sent as another gRPC + // connection call to the `Converse` method, again with streamed requests and + // responses, such as: + // + // * ConverseRequest.config + // * ConverseRequest.audio_in + // * ConverseRequest.audio_in + // * ConverseRequest.audio_in + // * ConverseResponse.event_type.END_OF_UTTERANCE + // * ConverseResponse.result.microphone_mode.CLOSE_MICROPHONE + // * ConverseResponse.audio_out + // * ConverseResponse.audio_out + // * ConverseResponse.audio_out + // * ConverseResponse.audio_out + // + // Although the precise order of responses is not guaranteed, sequential + // ConverseResponse.audio_out messages will always contain sequential portions + // of audio. + rpc Converse(stream ConverseRequest) returns (stream ConverseResponse); +} + +// Specifies how to process the `ConverseRequest` messages. +message ConverseConfig { + // *Required* Specifies how to process the subsequent incoming audio. + AudioInConfig audio_in_config = 1; + + // *Required* Specifies how to format the audio that will be returned. + AudioOutConfig audio_out_config = 2; + + // *Required* Represents the current dialog state. + ConverseState converse_state = 3; +} + +// Specifies how to process the `audio_in` data that will be provided in +// subsequent requests. For recommended settings, see the Google Assistant SDK +// [best practices](https://developers.google.com/assistant/sdk/develop/grpc/best-practices/audio). +message AudioInConfig { + // Audio encoding of the data sent in the audio message. + // Audio must be one-channel (mono). The only language supported is "en-US". + enum Encoding { + // Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][]. + ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + // This encoding includes no header, only the raw audio bytes. + LINEAR16 = 1; + + // [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio + // Codec) is the recommended encoding because it is + // lossless--therefore recognition is not compromised--and + // requires only about half the bandwidth of `LINEAR16`. This encoding + // includes the `FLAC` stream header followed by audio data. It supports + // 16-bit and 24-bit samples, however, not all fields in `STREAMINFO` are + // supported. + FLAC = 2; + } + + // *Required* Encoding of audio data sent in all `audio_in` messages. + Encoding encoding = 1; + + // *Required* Sample rate (in Hertz) of the audio data sent in all `audio_in` + // messages. Valid values are from 16000-24000, but 16000 is optimal. + // For best results, set the sampling rate of the audio source to 16000 Hz. + // If that's not possible, use the native sample rate of the audio source + // (instead of re-sampling). + int32 sample_rate_hertz = 2; +} + +// Specifies the desired format for the server to use when it returns +// `audio_out` messages. +message AudioOutConfig { + // Audio encoding of the data returned in the audio message. All encodings are + // raw audio bytes with no header, except as indicated below. + enum Encoding { + // Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][]. + ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + LINEAR16 = 1; + + // MP3 audio encoding. The sample rate is encoded in the payload. + MP3 = 2; + + // Opus-encoded audio wrapped in an ogg container. The result will be a + // file which can be played natively on Android and in some browsers (such + // as Chrome). The quality of the encoding is considerably higher than MP3 + // while using the same bitrate. The sample rate is encoded in the payload. + OPUS_IN_OGG = 3; + } + + // *Required* The encoding of audio data to be returned in all `audio_out` + // messages. + Encoding encoding = 1; + + // *Required* The sample rate in Hertz of the audio data returned in + // `audio_out` messages. Valid values are: 16000-24000. + int32 sample_rate_hertz = 2; + + // *Required* Current volume setting of the device's audio output. + // Valid values are 1 to 100 (corresponding to 1% to 100%). + int32 volume_percentage = 3; +} + +// Provides information about the current dialog state. +message ConverseState { + // *Required* The `conversation_state` value returned in the prior + // `ConverseResponse`. Omit (do not set the field) if there was no prior + // `ConverseResponse`. If there was a prior `ConverseResponse`, do not omit + // this field; doing so will end that conversation (and this new request will + // start a new conversation). + bytes conversation_state = 1; +} + +// The audio containing the assistant's response to the query. Sequential chunks +// of audio data are received in sequential `ConverseResponse` messages. +message AudioOut { + // *Output-only* The audio data containing the assistant's response to the + // query. Sequential chunks of audio data are received in sequential + // `ConverseResponse` messages. + bytes audio_data = 1; +} + +// The semantic result for the user's spoken query. +message ConverseResult { + // Possible states of the microphone after a `Converse` RPC completes. + enum MicrophoneMode { + // No mode specified. + MICROPHONE_MODE_UNSPECIFIED = 0; + + // The service is not expecting a follow-on question from the user. + // The microphone should remain off until the user re-activates it. + CLOSE_MICROPHONE = 1; + + // The service is expecting a follow-on question from the user. The + // microphone should be re-opened when the `AudioOut` playback completes + // (by starting a new `Converse` RPC call to send the new audio). + DIALOG_FOLLOW_ON = 2; + } + + // *Output-only* The recognized transcript of what the user said. + string spoken_request_text = 1; + + // *Output-only* The text of the assistant's spoken response. This is only + // returned for an IFTTT action. + string spoken_response_text = 2; + + // *Output-only* State information for subsequent `ConverseRequest`. This + // value should be saved in the client and returned in the + // `conversation_state` with the next `ConverseRequest`. (The client does not + // need to interpret or otherwise use this value.) There is no need to save + // this information across device restarts. + bytes conversation_state = 3; + + // *Output-only* Specifies the mode of the microphone after this `Converse` + // RPC is processed. + MicrophoneMode microphone_mode = 4; + + // *Output-only* Updated volume level. The value will be 0 or omitted + // (indicating no change) unless a voice command such as "Increase the volume" + // or "Set volume level 4" was recognized, in which case the value will be + // between 1 and 100 (corresponding to the new volume level of 1% to 100%). + // Typically, a client should use this volume level when playing the + // `audio_out` data, and retain this value as the current volume level and + // supply it in the `AudioOutConfig` of the next `ConverseRequest`. (Some + // clients may also implement other ways to allow the current volume level to + // be changed, for example, by providing a knob that the user can turn.) + int32 volume_percentage = 5; +} + +// The top-level message sent by the client. Clients must send at least two, and +// typically numerous `ConverseRequest` messages. The first message must +// contain a `config` message and must not contain `audio_in` data. All +// subsequent messages must contain `audio_in` data and must not contain a +// `config` message. +message ConverseRequest { + // Exactly one of these fields must be specified in each `ConverseRequest`. + oneof converse_request { + // The `config` message provides information to the recognizer that + // specifies how to process the request. + // The first `ConverseRequest` message must contain a `config` message. + ConverseConfig config = 1; + + // The audio data to be recognized. Sequential chunks of audio data are sent + // in sequential `ConverseRequest` messages. The first `ConverseRequest` + // message must not contain `audio_in` data and all subsequent + // `ConverseRequest` messages must contain `audio_in` data. The audio bytes + // must be encoded as specified in `AudioInConfig`. + // Audio must be sent at approximately real-time (16000 samples per second). + // An error will be returned if audio is sent significantly faster or + // slower. + bytes audio_in = 2; + } +} + +// The top-level message received by the client. A series of one or more +// `ConverseResponse` messages are streamed back to the client. +message ConverseResponse { + // Indicates the type of event. + enum EventType { + // No event specified. + EVENT_TYPE_UNSPECIFIED = 0; + + // This event indicates that the server has detected the end of the user's + // speech utterance and expects no additional speech. Therefore, the server + // will not process additional audio (although it may subsequently return + // additional results). The client should stop sending additional audio + // data, half-close the gRPC connection, and wait for any additional results + // until the server closes the gRPC connection. + END_OF_UTTERANCE = 1; + } + + // Exactly one of these fields will be populated in each `ConverseResponse`. + oneof converse_response { + // *Output-only* If set, returns a [google.rpc.Status][google.rpc.Status] message that + // specifies the error for the operation. + // If an error occurs during processing, this message will be set and there + // will be no further messages sent. + google.rpc.Status error = 1; + + // *Output-only* Indicates the type of event. + EventType event_type = 2; + + // *Output-only* The audio containing the assistant's response to the query. + AudioOut audio_out = 3; + + // *Output-only* The semantic result for the user's spoken query. + ConverseResult result = 5; + } +} diff --git a/handwritten/cloud-profiler/google/bigtable/admin/artman_bigtable_admin.yaml b/handwritten/cloud-profiler/google/bigtable/admin/artman_bigtable_admin.yaml new file mode 100644 index 00000000000..2cf1232f63b --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/artman_bigtable_admin.yaml @@ -0,0 +1,94 @@ +common: + api_name: bigtable-admin + api_version: v2 + organization_name: google-cloud + service_yaml: bigtableadmin.yaml + gapic_yaml: v2/bigtable_admin_gapic.yaml + src_proto_paths: + - v2 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/google-cloud-bigtable-admin-v2 + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-bigtable-admin +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-bigtable-admin-v2 + - name: grpc + dest: generated/python/proto-google-cloud-bigtable-admin-v2 +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-bigtable-admin-v2 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-bigtable-admin + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/bigtable-admin/v2 + dest: google-cloud-bigtable-admin/lib/google/cloud/bigtable-admin/v2 +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-bigtable-admin-v2/vendor + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: bigtable-admin/apiv2 +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + publish_targets: + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v2 + dest: packages/bigtable-admin/src/v2 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/bigtable-admin +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/bigtable/admin/bigtableadmin.yaml b/handwritten/cloud-profiler/google/bigtable/admin/bigtableadmin.yaml new file mode 100644 index 00000000000..8f6c0e2bcbe --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/bigtableadmin.yaml @@ -0,0 +1,85 @@ +type: google.api.Service +config_version: 3 +name: bigtableadmin.googleapis.com +title: Cloud Bigtable Admin API + +apis: +- name: google.bigtable.admin.v2.BigtableInstanceAdmin +- name: google.bigtable.admin.v2.BigtableTableAdmin + +types: +- name: google.bigtable.admin.v2.CreateInstanceMetadata +- name: google.bigtable.admin.v2.CreateClusterMetadata +- name: google.bigtable.admin.v2.UpdateClusterMetadata + +http: + rules: + - selector: google.longrunning.Operations.ListOperations + get: '/v2/{name=operations}' + + - selector: google.longrunning.Operations.GetOperation + get: '/v2/{name=operations/**}' + + - selector: google.longrunning.Operations.DeleteOperation + delete: '/v2/{name=operations/**}' + + - selector: google.longrunning.Operations.CancelOperation + post: '/v2/{name=operations/**}:cancel' + + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/bigtable.admin, + https://www.googleapis.com/auth/bigtable.admin.cluster, + https://www.googleapis.com/auth/bigtable.admin.instance, + https://www.googleapis.com/auth/cloud-bigtable.admin, + https://www.googleapis.com/auth/cloud-bigtable.admin.cluster, + https://www.googleapis.com/auth/cloud-platform + - selector: 'google.bigtable.admin.v2.BigtableTableAdmin.*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/bigtable.admin, + https://www.googleapis.com/auth/bigtable.admin.table, + https://www.googleapis.com/auth/cloud-bigtable.admin, + https://www.googleapis.com/auth/cloud-bigtable.admin.table, + https://www.googleapis.com/auth/cloud-platform + - selector: |- + google.bigtable.admin.v2.BigtableInstanceAdmin.GetCluster, + google.bigtable.admin.v2.BigtableInstanceAdmin.GetInstance, + google.bigtable.admin.v2.BigtableInstanceAdmin.ListClusters, + google.bigtable.admin.v2.BigtableInstanceAdmin.ListInstances + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/bigtable.admin, + https://www.googleapis.com/auth/bigtable.admin.cluster, + https://www.googleapis.com/auth/bigtable.admin.instance, + https://www.googleapis.com/auth/cloud-bigtable.admin, + https://www.googleapis.com/auth/cloud-bigtable.admin.cluster, + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only + - selector: |- + google.bigtable.admin.v2.BigtableTableAdmin.GetTable, + google.bigtable.admin.v2.BigtableTableAdmin.ListTables + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/bigtable.admin, + https://www.googleapis.com/auth/bigtable.admin.table, + https://www.googleapis.com/auth/cloud-bigtable.admin, + https://www.googleapis.com/auth/cloud-bigtable.admin.table, + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only + - selector: |- + google.longrunning.Operations.GetOperation, + google.longrunning.Operations.ListOperations + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/bigtable.admin, + https://www.googleapis.com/auth/bigtable.admin.cluster, + https://www.googleapis.com/auth/bigtable.admin.instance, + https://www.googleapis.com/auth/cloud-bigtable.admin, + https://www.googleapis.com/auth/cloud-bigtable.admin.cluster, + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only diff --git a/handwritten/cloud-profiler/google/bigtable/admin/cluster/bigtableclusteradmin.yaml b/handwritten/cloud-profiler/google/bigtable/admin/cluster/bigtableclusteradmin.yaml new file mode 100644 index 00000000000..be789aa70eb --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/cluster/bigtableclusteradmin.yaml @@ -0,0 +1,39 @@ +type: google.api.Service +config_version: 0 +name: bigtableclusteradmin.googleapis.com +title: Google Cloud Bigtable Cluster Admin API + +apis: +- name: google.longrunning.Operations +- name: google.bigtable.admin.cluster.v1.BigtableClusterService +- name: google.bigtable.admin.v2.BigtableInstanceAdmin + +types: +- name: google.bigtable.admin.cluster.v1.CreateClusterMetadata +- name: google.bigtable.admin.cluster.v1.UpdateClusterMetadata +- name: google.bigtable.admin.cluster.v1.UndeleteClusterMetadata +- name: google.bigtable.admin.cluster.v1.V2OperationMetadata +- name: google.bigtable.admin.v2.CreateInstanceMetadata +- name: google.bigtable.admin.v2.UpdateClusterMetadata + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: >- + https://www.googleapis.com/auth/bigtable.admin, + https://www.googleapis.com/auth/bigtable.admin.cluster, + https://www.googleapis.com/auth/bigtable.admin.instance, + https://www.googleapis.com/auth/cloud-bigtable.admin, + https://www.googleapis.com/auth/cloud-bigtable.admin.cluster, + https://www.googleapis.com/auth/cloud-platform + - selector: google.bigtable.admin.cluster.v1.BigtableClusterService.GetCluster + oauth: + canonical_scopes: >- + https://www.googleapis.com/auth/bigtable.admin, + https://www.googleapis.com/auth/bigtable.admin.cluster, + https://www.googleapis.com/auth/bigtable.admin.instance, + https://www.googleapis.com/auth/cloud-bigtable.admin, + https://www.googleapis.com/auth/cloud-bigtable.admin.cluster, + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only diff --git a/handwritten/cloud-profiler/google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto b/handwritten/cloud-profiler/google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto new file mode 100644 index 00000000000..ca3b663d866 --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto @@ -0,0 +1,94 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.admin.cluster.v1; + +import "google/api/annotations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/cluster/v1;cluster"; +option java_multiple_files = true; +option java_outer_classname = "BigtableClusterDataProto"; +option java_package = "com.google.bigtable.admin.cluster.v1"; + + +// A physical location in which a particular project can allocate Cloud BigTable +// resources. +message Zone { + // Possible states of a zone. + enum Status { + // The state of the zone is unknown or unspecified. + UNKNOWN = 0; + + // The zone is in a good state. + OK = 1; + + // The zone is down for planned maintenance. + PLANNED_MAINTENANCE = 2; + + // The zone is down for emergency or unplanned maintenance. + EMERGENCY_MAINENANCE = 3; + } + + // A permanent unique identifier for the zone. + // Values are of the form projects//zones/[a-z][-a-z0-9]* + string name = 1; + + // The name of this zone as it appears in UIs. + string display_name = 2; + + // The current state of this zone. + Status status = 3; +} + +// An isolated set of Cloud BigTable resources on which tables can be hosted. +message Cluster { + // A permanent unique identifier for the cluster. For technical reasons, the + // zone in which the cluster resides is included here. + // Values are of the form + // projects//zones//clusters/[a-z][-a-z0-9]* + string name = 1; + + // The operation currently running on the cluster, if any. + // This cannot be set directly, only through CreateCluster, UpdateCluster, + // or UndeleteCluster. Calls to these methods will be rejected if + // "current_operation" is already set. + google.longrunning.Operation current_operation = 3; + + // The descriptive name for this cluster as it appears in UIs. + // Must be unique per zone. + string display_name = 4; + + // The number of serve nodes allocated to this cluster. + int32 serve_nodes = 5; + + // What storage type to use for tables in this cluster. Only configurable at + // cluster creation time. If unspecified, STORAGE_SSD will be used. + StorageType default_storage_type = 8; +} + +enum StorageType { + // The storage type used is unspecified. + STORAGE_UNSPECIFIED = 0; + + // Data will be stored in SSD, providing low and consistent latencies. + STORAGE_SSD = 1; + + // Data will be stored in HDD, providing high and less predictable + // latencies. + STORAGE_HDD = 2; +} diff --git a/handwritten/cloud-profiler/google/bigtable/admin/cluster/v1/bigtable_cluster_service.proto b/handwritten/cloud-profiler/google/bigtable/admin/cluster/v1/bigtable_cluster_service.proto new file mode 100644 index 00000000000..038fcc46397 --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/cluster/v1/bigtable_cluster_service.proto @@ -0,0 +1,130 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.admin.cluster.v1; + +import "google/api/annotations.proto"; +import "google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto"; +import "google/bigtable/admin/cluster/v1/bigtable_cluster_service_messages.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; + +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/cluster/v1;cluster"; +option java_multiple_files = true; +option java_outer_classname = "BigtableClusterServicesProto"; +option java_package = "com.google.bigtable.admin.cluster.v1"; + + +// Service for managing zonal Cloud Bigtable resources. +service BigtableClusterService { + // Lists the supported zones for the given project. + rpc ListZones(ListZonesRequest) returns (ListZonesResponse) { + option (google.api.http) = { get: "/v1/{name=projects/*}/zones" }; + } + + // Gets information about a particular cluster. + rpc GetCluster(GetClusterRequest) returns (Cluster) { + option (google.api.http) = { get: "/v1/{name=projects/*/zones/*/clusters/*}" }; + } + + // Lists all clusters in the given project, along with any zones for which + // cluster information could not be retrieved. + rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { + option (google.api.http) = { get: "/v1/{name=projects/*}/aggregated/clusters" }; + } + + // Creates a cluster and begins preparing it to begin serving. The returned + // cluster embeds as its "current_operation" a long-running operation which + // can be used to track the progress of turning up the new cluster. + // Immediately upon completion of this request: + // * The cluster will be readable via the API, with all requested attributes + // but no allocated resources. + // Until completion of the embedded operation: + // * Cancelling the operation will render the cluster immediately unreadable + // via the API. + // * All other attempts to modify or delete the cluster will be rejected. + // Upon completion of the embedded operation: + // * Billing for all successfully-allocated resources will begin (some types + // may have lower than the requested levels). + // * New tables can be created in the cluster. + // * The cluster's allocated resource levels will be readable via the API. + // The embedded operation's "metadata" field type is + // [CreateClusterMetadata][google.bigtable.admin.cluster.v1.CreateClusterMetadata] The embedded operation's "response" field type is + // [Cluster][google.bigtable.admin.cluster.v1.Cluster], if successful. + rpc CreateCluster(CreateClusterRequest) returns (Cluster) { + option (google.api.http) = { post: "/v1/{name=projects/*/zones/*}/clusters" body: "*" }; + } + + // Updates a cluster, and begins allocating or releasing resources as + // requested. The returned cluster embeds as its "current_operation" a + // long-running operation which can be used to track the progress of updating + // the cluster. + // Immediately upon completion of this request: + // * For resource types where a decrease in the cluster's allocation has been + // requested, billing will be based on the newly-requested level. + // Until completion of the embedded operation: + // * Cancelling the operation will set its metadata's "cancelled_at_time", + // and begin restoring resources to their pre-request values. The operation + // is guaranteed to succeed at undoing all resource changes, after which + // point it will terminate with a CANCELLED status. + // * All other attempts to modify or delete the cluster will be rejected. + // * Reading the cluster via the API will continue to give the pre-request + // resource levels. + // Upon completion of the embedded operation: + // * Billing will begin for all successfully-allocated resources (some types + // may have lower than the requested levels). + // * All newly-reserved resources will be available for serving the cluster's + // tables. + // * The cluster's new resource levels will be readable via the API. + // [UpdateClusterMetadata][google.bigtable.admin.cluster.v1.UpdateClusterMetadata] The embedded operation's "response" field type is + // [Cluster][google.bigtable.admin.cluster.v1.Cluster], if successful. + rpc UpdateCluster(Cluster) returns (Cluster) { + option (google.api.http) = { put: "/v1/{name=projects/*/zones/*/clusters/*}" body: "*" }; + } + + // Marks a cluster and all of its tables for permanent deletion in 7 days. + // Immediately upon completion of the request: + // * Billing will cease for all of the cluster's reserved resources. + // * The cluster's "delete_time" field will be set 7 days in the future. + // Soon afterward: + // * All tables within the cluster will become unavailable. + // Prior to the cluster's "delete_time": + // * The cluster can be recovered with a call to UndeleteCluster. + // * All other attempts to modify or delete the cluster will be rejected. + // At the cluster's "delete_time": + // * The cluster and *all of its tables* will immediately and irrevocably + // disappear from the API, and their data will be permanently deleted. + rpc DeleteCluster(DeleteClusterRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/{name=projects/*/zones/*/clusters/*}" }; + } + + // Cancels the scheduled deletion of an cluster and begins preparing it to + // resume serving. The returned operation will also be embedded as the + // cluster's "current_operation". + // Immediately upon completion of this request: + // * The cluster's "delete_time" field will be unset, protecting it from + // automatic deletion. + // Until completion of the returned operation: + // * The operation cannot be cancelled. + // Upon completion of the returned operation: + // * Billing for the cluster's resources will resume. + // * All tables within the cluster will be available. + // [UndeleteClusterMetadata][google.bigtable.admin.cluster.v1.UndeleteClusterMetadata] The embedded operation's "response" field type is + // [Cluster][google.bigtable.admin.cluster.v1.Cluster], if successful. + rpc UndeleteCluster(UndeleteClusterRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/{name=projects/*/zones/*/clusters/*}:undelete" body: "" }; + } +} diff --git a/handwritten/cloud-profiler/google/bigtable/admin/cluster/v1/bigtable_cluster_service_messages.proto b/handwritten/cloud-profiler/google/bigtable/admin/cluster/v1/bigtable_cluster_service_messages.proto new file mode 100644 index 00000000000..518d14dac8e --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/cluster/v1/bigtable_cluster_service_messages.proto @@ -0,0 +1,141 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.admin.cluster.v1; + +import "google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/cluster/v1;cluster"; +option java_multiple_files = true; +option java_outer_classname = "BigtableClusterServiceMessagesProto"; +option java_package = "com.google.bigtable.admin.cluster.v1"; + + +// Request message for BigtableClusterService.ListZones. +message ListZonesRequest { + // The unique name of the project for which a list of supported zones is + // requested. + // Values are of the form projects/ + string name = 1; +} + +// Response message for BigtableClusterService.ListZones. +message ListZonesResponse { + // The list of requested zones. + repeated Zone zones = 1; +} + +// Request message for BigtableClusterService.GetCluster. +message GetClusterRequest { + // The unique name of the requested cluster. + // Values are of the form projects//zones//clusters/ + string name = 1; +} + +// Request message for BigtableClusterService.ListClusters. +message ListClustersRequest { + // The unique name of the project for which a list of clusters is requested. + // Values are of the form projects/ + string name = 1; +} + +// Response message for BigtableClusterService.ListClusters. +message ListClustersResponse { + // The list of requested Clusters. + repeated Cluster clusters = 1; + + // The zones for which clusters could not be retrieved. + repeated Zone failed_zones = 2; +} + +// Request message for BigtableClusterService.CreateCluster. +message CreateClusterRequest { + // The unique name of the zone in which to create the cluster. + // Values are of the form projects//zones/ + string name = 1; + + // The id to be used when referring to the new cluster within its zone, + // e.g. just the "test-cluster" section of the full name + // "projects//zones//clusters/test-cluster". + string cluster_id = 2; + + // The cluster to create. + // The "name", "delete_time", and "current_operation" fields must be left + // blank. + Cluster cluster = 3; +} + +// Metadata type for the operation returned by +// BigtableClusterService.CreateCluster. +message CreateClusterMetadata { + // The request which prompted the creation of this operation. + CreateClusterRequest original_request = 1; + + // The time at which original_request was received. + google.protobuf.Timestamp request_time = 2; + + // The time at which this operation failed or was completed successfully. + google.protobuf.Timestamp finish_time = 3; +} + +// Metadata type for the operation returned by +// BigtableClusterService.UpdateCluster. +message UpdateClusterMetadata { + // The request which prompted the creation of this operation. + Cluster original_request = 1; + + // The time at which original_request was received. + google.protobuf.Timestamp request_time = 2; + + // The time at which this operation was cancelled. If set, this operation is + // in the process of undoing itself (which is guaranteed to succeed) and + // cannot be cancelled again. + google.protobuf.Timestamp cancel_time = 3; + + // The time at which this operation failed or was completed successfully. + google.protobuf.Timestamp finish_time = 4; +} + +// Request message for BigtableClusterService.DeleteCluster. +message DeleteClusterRequest { + // The unique name of the cluster to be deleted. + // Values are of the form projects//zones//clusters/ + string name = 1; +} + +// Request message for BigtableClusterService.UndeleteCluster. +message UndeleteClusterRequest { + // The unique name of the cluster to be un-deleted. + // Values are of the form projects//zones//clusters/ + string name = 1; +} + +// Metadata type for the operation returned by +// BigtableClusterService.UndeleteCluster. +message UndeleteClusterMetadata { + // The time at which the original request was received. + google.protobuf.Timestamp request_time = 1; + + // The time at which this operation failed or was completed successfully. + google.protobuf.Timestamp finish_time = 2; +} + +// Metadata type for operations initiated by the V2 BigtableAdmin service. +// More complete information for such operations is available via the V2 API. +message V2OperationMetadata { + +} diff --git a/handwritten/cloud-profiler/google/bigtable/admin/table/bigtabletableadmin.yaml b/handwritten/cloud-profiler/google/bigtable/admin/table/bigtabletableadmin.yaml new file mode 100644 index 00000000000..e1b7886b46f --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/table/bigtabletableadmin.yaml @@ -0,0 +1,27 @@ +type: google.api.Service +config_version: 0 +name: bigtabletableadmin.googleapis.com +title: Google Cloud Bigtable Table Admin API + +apis: +- name: google.bigtable.admin.table.v1.BigtableTableService + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: >- + https://www.googleapis.com/auth/bigtable.admin, + https://www.googleapis.com/auth/bigtable.admin.table, + https://www.googleapis.com/auth/cloud-bigtable.admin, + https://www.googleapis.com/auth/cloud-bigtable.admin.table, + https://www.googleapis.com/auth/cloud-platform + - selector: google.bigtable.admin.table.v1.BigtableTableService.GetTable + oauth: + canonical_scopes: >- + https://www.googleapis.com/auth/bigtable.admin, + https://www.googleapis.com/auth/bigtable.admin.table, + https://www.googleapis.com/auth/cloud-bigtable.admin, + https://www.googleapis.com/auth/cloud-bigtable.admin.table, + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only diff --git a/handwritten/cloud-profiler/google/bigtable/admin/table/v1/bigtable_table_data.proto b/handwritten/cloud-profiler/google/bigtable/admin/table/v1/bigtable_table_data.proto new file mode 100644 index 00000000000..e4efb74f560 --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/table/v1/bigtable_table_data.proto @@ -0,0 +1,126 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.admin.table.v1; + +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; + +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/table/v1;table"; +option java_multiple_files = true; +option java_outer_classname = "BigtableTableDataProto"; +option java_package = "com.google.bigtable.admin.table.v1"; + + +// A collection of user data indexed by row, column, and timestamp. +// Each table is served using the resources of its parent cluster. +message Table { + enum TimestampGranularity { + MILLIS = 0; + } + + // A unique identifier of the form + // /tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]* + string name = 1; + + // If this Table is in the process of being created, the Operation used to + // track its progress. As long as this operation is present, the Table will + // not accept any Table Admin or Read/Write requests. + google.longrunning.Operation current_operation = 2; + + // The column families configured for this table, mapped by column family id. + map column_families = 3; + + // The granularity (e.g. MILLIS, MICROS) at which timestamps are stored in + // this table. Timestamps not matching the granularity will be rejected. + // Cannot be changed once the table is created. + TimestampGranularity granularity = 4; +} + +// A set of columns within a table which share a common configuration. +message ColumnFamily { + // A unique identifier of the form /columnFamilies/[-_.a-zA-Z0-9]+ + // The last segment is the same as the "name" field in + // google.bigtable.v1.Family. + string name = 1; + + // Garbage collection expression specified by the following grammar: + // GC = EXPR + // | "" ; + // EXPR = EXPR, "||", EXPR (* lowest precedence *) + // | EXPR, "&&", EXPR + // | "(", EXPR, ")" (* highest precedence *) + // | PROP ; + // PROP = "version() >", NUM32 + // | "age() >", NUM64, [ UNIT ] ; + // NUM32 = non-zero-digit { digit } ; (* # NUM32 <= 2^32 - 1 *) + // NUM64 = non-zero-digit { digit } ; (* # NUM64 <= 2^63 - 1 *) + // UNIT = "d" | "h" | "m" (* d=days, h=hours, m=minutes, else micros *) + // GC expressions can be up to 500 characters in length + // + // The different types of PROP are defined as follows: + // version() - cell index, counting from most recent and starting at 1 + // age() - age of the cell (current time minus cell timestamp) + // + // Example: "version() > 3 || (age() > 3d && version() > 1)" + // drop cells beyond the most recent three, and drop cells older than three + // days unless they're the most recent cell in the row/column + // + // Garbage collection executes opportunistically in the background, and so + // it's possible for reads to return a cell even if it matches the active GC + // expression for its family. + string gc_expression = 2; + + // Garbage collection rule specified as a protobuf. + // Supersedes `gc_expression`. + // Must serialize to at most 500 bytes. + // + // NOTE: Garbage collection executes opportunistically in the background, and + // so it's possible for reads to return a cell even if it matches the active + // GC expression for its family. + GcRule gc_rule = 3; +} + +// Rule for determining which cells to delete during garbage collection. +message GcRule { + // A GcRule which deletes cells matching all of the given rules. + message Intersection { + // Only delete cells which would be deleted by every element of `rules`. + repeated GcRule rules = 1; + } + + // A GcRule which deletes cells matching any of the given rules. + message Union { + // Delete cells which would be deleted by any element of `rules`. + repeated GcRule rules = 1; + } + + oneof rule { + // Delete all cells in a column except the most recent N. + int32 max_num_versions = 1; + + // Delete cells in a column older than the given age. + // Values must be at least one millisecond, and will be truncated to + // microsecond granularity. + google.protobuf.Duration max_age = 2; + + // Delete cells that would be deleted by every nested rule. + Intersection intersection = 3; + + // Delete cells that would be deleted by any nested rule. + Union union = 4; + } +} diff --git a/handwritten/cloud-profiler/google/bigtable/admin/table/v1/bigtable_table_service.proto b/handwritten/cloud-profiler/google/bigtable/admin/table/v1/bigtable_table_service.proto new file mode 100644 index 00000000000..6e968fee17c --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/table/v1/bigtable_table_service.proto @@ -0,0 +1,80 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.admin.table.v1; + +import "google/api/annotations.proto"; +import "google/bigtable/admin/table/v1/bigtable_table_data.proto"; +import "google/bigtable/admin/table/v1/bigtable_table_service_messages.proto"; +import "google/protobuf/empty.proto"; + +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/table/v1;table"; +option java_multiple_files = true; +option java_outer_classname = "BigtableTableServicesProto"; +option java_package = "com.google.bigtable.admin.table.v1"; + + +// Service for creating, configuring, and deleting Cloud Bigtable tables. +// Provides access to the table schemas only, not the data stored within the tables. +service BigtableTableService { + // Creates a new table, to be served from a specified cluster. + // The table can be created with a full set of initial column families, + // specified in the request. + rpc CreateTable(CreateTableRequest) returns (Table) { + option (google.api.http) = { post: "/v1/{name=projects/*/zones/*/clusters/*}/tables" body: "*" }; + } + + // Lists the names of all tables served from a specified cluster. + rpc ListTables(ListTablesRequest) returns (ListTablesResponse) { + option (google.api.http) = { get: "/v1/{name=projects/*/zones/*/clusters/*}/tables" }; + } + + // Gets the schema of the specified table, including its column families. + rpc GetTable(GetTableRequest) returns (Table) { + option (google.api.http) = { get: "/v1/{name=projects/*/zones/*/clusters/*/tables/*}" }; + } + + // Permanently deletes a specified table and all of its data. + rpc DeleteTable(DeleteTableRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/{name=projects/*/zones/*/clusters/*/tables/*}" }; + } + + // Changes the name of a specified table. + // Cannot be used to move tables between clusters, zones, or projects. + rpc RenameTable(RenameTableRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1/{name=projects/*/zones/*/clusters/*/tables/*}:rename" body: "*" }; + } + + // Creates a new column family within a specified table. + rpc CreateColumnFamily(CreateColumnFamilyRequest) returns (ColumnFamily) { + option (google.api.http) = { post: "/v1/{name=projects/*/zones/*/clusters/*/tables/*}/columnFamilies" body: "*" }; + } + + // Changes the configuration of a specified column family. + rpc UpdateColumnFamily(ColumnFamily) returns (ColumnFamily) { + option (google.api.http) = { put: "/v1/{name=projects/*/zones/*/clusters/*/tables/*/columnFamilies/*}" body: "*" }; + } + + // Permanently deletes a specified column family and all of its data. + rpc DeleteColumnFamily(DeleteColumnFamilyRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/{name=projects/*/zones/*/clusters/*/tables/*/columnFamilies/*}" }; + } + + // Delete all rows in a table corresponding to a particular prefix + rpc BulkDeleteRows(BulkDeleteRowsRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1/{table_name=projects/*/zones/*/clusters/*/tables/*}:bulkDeleteRows" body: "*" }; + } +} diff --git a/handwritten/cloud-profiler/google/bigtable/admin/table/v1/bigtable_table_service_messages.proto b/handwritten/cloud-profiler/google/bigtable/admin/table/v1/bigtable_table_service_messages.proto new file mode 100644 index 00000000000..617ede65592 --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/table/v1/bigtable_table_service_messages.proto @@ -0,0 +1,116 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.admin.table.v1; + +import "google/bigtable/admin/table/v1/bigtable_table_data.proto"; + +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/table/v1;table"; +option java_multiple_files = true; +option java_outer_classname = "BigtableTableServiceMessagesProto"; +option java_package = "com.google.bigtable.admin.table.v1"; + + +message CreateTableRequest { + // The unique name of the cluster in which to create the new table. + string name = 1; + + // The name by which the new table should be referred to within the cluster, + // e.g. "foobar" rather than "/tables/foobar". + string table_id = 2; + + // The Table to create. The `name` field of the Table and all of its + // ColumnFamilies must be left blank, and will be populated in the response. + Table table = 3; + + // The optional list of row keys that will be used to initially split the + // table into several tablets (Tablets are similar to HBase regions). + // Given two split keys, "s1" and "s2", three tablets will be created, + // spanning the key ranges: [, s1), [s1, s2), [s2, ). + // + // Example: + // * Row keys := ["a", "apple", "custom", "customer_1", "customer_2", + // "other", "zz"] + // * initial_split_keys := ["apple", "customer_1", "customer_2", "other"] + // * Key assignment: + // - Tablet 1 [, apple) => {"a"}. + // - Tablet 2 [apple, customer_1) => {"apple", "custom"}. + // - Tablet 3 [customer_1, customer_2) => {"customer_1"}. + // - Tablet 4 [customer_2, other) => {"customer_2"}. + // - Tablet 5 [other, ) => {"other", "zz"}. + repeated string initial_split_keys = 4; +} + +message ListTablesRequest { + // The unique name of the cluster for which tables should be listed. + string name = 1; +} + +message ListTablesResponse { + // The tables present in the requested cluster. + // At present, only the names of the tables are populated. + repeated Table tables = 1; +} + +message GetTableRequest { + // The unique name of the requested table. + string name = 1; +} + +message DeleteTableRequest { + // The unique name of the table to be deleted. + string name = 1; +} + +message RenameTableRequest { + // The current unique name of the table. + string name = 1; + + // The new name by which the table should be referred to within its containing + // cluster, e.g. "foobar" rather than "/tables/foobar". + string new_id = 2; +} + +message CreateColumnFamilyRequest { + // The unique name of the table in which to create the new column family. + string name = 1; + + // The name by which the new column family should be referred to within the + // table, e.g. "foobar" rather than "/columnFamilies/foobar". + string column_family_id = 2; + + // The column family to create. The `name` field must be left blank. + ColumnFamily column_family = 3; +} + +message DeleteColumnFamilyRequest { + // The unique name of the column family to be deleted. + string name = 1; +} + +message BulkDeleteRowsRequest { + // The unique name of the table on which to perform the bulk delete + string table_name = 1; + + oneof target { + // Delete all rows that start with this row key prefix. Prefix cannot be + // zero length. + bytes row_key_prefix = 2; + + // Delete all rows in the table. Setting this to false is a no-op. + bool delete_all_data_from_table = 3; + } +} diff --git a/handwritten/cloud-profiler/google/bigtable/admin/v2/bigtable_admin_gapic.yaml b/handwritten/cloud-profiler/google/bigtable/admin/v2/bigtable_admin_gapic.yaml new file mode 100644 index 00000000000..138cec90eb8 --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/v2/bigtable_admin_gapic.yaml @@ -0,0 +1,411 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.bigtable.admin.v2 + python: + package_name: google.cloud.gapic.bigtable.admin.v2 + go: + package_name: cloud.google.com/go/bigtable/admin/apiv2 + csharp: + package_name: Google.Cloud.Bigtable.Admin.V2 + ruby: + package_name: Google::Cloud::Bigtable::Admin::V2 + php: + package_name: Google\Cloud\Bigtable\Admin\V2 + nodejs: + package_name: admin.v2 +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.bigtable.admin.v2.BigtableInstanceAdmin + collections: + - name_pattern: projects/{project} + entity_name: project + - name_pattern: projects/{project}/instances/{instance} + entity_name: instance + - name_pattern: projects/{project}/instances/{instance}/clusters/{cluster} + entity_name: cluster + - name_pattern: projects/{project}/locations/{location} + entity_name: location + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: + - UNAVAILABLE + retry_params_def: + - name: default + initial_retry_delay_millis: 5 + retry_delay_multiplier: 2 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 60000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 60000 + total_timeout_millis: 600000 + methods: + - name: CreateInstance + flattening: + groups: + - parameters: + - parent + - instance_id + - instance + - clusters + required_fields: + - parent + - instance_id + - instance + - clusters + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + parent: project + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + long_running: + return_type: google.bigtable.admin.v2.Instance + metadata_type: google.bigtable.admin.v2.CreateInstanceMetadata + initial_poll_delay_millis: 500 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 5000 + total_poll_timeout_millis: 300000 + - name: GetInstance + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: instance + timeout_millis: 60000 + - name: ListInstances + flattening: + groups: + - parameters: + - parent + required_fields: + - parent + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + parent: project + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: UpdateInstance + flattening: + groups: + - parameters: + - name + - display_name + - type + required_fields: + - name + - display_name + - type + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: instance + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: DeleteInstance + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: instance + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: CreateCluster + flattening: + groups: + - parameters: + - parent + - cluster_id + - cluster + required_fields: + - parent + - cluster_id + - cluster + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + parent: instance + resource_name_treatment: STATIC_TYPES + long_running: + return_type: google.bigtable.admin.v2.Cluster + metadata_type: google.bigtable.admin.v2.CreateClusterMetadata + initial_poll_delay_millis: 500 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 5000 + total_poll_timeout_millis: 300000 + timeout_millis: 60000 + - name: GetCluster + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: cluster + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: ListClusters + flattening: + groups: + - parameters: + - parent + required_fields: + - parent + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + parent: instance + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: UpdateCluster + flattening: + groups: + - parameters: + - name + - location + - serve_nodes + - default_storage_type + required_fields: + - name + - location + - serve_nodes + - default_storage_type + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: cluster + resource_name_treatment: STATIC_TYPES + long_running: + return_type: google.bigtable.admin.v2.Cluster + metadata_type: google.bigtable.admin.v2.UpdateClusterMetadata + initial_poll_delay_millis: 500 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 5000 + total_poll_timeout_millis: 300000 + timeout_millis: 60000 + - name: DeleteCluster + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: cluster + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 +- name: google.bigtable.admin.v2.BigtableTableAdmin + collections: + - name_pattern: projects/{project}/instances/{instance} + entity_name: instance + - name_pattern: projects/{project}/instances/{instance}/tables/{table} + entity_name: table + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + methods: + - name: CreateTable + flattening: + groups: + - parameters: + - parent + - table_id + - table + required_fields: + - parent + - table_id + - table + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + parent: instance + resource_name_treatment: STATIC_TYPES + timeout_millis: 130000 + - name: ListTables + flattening: + groups: + - parameters: + - parent + required_fields: + - parent + request_object_method: false + page_streaming: + request: + token_field: page_token + response: + token_field: next_page_token + resources_field: tables + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + parent: instance + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: GetTable + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: table + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: DeleteTable + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: table + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: ModifyColumnFamilies + flattening: + groups: + - parameters: + - name + - modifications + required_fields: + - name + - modifications + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + name: table + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: DropRowRange + flattening: + groups: + - parameters: + - name + - row_key_prefix + required_fields: + - name + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + name: table + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + +resource_name_generation: +- message_name: CreateInstanceRequest + field_entity_map: + parent: project +- message_name: GetInstanceRequest + field_entity_map: + name: instance +- message_name: ListInstancesRequest + field_entity_map: + parent: project +- message_name: UpdateInstanceRequest + field_entity_map: + name: instance +- message_name: DeleteInstanceRequest + field_entity_map: + name: instance +- message_name: CreateClusterRequest + field_entity_map: + parent: instance +- message_name: GetClusterRequest + field_entity_map: + name: cluster +- message_name: ListClustersRequest + field_entity_map: + parent: instance +- message_name: UpdateClusterRequest + field_entity_map: + name: cluster +- message_name: DeleteClusterRequest + field_entity_map: + name: cluster +- message_name: CreateTableRequest + field_entity_map: + parent: instance +- message_name: ListTablesRequest + field_entity_map: + parent: instance +- message_name: GetTableRequest + field_entity_map: + name: table +- message_name: DeleteTableRequest + field_entity_map: + name: table +- message_name: ModifyColumnFamiliesRequest + field_entity_map: + name: table +- message_name: DropRowRangeRequest + field_entity_map: + name: table +- message_name: Instance + field_entity_map: + name: instance +- message_name: Cluster + field_entity_map: + name: cluster + location: location +- message_name: Table + field_entity_map: + name: table + diff --git a/handwritten/cloud-profiler/google/bigtable/admin/v2/bigtable_instance_admin.proto b/handwritten/cloud-profiler/google/bigtable/admin/v2/bigtable_instance_admin.proto new file mode 100644 index 00000000000..bd63124407d --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/v2/bigtable_instance_admin.proto @@ -0,0 +1,246 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.admin.v2; + +import "google/api/annotations.proto"; +import "google/bigtable/admin/v2/instance.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2"; +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin"; +option java_multiple_files = true; +option java_outer_classname = "BigtableInstanceAdminProto"; +option java_package = "com.google.bigtable.admin.v2"; + + +// Service for creating, configuring, and deleting Cloud Bigtable Instances and +// Clusters. Provides access to the Instance and Cluster schemas only, not the +// tables' metadata or data stored in those tables. +service BigtableInstanceAdmin { + // Create an instance within a project. + rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v2/{parent=projects/*}/instances" body: "*" }; + } + + // Gets information about an instance. + rpc GetInstance(GetInstanceRequest) returns (Instance) { + option (google.api.http) = { get: "/v2/{name=projects/*/instances/*}" }; + } + + // Lists information about instances in a project. + rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { + option (google.api.http) = { get: "/v2/{parent=projects/*}/instances" }; + } + + // Updates an instance within a project. + rpc UpdateInstance(Instance) returns (Instance) { + option (google.api.http) = { put: "/v2/{name=projects/*/instances/*}" body: "*" }; + } + + // Delete an instance from a project. + rpc DeleteInstance(DeleteInstanceRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v2/{name=projects/*/instances/*}" }; + } + + // Creates a cluster within an instance. + rpc CreateCluster(CreateClusterRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v2/{parent=projects/*/instances/*}/clusters" body: "cluster" }; + } + + // Gets information about a cluster. + rpc GetCluster(GetClusterRequest) returns (Cluster) { + option (google.api.http) = { get: "/v2/{name=projects/*/instances/*/clusters/*}" }; + } + + // Lists information about clusters in an instance. + rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { + option (google.api.http) = { get: "/v2/{parent=projects/*/instances/*}/clusters" }; + } + + // Updates a cluster within an instance. + rpc UpdateCluster(Cluster) returns (google.longrunning.Operation) { + option (google.api.http) = { put: "/v2/{name=projects/*/instances/*/clusters/*}" body: "*" }; + } + + // Deletes a cluster from an instance. + rpc DeleteCluster(DeleteClusterRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v2/{name=projects/*/instances/*/clusters/*}" }; + } +} + +// Request message for BigtableInstanceAdmin.CreateInstance. +message CreateInstanceRequest { + // The unique name of the project in which to create the new instance. + // Values are of the form `projects/`. + string parent = 1; + + // The ID to be used when referring to the new instance within its project, + // e.g., just `myinstance` rather than + // `projects/myproject/instances/myinstance`. + string instance_id = 2; + + // The instance to create. + // Fields marked `OutputOnly` must be left blank. + Instance instance = 3; + + // The clusters to be created within the instance, mapped by desired + // cluster ID, e.g., just `mycluster` rather than + // `projects/myproject/instances/myinstance/clusters/mycluster`. + // Fields marked `OutputOnly` must be left blank. + // Currently exactly one cluster must be specified. + map clusters = 4; +} + +// Request message for BigtableInstanceAdmin.GetInstance. +message GetInstanceRequest { + // The unique name of the requested instance. Values are of the form + // `projects//instances/`. + string name = 1; +} + +// Request message for BigtableInstanceAdmin.ListInstances. +message ListInstancesRequest { + // The unique name of the project for which a list of instances is requested. + // Values are of the form `projects/`. + string parent = 1; + + // The value of `next_page_token` returned by a previous call. + string page_token = 2; +} + +// Response message for BigtableInstanceAdmin.ListInstances. +message ListInstancesResponse { + // The list of requested instances. + repeated Instance instances = 1; + + // Locations from which Instance information could not be retrieved, + // due to an outage or some other transient condition. + // Instances whose Clusters are all in one of the failed locations + // may be missing from `instances`, and Instances with at least one + // Cluster in a failed location may only have partial information returned. + repeated string failed_locations = 2; + + // Set if not all instances could be returned in a single response. + // Pass this value to `page_token` in another request to get the next + // page of results. + string next_page_token = 3; +} + +// Request message for BigtableInstanceAdmin.DeleteInstance. +message DeleteInstanceRequest { + // The unique name of the instance to be deleted. + // Values are of the form `projects//instances/`. + string name = 1; +} + +// Request message for BigtableInstanceAdmin.CreateCluster. +message CreateClusterRequest { + // The unique name of the instance in which to create the new cluster. + // Values are of the form + // `projects//instances/`. + string parent = 1; + + // The ID to be used when referring to the new cluster within its instance, + // e.g., just `mycluster` rather than + // `projects/myproject/instances/myinstance/clusters/mycluster`. + string cluster_id = 2; + + // The cluster to be created. + // Fields marked `OutputOnly` must be left blank. + Cluster cluster = 3; +} + +// Request message for BigtableInstanceAdmin.GetCluster. +message GetClusterRequest { + // The unique name of the requested cluster. Values are of the form + // `projects//instances//clusters/`. + string name = 1; +} + +// Request message for BigtableInstanceAdmin.ListClusters. +message ListClustersRequest { + // The unique name of the instance for which a list of clusters is requested. + // Values are of the form `projects//instances/`. + // Use ` = '-'` to list Clusters for all Instances in a project, + // e.g., `projects/myproject/instances/-`. + string parent = 1; + + // The value of `next_page_token` returned by a previous call. + string page_token = 2; +} + +// Response message for BigtableInstanceAdmin.ListClusters. +message ListClustersResponse { + // The list of requested clusters. + repeated Cluster clusters = 1; + + // Locations from which Cluster information could not be retrieved, + // due to an outage or some other transient condition. + // Clusters from these locations may be missing from `clusters`, + // or may only have partial information returned. + repeated string failed_locations = 2; + + // Set if not all clusters could be returned in a single response. + // Pass this value to `page_token` in another request to get the next + // page of results. + string next_page_token = 3; +} + +// Request message for BigtableInstanceAdmin.DeleteCluster. +message DeleteClusterRequest { + // The unique name of the cluster to be deleted. Values are of the form + // `projects//instances//clusters/`. + string name = 1; +} + +// The metadata for the Operation returned by CreateInstance. +message CreateInstanceMetadata { + // The request that prompted the initiation of this CreateInstance operation. + CreateInstanceRequest original_request = 1; + + // The time at which the original request was received. + google.protobuf.Timestamp request_time = 2; + + // The time at which the operation failed or was completed successfully. + google.protobuf.Timestamp finish_time = 3; +} + +// The metadata for the Operation returned by CreateCluster. +message CreateClusterMetadata { + // The request that prompted the initiation of this CreateCluster operation. + CreateClusterRequest original_request = 1; + + // The time at which the original request was received. + google.protobuf.Timestamp request_time = 2; + + // The time at which the operation failed or was completed successfully. + google.protobuf.Timestamp finish_time = 3; +} + +// The metadata for the Operation returned by UpdateCluster. +message UpdateClusterMetadata { + // The request that prompted the initiation of this UpdateCluster operation. + Cluster original_request = 1; + + // The time at which the original request was received. + google.protobuf.Timestamp request_time = 2; + + // The time at which the operation failed or was completed successfully. + google.protobuf.Timestamp finish_time = 3; +} diff --git a/handwritten/cloud-profiler/google/bigtable/admin/v2/bigtable_table_admin.proto b/handwritten/cloud-profiler/google/bigtable/admin/v2/bigtable_table_admin.proto new file mode 100644 index 00000000000..2abe3ff7f0d --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/v2/bigtable_table_admin.proto @@ -0,0 +1,218 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.admin.v2; + +import "google/api/annotations.proto"; +import "google/bigtable/admin/v2/table.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2"; +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin"; +option java_multiple_files = true; +option java_outer_classname = "BigtableTableAdminProto"; +option java_package = "com.google.bigtable.admin.v2"; + + +// Service for creating, configuring, and deleting Cloud Bigtable tables. +// +// +// Provides access to the table schemas only, not the data stored within +// the tables. +service BigtableTableAdmin { + // Creates a new table in the specified instance. + // The table can be created with a full set of initial column families, + // specified in the request. + rpc CreateTable(CreateTableRequest) returns (Table) { + option (google.api.http) = { post: "/v2/{parent=projects/*/instances/*}/tables" body: "*" }; + } + + // Lists all tables served from a specified instance. + rpc ListTables(ListTablesRequest) returns (ListTablesResponse) { + option (google.api.http) = { get: "/v2/{parent=projects/*/instances/*}/tables" }; + } + + // Gets metadata information about the specified table. + rpc GetTable(GetTableRequest) returns (Table) { + option (google.api.http) = { get: "/v2/{name=projects/*/instances/*/tables/*}" }; + } + + // Permanently deletes a specified table and all of its data. + rpc DeleteTable(DeleteTableRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v2/{name=projects/*/instances/*/tables/*}" }; + } + + // Performs a series of column family modifications on the specified table. + // Either all or none of the modifications will occur before this method + // returns, but data requests received prior to that point may see a table + // where only some modifications have taken effect. + rpc ModifyColumnFamilies(ModifyColumnFamiliesRequest) returns (Table) { + option (google.api.http) = { post: "/v2/{name=projects/*/instances/*/tables/*}:modifyColumnFamilies" body: "*" }; + } + + // Permanently drop/delete a row range from a specified table. The request can + // specify whether to delete all rows in a table, or only those that match a + // particular prefix. + rpc DropRowRange(DropRowRangeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v2/{name=projects/*/instances/*/tables/*}:dropRowRange" body: "*" }; + } +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.CreateTable][google.bigtable.admin.v2.BigtableTableAdmin.CreateTable] +message CreateTableRequest { + // An initial split point for a newly created table. + message Split { + // Row key to use as an initial tablet boundary. + bytes key = 1; + } + + // The unique name of the instance in which to create the table. + // Values are of the form `projects//instances/`. + string parent = 1; + + // The name by which the new table should be referred to within the parent + // instance, e.g., `foobar` rather than `/tables/foobar`. + string table_id = 2; + + // The Table to create. + Table table = 3; + + // The optional list of row keys that will be used to initially split the + // table into several tablets (tablets are similar to HBase regions). + // Given two split keys, `s1` and `s2`, three tablets will be created, + // spanning the key ranges: `[, s1), [s1, s2), [s2, )`. + // + // Example: + // + // * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",` + // `"other", "zz"]` + // * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]` + // * Key assignment: + // - Tablet 1 `[, apple) => {"a"}.` + // - Tablet 2 `[apple, customer_1) => {"apple", "custom"}.` + // - Tablet 3 `[customer_1, customer_2) => {"customer_1"}.` + // - Tablet 4 `[customer_2, other) => {"customer_2"}.` + // - Tablet 5 `[other, ) => {"other", "zz"}.` + repeated Split initial_splits = 4; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange][google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange] +message DropRowRangeRequest { + // The unique name of the table on which to drop a range of rows. + // Values are of the form + // `projects//instances//tables/`. + string name = 1; + + // Delete all rows or by prefix. + oneof target { + // Delete all rows that start with this row key prefix. Prefix cannot be + // zero length. + bytes row_key_prefix = 2; + + // Delete all rows in the table. Setting this to false is a no-op. + bool delete_all_data_from_table = 3; + } +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.ListTables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables] +message ListTablesRequest { + // The unique name of the instance for which tables should be listed. + // Values are of the form `projects//instances/`. + string parent = 1; + + // The view to be applied to the returned tables' fields. + // Defaults to `NAME_ONLY` if unspecified; no others are currently supported. + Table.View view = 2; + + // The value of `next_page_token` returned by a previous call. + string page_token = 3; +} + +// Response message for +// [google.bigtable.admin.v2.BigtableTableAdmin.ListTables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables] +message ListTablesResponse { + // The tables present in the requested instance. + repeated Table tables = 1; + + // Set if not all tables could be returned in a single response. + // Pass this value to `page_token` in another request to get the next + // page of results. + string next_page_token = 2; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.GetTable][google.bigtable.admin.v2.BigtableTableAdmin.GetTable] +message GetTableRequest { + // The unique name of the requested table. + // Values are of the form + // `projects//instances//tables/
`. + string name = 1; + + // The view to be applied to the returned table's fields. + // Defaults to `SCHEMA_VIEW` if unspecified. + Table.View view = 2; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable][google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable] +message DeleteTableRequest { + // The unique name of the table to be deleted. + // Values are of the form + // `projects//instances//tables/
`. + string name = 1; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies][google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies] +message ModifyColumnFamiliesRequest { + // A create, update, or delete of a particular column family. + message Modification { + // The ID of the column family to be modified. + string id = 1; + + // Column familiy modifications. + oneof mod { + // Create a new column family with the specified schema, or fail if + // one already exists with the given ID. + ColumnFamily create = 2; + + // Update an existing column family to the specified schema, or fail + // if no column family exists with the given ID. + ColumnFamily update = 3; + + // Drop (delete) the column family with the given ID, or fail if no such + // family exists. + bool drop = 4; + } + } + + // The unique name of the table whose families should be modified. + // Values are of the form + // `projects//instances//tables/
`. + string name = 1; + + // Modifications to be atomically applied to the specified table's families. + // Entries are applied in order, meaning that earlier modifications can be + // masked by later ones (in the case of repeated updates to the same family, + // for example). + repeated Modification modifications = 2; +} diff --git a/handwritten/cloud-profiler/google/bigtable/admin/v2/common.proto b/handwritten/cloud-profiler/google/bigtable/admin/v2/common.proto new file mode 100644 index 00000000000..6f3eee83a84 --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/v2/common.proto @@ -0,0 +1,39 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.admin.v2; + +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2"; +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.bigtable.admin.v2"; + + +// Storage media types for persisting Bigtable data. +enum StorageType { + // The user did not specify a storage type. + STORAGE_TYPE_UNSPECIFIED = 0; + + // Flash (SSD) storage should be used. + SSD = 1; + + // Magnetic drive (HDD) storage should be used. + HDD = 2; +} diff --git a/handwritten/cloud-profiler/google/bigtable/admin/v2/instance.proto b/handwritten/cloud-profiler/google/bigtable/admin/v2/instance.proto new file mode 100644 index 00000000000..fba9caa8487 --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/v2/instance.proto @@ -0,0 +1,140 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.admin.v2; + +import "google/api/annotations.proto"; +import "google/bigtable/admin/v2/common.proto"; + +option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2"; +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin"; +option java_multiple_files = true; +option java_outer_classname = "InstanceProto"; +option java_package = "com.google.bigtable.admin.v2"; + + +// A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and +// the resources that serve them. +// All tables in an instance are served from a single +// [Cluster][google.bigtable.admin.v2.Cluster]. +message Instance { + // Possible states of an instance. + enum State { + // The state of the instance could not be determined. + STATE_NOT_KNOWN = 0; + + // The instance has been successfully created and can serve requests + // to its tables. + READY = 1; + + // The instance is currently being created, and may be destroyed + // if the creation process encounters an error. + CREATING = 2; + } + + // The type of the instance. + enum Type { + // The type of the instance is unspecified. If set when creating an + // instance, a `PRODUCTION` instance will be created. If set when updating + // an instance, the type will be left unchanged. + TYPE_UNSPECIFIED = 0; + + // An instance meant for production use. `serve_nodes` must be set + // on the cluster. + PRODUCTION = 1; + + // The instance is meant for development and testing purposes only; it has + // no performance or uptime guarantees and is not covered by SLA. + // After a development instance is created, it can be upgraded by + // updating the instance to type `PRODUCTION`. An instance created + // as a production instance cannot be changed to a development instance. + // When creating a development instance, `serve_nodes` on the cluster must + // not be set. + DEVELOPMENT = 2; + } + + // (`OutputOnly`) + // The unique name of the instance. Values are of the form + // `projects//instances/[a-z][a-z0-9\\-]+[a-z0-9]`. + string name = 1; + + // The descriptive name for this instance as it appears in UIs. + // Can be changed at any time, but should be kept globally unique + // to avoid confusion. + string display_name = 2; + + // (`OutputOnly`) + // The current state of the instance. + State state = 3; + + // The type of the instance. Defaults to `PRODUCTION`. + Type type = 4; +} + +// A resizable group of nodes in a particular cloud location, capable +// of serving all [Tables][google.bigtable.admin.v2.Table] in the parent +// [Instance][google.bigtable.admin.v2.Instance]. +message Cluster { + // Possible states of a cluster. + enum State { + // The state of the cluster could not be determined. + STATE_NOT_KNOWN = 0; + + // The cluster has been successfully created and is ready to serve requests. + READY = 1; + + // The cluster is currently being created, and may be destroyed + // if the creation process encounters an error. + // A cluster may not be able to serve requests while being created. + CREATING = 2; + + // The cluster is currently being resized, and may revert to its previous + // node count if the process encounters an error. + // A cluster is still capable of serving requests while being resized, + // but may exhibit performance as if its number of allocated nodes is + // between the starting and requested states. + RESIZING = 3; + + // The cluster has no backing nodes. The data (tables) still + // exist, but no operations can be performed on the cluster. + DISABLED = 4; + } + + // (`OutputOnly`) + // The unique name of the cluster. Values are of the form + // `projects//instances//clusters/[a-z][-a-z0-9]*`. + string name = 1; + + // (`CreationOnly`) + // The location where this cluster's nodes and storage reside. For best + // performance, clients should be located as close as possible to this cluster. + // Currently only zones are supported, so values should be of the form + // `projects//locations/`. + string location = 2; + + // (`OutputOnly`) + // The current state of the cluster. + State state = 3; + + // The number of nodes allocated to this cluster. More nodes enable higher + // throughput and more consistent performance. + int32 serve_nodes = 4; + + // (`CreationOnly`) + // The type of storage used by this cluster to serve its + // parent instance's tables, unless explicitly overridden. + StorageType default_storage_type = 5; +} diff --git a/handwritten/cloud-profiler/google/bigtable/admin/v2/table.proto b/handwritten/cloud-profiler/google/bigtable/admin/v2/table.proto new file mode 100644 index 00000000000..cdb0b1312d6 --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/admin/v2/table.proto @@ -0,0 +1,119 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.admin.v2; + +import "google/api/annotations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2"; +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin"; +option java_multiple_files = true; +option java_outer_classname = "TableProto"; +option java_package = "com.google.bigtable.admin.v2"; + + +// A collection of user data indexed by row, column, and timestamp. +// Each table is served using the resources of its parent cluster. +message Table { + // Possible timestamp granularities to use when keeping multiple versions + // of data in a table. + enum TimestampGranularity { + // The user did not specify a granularity. Should not be returned. + // When specified during table creation, MILLIS will be used. + TIMESTAMP_GRANULARITY_UNSPECIFIED = 0; + + // The table keeps data versioned at a granularity of 1ms. + MILLIS = 1; + } + + // Defines a view over a table's fields. + enum View { + // Uses the default view for each method as documented in its request. + VIEW_UNSPECIFIED = 0; + + // Only populates `name`. + NAME_ONLY = 1; + + // Only populates `name` and fields related to the table's schema. + SCHEMA_VIEW = 2; + + // Populates all fields. + FULL = 4; + } + + // (`OutputOnly`) + // The unique name of the table. Values are of the form + // `projects//instances//tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. + // Views: `NAME_ONLY`, `SCHEMA_VIEW`, `FULL` + string name = 1; + + // (`CreationOnly`) + // The column families configured for this table, mapped by column family ID. + // Views: `SCHEMA_VIEW`, `FULL` + map column_families = 3; + + // (`CreationOnly`) + // The granularity (e.g. `MILLIS`, `MICROS`) at which timestamps are stored in + // this table. Timestamps not matching the granularity will be rejected. + // If unspecified at creation time, the value will be set to `MILLIS`. + // Views: `SCHEMA_VIEW`, `FULL` + TimestampGranularity granularity = 4; +} + +// A set of columns within a table which share a common configuration. +message ColumnFamily { + // Garbage collection rule specified as a protobuf. + // Must serialize to at most 500 bytes. + // + // NOTE: Garbage collection executes opportunistically in the background, and + // so it's possible for reads to return a cell even if it matches the active + // GC expression for its family. + GcRule gc_rule = 1; +} + +// Rule for determining which cells to delete during garbage collection. +message GcRule { + // A GcRule which deletes cells matching all of the given rules. + message Intersection { + // Only delete cells which would be deleted by every element of `rules`. + repeated GcRule rules = 1; + } + + // A GcRule which deletes cells matching any of the given rules. + message Union { + // Delete cells which would be deleted by any element of `rules`. + repeated GcRule rules = 1; + } + + // Garbage collection rules. + oneof rule { + // Delete all cells in a column except the most recent N. + int32 max_num_versions = 1; + + // Delete cells in a column older than the given age. + // Values must be at least one millisecond, and will be truncated to + // microsecond granularity. + google.protobuf.Duration max_age = 2; + + // Delete cells that would be deleted by every nested rule. + Intersection intersection = 3; + + // Delete cells that would be deleted by any nested rule. + Union union = 4; + } +} diff --git a/handwritten/cloud-profiler/google/bigtable/artman_bigtable.yaml b/handwritten/cloud-profiler/google/bigtable/artman_bigtable.yaml new file mode 100644 index 00000000000..148cdd0c533 --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/artman_bigtable.yaml @@ -0,0 +1,105 @@ +common: + api_name: bigtable + api_version: v2 + organization_name: google-cloud + service_yaml: bigtable.yaml + gapic_yaml: v2/bigtable_gapic.yaml + src_proto_paths: + - v2 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-bigtable + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/google-cloud-bigtable-v2 +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: google/cloud/bigtable_v2 + dest: bigtable/google/cloud/bigtable_v2 + - src: tests/unit/gapic/v1 + dest: bigtable/tests/gapic + - name: grpc + src: google/cloud/proto + dest: bigtable/google/cloud/proto + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-bigtable-v2 + - name: grpc + dest: generated/python/proto-google-cloud-bigtable-v2 +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-bigtable-v2 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-bigtable + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/bigtable/v2 + dest: google-cloud-bigtable/lib/google/cloud/bigtable/v2 +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-cloud-bigtable-v2/vendor + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: bigtable/apiv2 +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + publish_targets: + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v2 + dest: packages/bigtable/src/v2 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/bigtable +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/bigtable/bigtable.yaml b/handwritten/cloud-profiler/google/bigtable/bigtable.yaml new file mode 100644 index 00000000000..f0ce19f90d6 --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/bigtable.yaml @@ -0,0 +1,33 @@ +# Google Bigtable API service configuration + +type: google.api.Service +config_version: 0 +name: bigtable.googleapis.com +title: Google Cloud Bigtable API + +documentation: + summary: + Google Cloud Bigtable - http://cloud.google.com/bigtable/ + +apis: +- name: google.bigtable.v2.Bigtable + +authentication: + rules: + # Unless explicitly weakened, all ops require write access + - selector: '*' + oauth: + canonical_scopes: https://www.googleapis.com/auth/bigtable.data, + https://www.googleapis.com/auth/cloud-bigtable.data, + https://www.googleapis.com/auth/cloud-platform + + # Ops which only require read access + - selector: google.bigtable.v2.Bigtable.ReadRows, + google.bigtable.v2.Bigtable.SampleRowKeys + oauth: + canonical_scopes: https://www.googleapis.com/auth/bigtable.data, + https://www.googleapis.com/auth/bigtable.data.readonly, + https://www.googleapis.com/auth/cloud-bigtable.data, + https://www.googleapis.com/auth/cloud-bigtable.data.readonly, + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only diff --git a/handwritten/cloud-profiler/google/bigtable/v1/bigtable_data.proto b/handwritten/cloud-profiler/google/bigtable/v1/bigtable_data.proto new file mode 100644 index 00000000000..57fdfe14721 --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/v1/bigtable_data.proto @@ -0,0 +1,516 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.v1; + +option go_package = "google.golang.org/genproto/googleapis/bigtable/v1;bigtable"; +option java_multiple_files = true; +option java_outer_classname = "BigtableDataProto"; +option java_package = "com.google.bigtable.v1"; + + +// Specifies the complete (requested) contents of a single row of a table. +// Rows which exceed 256MiB in size cannot be read in full. +message Row { + // The unique key which identifies this row within its table. This is the same + // key that's used to identify the row in, for example, a MutateRowRequest. + // May contain any non-empty byte string up to 4KiB in length. + bytes key = 1; + + // May be empty, but only if the entire row is empty. + // The mutual ordering of column families is not specified. + repeated Family families = 2; +} + +// Specifies (some of) the contents of a single row/column family of a table. +message Family { + // The unique key which identifies this family within its row. This is the + // same key that's used to identify the family in, for example, a RowFilter + // which sets its "family_name_regex_filter" field. + // Must match [-_.a-zA-Z0-9]+, except that AggregatingRowProcessors may + // produce cells in a sentinel family with an empty name. + // Must be no greater than 64 characters in length. + string name = 1; + + // Must not be empty. Sorted in order of increasing "qualifier". + repeated Column columns = 2; +} + +// Specifies (some of) the contents of a single row/column of a table. +message Column { + // The unique key which identifies this column within its family. This is the + // same key that's used to identify the column in, for example, a RowFilter + // which sets its "column_qualifier_regex_filter" field. + // May contain any byte string, including the empty string, up to 16kiB in + // length. + bytes qualifier = 1; + + // Must not be empty. Sorted in order of decreasing "timestamp_micros". + repeated Cell cells = 2; +} + +// Specifies (some of) the contents of a single row/column/timestamp of a table. +message Cell { + // The cell's stored timestamp, which also uniquely identifies it within + // its column. + // Values are always expressed in microseconds, but individual tables may set + // a coarser "granularity" to further restrict the allowed values. For + // example, a table which specifies millisecond granularity will only allow + // values of "timestamp_micros" which are multiples of 1000. + int64 timestamp_micros = 1; + + // The value stored in the cell. + // May contain any byte string, including the empty string, up to 100MiB in + // length. + bytes value = 2; + + // Labels applied to the cell by a [RowFilter][google.bigtable.v1.RowFilter]. + repeated string labels = 3; +} + +// Specifies a contiguous range of rows. +message RowRange { + // Inclusive lower bound. If left empty, interpreted as the empty string. + bytes start_key = 2; + + // Exclusive upper bound. If left empty, interpreted as infinity. + bytes end_key = 3; +} + +// Specifies a non-contiguous set of rows. +message RowSet { + // Single rows included in the set. + repeated bytes row_keys = 1; + + // Contiguous row ranges included in the set. + repeated RowRange row_ranges = 2; +} + +// Specifies a contiguous range of columns within a single column family. +// The range spans from : to +// :, where both bounds can be either inclusive or +// exclusive. +message ColumnRange { + // The name of the column family within which this range falls. + string family_name = 1; + + // The column qualifier at which to start the range (within 'column_family'). + // If neither field is set, interpreted as the empty string, inclusive. + oneof start_qualifier { + // Used when giving an inclusive lower bound for the range. + bytes start_qualifier_inclusive = 2; + + // Used when giving an exclusive lower bound for the range. + bytes start_qualifier_exclusive = 3; + } + + // The column qualifier at which to end the range (within 'column_family'). + // If neither field is set, interpreted as the infinite string, exclusive. + oneof end_qualifier { + // Used when giving an inclusive upper bound for the range. + bytes end_qualifier_inclusive = 4; + + // Used when giving an exclusive upper bound for the range. + bytes end_qualifier_exclusive = 5; + } +} + +// Specified a contiguous range of microsecond timestamps. +message TimestampRange { + // Inclusive lower bound. If left empty, interpreted as 0. + int64 start_timestamp_micros = 1; + + // Exclusive upper bound. If left empty, interpreted as infinity. + int64 end_timestamp_micros = 2; +} + +// Specifies a contiguous range of raw byte values. +message ValueRange { + // The value at which to start the range. + // If neither field is set, interpreted as the empty string, inclusive. + oneof start_value { + // Used when giving an inclusive lower bound for the range. + bytes start_value_inclusive = 1; + + // Used when giving an exclusive lower bound for the range. + bytes start_value_exclusive = 2; + } + + // The value at which to end the range. + // If neither field is set, interpreted as the infinite string, exclusive. + oneof end_value { + // Used when giving an inclusive upper bound for the range. + bytes end_value_inclusive = 3; + + // Used when giving an exclusive upper bound for the range. + bytes end_value_exclusive = 4; + } +} + +// Takes a row as input and produces an alternate view of the row based on +// specified rules. For example, a RowFilter might trim down a row to include +// just the cells from columns matching a given regular expression, or might +// return all the cells of a row but not their values. More complicated filters +// can be composed out of these components to express requests such as, "within +// every column of a particular family, give just the two most recent cells +// which are older than timestamp X." +// +// There are two broad categories of RowFilters (true filters and transformers), +// as well as two ways to compose simple filters into more complex ones +// (chains and interleaves). They work as follows: +// +// * True filters alter the input row by excluding some of its cells wholesale +// from the output row. An example of a true filter is the "value_regex_filter", +// which excludes cells whose values don't match the specified pattern. All +// regex true filters use RE2 syntax (https://github.com/google/re2/wiki/Syntax) +// in raw byte mode (RE2::Latin1), and are evaluated as full matches. An +// important point to keep in mind is that RE2(.) is equivalent by default to +// RE2([^\n]), meaning that it does not match newlines. When attempting to match +// an arbitrary byte, you should therefore use the escape sequence '\C', which +// may need to be further escaped as '\\C' in your client language. +// +// * Transformers alter the input row by changing the values of some of its +// cells in the output, without excluding them completely. Currently, the only +// supported transformer is the "strip_value_transformer", which replaces every +// cell's value with the empty string. +// +// * Chains and interleaves are described in more detail in the +// RowFilter.Chain and RowFilter.Interleave documentation. +// +// The total serialized size of a RowFilter message must not +// exceed 4096 bytes, and RowFilters may not be nested within each other +// (in Chains or Interleaves) to a depth of more than 20. +message RowFilter { + // A RowFilter which sends rows through several RowFilters in sequence. + message Chain { + // The elements of "filters" are chained together to process the input row: + // in row -> f(0) -> intermediate row -> f(1) -> ... -> f(N) -> out row + // The full chain is executed atomically. + repeated RowFilter filters = 1; + } + + // A RowFilter which sends each row to each of several component + // RowFilters and interleaves the results. + message Interleave { + // The elements of "filters" all process a copy of the input row, and the + // results are pooled, sorted, and combined into a single output row. + // If multiple cells are produced with the same column and timestamp, + // they will all appear in the output row in an unspecified mutual order. + // Consider the following example, with three filters: + // + // input row + // | + // ----------------------------------------------------- + // | | | + // f(0) f(1) f(2) + // | | | + // 1: foo,bar,10,x foo,bar,10,z far,bar,7,a + // 2: foo,blah,11,z far,blah,5,x far,blah,5,x + // | | | + // ----------------------------------------------------- + // | + // 1: foo,bar,10,z // could have switched with #2 + // 2: foo,bar,10,x // could have switched with #1 + // 3: foo,blah,11,z + // 4: far,bar,7,a + // 5: far,blah,5,x // identical to #6 + // 6: far,blah,5,x // identical to #5 + // All interleaved filters are executed atomically. + repeated RowFilter filters = 1; + } + + // A RowFilter which evaluates one of two possible RowFilters, depending on + // whether or not a predicate RowFilter outputs any cells from the input row. + // + // IMPORTANT NOTE: The predicate filter does not execute atomically with the + // true and false filters, which may lead to inconsistent or unexpected + // results. Additionally, Condition filters have poor performance, especially + // when filters are set for the false condition. + message Condition { + // If "predicate_filter" outputs any cells, then "true_filter" will be + // evaluated on the input row. Otherwise, "false_filter" will be evaluated. + RowFilter predicate_filter = 1; + + // The filter to apply to the input row if "predicate_filter" returns any + // results. If not provided, no results will be returned in the true case. + RowFilter true_filter = 2; + + // The filter to apply to the input row if "predicate_filter" does not + // return any results. If not provided, no results will be returned in the + // false case. + RowFilter false_filter = 3; + } + + // Which of the possible RowFilter types to apply. If none are set, this + // RowFilter returns all cells in the input row. + oneof filter { + // Applies several RowFilters to the data in sequence, progressively + // narrowing the results. + Chain chain = 1; + + // Applies several RowFilters to the data in parallel and combines the + // results. + Interleave interleave = 2; + + // Applies one of two possible RowFilters to the data based on the output of + // a predicate RowFilter. + Condition condition = 3; + + // ADVANCED USE ONLY. + // Hook for introspection into the RowFilter. Outputs all cells directly to + // the output of the read rather than to any parent filter. Consider the + // following example: + // + // Chain( + // FamilyRegex("A"), + // Interleave( + // All(), + // Chain(Label("foo"), Sink()) + // ), + // QualifierRegex("B") + // ) + // + // A,A,1,w + // A,B,2,x + // B,B,4,z + // | + // FamilyRegex("A") + // | + // A,A,1,w + // A,B,2,x + // | + // +------------+-------------+ + // | | + // All() Label(foo) + // | | + // A,A,1,w A,A,1,w,labels:[foo] + // A,B,2,x A,B,2,x,labels:[foo] + // | | + // | Sink() --------------+ + // | | | + // +------------+ x------+ A,A,1,w,labels:[foo] + // | A,B,2,x,labels:[foo] + // A,A,1,w | + // A,B,2,x | + // | | + // QualifierRegex("B") | + // | | + // A,B,2,x | + // | | + // +--------------------------------+ + // | + // A,A,1,w,labels:[foo] + // A,B,2,x,labels:[foo] // could be switched + // A,B,2,x // could be switched + // + // Despite being excluded by the qualifier filter, a copy of every cell + // that reaches the sink is present in the final result. + // + // As with an [Interleave][google.bigtable.v1.RowFilter.Interleave], + // duplicate cells are possible, and appear in an unspecified mutual order. + // In this case we have a duplicate with column "A:B" and timestamp 2, + // because one copy passed through the all filter while the other was + // passed through the label and sink. Note that one copy has label "foo", + // while the other does not. + // + // Cannot be used within the `predicate_filter`, `true_filter`, or + // `false_filter` of a [Condition][google.bigtable.v1.RowFilter.Condition]. + bool sink = 16; + + // Matches all cells, regardless of input. Functionally equivalent to + // leaving `filter` unset, but included for completeness. + bool pass_all_filter = 17; + + // Does not match any cells, regardless of input. Useful for temporarily + // disabling just part of a filter. + bool block_all_filter = 18; + + // Matches only cells from rows whose keys satisfy the given RE2 regex. In + // other words, passes through the entire row when the key matches, and + // otherwise produces an empty row. + // Note that, since row keys can contain arbitrary bytes, the '\C' escape + // sequence must be used if a true wildcard is desired. The '.' character + // will not match the new line character '\n', which may be present in a + // binary key. + bytes row_key_regex_filter = 4; + + // Matches all cells from a row with probability p, and matches no cells + // from the row with probability 1-p. + double row_sample_filter = 14; + + // Matches only cells from columns whose families satisfy the given RE2 + // regex. For technical reasons, the regex must not contain the ':' + // character, even if it is not being used as a literal. + // Note that, since column families cannot contain the new line character + // '\n', it is sufficient to use '.' as a full wildcard when matching + // column family names. + string family_name_regex_filter = 5; + + // Matches only cells from columns whose qualifiers satisfy the given RE2 + // regex. + // Note that, since column qualifiers can contain arbitrary bytes, the '\C' + // escape sequence must be used if a true wildcard is desired. The '.' + // character will not match the new line character '\n', which may be + // present in a binary qualifier. + bytes column_qualifier_regex_filter = 6; + + // Matches only cells from columns within the given range. + ColumnRange column_range_filter = 7; + + // Matches only cells with timestamps within the given range. + TimestampRange timestamp_range_filter = 8; + + // Matches only cells with values that satisfy the given regular expression. + // Note that, since cell values can contain arbitrary bytes, the '\C' escape + // sequence must be used if a true wildcard is desired. The '.' character + // will not match the new line character '\n', which may be present in a + // binary value. + bytes value_regex_filter = 9; + + // Matches only cells with values that fall within the given range. + ValueRange value_range_filter = 15; + + // Skips the first N cells of each row, matching all subsequent cells. + // If duplicate cells are present, as is possible when using an Interleave, + // each copy of the cell is counted separately. + int32 cells_per_row_offset_filter = 10; + + // Matches only the first N cells of each row. + // If duplicate cells are present, as is possible when using an Interleave, + // each copy of the cell is counted separately. + int32 cells_per_row_limit_filter = 11; + + // Matches only the most recent N cells within each column. For example, + // if N=2, this filter would match column "foo:bar" at timestamps 10 and 9, + // skip all earlier cells in "foo:bar", and then begin matching again in + // column "foo:bar2". + // If duplicate cells are present, as is possible when using an Interleave, + // each copy of the cell is counted separately. + int32 cells_per_column_limit_filter = 12; + + // Replaces each cell's value with the empty string. + bool strip_value_transformer = 13; + + // Applies the given label to all cells in the output row. This allows + // the client to determine which results were produced from which part of + // the filter. + // + // Values must be at most 15 characters in length, and match the RE2 + // pattern [a-z0-9\\-]+ + // + // Due to a technical limitation, it is not currently possible to apply + // multiple labels to a cell. As a result, a Chain may have no more than + // one sub-filter which contains a apply_label_transformer. It is okay for + // an Interleave to contain multiple apply_label_transformers, as they will + // be applied to separate copies of the input. This may be relaxed in the + // future. + string apply_label_transformer = 19; + } +} + +// Specifies a particular change to be made to the contents of a row. +message Mutation { + // A Mutation which sets the value of the specified cell. + message SetCell { + // The name of the family into which new data should be written. + // Must match [-_.a-zA-Z0-9]+ + string family_name = 1; + + // The qualifier of the column into which new data should be written. + // Can be any byte string, including the empty string. + bytes column_qualifier = 2; + + // The timestamp of the cell into which new data should be written. + // Use -1 for current Bigtable server time. + // Otherwise, the client should set this value itself, noting that the + // default value is a timestamp of zero if the field is left unspecified. + // Values must match the "granularity" of the table (e.g. micros, millis). + int64 timestamp_micros = 3; + + // The value to be written into the specified cell. + bytes value = 4; + } + + // A Mutation which deletes cells from the specified column, optionally + // restricting the deletions to a given timestamp range. + message DeleteFromColumn { + // The name of the family from which cells should be deleted. + // Must match [-_.a-zA-Z0-9]+ + string family_name = 1; + + // The qualifier of the column from which cells should be deleted. + // Can be any byte string, including the empty string. + bytes column_qualifier = 2; + + // The range of timestamps within which cells should be deleted. + TimestampRange time_range = 3; + } + + // A Mutation which deletes all cells from the specified column family. + message DeleteFromFamily { + // The name of the family from which cells should be deleted. + // Must match [-_.a-zA-Z0-9]+ + string family_name = 1; + } + + // A Mutation which deletes all cells from the containing row. + message DeleteFromRow { + + } + + // Which of the possible Mutation types to apply. + oneof mutation { + // Set a cell's value. + SetCell set_cell = 1; + + // Deletes cells from a column. + DeleteFromColumn delete_from_column = 2; + + // Deletes cells from a column family. + DeleteFromFamily delete_from_family = 3; + + // Deletes cells from the entire row. + DeleteFromRow delete_from_row = 4; + } +} + +// Specifies an atomic read/modify/write operation on the latest value of the +// specified column. +message ReadModifyWriteRule { + // The name of the family to which the read/modify/write should be applied. + // Must match [-_.a-zA-Z0-9]+ + string family_name = 1; + + // The qualifier of the column to which the read/modify/write should be + // applied. + // Can be any byte string, including the empty string. + bytes column_qualifier = 2; + + // The rule used to determine the column's new latest value from its current + // latest value. + oneof rule { + // Rule specifying that "append_value" be appended to the existing value. + // If the targeted cell is unset, it will be treated as containing the + // empty string. + bytes append_value = 3; + + // Rule specifying that "increment_amount" be added to the existing value. + // If the targeted cell is unset, it will be treated as containing a zero. + // Otherwise, the targeted cell must contain an 8-byte value (interpreted + // as a 64-bit big-endian signed integer), or the entire request will fail. + int64 increment_amount = 4; + } +} diff --git a/handwritten/cloud-profiler/google/bigtable/v1/bigtable_service.proto b/handwritten/cloud-profiler/google/bigtable/v1/bigtable_service.proto new file mode 100644 index 00000000000..e26c61b123f --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/v1/bigtable_service.proto @@ -0,0 +1,74 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.v1; + +import "google/api/annotations.proto"; +import "google/bigtable/v1/bigtable_data.proto"; +import "google/bigtable/v1/bigtable_service_messages.proto"; +import "google/protobuf/empty.proto"; + +option go_package = "google.golang.org/genproto/googleapis/bigtable/v1;bigtable"; +option java_generic_services = true; +option java_multiple_files = true; +option java_outer_classname = "BigtableServicesProto"; +option java_package = "com.google.bigtable.v1"; + + +// Service for reading from and writing to existing Bigtables. +service BigtableService { + // Streams back the contents of all requested rows, optionally applying + // the same Reader filter to each. Depending on their size, rows may be + // broken up across multiple responses, but atomicity of each row will still + // be preserved. + rpc ReadRows(ReadRowsRequest) returns (stream ReadRowsResponse) { + option (google.api.http) = { post: "/v1/{table_name=projects/*/zones/*/clusters/*/tables/*}/rows:read" body: "*" }; + } + + // Returns a sample of row keys in the table. The returned row keys will + // delimit contiguous sections of the table of approximately equal size, + // which can be used to break up the data for distributed tasks like + // mapreduces. + rpc SampleRowKeys(SampleRowKeysRequest) returns (stream SampleRowKeysResponse) { + option (google.api.http) = { get: "/v1/{table_name=projects/*/zones/*/clusters/*/tables/*}/rows:sampleKeys" }; + } + + // Mutates a row atomically. Cells already present in the row are left + // unchanged unless explicitly changed by 'mutation'. + rpc MutateRow(MutateRowRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1/{table_name=projects/*/zones/*/clusters/*/tables/*}/rows/{row_key}:mutate" body: "*" }; + } + + // Mutates multiple rows in a batch. Each individual row is mutated + // atomically as in MutateRow, but the entire batch is not executed + // atomically. + rpc MutateRows(MutateRowsRequest) returns (MutateRowsResponse) { + option (google.api.http) = { post: "/v1/{table_name=projects/*/zones/*/clusters/*/tables/*}:mutateRows" body: "*" }; + } + + // Mutates a row atomically based on the output of a predicate Reader filter. + rpc CheckAndMutateRow(CheckAndMutateRowRequest) returns (CheckAndMutateRowResponse) { + option (google.api.http) = { post: "/v1/{table_name=projects/*/zones/*/clusters/*/tables/*}/rows/{row_key}:checkAndMutate" body: "*" }; + } + + // Modifies a row atomically, reading the latest existing timestamp/value from + // the specified columns and writing a new value at + // max(existing timestamp, current server time) based on pre-defined + // read/modify/write rules. Returns the new contents of all modified cells. + rpc ReadModifyWriteRow(ReadModifyWriteRowRequest) returns (Row) { + option (google.api.http) = { post: "/v1/{table_name=projects/*/zones/*/clusters/*/tables/*}/rows/{row_key}:readModifyWrite" body: "*" }; + } +} diff --git a/handwritten/cloud-profiler/google/bigtable/v1/bigtable_service_messages.proto b/handwritten/cloud-profiler/google/bigtable/v1/bigtable_service_messages.proto new file mode 100644 index 00000000000..a39bc1de600 --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/v1/bigtable_service_messages.proto @@ -0,0 +1,218 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.v1; + +import "google/bigtable/v1/bigtable_data.proto"; +import "google/rpc/status.proto"; + +option go_package = "google.golang.org/genproto/googleapis/bigtable/v1;bigtable"; +option java_multiple_files = true; +option java_outer_classname = "BigtableServiceMessagesProto"; +option java_package = "com.google.bigtable.v1"; + + +// Request message for BigtableServer.ReadRows. +message ReadRowsRequest { + // The unique name of the table from which to read. + string table_name = 1; + + // If neither row_key nor row_range is set, reads from all rows. + oneof target { + // The key of a single row from which to read. + bytes row_key = 2; + + // A range of rows from which to read. + RowRange row_range = 3; + + // A set of rows from which to read. Entries need not be in order, and will + // be deduplicated before reading. + // The total serialized size of the set must not exceed 1MB. + RowSet row_set = 8; + } + + // The filter to apply to the contents of the specified row(s). If unset, + // reads the entire table. + RowFilter filter = 5; + + // By default, rows are read sequentially, producing results which are + // guaranteed to arrive in increasing row order. Setting + // "allow_row_interleaving" to true allows multiple rows to be interleaved in + // the response stream, which increases throughput but breaks this guarantee, + // and may force the client to use more memory to buffer partially-received + // rows. Cannot be set to true when specifying "num_rows_limit". + bool allow_row_interleaving = 6; + + // The read will terminate after committing to N rows' worth of results. The + // default (zero) is to return all results. + // Note that "allow_row_interleaving" cannot be set to true when this is set. + int64 num_rows_limit = 7; +} + +// Response message for BigtableService.ReadRows. +message ReadRowsResponse { + // Specifies a piece of a row's contents returned as part of the read + // response stream. + message Chunk { + oneof chunk { + // A subset of the data from a particular row. As long as no "reset_row" + // is received in between, multiple "row_contents" from the same row are + // from the same atomic view of that row, and will be received in the + // expected family/column/timestamp order. + Family row_contents = 1; + + // Indicates that the client should drop all previous chunks for + // "row_key", as it will be re-read from the beginning. + bool reset_row = 2; + + // Indicates that the client can safely process all previous chunks for + // "row_key", as its data has been fully read. + bool commit_row = 3; + } + } + + // The key of the row for which we're receiving data. + // Results will be received in increasing row key order, unless + // "allow_row_interleaving" was specified in the request. + bytes row_key = 1; + + // One or more chunks of the row specified by "row_key". + repeated Chunk chunks = 2; +} + +// Request message for BigtableService.SampleRowKeys. +message SampleRowKeysRequest { + // The unique name of the table from which to sample row keys. + string table_name = 1; +} + +// Response message for BigtableService.SampleRowKeys. +message SampleRowKeysResponse { + // Sorted streamed sequence of sample row keys in the table. The table might + // have contents before the first row key in the list and after the last one, + // but a key containing the empty string indicates "end of table" and will be + // the last response given, if present. + // Note that row keys in this list may not have ever been written to or read + // from, and users should therefore not make any assumptions about the row key + // structure that are specific to their use case. + bytes row_key = 1; + + // Approximate total storage space used by all rows in the table which precede + // "row_key". Buffering the contents of all rows between two subsequent + // samples would require space roughly equal to the difference in their + // "offset_bytes" fields. + int64 offset_bytes = 2; +} + +// Request message for BigtableService.MutateRow. +message MutateRowRequest { + // The unique name of the table to which the mutation should be applied. + string table_name = 1; + + // The key of the row to which the mutation should be applied. + bytes row_key = 2; + + // Changes to be atomically applied to the specified row. Entries are applied + // in order, meaning that earlier mutations can be masked by later ones. + // Must contain at least one entry and at most 100000. + repeated Mutation mutations = 3; +} + +// Request message for BigtableService.MutateRows. +message MutateRowsRequest { + message Entry { + // The key of the row to which the `mutations` should be applied. + bytes row_key = 1; + + // Changes to be atomically applied to the specified row. Mutations are + // applied in order, meaning that earlier mutations can be masked by + // later ones. + // At least one mutation must be specified. + repeated Mutation mutations = 2; + } + + // The unique name of the table to which the mutations should be applied. + string table_name = 1; + + // The row keys/mutations to be applied in bulk. + // Each entry is applied as an atomic mutation, but the entries may be + // applied in arbitrary order (even between entries for the same row). + // At least one entry must be specified, and in total the entries may + // contain at most 100000 mutations. + repeated Entry entries = 2; +} + +// Response message for BigtableService.MutateRows. +message MutateRowsResponse { + // The results for each Entry from the request, presented in the order + // in which the entries were originally given. + // Depending on how requests are batched during execution, it is possible + // for one Entry to fail due to an error with another Entry. In the event + // that this occurs, the same error will be reported for both entries. + repeated google.rpc.Status statuses = 1; +} + +// Request message for BigtableService.CheckAndMutateRowRequest +message CheckAndMutateRowRequest { + // The unique name of the table to which the conditional mutation should be + // applied. + string table_name = 1; + + // The key of the row to which the conditional mutation should be applied. + bytes row_key = 2; + + // The filter to be applied to the contents of the specified row. Depending + // on whether or not any results are yielded, either "true_mutations" or + // "false_mutations" will be executed. If unset, checks that the row contains + // any values at all. + RowFilter predicate_filter = 6; + + // Changes to be atomically applied to the specified row if "predicate_filter" + // yields at least one cell when applied to "row_key". Entries are applied in + // order, meaning that earlier mutations can be masked by later ones. + // Must contain at least one entry if "false_mutations" is empty, and at most + // 100000. + repeated Mutation true_mutations = 4; + + // Changes to be atomically applied to the specified row if "predicate_filter" + // does not yield any cells when applied to "row_key". Entries are applied in + // order, meaning that earlier mutations can be masked by later ones. + // Must contain at least one entry if "true_mutations" is empty, and at most + // 100000. + repeated Mutation false_mutations = 5; +} + +// Response message for BigtableService.CheckAndMutateRowRequest. +message CheckAndMutateRowResponse { + // Whether or not the request's "predicate_filter" yielded any results for + // the specified row. + bool predicate_matched = 1; +} + +// Request message for BigtableService.ReadModifyWriteRowRequest. +message ReadModifyWriteRowRequest { + // The unique name of the table to which the read/modify/write rules should be + // applied. + string table_name = 1; + + // The key of the row to which the read/modify/write rules should be applied. + bytes row_key = 2; + + // Rules specifying how the specified row's contents are to be transformed + // into writes. Entries are applied in order, meaning that earlier rules will + // affect the results of later ones. + repeated ReadModifyWriteRule rules = 3; +} diff --git a/handwritten/cloud-profiler/google/bigtable/v2/bigtable.proto b/handwritten/cloud-profiler/google/bigtable/v2/bigtable.proto new file mode 100644 index 00000000000..1ef594ab722 --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/v2/bigtable.proto @@ -0,0 +1,323 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.v2; + +import "google/api/annotations.proto"; +import "google/bigtable/v2/data.proto"; +import "google/protobuf/wrappers.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Bigtable.V2"; +option go_package = "google.golang.org/genproto/googleapis/bigtable/v2;bigtable"; +option java_multiple_files = true; +option java_outer_classname = "BigtableProto"; +option java_package = "com.google.bigtable.v2"; + + +// Service for reading from and writing to existing Bigtable tables. +service Bigtable { + // Streams back the contents of all requested rows in key order, optionally + // applying the same Reader filter to each. Depending on their size, + // rows and cells may be broken up across multiple responses, but + // atomicity of each row will still be preserved. See the + // ReadRowsResponse documentation for details. + rpc ReadRows(ReadRowsRequest) returns (stream ReadRowsResponse) { + option (google.api.http) = { post: "/v2/{table_name=projects/*/instances/*/tables/*}:readRows" body: "*" }; + } + + // Returns a sample of row keys in the table. The returned row keys will + // delimit contiguous sections of the table of approximately equal size, + // which can be used to break up the data for distributed tasks like + // mapreduces. + rpc SampleRowKeys(SampleRowKeysRequest) returns (stream SampleRowKeysResponse) { + option (google.api.http) = { get: "/v2/{table_name=projects/*/instances/*/tables/*}:sampleRowKeys" }; + } + + // Mutates a row atomically. Cells already present in the row are left + // unchanged unless explicitly changed by `mutation`. + rpc MutateRow(MutateRowRequest) returns (MutateRowResponse) { + option (google.api.http) = { post: "/v2/{table_name=projects/*/instances/*/tables/*}:mutateRow" body: "*" }; + } + + // Mutates multiple rows in a batch. Each individual row is mutated + // atomically as in MutateRow, but the entire batch is not executed + // atomically. + rpc MutateRows(MutateRowsRequest) returns (stream MutateRowsResponse) { + option (google.api.http) = { post: "/v2/{table_name=projects/*/instances/*/tables/*}:mutateRows" body: "*" }; + } + + // Mutates a row atomically based on the output of a predicate Reader filter. + rpc CheckAndMutateRow(CheckAndMutateRowRequest) returns (CheckAndMutateRowResponse) { + option (google.api.http) = { post: "/v2/{table_name=projects/*/instances/*/tables/*}:checkAndMutateRow" body: "*" }; + } + + // Modifies a row atomically. The method reads the latest existing timestamp + // and value from the specified columns and writes a new entry based on + // pre-defined read/modify/write rules. The new value for the timestamp is the + // greater of the existing timestamp or the current server time. The method + // returns the new contents of all modified cells. + rpc ReadModifyWriteRow(ReadModifyWriteRowRequest) returns (ReadModifyWriteRowResponse) { + option (google.api.http) = { post: "/v2/{table_name=projects/*/instances/*/tables/*}:readModifyWriteRow" body: "*" }; + } +} + +// Request message for Bigtable.ReadRows. +message ReadRowsRequest { + // The unique name of the table from which to read. + // Values are of the form + // `projects//instances//tables/
`. + string table_name = 1; + + // The row keys and/or ranges to read. If not specified, reads from all rows. + RowSet rows = 2; + + // The filter to apply to the contents of the specified row(s). If unset, + // reads the entirety of each row. + RowFilter filter = 3; + + // The read will terminate after committing to N rows' worth of results. The + // default (zero) is to return all results. + int64 rows_limit = 4; +} + +// Response message for Bigtable.ReadRows. +message ReadRowsResponse { + // Specifies a piece of a row's contents returned as part of the read + // response stream. + message CellChunk { + // The row key for this chunk of data. If the row key is empty, + // this CellChunk is a continuation of the same row as the previous + // CellChunk in the response stream, even if that CellChunk was in a + // previous ReadRowsResponse message. + bytes row_key = 1; + + // The column family name for this chunk of data. If this message + // is not present this CellChunk is a continuation of the same column + // family as the previous CellChunk. The empty string can occur as a + // column family name in a response so clients must check + // explicitly for the presence of this message, not just for + // `family_name.value` being non-empty. + google.protobuf.StringValue family_name = 2; + + // The column qualifier for this chunk of data. If this message + // is not present, this CellChunk is a continuation of the same column + // as the previous CellChunk. Column qualifiers may be empty so + // clients must check for the presence of this message, not just + // for `qualifier.value` being non-empty. + google.protobuf.BytesValue qualifier = 3; + + // The cell's stored timestamp, which also uniquely identifies it + // within its column. Values are always expressed in + // microseconds, but individual tables may set a coarser + // granularity to further restrict the allowed values. For + // example, a table which specifies millisecond granularity will + // only allow values of `timestamp_micros` which are multiples of + // 1000. Timestamps are only set in the first CellChunk per cell + // (for cells split into multiple chunks). + int64 timestamp_micros = 4; + + // Labels applied to the cell by a + // [RowFilter][google.bigtable.v2.RowFilter]. Labels are only set + // on the first CellChunk per cell. + repeated string labels = 5; + + // The value stored in the cell. Cell values can be split across + // multiple CellChunks. In that case only the value field will be + // set in CellChunks after the first: the timestamp and labels + // will only be present in the first CellChunk, even if the first + // CellChunk came in a previous ReadRowsResponse. + bytes value = 6; + + // If this CellChunk is part of a chunked cell value and this is + // not the final chunk of that cell, value_size will be set to the + // total length of the cell value. The client can use this size + // to pre-allocate memory to hold the full cell value. + int32 value_size = 7; + + oneof row_status { + // Indicates that the client should drop all previous chunks for + // `row_key`, as it will be re-read from the beginning. + bool reset_row = 8; + + // Indicates that the client can safely process all previous chunks for + // `row_key`, as its data has been fully read. + bool commit_row = 9; + } + } + + repeated CellChunk chunks = 1; + + // Optionally the server might return the row key of the last row it + // has scanned. The client can use this to construct a more + // efficient retry request if needed: any row keys or portions of + // ranges less than this row key can be dropped from the request. + // This is primarily useful for cases where the server has read a + // lot of data that was filtered out since the last committed row + // key, allowing the client to skip that work on a retry. + bytes last_scanned_row_key = 2; +} + +// Request message for Bigtable.SampleRowKeys. +message SampleRowKeysRequest { + // The unique name of the table from which to sample row keys. + // Values are of the form + // `projects//instances//tables/
`. + string table_name = 1; +} + +// Response message for Bigtable.SampleRowKeys. +message SampleRowKeysResponse { + // Sorted streamed sequence of sample row keys in the table. The table might + // have contents before the first row key in the list and after the last one, + // but a key containing the empty string indicates "end of table" and will be + // the last response given, if present. + // Note that row keys in this list may not have ever been written to or read + // from, and users should therefore not make any assumptions about the row key + // structure that are specific to their use case. + bytes row_key = 1; + + // Approximate total storage space used by all rows in the table which precede + // `row_key`. Buffering the contents of all rows between two subsequent + // samples would require space roughly equal to the difference in their + // `offset_bytes` fields. + int64 offset_bytes = 2; +} + +// Request message for Bigtable.MutateRow. +message MutateRowRequest { + // The unique name of the table to which the mutation should be applied. + // Values are of the form + // `projects//instances//tables/
`. + string table_name = 1; + + // The key of the row to which the mutation should be applied. + bytes row_key = 2; + + // Changes to be atomically applied to the specified row. Entries are applied + // in order, meaning that earlier mutations can be masked by later ones. + // Must contain at least one entry and at most 100000. + repeated Mutation mutations = 3; +} + +// Response message for Bigtable.MutateRow. +message MutateRowResponse { + +} + +// Request message for BigtableService.MutateRows. +message MutateRowsRequest { + message Entry { + // The key of the row to which the `mutations` should be applied. + bytes row_key = 1; + + // Changes to be atomically applied to the specified row. Mutations are + // applied in order, meaning that earlier mutations can be masked by + // later ones. + // You must specify at least one mutation. + repeated Mutation mutations = 2; + } + + // The unique name of the table to which the mutations should be applied. + string table_name = 1; + + // The row keys and corresponding mutations to be applied in bulk. + // Each entry is applied as an atomic mutation, but the entries may be + // applied in arbitrary order (even between entries for the same row). + // At least one entry must be specified, and in total the entries can + // contain at most 100000 mutations. + repeated Entry entries = 2; +} + +// Response message for BigtableService.MutateRows. +message MutateRowsResponse { + message Entry { + // The index into the original request's `entries` list of the Entry + // for which a result is being reported. + int64 index = 1; + + // The result of the request Entry identified by `index`. + // Depending on how requests are batched during execution, it is possible + // for one Entry to fail due to an error with another Entry. In the event + // that this occurs, the same error will be reported for both entries. + google.rpc.Status status = 2; + } + + // One or more results for Entries from the batch request. + repeated Entry entries = 1; +} + +// Request message for Bigtable.CheckAndMutateRow. +message CheckAndMutateRowRequest { + // The unique name of the table to which the conditional mutation should be + // applied. + // Values are of the form + // `projects//instances//tables/
`. + string table_name = 1; + + // The key of the row to which the conditional mutation should be applied. + bytes row_key = 2; + + // The filter to be applied to the contents of the specified row. Depending + // on whether or not any results are yielded, either `true_mutations` or + // `false_mutations` will be executed. If unset, checks that the row contains + // any values at all. + RowFilter predicate_filter = 6; + + // Changes to be atomically applied to the specified row if `predicate_filter` + // yields at least one cell when applied to `row_key`. Entries are applied in + // order, meaning that earlier mutations can be masked by later ones. + // Must contain at least one entry if `false_mutations` is empty, and at most + // 100000. + repeated Mutation true_mutations = 4; + + // Changes to be atomically applied to the specified row if `predicate_filter` + // does not yield any cells when applied to `row_key`. Entries are applied in + // order, meaning that earlier mutations can be masked by later ones. + // Must contain at least one entry if `true_mutations` is empty, and at most + // 100000. + repeated Mutation false_mutations = 5; +} + +// Response message for Bigtable.CheckAndMutateRow. +message CheckAndMutateRowResponse { + // Whether or not the request's `predicate_filter` yielded any results for + // the specified row. + bool predicate_matched = 1; +} + +// Request message for Bigtable.ReadModifyWriteRow. +message ReadModifyWriteRowRequest { + // The unique name of the table to which the read/modify/write rules should be + // applied. + // Values are of the form + // `projects//instances//tables/
`. + string table_name = 1; + + // The key of the row to which the read/modify/write rules should be applied. + bytes row_key = 2; + + // Rules specifying how the specified row's contents are to be transformed + // into writes. Entries are applied in order, meaning that earlier rules will + // affect the results of later ones. + repeated ReadModifyWriteRule rules = 3; +} + +// Response message for Bigtable.ReadModifyWriteRow. +message ReadModifyWriteRowResponse { + // A Row containing the new contents of all cells modified by the request. + Row row = 1; +} diff --git a/handwritten/cloud-profiler/google/bigtable/v2/bigtable_gapic.yaml b/handwritten/cloud-profiler/google/bigtable/v2/bigtable_gapic.yaml new file mode 100644 index 00000000000..0a21edc0d5f --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/v2/bigtable_gapic.yaml @@ -0,0 +1,163 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.bigtable.v2 + python: + package_name: google.cloud.bigtable_v2.gapic + go: + package_name: cloud.google.com/go/bigtable/apiv2 + csharp: + package_name: Google.Cloud.Bigtable.V2 + ruby: + package_name: Google::Cloud::Bigtable::V2 + php: + package_name: Google\Cloud\Bigtable\V2 + nodejs: + package_name: bigtable.v2 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.bigtable.v2.Bigtable + collections: + - name_pattern: projects/{project}/instances/{instance}/tables/{table} + entity_name: table + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + methods: + - name: ReadRows + flattening: + groups: + - parameters: + - table_name + required_fields: + - table_name + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + table_name: table + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: SampleRowKeys + flattening: + groups: + - parameters: + - table_name + required_fields: + - table_name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + table_name: table + timeout_millis: 60000 + resource_name_treatment: STATIC_TYPES + - name: MutateRow + flattening: + groups: + - parameters: + - table_name + - row_key + - mutations + required_fields: + - table_name + - row_key + - mutations + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + table_name: table + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: MutateRows + flattening: + groups: + - parameters: + - table_name + - entries + required_fields: + - table_name + - entries + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + table_name: table + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: CheckAndMutateRow + flattening: + groups: + - parameters: + - table_name + - row_key + - predicate_filter + - true_mutations + - false_mutations + # Note that one of {true_mutations,false_mutations} must be specified, but + # since they are not both required, we leave them as optional params. + required_fields: + - table_name + - row_key + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + table_name: table + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: ReadModifyWriteRow + flattening: + groups: + - parameters: + - table_name + - row_key + - rules + required_fields: + - table_name + - row_key + - rules + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + table_name: table + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 +resource_name_generation: +- message_name: ReadRowsRequest + field_entity_map: + table_name: table +- message_name: SampleRowKeysRequest + field_entity_map: + table_name: table +- message_name: MutateRowRequest + field_entity_map: + table_name: table +- message_name: MutateRowsRequest + field_entity_map: + table_name: table +- message_name: CheckAndMutateRowRequest + field_entity_map: + table_name: table +- message_name: ReadModifyWriteRowRequest + field_entity_map: + table_name: table diff --git a/handwritten/cloud-profiler/google/bigtable/v2/data.proto b/handwritten/cloud-profiler/google/bigtable/v2/data.proto new file mode 100644 index 00000000000..3c140803fe1 --- /dev/null +++ b/handwritten/cloud-profiler/google/bigtable/v2/data.proto @@ -0,0 +1,534 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bigtable.v2; + +option csharp_namespace = "Google.Cloud.Bigtable.V2"; +option go_package = "google.golang.org/genproto/googleapis/bigtable/v2;bigtable"; +option java_multiple_files = true; +option java_outer_classname = "DataProto"; +option java_package = "com.google.bigtable.v2"; + + +// Specifies the complete (requested) contents of a single row of a table. +// Rows which exceed 256MiB in size cannot be read in full. +message Row { + // The unique key which identifies this row within its table. This is the same + // key that's used to identify the row in, for example, a MutateRowRequest. + // May contain any non-empty byte string up to 4KiB in length. + bytes key = 1; + + // May be empty, but only if the entire row is empty. + // The mutual ordering of column families is not specified. + repeated Family families = 2; +} + +// Specifies (some of) the contents of a single row/column family intersection +// of a table. +message Family { + // The unique key which identifies this family within its row. This is the + // same key that's used to identify the family in, for example, a RowFilter + // which sets its "family_name_regex_filter" field. + // Must match `[-_.a-zA-Z0-9]+`, except that AggregatingRowProcessors may + // produce cells in a sentinel family with an empty name. + // Must be no greater than 64 characters in length. + string name = 1; + + // Must not be empty. Sorted in order of increasing "qualifier". + repeated Column columns = 2; +} + +// Specifies (some of) the contents of a single row/column intersection of a +// table. +message Column { + // The unique key which identifies this column within its family. This is the + // same key that's used to identify the column in, for example, a RowFilter + // which sets its `column_qualifier_regex_filter` field. + // May contain any byte string, including the empty string, up to 16kiB in + // length. + bytes qualifier = 1; + + // Must not be empty. Sorted in order of decreasing "timestamp_micros". + repeated Cell cells = 2; +} + +// Specifies (some of) the contents of a single row/column/timestamp of a table. +message Cell { + // The cell's stored timestamp, which also uniquely identifies it within + // its column. + // Values are always expressed in microseconds, but individual tables may set + // a coarser granularity to further restrict the allowed values. For + // example, a table which specifies millisecond granularity will only allow + // values of `timestamp_micros` which are multiples of 1000. + int64 timestamp_micros = 1; + + // The value stored in the cell. + // May contain any byte string, including the empty string, up to 100MiB in + // length. + bytes value = 2; + + // Labels applied to the cell by a [RowFilter][google.bigtable.v2.RowFilter]. + repeated string labels = 3; +} + +// Specifies a contiguous range of rows. +message RowRange { + // The row key at which to start the range. + // If neither field is set, interpreted as the empty string, inclusive. + oneof start_key { + // Used when giving an inclusive lower bound for the range. + bytes start_key_closed = 1; + + // Used when giving an exclusive lower bound for the range. + bytes start_key_open = 2; + } + + // The row key at which to end the range. + // If neither field is set, interpreted as the infinite row key, exclusive. + oneof end_key { + // Used when giving an exclusive upper bound for the range. + bytes end_key_open = 3; + + // Used when giving an inclusive upper bound for the range. + bytes end_key_closed = 4; + } +} + +// Specifies a non-contiguous set of rows. +message RowSet { + // Single rows included in the set. + repeated bytes row_keys = 1; + + // Contiguous row ranges included in the set. + repeated RowRange row_ranges = 2; +} + +// Specifies a contiguous range of columns within a single column family. +// The range spans from <column_family>:<start_qualifier> to +// <column_family>:<end_qualifier>, where both bounds can be either +// inclusive or exclusive. +message ColumnRange { + // The name of the column family within which this range falls. + string family_name = 1; + + // The column qualifier at which to start the range (within `column_family`). + // If neither field is set, interpreted as the empty string, inclusive. + oneof start_qualifier { + // Used when giving an inclusive lower bound for the range. + bytes start_qualifier_closed = 2; + + // Used when giving an exclusive lower bound for the range. + bytes start_qualifier_open = 3; + } + + // The column qualifier at which to end the range (within `column_family`). + // If neither field is set, interpreted as the infinite string, exclusive. + oneof end_qualifier { + // Used when giving an inclusive upper bound for the range. + bytes end_qualifier_closed = 4; + + // Used when giving an exclusive upper bound for the range. + bytes end_qualifier_open = 5; + } +} + +// Specified a contiguous range of microsecond timestamps. +message TimestampRange { + // Inclusive lower bound. If left empty, interpreted as 0. + int64 start_timestamp_micros = 1; + + // Exclusive upper bound. If left empty, interpreted as infinity. + int64 end_timestamp_micros = 2; +} + +// Specifies a contiguous range of raw byte values. +message ValueRange { + // The value at which to start the range. + // If neither field is set, interpreted as the empty string, inclusive. + oneof start_value { + // Used when giving an inclusive lower bound for the range. + bytes start_value_closed = 1; + + // Used when giving an exclusive lower bound for the range. + bytes start_value_open = 2; + } + + // The value at which to end the range. + // If neither field is set, interpreted as the infinite string, exclusive. + oneof end_value { + // Used when giving an inclusive upper bound for the range. + bytes end_value_closed = 3; + + // Used when giving an exclusive upper bound for the range. + bytes end_value_open = 4; + } +} + +// Takes a row as input and produces an alternate view of the row based on +// specified rules. For example, a RowFilter might trim down a row to include +// just the cells from columns matching a given regular expression, or might +// return all the cells of a row but not their values. More complicated filters +// can be composed out of these components to express requests such as, "within +// every column of a particular family, give just the two most recent cells +// which are older than timestamp X." +// +// There are two broad categories of RowFilters (true filters and transformers), +// as well as two ways to compose simple filters into more complex ones +// (chains and interleaves). They work as follows: +// +// * True filters alter the input row by excluding some of its cells wholesale +// from the output row. An example of a true filter is the `value_regex_filter`, +// which excludes cells whose values don't match the specified pattern. All +// regex true filters use RE2 syntax (https://github.com/google/re2/wiki/Syntax) +// in raw byte mode (RE2::Latin1), and are evaluated as full matches. An +// important point to keep in mind is that `RE2(.)` is equivalent by default to +// `RE2([^\n])`, meaning that it does not match newlines. When attempting to +// match an arbitrary byte, you should therefore use the escape sequence `\C`, +// which may need to be further escaped as `\\C` in your client language. +// +// * Transformers alter the input row by changing the values of some of its +// cells in the output, without excluding them completely. Currently, the only +// supported transformer is the `strip_value_transformer`, which replaces every +// cell's value with the empty string. +// +// * Chains and interleaves are described in more detail in the +// RowFilter.Chain and RowFilter.Interleave documentation. +// +// The total serialized size of a RowFilter message must not +// exceed 4096 bytes, and RowFilters may not be nested within each other +// (in Chains or Interleaves) to a depth of more than 20. +message RowFilter { + // A RowFilter which sends rows through several RowFilters in sequence. + message Chain { + // The elements of "filters" are chained together to process the input row: + // in row -> f(0) -> intermediate row -> f(1) -> ... -> f(N) -> out row + // The full chain is executed atomically. + repeated RowFilter filters = 1; + } + + // A RowFilter which sends each row to each of several component + // RowFilters and interleaves the results. + message Interleave { + // The elements of "filters" all process a copy of the input row, and the + // results are pooled, sorted, and combined into a single output row. + // If multiple cells are produced with the same column and timestamp, + // they will all appear in the output row in an unspecified mutual order. + // Consider the following example, with three filters: + // + // input row + // | + // ----------------------------------------------------- + // | | | + // f(0) f(1) f(2) + // | | | + // 1: foo,bar,10,x foo,bar,10,z far,bar,7,a + // 2: foo,blah,11,z far,blah,5,x far,blah,5,x + // | | | + // ----------------------------------------------------- + // | + // 1: foo,bar,10,z // could have switched with #2 + // 2: foo,bar,10,x // could have switched with #1 + // 3: foo,blah,11,z + // 4: far,bar,7,a + // 5: far,blah,5,x // identical to #6 + // 6: far,blah,5,x // identical to #5 + // + // All interleaved filters are executed atomically. + repeated RowFilter filters = 1; + } + + // A RowFilter which evaluates one of two possible RowFilters, depending on + // whether or not a predicate RowFilter outputs any cells from the input row. + // + // IMPORTANT NOTE: The predicate filter does not execute atomically with the + // true and false filters, which may lead to inconsistent or unexpected + // results. Additionally, Condition filters have poor performance, especially + // when filters are set for the false condition. + message Condition { + // If `predicate_filter` outputs any cells, then `true_filter` will be + // evaluated on the input row. Otherwise, `false_filter` will be evaluated. + RowFilter predicate_filter = 1; + + // The filter to apply to the input row if `predicate_filter` returns any + // results. If not provided, no results will be returned in the true case. + RowFilter true_filter = 2; + + // The filter to apply to the input row if `predicate_filter` does not + // return any results. If not provided, no results will be returned in the + // false case. + RowFilter false_filter = 3; + } + + // Which of the possible RowFilter types to apply. If none are set, this + // RowFilter returns all cells in the input row. + oneof filter { + // Applies several RowFilters to the data in sequence, progressively + // narrowing the results. + Chain chain = 1; + + // Applies several RowFilters to the data in parallel and combines the + // results. + Interleave interleave = 2; + + // Applies one of two possible RowFilters to the data based on the output of + // a predicate RowFilter. + Condition condition = 3; + + // ADVANCED USE ONLY. + // Hook for introspection into the RowFilter. Outputs all cells directly to + // the output of the read rather than to any parent filter. Consider the + // following example: + // + // Chain( + // FamilyRegex("A"), + // Interleave( + // All(), + // Chain(Label("foo"), Sink()) + // ), + // QualifierRegex("B") + // ) + // + // A,A,1,w + // A,B,2,x + // B,B,4,z + // | + // FamilyRegex("A") + // | + // A,A,1,w + // A,B,2,x + // | + // +------------+-------------+ + // | | + // All() Label(foo) + // | | + // A,A,1,w A,A,1,w,labels:[foo] + // A,B,2,x A,B,2,x,labels:[foo] + // | | + // | Sink() --------------+ + // | | | + // +------------+ x------+ A,A,1,w,labels:[foo] + // | A,B,2,x,labels:[foo] + // A,A,1,w | + // A,B,2,x | + // | | + // QualifierRegex("B") | + // | | + // A,B,2,x | + // | | + // +--------------------------------+ + // | + // A,A,1,w,labels:[foo] + // A,B,2,x,labels:[foo] // could be switched + // A,B,2,x // could be switched + // + // Despite being excluded by the qualifier filter, a copy of every cell + // that reaches the sink is present in the final result. + // + // As with an [Interleave][google.bigtable.v2.RowFilter.Interleave], + // duplicate cells are possible, and appear in an unspecified mutual order. + // In this case we have a duplicate with column "A:B" and timestamp 2, + // because one copy passed through the all filter while the other was + // passed through the label and sink. Note that one copy has label "foo", + // while the other does not. + // + // Cannot be used within the `predicate_filter`, `true_filter`, or + // `false_filter` of a [Condition][google.bigtable.v2.RowFilter.Condition]. + bool sink = 16; + + // Matches all cells, regardless of input. Functionally equivalent to + // leaving `filter` unset, but included for completeness. + bool pass_all_filter = 17; + + // Does not match any cells, regardless of input. Useful for temporarily + // disabling just part of a filter. + bool block_all_filter = 18; + + // Matches only cells from rows whose keys satisfy the given RE2 regex. In + // other words, passes through the entire row when the key matches, and + // otherwise produces an empty row. + // Note that, since row keys can contain arbitrary bytes, the `\C` escape + // sequence must be used if a true wildcard is desired. The `.` character + // will not match the new line character `\n`, which may be present in a + // binary key. + bytes row_key_regex_filter = 4; + + // Matches all cells from a row with probability p, and matches no cells + // from the row with probability 1-p. + double row_sample_filter = 14; + + // Matches only cells from columns whose families satisfy the given RE2 + // regex. For technical reasons, the regex must not contain the `:` + // character, even if it is not being used as a literal. + // Note that, since column families cannot contain the new line character + // `\n`, it is sufficient to use `.` as a full wildcard when matching + // column family names. + string family_name_regex_filter = 5; + + // Matches only cells from columns whose qualifiers satisfy the given RE2 + // regex. + // Note that, since column qualifiers can contain arbitrary bytes, the `\C` + // escape sequence must be used if a true wildcard is desired. The `.` + // character will not match the new line character `\n`, which may be + // present in a binary qualifier. + bytes column_qualifier_regex_filter = 6; + + // Matches only cells from columns within the given range. + ColumnRange column_range_filter = 7; + + // Matches only cells with timestamps within the given range. + TimestampRange timestamp_range_filter = 8; + + // Matches only cells with values that satisfy the given regular expression. + // Note that, since cell values can contain arbitrary bytes, the `\C` escape + // sequence must be used if a true wildcard is desired. The `.` character + // will not match the new line character `\n`, which may be present in a + // binary value. + bytes value_regex_filter = 9; + + // Matches only cells with values that fall within the given range. + ValueRange value_range_filter = 15; + + // Skips the first N cells of each row, matching all subsequent cells. + // If duplicate cells are present, as is possible when using an Interleave, + // each copy of the cell is counted separately. + int32 cells_per_row_offset_filter = 10; + + // Matches only the first N cells of each row. + // If duplicate cells are present, as is possible when using an Interleave, + // each copy of the cell is counted separately. + int32 cells_per_row_limit_filter = 11; + + // Matches only the most recent N cells within each column. For example, + // if N=2, this filter would match column `foo:bar` at timestamps 10 and 9, + // skip all earlier cells in `foo:bar`, and then begin matching again in + // column `foo:bar2`. + // If duplicate cells are present, as is possible when using an Interleave, + // each copy of the cell is counted separately. + int32 cells_per_column_limit_filter = 12; + + // Replaces each cell's value with the empty string. + bool strip_value_transformer = 13; + + // Applies the given label to all cells in the output row. This allows + // the client to determine which results were produced from which part of + // the filter. + // + // Values must be at most 15 characters in length, and match the RE2 + // pattern `[a-z0-9\\-]+` + // + // Due to a technical limitation, it is not currently possible to apply + // multiple labels to a cell. As a result, a Chain may have no more than + // one sub-filter which contains a `apply_label_transformer`. It is okay for + // an Interleave to contain multiple `apply_label_transformers`, as they + // will be applied to separate copies of the input. This may be relaxed in + // the future. + string apply_label_transformer = 19; + } +} + +// Specifies a particular change to be made to the contents of a row. +message Mutation { + // A Mutation which sets the value of the specified cell. + message SetCell { + // The name of the family into which new data should be written. + // Must match `[-_.a-zA-Z0-9]+` + string family_name = 1; + + // The qualifier of the column into which new data should be written. + // Can be any byte string, including the empty string. + bytes column_qualifier = 2; + + // The timestamp of the cell into which new data should be written. + // Use -1 for current Bigtable server time. + // Otherwise, the client should set this value itself, noting that the + // default value is a timestamp of zero if the field is left unspecified. + // Values must match the granularity of the table (e.g. micros, millis). + int64 timestamp_micros = 3; + + // The value to be written into the specified cell. + bytes value = 4; + } + + // A Mutation which deletes cells from the specified column, optionally + // restricting the deletions to a given timestamp range. + message DeleteFromColumn { + // The name of the family from which cells should be deleted. + // Must match `[-_.a-zA-Z0-9]+` + string family_name = 1; + + // The qualifier of the column from which cells should be deleted. + // Can be any byte string, including the empty string. + bytes column_qualifier = 2; + + // The range of timestamps within which cells should be deleted. + TimestampRange time_range = 3; + } + + // A Mutation which deletes all cells from the specified column family. + message DeleteFromFamily { + // The name of the family from which cells should be deleted. + // Must match `[-_.a-zA-Z0-9]+` + string family_name = 1; + } + + // A Mutation which deletes all cells from the containing row. + message DeleteFromRow { + + } + + // Which of the possible Mutation types to apply. + oneof mutation { + // Set a cell's value. + SetCell set_cell = 1; + + // Deletes cells from a column. + DeleteFromColumn delete_from_column = 2; + + // Deletes cells from a column family. + DeleteFromFamily delete_from_family = 3; + + // Deletes cells from the entire row. + DeleteFromRow delete_from_row = 4; + } +} + +// Specifies an atomic read/modify/write operation on the latest value of the +// specified column. +message ReadModifyWriteRule { + // The name of the family to which the read/modify/write should be applied. + // Must match `[-_.a-zA-Z0-9]+` + string family_name = 1; + + // The qualifier of the column to which the read/modify/write should be + // applied. + // Can be any byte string, including the empty string. + bytes column_qualifier = 2; + + // The rule used to determine the column's new latest value from its current + // latest value. + oneof rule { + // Rule specifying that `append_value` be appended to the existing value. + // If the targeted cell is unset, it will be treated as containing the + // empty string. + bytes append_value = 3; + + // Rule specifying that `increment_amount` be added to the existing value. + // If the targeted cell is unset, it will be treated as containing a zero. + // Otherwise, the targeted cell must contain an 8-byte value (interpreted + // as a 64-bit big-endian signed integer), or the entire request will fail. + int64 increment_amount = 4; + } +} diff --git a/handwritten/cloud-profiler/google/bytestream/bytestream.proto b/handwritten/cloud-profiler/google/bytestream/bytestream.proto new file mode 100644 index 00000000000..85e386fc2b2 --- /dev/null +++ b/handwritten/cloud-profiler/google/bytestream/bytestream.proto @@ -0,0 +1,181 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.bytestream; + +import "google/api/annotations.proto"; +import "google/protobuf/wrappers.proto"; + +option go_package = "google.golang.org/genproto/googleapis/bytestream;bytestream"; +option java_outer_classname = "ByteStreamProto"; +option java_package = "com.google.bytestream"; + + +// #### Introduction +// +// The Byte Stream API enables a client to read and write a stream of bytes to +// and from a resource. Resources have names, and these names are supplied in +// the API calls below to identify the resource that is being read from or +// written to. +// +// All implementations of the Byte Stream API export the interface defined here: +// +// * `Read()`: Reads the contents of a resource. +// +// * `Write()`: Writes the contents of a resource. The client can call `Write()` +// multiple times with the same resource and can check the status of the write +// by calling `QueryWriteStatus()`. +// +// #### Service parameters and metadata +// +// The ByteStream API provides no direct way to access/modify any metadata +// associated with the resource. +// +// #### Errors +// +// The errors returned by the service are in the Google canonical error space. +service ByteStream { + // `Read()` is used to retrieve the contents of a resource as a sequence + // of bytes. The bytes are returned in a sequence of responses, and the + // responses are delivered as the results of a server-side streaming RPC. + rpc Read(ReadRequest) returns (stream ReadResponse); + + // `Write()` is used to send the contents of a resource as a sequence of + // bytes. The bytes are sent in a sequence of request protos of a client-side + // streaming RPC. + // + // A `Write()` action is resumable. If there is an error or the connection is + // broken during the `Write()`, the client should check the status of the + // `Write()` by calling `QueryWriteStatus()` and continue writing from the + // returned `committed_size`. This may be less than the amount of data the + // client previously sent. + // + // Calling `Write()` on a resource name that was previously written and + // finalized could cause an error, depending on whether the underlying service + // allows over-writing of previously written resources. + // + // When the client closes the request channel, the service will respond with + // a `WriteResponse`. The service will not view the resource as `complete` + // until the client has sent a `WriteRequest` with `finish_write` set to + // `true`. Sending any requests on a stream after sending a request with + // `finish_write` set to `true` will cause an error. The client **should** + // check the `WriteResponse` it receives to determine how much data the + // service was able to commit and whether the service views the resource as + // `complete` or not. + rpc Write(stream WriteRequest) returns (WriteResponse); + + // `QueryWriteStatus()` is used to find the `committed_size` for a resource + // that is being written, which can then be used as the `write_offset` for + // the next `Write()` call. + // + // If the resource does not exist (i.e., the resource has been deleted, or the + // first `Write()` has not yet reached the service), this method returns the + // error `NOT_FOUND`. + // + // The client **may** call `QueryWriteStatus()` at any time to determine how + // much data has been processed for this resource. This is useful if the + // client is buffering data and needs to know which data can be safely + // evicted. For any sequence of `QueryWriteStatus()` calls for a given + // resource name, the sequence of returned `committed_size` values will be + // non-decreasing. + rpc QueryWriteStatus(QueryWriteStatusRequest) returns (QueryWriteStatusResponse); +} + +// Request object for ByteStream.Read. +message ReadRequest { + // The name of the resource to read. + string resource_name = 1; + + // The offset for the first byte to return in the read, relative to the start + // of the resource. + // + // A `read_offset` that is negative or greater than the size of the resource + // will cause an `OUT_OF_RANGE` error. + int64 read_offset = 2; + + // The maximum number of `data` bytes the server is allowed to return in the + // sum of all `ReadResponse` messages. A `read_limit` of zero indicates that + // there is no limit, and a negative `read_limit` will cause an error. + // + // If the stream returns fewer bytes than allowed by the `read_limit` and no + // error occurred, the stream includes all data from the `read_offset` to the + // end of the resource. + int64 read_limit = 3; +} + +// Response object for ByteStream.Read. +message ReadResponse { + // A portion of the data for the resource. The service **may** leave `data` + // empty for any given `ReadResponse`. This enables the service to inform the + // client that the request is still live while it is running an operation to + // generate more data. + bytes data = 10; +} + +// Request object for ByteStream.Write. +message WriteRequest { + // The name of the resource to write. This **must** be set on the first + // `WriteRequest` of each `Write()` action. If it is set on subsequent calls, + // it **must** match the value of the first request. + string resource_name = 1; + + // The offset from the beginning of the resource at which the data should be + // written. It is required on all `WriteRequest`s. + // + // In the first `WriteRequest` of a `Write()` action, it indicates + // the initial offset for the `Write()` call. The value **must** be equal to + // the `committed_size` that a call to `QueryWriteStatus()` would return. + // + // On subsequent calls, this value **must** be set and **must** be equal to + // the sum of the first `write_offset` and the sizes of all `data` bundles + // sent previously on this stream. + // + // An incorrect value will cause an error. + int64 write_offset = 2; + + // If `true`, this indicates that the write is complete. Sending any + // `WriteRequest`s subsequent to one in which `finish_write` is `true` will + // cause an error. + bool finish_write = 3; + + // A portion of the data for the resource. The client **may** leave `data` + // empty for any given `WriteRequest`. This enables the client to inform the + // service that the request is still live while it is running an operation to + // generate more data. + bytes data = 10; +} + +// Response object for ByteStream.Write. +message WriteResponse { + // The number of bytes that have been processed for the given resource. + int64 committed_size = 1; +} + +// Request object for ByteStream.QueryWriteStatus. +message QueryWriteStatusRequest { + // The name of the resource whose write status is being requested. + string resource_name = 1; +} + +// Response object for ByteStream.QueryWriteStatus. +message QueryWriteStatusResponse { + // The number of bytes that have been processed for the given resource. + int64 committed_size = 1; + + // `complete` is `true` only if the client has sent a `WriteRequest` with + // `finish_write` set to true, and the server has processed that request. + bool complete = 2; +} diff --git a/handwritten/cloud-profiler/google/cloud/audit/audit_log.proto b/handwritten/cloud-profiler/google/cloud/audit/audit_log.proto new file mode 100644 index 00000000000..eab66a1f9c2 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/audit/audit_log.proto @@ -0,0 +1,128 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.audit; + +import "google/api/annotations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/struct.proto"; +import "google/rpc/status.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/audit;audit"; +option java_multiple_files = true; +option java_outer_classname = "AuditLogProto"; +option java_package = "com.google.cloud.audit"; + + +// Common audit log format for Google Cloud Platform API operations. +message AuditLog { + // The name of the API service performing the operation. For example, + // `"datastore.googleapis.com"`. + string service_name = 7; + + // The name of the service method or operation. + // For API calls, this should be the name of the API method. + // For example, + // + // "google.datastore.v1.Datastore.RunQuery" + // "google.logging.v1.LoggingService.DeleteLog" + string method_name = 8; + + // The resource or collection that is the target of the operation. + // The name is a scheme-less URI, not including the API service name. + // For example: + // + // "shelves/SHELF_ID/books" + // "shelves/SHELF_ID/books/BOOK_ID" + string resource_name = 11; + + // The number of items returned from a List or Query API method, + // if applicable. + int64 num_response_items = 12; + + // The status of the overall operation. + google.rpc.Status status = 2; + + // Authentication information. + AuthenticationInfo authentication_info = 3; + + // Authorization information. If there are multiple + // resources or permissions involved, then there is + // one AuthorizationInfo element for each {resource, permission} tuple. + repeated AuthorizationInfo authorization_info = 9; + + // Metadata about the operation. + RequestMetadata request_metadata = 4; + + // The operation request. This may not include all request parameters, + // such as those that are too large, privacy-sensitive, or duplicated + // elsewhere in the log record. + // It should never include user-generated data, such as file contents. + // When the JSON object represented here has a proto equivalent, the proto + // name will be indicated in the `@type` property. + google.protobuf.Struct request = 16; + + // The operation response. This may not include all response elements, + // such as those that are too large, privacy-sensitive, or duplicated + // elsewhere in the log record. + // It should never include user-generated data, such as file contents. + // When the JSON object represented here has a proto equivalent, the proto + // name will be indicated in the `@type` property. + google.protobuf.Struct response = 17; + + // Other service-specific data about the request, response, and other + // activities. + google.protobuf.Any service_data = 15; +} + +// Authentication information for the operation. +message AuthenticationInfo { + // The email address of the authenticated user making the request. + string principal_email = 1; +} + +// Authorization information for the operation. +message AuthorizationInfo { + // The resource being accessed, as a REST-style string. For example: + // + // bigquery.googlapis.com/projects/PROJECTID/datasets/DATASETID + string resource = 1; + + // The required IAM permission. + string permission = 2; + + // Whether or not authorization for `resource` and `permission` + // was granted. + bool granted = 3; +} + +// Metadata about the request. +message RequestMetadata { + // The IP address of the caller. + string caller_ip = 1; + + // The user agent of the caller. + // This information is not authenticated and should be treated accordingly. + // For example: + // + // + `google-api-python-client/1.4.0`: + // The request was made by the Google API client for Python. + // + `Cloud SDK Command Line Tool apitools-client/1.0 gcloud/0.9.62`: + // The request was made by the Google Cloud SDK CLI (gcloud). + // + `AppEngine-Google; (+http://code.google.com/appengine; appid: s~my-project`: + // The request was made from the `my-project` App Engine app. + string caller_supplied_user_agent = 2; +} diff --git a/handwritten/cloud-profiler/google/cloud/bigquery/logging/v1/audit_data.proto b/handwritten/cloud-profiler/google/cloud/bigquery/logging/v1/audit_data.proto new file mode 100644 index 00000000000..2d474106fd4 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/bigquery/logging/v1/audit_data.proto @@ -0,0 +1,525 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.bigquery.logging.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/logging/v1;logging"; +option java_multiple_files = true; +option java_outer_classname = "AuditDataProto"; +option java_package = "com.google.cloud.bigquery.logging.v1"; + + +// BigQuery request and response messages for audit log. +// Note: `Table.schema` has been deprecated in favor of `Table.schemaJson`. +// `Table.schema` may continue to be present in your logs during this +// transition. +message AuditData { + // Request data for each BigQuery method. + oneof request { + // Table insert request. + TableInsertRequest table_insert_request = 1; + + // Table update request. + TableUpdateRequest table_update_request = 16; + + // Dataset list request. + DatasetListRequest dataset_list_request = 2; + + // Dataset insert request. + DatasetInsertRequest dataset_insert_request = 3; + + // Dataset update request. + DatasetUpdateRequest dataset_update_request = 4; + + // Job insert request. + JobInsertRequest job_insert_request = 5; + + // Job query request. + JobQueryRequest job_query_request = 6; + + // Job get query results request. + JobGetQueryResultsRequest job_get_query_results_request = 7; + + // Table data-list request. + TableDataListRequest table_data_list_request = 8; + } + + // Response data for each BigQuery method. + oneof response { + // Table insert response. + TableInsertResponse table_insert_response = 9; + + // Table update response. + TableUpdateResponse table_update_response = 10; + + // Dataset insert response. + DatasetInsertResponse dataset_insert_response = 11; + + // Dataset update response. + DatasetUpdateResponse dataset_update_response = 12; + + // Job insert response. + JobInsertResponse job_insert_response = 18; + + // Job query response. + JobQueryResponse job_query_response = 13; + + // Job get query results response. + JobGetQueryResultsResponse job_get_query_results_response = 14; + + // Deprecated: Job query-done response. Use this information for usage + // analysis. + JobQueryDoneResponse job_query_done_response = 15; + } + + // A job completion event. + JobCompletedEvent job_completed_event = 17; +} + +// Table insert request. +message TableInsertRequest { + // The new table. + Table resource = 1; +} + +// Table update request. +message TableUpdateRequest { + // The table to be updated. + Table resource = 1; +} + +// Table insert response. +message TableInsertResponse { + // Final state of the inserted table. + Table resource = 1; +} + +// Table update response. +message TableUpdateResponse { + // Final state of the updated table. + Table resource = 1; +} + +// Dataset list request. +message DatasetListRequest { + // Whether to list all datasets, including hidden ones. + bool list_all = 1; +} + +// Dataset insert request. +message DatasetInsertRequest { + // The dataset to be inserted. + Dataset resource = 1; +} + +// Dataset insert response. +message DatasetInsertResponse { + // Final state of the inserted dataset. + Dataset resource = 1; +} + +// Dataset update request. +message DatasetUpdateRequest { + // The dataset to be updated. + Dataset resource = 1; +} + +// Dataset update response. +message DatasetUpdateResponse { + // Final state of the updated dataset. + Dataset resource = 1; +} + +// Job insert request. +message JobInsertRequest { + // Job insert request. + Job resource = 1; +} + +// Job insert response. +message JobInsertResponse { + // Job insert response. + Job resource = 1; +} + +// Job query request. +message JobQueryRequest { + // The query. + string query = 1; + + // The maximum number of results. + uint32 max_results = 2; + + // The default dataset for tables that do not have a dataset specified. + DatasetName default_dataset = 3; + + // Project that the query should be charged to. + string project_id = 4; + + // If true, don't actually run the job. Just check that it would run. + bool dry_run = 5; +} + +// Job query response. +message JobQueryResponse { + // The total number of rows in the full query result set. + uint64 total_results = 1; + + // Information about the queried job. + Job job = 2; +} + +// Job getQueryResults request. +message JobGetQueryResultsRequest { + // Maximum number of results to return. + uint32 max_results = 1; + + // Zero-based row number at which to start. + uint64 start_row = 2; +} + +// Job getQueryResults response. +message JobGetQueryResultsResponse { + // Total number of results in query results. + uint64 total_results = 1; + + // The job that was created to run the query. + // It completed if `job.status.state` is `DONE`. + // It failed if `job.status.errorResult` is also present. + Job job = 2; +} + +// Job getQueryDone response. +message JobQueryDoneResponse { + // The job and status information. + // The job completed if `job.status.state` is `DONE`. + Job job = 1; +} + +// Query job completed event. +message JobCompletedEvent { + // Name of the event. + string event_name = 1; + + // Job information. + Job job = 2; +} + +// Table data-list request. +message TableDataListRequest { + // Starting row offset. + uint64 start_row = 1; + + // Maximum number of results to return. + uint32 max_results = 2; +} + +// Describes a BigQuery table. +// See the [Table](/bigquery/docs/reference/v2/tables) API resource +// for more details on individual fields. +// Note: `Table.schema` has been deprecated in favor of `Table.schemaJson`. +// `Table.schema` may continue to be present in your logs during this +// transition. +message Table { + // The name of the table. + TableName table_name = 1; + + // User-provided metadata for the table. + TableInfo info = 2; + + // A JSON representation of the table's schema. + string schema_json = 8; + + // If present, this is a virtual table defined by a SQL query. + TableViewDefinition view = 4; + + // The expiration date for the table, after which the table + // is deleted and the storage reclaimed. + // If not present, the table persists indefinitely. + google.protobuf.Timestamp expire_time = 5; + + // The time the table was created. + google.protobuf.Timestamp create_time = 6; + + // The time the table was last truncated + // by an operation with a `writeDisposition` of `WRITE_TRUNCATE`. + google.protobuf.Timestamp truncate_time = 7; +} + +// User-provided metadata for a table. +message TableInfo { + // A short name for the table, such as`"Analytics Data - Jan 2011"`. + string friendly_name = 1; + + // A long description, perhaps several paragraphs, + // describing the table contents in detail. + string description = 2; +} + +// Describes a virtual table defined by a SQL query. +message TableViewDefinition { + // SQL query defining the view. + string query = 1; +} + +// BigQuery dataset information. +// See the [Dataset](/bigquery/docs/reference/v2/datasets) API resource +// for more details on individual fields. +message Dataset { + // The name of the dataset. + DatasetName dataset_name = 1; + + // User-provided metadata for the dataset. + DatasetInfo info = 2; + + // The time the dataset was created. + google.protobuf.Timestamp create_time = 4; + + // The time the dataset was last modified. + google.protobuf.Timestamp update_time = 5; + + // The access control list for the dataset. + BigQueryAcl acl = 6; + + // If this field is present, each table that does not specify an + // expiration time is assigned an expiration time by adding this + // duration to the table's `createTime`. If this field is empty, + // there is no default table expiration time. + google.protobuf.Duration default_table_expire_duration = 8; +} + +// User-provided metadata for a dataset. +message DatasetInfo { + // A short name for the dataset, such as`"Analytics Data 2011"`. + string friendly_name = 1; + + // A long description, perhaps several paragraphs, + // describing the dataset contents in detail. + string description = 2; +} + +// An access control list. +message BigQueryAcl { + // Access control entry. + message Entry { + // The granted role, which can be `READER`, `WRITER`, or `OWNER`. + string role = 1; + + // Grants access to a group identified by an email address. + string group_email = 2; + + // Grants access to a user identified by an email address. + string user_email = 3; + + // Grants access to all members of a domain. + string domain = 4; + + // Grants access to special groups. Valid groups are `PROJECT_OWNERS`, + // `PROJECT_READERS`, `PROJECT_WRITERS` and `ALL_AUTHENTICATED_USERS`. + string special_group = 5; + + // Grants access to a BigQuery View. + TableName view_name = 6; + } + + // Access control entry list. + repeated Entry entries = 1; +} + +// Describes a job. +message Job { + // Job name. + JobName job_name = 1; + + // Job configuration. + JobConfiguration job_configuration = 2; + + // Job status. + JobStatus job_status = 3; + + // Job statistics. + JobStatistics job_statistics = 4; +} + +// Job configuration information. +// See the [Jobs](/bigquery/docs/reference/v2/jobs) API resource +// for more details on individual fields. +message JobConfiguration { + // Describes a query job, which executes a SQL-like query. + message Query { + // The SQL query to run. + string query = 1; + + // The table where results are written. + TableName destination_table = 2; + + // Describes when a job is allowed to create a table: + // `CREATE_IF_NEEDED`, `CREATE_NEVER`. + string create_disposition = 3; + + // Describes how writes affect existing tables: + // `WRITE_TRUNCATE`, `WRITE_APPEND`, `WRITE_EMPTY`. + string write_disposition = 4; + + // If a table name is specified without a dataset in a query, + // this dataset will be added to table name. + DatasetName default_dataset = 5; + + // Describes data sources outside BigQuery, if needed. + repeated TableDefinition table_definitions = 6; + } + + // Describes a load job, which loads data from an external source via + // the import pipeline. + message Load { + // URIs for the data to be imported. Only Google Cloud Storage URIs are + // supported. + repeated string source_uris = 1; + + // The table schema in JSON format representation of a TableSchema. + string schema_json = 6; + + // The table where the imported data is written. + TableName destination_table = 3; + + // Describes when a job is allowed to create a table: + // `CREATE_IF_NEEDED`, `CREATE_NEVER`. + string create_disposition = 4; + + // Describes how writes affect existing tables: + // `WRITE_TRUNCATE`, `WRITE_APPEND`, `WRITE_EMPTY`. + string write_disposition = 5; + } + + // Describes an extract job, which exports data to an external source + // via the export pipeline. + message Extract { + // Google Cloud Storage URIs where extracted data should be written. + repeated string destination_uris = 1; + + // The source table. + TableName source_table = 2; + } + + // Describes a copy job, which copies an existing table to another table. + message TableCopy { + // Source tables. + repeated TableName source_tables = 1; + + // Destination table. + TableName destination_table = 2; + + // Describes when a job is allowed to create a table: + // `CREATE_IF_NEEDED`, `CREATE_NEVER`. + string create_disposition = 3; + + // Describes how writes affect existing tables: + // `WRITE_TRUNCATE`, `WRITE_APPEND`, `WRITE_EMPTY`. + string write_disposition = 4; + } + + // Job configuration information. + oneof configuration { + // Query job information. + Query query = 5; + + // Load job information. + Load load = 6; + + // Extract job information. + Extract extract = 7; + + // TableCopy job information. + TableCopy table_copy = 8; + } + + // If true, don't actually run the job. Just check that it would run. + bool dry_run = 9; +} + +// Describes an external data source used in a query. +message TableDefinition { + // Name of the table, used in queries. + string name = 1; + + // Google Cloud Storage URIs for the data to be imported. + repeated string source_uris = 2; +} + +// Running state of a job. +message JobStatus { + // State of a job: `PENDING`, `RUNNING`, or `DONE`. + string state = 1; + + // If the job did not complete successfully, this field describes why. + google.rpc.Status error = 2; +} + +// Job statistics that may change after a job starts. +message JobStatistics { + // Time when the job was created. + google.protobuf.Timestamp create_time = 1; + + // Time when the job started. + google.protobuf.Timestamp start_time = 2; + + // Time when the job ended. + google.protobuf.Timestamp end_time = 3; + + // Total bytes processed for a job. + int64 total_processed_bytes = 4; + + // Processed bytes, adjusted by the job's CPU usage. + int64 total_billed_bytes = 5; + + // The tier assigned by CPU-based billing. + int32 billing_tier = 7; +} + +// The fully-qualified name for a dataset. +message DatasetName { + // The project ID. + string project_id = 1; + + // The dataset ID within the project. + string dataset_id = 2; +} + +// The fully-qualified name for a table. +message TableName { + // The project ID. + string project_id = 1; + + // The dataset ID within the project. + string dataset_id = 2; + + // The table ID of the table within the dataset. + string table_id = 3; +} + +// The fully-qualified name for a job. +message JobName { + // The project ID. + string project_id = 1; + + // The job ID within the project. + string job_id = 2; +} diff --git a/handwritten/cloud-profiler/google/cloud/billing/v1/cloud_billing.proto b/handwritten/cloud-profiler/google/cloud/billing/v1/cloud_billing.proto new file mode 100644 index 00000000000..9ce199863d5 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/billing/v1/cloud_billing.proto @@ -0,0 +1,214 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.billing.v1; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/billing/v1;billing"; +option java_multiple_files = true; +option java_outer_classname = "CloudBillingProto"; +option java_package = "com.google.cloud.billing.v1"; + + +// Retrieves Google Cloud Console billing accounts and associates them with +// projects. +service CloudBilling { + // Gets information about a billing account. The current authenticated user + // must be an [owner of the billing + // account](https://support.google.com/cloud/answer/4430947). + rpc GetBillingAccount(GetBillingAccountRequest) returns (BillingAccount) { + option (google.api.http) = { get: "/v1/{name=billingAccounts/*}" }; + } + + // Lists the billing accounts that the current authenticated user + // [owns](https://support.google.com/cloud/answer/4430947). + rpc ListBillingAccounts(ListBillingAccountsRequest) returns (ListBillingAccountsResponse) { + option (google.api.http) = { get: "/v1/billingAccounts" }; + } + + // Lists the projects associated with a billing account. The current + // authenticated user must be an [owner of the billing + // account](https://support.google.com/cloud/answer/4430947). + rpc ListProjectBillingInfo(ListProjectBillingInfoRequest) returns (ListProjectBillingInfoResponse) { + option (google.api.http) = { get: "/v1/{name=billingAccounts/*}/projects" }; + } + + // Gets the billing information for a project. The current authenticated user + // must have [permission to view the + // project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo + // ). + rpc GetProjectBillingInfo(GetProjectBillingInfoRequest) returns (ProjectBillingInfo) { + option (google.api.http) = { get: "/v1/{name=projects/*}/billingInfo" }; + } + + // Sets or updates the billing account associated with a project. You specify + // the new billing account by setting the `billing_account_name` in the + // `ProjectBillingInfo` resource to the resource name of a billing account. + // Associating a project with an open billing account enables billing on the + // project and allows charges for resource usage. If the project already had a + // billing account, this method changes the billing account used for resource + // usage charges. + // + // *Note:* Incurred charges that have not yet been reported in the transaction + // history of the Google Cloud Console may be billed to the new billing + // account, even if the charge occurred before the new billing account was + // assigned to the project. + // + // The current authenticated user must have ownership privileges for both the + // [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo + // ) and the [billing + // account](https://support.google.com/cloud/answer/4430947). + // + // You can disable billing on the project by setting the + // `billing_account_name` field to empty. This action disassociates the + // current billing account from the project. Any billable activity of your + // in-use services will stop, and your application could stop functioning as + // expected. Any unbilled charges to date will be billed to the previously + // associated account. The current authenticated user must be either an owner + // of the project or an owner of the billing account for the project. + // + // Note that associating a project with a *closed* billing account will have + // much the same effect as disabling billing on the project: any paid + // resources used by the project will be shut down. Thus, unless you wish to + // disable billing, you should always call this method with the name of an + // *open* billing account. + rpc UpdateProjectBillingInfo(UpdateProjectBillingInfoRequest) returns (ProjectBillingInfo) { + option (google.api.http) = { put: "/v1/{name=projects/*}/billingInfo" body: "project_billing_info" }; + } +} + +// A billing account in [Google Cloud +// Console](https://console.cloud.google.com/). You can assign a billing account +// to one or more projects. +message BillingAccount { + // The resource name of the billing account. The resource name has the form + // `billingAccounts/{billing_account_id}`. For example, + // `billingAccounts/012345-567890-ABCDEF` would be the resource name for + // billing account `012345-567890-ABCDEF`. + string name = 1; + + // True if the billing account is open, and will therefore be charged for any + // usage on associated projects. False if the billing account is closed, and + // therefore projects associated with it will be unable to use paid services. + bool open = 2; + + // The display name given to the billing account, such as `My Billing + // Account`. This name is displayed in the Google Cloud Console. + string display_name = 3; +} + +// Encapsulation of billing information for a Cloud Console project. A project +// has at most one associated billing account at a time (but a billing account +// can be assigned to multiple projects). +message ProjectBillingInfo { + // The resource name for the `ProjectBillingInfo`; has the form + // `projects/{project_id}/billingInfo`. For example, the resource name for the + // billing information for project `tokyo-rain-123` would be + // `projects/tokyo-rain-123/billingInfo`. This field is read-only. + string name = 1; + + // The ID of the project that this `ProjectBillingInfo` represents, such as + // `tokyo-rain-123`. This is a convenience field so that you don't need to + // parse the `name` field to obtain a project ID. This field is read-only. + string project_id = 2; + + // The resource name of the billing account associated with the project, if + // any. For example, `billingAccounts/012345-567890-ABCDEF`. + string billing_account_name = 3; + + // True if the project is associated with an open billing account, to which + // usage on the project is charged. False if the project is associated with a + // closed billing account, or no billing account at all, and therefore cannot + // use paid services. This field is read-only. + bool billing_enabled = 4; +} + +// Request message for `GetBillingAccount`. +message GetBillingAccountRequest { + // The resource name of the billing account to retrieve. For example, + // `billingAccounts/012345-567890-ABCDEF`. + string name = 1; +} + +// Request message for `ListBillingAccounts`. +message ListBillingAccountsRequest { + // Requested page size. The maximum page size is 100; this is also the + // default. + int32 page_size = 1; + + // A token identifying a page of results to return. This should be a + // `next_page_token` value returned from a previous `ListBillingAccounts` + // call. If unspecified, the first page of results is returned. + string page_token = 2; +} + +// Response message for `ListBillingAccounts`. +message ListBillingAccountsResponse { + // A list of billing accounts. + repeated BillingAccount billing_accounts = 1; + + // A token to retrieve the next page of results. To retrieve the next page, + // call `ListBillingAccounts` again with the `page_token` field set to this + // value. This field is empty if there are no more results to retrieve. + string next_page_token = 2; +} + +// Request message for `ListProjectBillingInfo`. +message ListProjectBillingInfoRequest { + // The resource name of the billing account associated with the projects that + // you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. + string name = 1; + + // Requested page size. The maximum page size is 100; this is also the + // default. + int32 page_size = 2; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous `ListProjectBillingInfo` + // call. If unspecified, the first page of results is returned. + string page_token = 3; +} + +// Request message for `ListProjectBillingInfoResponse`. +message ListProjectBillingInfoResponse { + // A list of `ProjectBillingInfo` resources representing the projects + // associated with the billing account. + repeated ProjectBillingInfo project_billing_info = 1; + + // A token to retrieve the next page of results. To retrieve the next page, + // call `ListProjectBillingInfo` again with the `page_token` field set to this + // value. This field is empty if there are no more results to retrieve. + string next_page_token = 2; +} + +// Request message for `GetProjectBillingInfo`. +message GetProjectBillingInfoRequest { + // The resource name of the project for which billing information is + // retrieved. For example, `projects/tokyo-rain-123`. + string name = 1; +} + +// Request message for `UpdateProjectBillingInfo`. +message UpdateProjectBillingInfoRequest { + // The resource name of the project associated with the billing information + // that you want to update. For example, `projects/tokyo-rain-123`. + string name = 1; + + // The new billing information for the project. Read-only fields are ignored; + // thus, you may leave empty all fields except `billing_account_name`. + ProjectBillingInfo project_billing_info = 2; +} diff --git a/handwritten/cloud-profiler/google/cloud/dataproc/v1/clusters.proto b/handwritten/cloud-profiler/google/cloud/dataproc/v1/clusters.proto new file mode 100644 index 00000000000..fc7f45eadf4 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/dataproc/v1/clusters.proto @@ -0,0 +1,444 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.dataproc.v1; + +import "google/api/annotations.proto"; +import "google/cloud/dataproc/v1/operations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/dataproc/v1;dataproc"; +option java_multiple_files = true; +option java_outer_classname = "ClustersProto"; +option java_package = "com.google.cloud.dataproc.v1"; + + +// The ClusterControllerService provides methods to manage clusters +// of Google Compute Engine instances. +service ClusterController { + // Creates a cluster in a project. + rpc CreateCluster(CreateClusterRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/regions/{region}/clusters" body: "cluster" }; + } + + // Updates a cluster in a project. + rpc UpdateCluster(UpdateClusterRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { patch: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}" body: "cluster" }; + } + + // Deletes a cluster in a project. + rpc DeleteCluster(DeleteClusterRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { delete: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}" }; + } + + // Gets the resource representation for a cluster in a project. + rpc GetCluster(GetClusterRequest) returns (Cluster) { + option (google.api.http) = { get: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}" }; + } + + // Lists all regions/{region}/clusters in a project. + rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { + option (google.api.http) = { get: "/v1/projects/{project_id}/regions/{region}/clusters" }; + } + + // Gets cluster diagnostic information. + // After the operation completes, the Operation.response field + // contains `DiagnoseClusterOutputLocation`. + rpc DiagnoseCluster(DiagnoseClusterRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}:diagnose" body: "*" }; + } +} + +// Describes the identifying information, config, and status of +// a cluster of Google Compute Engine instances. +message Cluster { + // [Required] The Google Cloud Platform project ID that the cluster belongs to. + string project_id = 1; + + // [Required] The cluster name. Cluster names within a project must be + // unique. Names of deleted clusters can be reused. + string cluster_name = 2; + + // [Required] The cluster config. Note that Cloud Dataproc may set + // default values, and values may change when clusters are updated. + ClusterConfig config = 3; + + // [Output-only] Cluster status. + ClusterStatus status = 4; + + // [Output-only] The previous cluster status. + repeated ClusterStatus status_history = 7; + + // [Output-only] A cluster UUID (Unique Universal Identifier). Cloud Dataproc + // generates this value when it creates the cluster. + string cluster_uuid = 6; +} + +// The cluster config. +message ClusterConfig { + // [Optional] A Google Cloud Storage staging bucket used for sharing generated + // SSH keys and config. If you do not specify a staging bucket, Cloud + // Dataproc will determine an appropriate Cloud Storage location (US, + // ASIA, or EU) for your cluster's staging bucket according to the Google + // Compute Engine zone where your cluster is deployed, and then it will create + // and manage this project-level, per-location bucket for you. + string config_bucket = 1; + + // [Required] The shared Google Compute Engine config settings for + // all instances in a cluster. + GceClusterConfig gce_cluster_config = 8; + + // [Optional] The Google Compute Engine config settings for + // the master instance in a cluster. + InstanceGroupConfig master_config = 9; + + // [Optional] The Google Compute Engine config settings for + // worker instances in a cluster. + InstanceGroupConfig worker_config = 10; + + // [Optional] The Google Compute Engine config settings for + // additional worker instances in a cluster. + InstanceGroupConfig secondary_worker_config = 12; + + // [Optional] The config settings for software inside the cluster. + SoftwareConfig software_config = 13; + + // [Optional] Commands to execute on each node after config is + // completed. By default, executables are run on master and all worker nodes. + // You can test a node's role metadata to run an executable on + // a master or worker node, as shown below using `curl` (you can also use `wget`): + // + // ROLE=$(curl -H Metadata-Flavor:Google http://metadata/computeMetadata/v1/instance/attributes/dataproc-role) + // if [[ "${ROLE}" == 'Master' ]]; then + // ... master specific actions ... + // else + // ... worker specific actions ... + // fi + repeated NodeInitializationAction initialization_actions = 11; +} + +// Common config settings for resources of Google Compute Engine cluster +// instances, applicable to all instances in the cluster. +message GceClusterConfig { + // [Required] The zone where the Google Compute Engine cluster will be located. + // Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/zones/[zone]`. + string zone_uri = 1; + + // [Optional] The Google Compute Engine network to be used for machine + // communications. Cannot be specified with subnetwork_uri. If neither + // `network_uri` nor `subnetwork_uri` is specified, the "default" network of + // the project is used, if it exists. Cannot be a "Custom Subnet Network" (see + // [Using Subnetworks](/compute/docs/subnetworks) for more information). + // Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/regions/global/default`. + string network_uri = 2; + + // [Optional] The Google Compute Engine subnetwork to be used for machine + // communications. Cannot be specified with network_uri. + // Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/regions/us-east1/sub0`. + string subnetwork_uri = 6; + + // [Optional] If true, all instances in the cluster will only have internal IP + // addresses. By default, clusters are not restricted to internal IP addresses, + // and will have ephemeral external IP addresses assigned to each instance. + // This `internal_ip_only` restriction can only be enabled for subnetwork + // enabled networks, and all off-cluster dependencies must be configured to be + // accessible without external IP addresses. + bool internal_ip_only = 7; + + // [Optional] The URIs of service account scopes to be included in Google + // Compute Engine instances. The following base set of scopes is always + // included: + // + // * https://www.googleapis.com/auth/cloud.useraccounts.readonly + // * https://www.googleapis.com/auth/devstorage.read_write + // * https://www.googleapis.com/auth/logging.write + // + // If no scopes are specified, the following defaults are also provided: + // + // * https://www.googleapis.com/auth/bigquery + // * https://www.googleapis.com/auth/bigtable.admin.table + // * https://www.googleapis.com/auth/bigtable.data + // * https://www.googleapis.com/auth/devstorage.full_control + repeated string service_account_scopes = 3; + + // The Google Compute Engine tags to add to all instances (see + // [Labeling instances](/compute/docs/label-or-tag-resources#labeling_instances)). + repeated string tags = 4; + + // The Google Compute Engine metadata entries to add to all instances (see + // [Project and instance metadata](https://cloud.google.com/compute/docs/storing-retrieving-metadata#project_and_instance_metadata)). + map metadata = 5; +} + +// [Optional] The config settings for Google Compute Engine resources in +// an instance group, such as a master or worker group. +message InstanceGroupConfig { + // [Required] The number of VM instances in the instance group. + // For master instance groups, must be set to 1. + int32 num_instances = 1; + + // [Optional] The list of instance names. Cloud Dataproc derives the names from + // `cluster_name`, `num_instances`, and the instance group if not set by user + // (recommended practice is to let Cloud Dataproc derive the name). + repeated string instance_names = 2; + + // [Output-only] The Google Compute Engine image resource used for cluster + // instances. Inferred from `SoftwareConfig.image_version`. + string image_uri = 3; + + // [Required] The Google Compute Engine machine type used for cluster instances. + // Example: `https://www.googleapis.com/compute/v1/projects/[project_id]/zones/us-east1-a/machineTypes/n1-standard-2`. + string machine_type_uri = 4; + + // [Optional] Disk option config settings. + DiskConfig disk_config = 5; + + // [Optional] Specifies that this instance group contains preemptible instances. + bool is_preemptible = 6; + + // [Output-only] The config for Google Compute Engine Instance Group + // Manager that manages this group. + // This is only used for preemptible instance groups. + ManagedGroupConfig managed_group_config = 7; +} + +// Specifies the resources used to actively manage an instance group. +message ManagedGroupConfig { + // [Output-only] The name of the Instance Template used for the Managed + // Instance Group. + string instance_template_name = 1; + + // [Output-only] The name of the Instance Group Manager for this group. + string instance_group_manager_name = 2; +} + +// Specifies the config of disk options for a group of VM instances. +message DiskConfig { + // [Optional] Size in GB of the boot disk (default is 500GB). + int32 boot_disk_size_gb = 1; + + // [Optional] Number of attached SSDs, from 0 to 4 (default is 0). + // If SSDs are not attached, the boot disk is used to store runtime logs and + // [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data. + // If one or more SSDs are attached, this runtime bulk + // data is spread across them, and the boot disk contains only basic + // config and installed binaries. + int32 num_local_ssds = 2; +} + +// Specifies an executable to run on a fully configured node and a +// timeout period for executable completion. +message NodeInitializationAction { + // [Required] Google Cloud Storage URI of executable file. + string executable_file = 1; + + // [Optional] Amount of time executable has to complete. Default is + // 10 minutes. Cluster creation fails with an explanatory error message (the + // name of the executable that caused the error and the exceeded timeout + // period) if the executable is not completed at end of the timeout period. + google.protobuf.Duration execution_timeout = 2; +} + +// The status of a cluster and its instances. +message ClusterStatus { + // The cluster state. + enum State { + // The cluster state is unknown. + UNKNOWN = 0; + + // The cluster is being created and set up. It is not ready for use. + CREATING = 1; + + // The cluster is currently running and healthy. It is ready for use. + RUNNING = 2; + + // The cluster encountered an error. It is not ready for use. + ERROR = 3; + + // The cluster is being deleted. It cannot be used. + DELETING = 4; + + // The cluster is being updated. It continues to accept and process jobs. + UPDATING = 5; + } + + // [Output-only] The cluster's state. + State state = 1; + + // [Output-only] Optional details of cluster's state. + string detail = 2; + + // [Output-only] Time when this state was entered. + google.protobuf.Timestamp state_start_time = 3; +} + +// Specifies the selection and config of software inside the cluster. +message SoftwareConfig { + // [Optional] The version of software inside the cluster. It must match the + // regular expression `[0-9]+\.[0-9]+`. If unspecified, it defaults to the + // latest version (see [Cloud Dataproc Versioning](/dataproc/versioning)). + string image_version = 1; + + // [Optional] The properties to set on daemon config files. + // + // Property keys are specified in `prefix:property` format, such as + // `core:fs.defaultFS`. The following are supported prefixes + // and their mappings: + // + // * core: `core-site.xml` + // * hdfs: `hdfs-site.xml` + // * mapred: `mapred-site.xml` + // * yarn: `yarn-site.xml` + // * hive: `hive-site.xml` + // * pig: `pig.properties` + // * spark: `spark-defaults.conf` + map properties = 2; +} + +// A request to create a cluster. +message CreateClusterRequest { + // [Required] The ID of the Google Cloud Platform project that the cluster + // belongs to. + string project_id = 1; + + // [Required] The Cloud Dataproc region in which to handle the request. + string region = 3; + + // [Required] The cluster to create. + Cluster cluster = 2; +} + +// A request to update a cluster. +message UpdateClusterRequest { + // [Required] The ID of the Google Cloud Platform project the + // cluster belongs to. + string project_id = 1; + + // [Required] The Cloud Dataproc region in which to handle the request. + string region = 5; + + // [Required] The cluster name. + string cluster_name = 2; + + // [Required] The changes to the cluster. + Cluster cluster = 3; + + // [Required] Specifies the path, relative to Cluster, of + // the field to update. For example, to change the number of workers + // in a cluster to 5, the update_mask parameter would be + // specified as config.worker_config.num_instances, + // and the `PATCH` request body would specify the new value, as follows: + // + // { + // "config":{ + // "workerConfig":{ + // "numInstances":"5" + // } + // } + // } + // Similarly, to change the number of preemptible workers in a cluster to 5, the + // update_mask parameter would be config.secondary_worker_config.num_instances, + // and the `PATCH` request body would be set as follows: + // + // { + // "config":{ + // "secondaryWorkerConfig":{ + // "numInstances":"5" + // } + // } + // } + // Note: Currently, config.worker_config.num_instances + // and config.secondary_worker_config.num_instances are the only + // fields that can be updated. + google.protobuf.FieldMask update_mask = 4; +} + +// A request to delete a cluster. +message DeleteClusterRequest { + // [Required] The ID of the Google Cloud Platform project that the cluster + // belongs to. + string project_id = 1; + + // [Required] The Cloud Dataproc region in which to handle the request. + string region = 3; + + // [Required] The cluster name. + string cluster_name = 2; +} + +// Request to get the resource representation for a cluster in a project. +message GetClusterRequest { + // [Required] The ID of the Google Cloud Platform project that the cluster + // belongs to. + string project_id = 1; + + // [Required] The Cloud Dataproc region in which to handle the request. + string region = 3; + + // [Required] The cluster name. + string cluster_name = 2; +} + +// A request to list the clusters in a project. +message ListClustersRequest { + // [Required] The ID of the Google Cloud Platform project that the cluster + // belongs to. + string project_id = 1; + + // [Required] The Cloud Dataproc region in which to handle the request. + string region = 4; + + // [Optional] The standard List page size. + int32 page_size = 2; + + // [Optional] The standard List page token. + string page_token = 3; +} + +// The list of all clusters in a project. +message ListClustersResponse { + // [Output-only] The clusters in the project. + repeated Cluster clusters = 1; + + // [Output-only] This token is included in the response if there are more + // results to fetch. To fetch additional results, provide this value as the + // `page_token` in a subsequent ListClustersRequest. + string next_page_token = 2; +} + +// A request to collect cluster diagnostic information. +message DiagnoseClusterRequest { + // [Required] The ID of the Google Cloud Platform project that the cluster + // belongs to. + string project_id = 1; + + // [Required] The Cloud Dataproc region in which to handle the request. + string region = 3; + + // [Required] The cluster name. + string cluster_name = 2; +} + +// The location of diagnostic output. +message DiagnoseClusterResults { + // [Output-only] The Google Cloud Storage URI of the diagnostic output. + // The output report is a plain text file with a summary of collected + // diagnostics. + string output_uri = 1; +} diff --git a/handwritten/cloud-profiler/google/cloud/dataproc/v1/jobs.proto b/handwritten/cloud-profiler/google/cloud/dataproc/v1/jobs.proto new file mode 100644 index 00000000000..854ce9b972a --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/dataproc/v1/jobs.proto @@ -0,0 +1,573 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.dataproc.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/dataproc/v1;dataproc"; +option java_multiple_files = true; +option java_outer_classname = "JobsProto"; +option java_package = "com.google.cloud.dataproc.v1"; + + +// The JobController provides methods to manage jobs. +service JobController { + // Submits a job to a cluster. + rpc SubmitJob(SubmitJobRequest) returns (Job) { + option (google.api.http) = { post: "/v1/projects/{project_id}/regions/{region}/jobs:submit" body: "*" }; + } + + // Gets the resource representation for a job in a project. + rpc GetJob(GetJobRequest) returns (Job) { + option (google.api.http) = { get: "/v1/projects/{project_id}/regions/{region}/jobs/{job_id}" }; + } + + // Lists regions/{region}/jobs in a project. + rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { + option (google.api.http) = { get: "/v1/projects/{project_id}/regions/{region}/jobs" }; + } + + // Starts a job cancellation request. To access the job resource + // after cancellation, call + // [regions/{region}/jobs.list](/dataproc/reference/rest/v1/projects.regions.jobs/list) or + // [regions/{region}/jobs.get](/dataproc/reference/rest/v1/projects.regions.jobs/get). + rpc CancelJob(CancelJobRequest) returns (Job) { + option (google.api.http) = { post: "/v1/projects/{project_id}/regions/{region}/jobs/{job_id}:cancel" body: "*" }; + } + + // Deletes the job from the project. If the job is active, the delete fails, + // and the response returns `FAILED_PRECONDITION`. + rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/projects/{project_id}/regions/{region}/jobs/{job_id}" }; + } +} + +// The runtime logging config of the job. +message LoggingConfig { + // The Log4j level for job execution. When running an + // [Apache Hive](http://hive.apache.org/) job, Cloud + // Dataproc configures the Hive client to an equivalent verbosity level. + enum Level { + // Level is unspecified. Use default level for log4j. + LEVEL_UNSPECIFIED = 0; + + // Use ALL level for log4j. + ALL = 1; + + // Use TRACE level for log4j. + TRACE = 2; + + // Use DEBUG level for log4j. + DEBUG = 3; + + // Use INFO level for log4j. + INFO = 4; + + // Use WARN level for log4j. + WARN = 5; + + // Use ERROR level for log4j. + ERROR = 6; + + // Use FATAL level for log4j. + FATAL = 7; + + // Turn off log4j. + OFF = 8; + } + + // The per-package log levels for the driver. This may include + // "root" package name to configure rootLogger. + // Examples: + // 'com.google = FATAL', 'root = INFO', 'org.apache = DEBUG' + map driver_log_levels = 2; +} + +// A Cloud Dataproc job for running +// [Apache Hadoop MapReduce](https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html) +// jobs on [Apache Hadoop YARN](https://hadoop.apache.org/docs/r2.7.1/hadoop-yarn/hadoop-yarn-site/YARN.html). +message HadoopJob { + // [Required] Indicates the location of the driver's main class. Specify + // either the jar file that contains the main class or the main class name. + // To specify both, add the jar file to `jar_file_uris`, and then specify + // the main class name in this property. + oneof driver { + // The HCFS URI of the jar file containing the main class. + // Examples: + // 'gs://foo-bucket/analytics-binaries/extract-useful-metrics-mr.jar' + // 'hdfs:/tmp/test-samples/custom-wordcount.jar' + // 'file:///home/usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar' + string main_jar_file_uri = 1; + + // The name of the driver's main class. The jar file containing the class + // must be in the default CLASSPATH or specified in `jar_file_uris`. + string main_class = 2; + } + + // [Optional] The arguments to pass to the driver. Do not + // include arguments, such as `-libjars` or `-Dfoo=bar`, that can be set as job + // properties, since a collision may occur that causes an incorrect job + // submission. + repeated string args = 3; + + // [Optional] Jar file URIs to add to the CLASSPATHs of the + // Hadoop driver and tasks. + repeated string jar_file_uris = 4; + + // [Optional] HCFS (Hadoop Compatible Filesystem) URIs of files to be copied + // to the working directory of Hadoop drivers and distributed tasks. Useful + // for naively parallel tasks. + repeated string file_uris = 5; + + // [Optional] HCFS URIs of archives to be extracted in the working directory of + // Hadoop drivers and tasks. Supported file types: + // .jar, .tar, .tar.gz, .tgz, or .zip. + repeated string archive_uris = 6; + + // [Optional] A mapping of property names to values, used to configure Hadoop. + // Properties that conflict with values set by the Cloud Dataproc API may be + // overwritten. Can include properties set in /etc/hadoop/conf/*-site and + // classes in user code. + map properties = 7; + + // [Optional] The runtime log config for job execution. + LoggingConfig logging_config = 8; +} + +// A Cloud Dataproc job for running [Apache Spark](http://spark.apache.org/) +// applications on YARN. +message SparkJob { + // [Required] The specification of the main method to call to drive the job. + // Specify either the jar file that contains the main class or the main class + // name. To pass both a main jar and a main class in that jar, add the jar to + // `CommonJob.jar_file_uris`, and then specify the main class name in `main_class`. + oneof driver { + // The HCFS URI of the jar file that contains the main class. + string main_jar_file_uri = 1; + + // The name of the driver's main class. The jar file that contains the class + // must be in the default CLASSPATH or specified in `jar_file_uris`. + string main_class = 2; + } + + // [Optional] The arguments to pass to the driver. Do not include arguments, + // such as `--conf`, that can be set as job properties, since a collision may + // occur that causes an incorrect job submission. + repeated string args = 3; + + // [Optional] HCFS URIs of jar files to add to the CLASSPATHs of the + // Spark driver and tasks. + repeated string jar_file_uris = 4; + + // [Optional] HCFS URIs of files to be copied to the working directory of + // Spark drivers and distributed tasks. Useful for naively parallel tasks. + repeated string file_uris = 5; + + // [Optional] HCFS URIs of archives to be extracted in the working directory + // of Spark drivers and tasks. Supported file types: + // .jar, .tar, .tar.gz, .tgz, and .zip. + repeated string archive_uris = 6; + + // [Optional] A mapping of property names to values, used to configure Spark. + // Properties that conflict with values set by the Cloud Dataproc API may be + // overwritten. Can include properties set in + // /etc/spark/conf/spark-defaults.conf and classes in user code. + map properties = 7; + + // [Optional] The runtime log config for job execution. + LoggingConfig logging_config = 8; +} + +// A Cloud Dataproc job for running +// [Apache PySpark](https://spark.apache.org/docs/0.9.0/python-programming-guide.html) +// applications on YARN. +message PySparkJob { + // [Required] The HCFS URI of the main Python file to use as the driver. Must + // be a .py file. + string main_python_file_uri = 1; + + // [Optional] The arguments to pass to the driver. Do not include arguments, + // such as `--conf`, that can be set as job properties, since a collision may + // occur that causes an incorrect job submission. + repeated string args = 2; + + // [Optional] HCFS file URIs of Python files to pass to the PySpark + // framework. Supported file types: .py, .egg, and .zip. + repeated string python_file_uris = 3; + + // [Optional] HCFS URIs of jar files to add to the CLASSPATHs of the + // Python driver and tasks. + repeated string jar_file_uris = 4; + + // [Optional] HCFS URIs of files to be copied to the working directory of + // Python drivers and distributed tasks. Useful for naively parallel tasks. + repeated string file_uris = 5; + + // [Optional] HCFS URIs of archives to be extracted in the working directory of + // .jar, .tar, .tar.gz, .tgz, and .zip. + repeated string archive_uris = 6; + + // [Optional] A mapping of property names to values, used to configure PySpark. + // Properties that conflict with values set by the Cloud Dataproc API may be + // overwritten. Can include properties set in + // /etc/spark/conf/spark-defaults.conf and classes in user code. + map properties = 7; + + // [Optional] The runtime log config for job execution. + LoggingConfig logging_config = 8; +} + +// A list of queries to run on a cluster. +message QueryList { + // [Required] The queries to execute. You do not need to terminate a query + // with a semicolon. Multiple queries can be specified in one string + // by separating each with a semicolon. Here is an example of an Cloud + // Dataproc API snippet that uses a QueryList to specify a HiveJob: + // + // "hiveJob": { + // "queryList": { + // "queries": [ + // "query1", + // "query2", + // "query3;query4", + // ] + // } + // } + repeated string queries = 1; +} + +// A Cloud Dataproc job for running [Apache Hive](https://hive.apache.org/) +// queries on YARN. +message HiveJob { + // [Required] The sequence of Hive queries to execute, specified as either + // an HCFS file URI or a list of queries. + oneof queries { + // The HCFS URI of the script that contains Hive queries. + string query_file_uri = 1; + + // A list of queries. + QueryList query_list = 2; + } + + // [Optional] Whether to continue executing queries if a query fails. + // The default value is `false`. Setting to `true` can be useful when executing + // independent parallel queries. + bool continue_on_failure = 3; + + // [Optional] Mapping of query variable names to values (equivalent to the + // Hive command: `SET name="value";`). + map script_variables = 4; + + // [Optional] A mapping of property names and values, used to configure Hive. + // Properties that conflict with values set by the Cloud Dataproc API may be + // overwritten. Can include properties set in /etc/hadoop/conf/*-site.xml, + // /etc/hive/conf/hive-site.xml, and classes in user code. + map properties = 5; + + // [Optional] HCFS URIs of jar files to add to the CLASSPATH of the + // Hive server and Hadoop MapReduce (MR) tasks. Can contain Hive SerDes + // and UDFs. + repeated string jar_file_uris = 6; +} + +// A Cloud Dataproc job for running [Apache Spark SQL](http://spark.apache.org/sql/) +// queries. +message SparkSqlJob { + // [Required] The sequence of Spark SQL queries to execute, specified as + // either an HCFS file URI or as a list of queries. + oneof queries { + // The HCFS URI of the script that contains SQL queries. + string query_file_uri = 1; + + // A list of queries. + QueryList query_list = 2; + } + + // [Optional] Mapping of query variable names to values (equivalent to the + // Spark SQL command: SET `name="value";`). + map script_variables = 3; + + // [Optional] A mapping of property names to values, used to configure + // Spark SQL's SparkConf. Properties that conflict with values set by the + // Cloud Dataproc API may be overwritten. + map properties = 4; + + // [Optional] HCFS URIs of jar files to be added to the Spark CLASSPATH. + repeated string jar_file_uris = 56; + + // [Optional] The runtime log config for job execution. + LoggingConfig logging_config = 6; +} + +// A Cloud Dataproc job for running [Apache Pig](https://pig.apache.org/) +// queries on YARN. +message PigJob { + // [Required] The sequence of Pig queries to execute, specified as an HCFS + // file URI or a list of queries. + oneof queries { + // The HCFS URI of the script that contains the Pig queries. + string query_file_uri = 1; + + // A list of queries. + QueryList query_list = 2; + } + + // [Optional] Whether to continue executing queries if a query fails. + // The default value is `false`. Setting to `true` can be useful when executing + // independent parallel queries. + bool continue_on_failure = 3; + + // [Optional] Mapping of query variable names to values (equivalent to the Pig + // command: `name=[value]`). + map script_variables = 4; + + // [Optional] A mapping of property names to values, used to configure Pig. + // Properties that conflict with values set by the Cloud Dataproc API may be + // overwritten. Can include properties set in /etc/hadoop/conf/*-site.xml, + // /etc/pig/conf/pig.properties, and classes in user code. + map properties = 5; + + // [Optional] HCFS URIs of jar files to add to the CLASSPATH of + // the Pig Client and Hadoop MapReduce (MR) tasks. Can contain Pig UDFs. + repeated string jar_file_uris = 6; + + // [Optional] The runtime log config for job execution. + LoggingConfig logging_config = 7; +} + +// Cloud Dataproc job config. +message JobPlacement { + // [Required] The name of the cluster where the job will be submitted. + string cluster_name = 1; + + // [Output-only] A cluster UUID generated by the Cloud Dataproc service when + // the job is submitted. + string cluster_uuid = 2; +} + +// Cloud Dataproc job status. +message JobStatus { + // The job state. + enum State { + // The job state is unknown. + STATE_UNSPECIFIED = 0; + + // The job is pending; it has been submitted, but is not yet running. + PENDING = 1; + + // Job has been received by the service and completed initial setup; + // it will soon be submitted to the cluster. + SETUP_DONE = 8; + + // The job is running on the cluster. + RUNNING = 2; + + // A CancelJob request has been received, but is pending. + CANCEL_PENDING = 3; + + // Transient in-flight resources have been canceled, and the request to + // cancel the running job has been issued to the cluster. + CANCEL_STARTED = 7; + + // The job cancellation was successful. + CANCELLED = 4; + + // The job has completed successfully. + DONE = 5; + + // The job has completed, but encountered an error. + ERROR = 6; + } + + // [Output-only] A state message specifying the overall job state. + State state = 1; + + // [Output-only] Optional job state details, such as an error + // description if the state is ERROR. + string details = 2; + + // [Output-only] The time when this state was entered. + google.protobuf.Timestamp state_start_time = 6; +} + +// Encapsulates the full scoping used to reference a job. +message JobReference { + // [Required] The ID of the Google Cloud Platform project that the job + // belongs to. + string project_id = 1; + + // [Optional] The job ID, which must be unique within the project. The job ID + // is generated by the server upon job submission or provided by the user as a + // means to perform retries without creating duplicate jobs. The ID must + // contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or + // hyphens (-). The maximum length is 512 characters. + string job_id = 2; +} + +// A Cloud Dataproc job resource. +message Job { + // [Optional] The fully qualified reference to the job, which can be used to + // obtain the equivalent REST path of the job resource. If this property + // is not specified when a job is created, the server generates a + // job_id. + JobReference reference = 1; + + // [Required] Job information, including how, when, and where to + // run the job. + JobPlacement placement = 2; + + // [Required] The application/framework-specific portion of the job. + oneof type_job { + // Job is a Hadoop job. + HadoopJob hadoop_job = 3; + + // Job is a Spark job. + SparkJob spark_job = 4; + + // Job is a Pyspark job. + PySparkJob pyspark_job = 5; + + // Job is a Hive job. + HiveJob hive_job = 6; + + // Job is a Pig job. + PigJob pig_job = 7; + + // Job is a SparkSql job. + SparkSqlJob spark_sql_job = 12; + } + + // [Output-only] The job status. Additional application-specific + // status information may be contained in the type_job + // and yarn_applications fields. + JobStatus status = 8; + + // [Output-only] The previous job status. + repeated JobStatus status_history = 13; + + // [Output-only] A URI pointing to the location of the stdout of the job's + // driver program. + string driver_output_resource_uri = 17; + + // [Output-only] If present, the location of miscellaneous control files + // which may be used as part of job setup and handling. If not present, + // control files may be placed in the same location as `driver_output_uri`. + string driver_control_files_uri = 15; +} + +// A request to submit a job. +message SubmitJobRequest { + // [Required] The ID of the Google Cloud Platform project that the job + // belongs to. + string project_id = 1; + + // [Required] The Cloud Dataproc region in which to handle the request. + string region = 3; + + // [Required] The job resource. + Job job = 2; +} + +// A request to get the resource representation for a job in a project. +message GetJobRequest { + // [Required] The ID of the Google Cloud Platform project that the job + // belongs to. + string project_id = 1; + + // [Required] The Cloud Dataproc region in which to handle the request. + string region = 3; + + // [Required] The job ID. + string job_id = 2; +} + +// A request to list jobs in a project. +message ListJobsRequest { + // A matcher that specifies categories of job states. + enum JobStateMatcher { + // Match all jobs, regardless of state. + ALL = 0; + + // Only match jobs in non-terminal states: PENDING, RUNNING, or + // CANCEL_PENDING. + ACTIVE = 1; + + // Only match jobs in terminal states: CANCELLED, DONE, or ERROR. + NON_ACTIVE = 2; + } + + // [Required] The ID of the Google Cloud Platform project that the job + // belongs to. + string project_id = 1; + + // [Required] The Cloud Dataproc region in which to handle the request. + string region = 6; + + // [Optional] The number of results to return in each response. + int32 page_size = 2; + + // [Optional] The page token, returned by a previous call, to request the + // next page of results. + string page_token = 3; + + // [Optional] If set, the returned jobs list includes only jobs that were + // submitted to the named cluster. + string cluster_name = 4; + + // [Optional] Specifies enumerated categories of jobs to list + // (default = match ALL jobs). + JobStateMatcher job_state_matcher = 5; +} + +// A list of jobs in a project. +message ListJobsResponse { + // [Output-only] Jobs list. + repeated Job jobs = 1; + + // [Optional] This token is included in the response if there are more results + // to fetch. To fetch additional results, provide this value as the + // `page_token` in a subsequent ListJobsRequest. + string next_page_token = 2; +} + +// A request to cancel a job. +message CancelJobRequest { + // [Required] The ID of the Google Cloud Platform project that the job + // belongs to. + string project_id = 1; + + // [Required] The Cloud Dataproc region in which to handle the request. + string region = 3; + + // [Required] The job ID. + string job_id = 2; +} + +// A request to delete a job. +message DeleteJobRequest { + // [Required] The ID of the Google Cloud Platform project that the job + // belongs to. + string project_id = 1; + + // [Required] The Cloud Dataproc region in which to handle the request. + string region = 3; + + // [Required] The job ID. + string job_id = 2; +} diff --git a/handwritten/cloud-profiler/google/cloud/dataproc/v1/operations.proto b/handwritten/cloud-profiler/google/cloud/dataproc/v1/operations.proto new file mode 100644 index 00000000000..61227ed2a8a --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/dataproc/v1/operations.proto @@ -0,0 +1,79 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.dataproc.v1; + +import "google/api/annotations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/dataproc/v1;dataproc"; +option java_multiple_files = true; +option java_outer_classname = "OperationsProto"; +option java_package = "com.google.cloud.dataproc.v1"; + + +// The status of the operation. +message ClusterOperationStatus { + // The operation state. + enum State { + // Unused. + UNKNOWN = 0; + + // The operation has been created. + PENDING = 1; + + // The operation is running. + RUNNING = 2; + + // The operation is done; either cancelled or completed. + DONE = 3; + } + + // [Output-only] A message containing the operation state. + State state = 1; + + // [Output-only] A message containing the detailed operation state. + string inner_state = 2; + + // [Output-only]A message containing any operation metadata details. + string details = 3; + + // [Output-only] The time this state was entered. + google.protobuf.Timestamp state_start_time = 4; +} + +// Metadata describing the operation. +message ClusterOperationMetadata { + // [Output-only] Name of the cluster for the operation. + string cluster_name = 7; + + // [Output-only] Cluster UUID for the operation. + string cluster_uuid = 8; + + // [Output-only] Current operation status. + ClusterOperationStatus status = 9; + + // [Output-only] The previous operation status. + repeated ClusterOperationStatus status_history = 10; + + // [Output-only] The operation type. + string operation_type = 11; + + // [Output-only] Short description of operation. + string description = 12; +} diff --git a/handwritten/cloud-profiler/google/cloud/functions/README.md b/handwritten/cloud-profiler/google/cloud/functions/README.md new file mode 100644 index 00000000000..4a9d225c7b6 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/functions/README.md @@ -0,0 +1,2 @@ +API for managing lightweight user-provided functions executed in response to +events. \ No newline at end of file diff --git a/handwritten/cloud-profiler/google/cloud/functions/artman_functions.yaml b/handwritten/cloud-profiler/google/cloud/functions/artman_functions.yaml new file mode 100644 index 00000000000..9453b47a085 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/functions/artman_functions.yaml @@ -0,0 +1,94 @@ +common: + api_name: functions + api_version: v1beta2 + organization_name: google-cloud + service_yaml: functions.yaml + gapic_yaml: v1beta2/functions_gapic.yaml + src_proto_paths: + - v1beta2 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-functions + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/google-cloud-functions-v1beta2 +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-functions-v1beta2 + - name: grpc + dest: generated/python/proto-google-cloud-functions-v1beta2 +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-functions-v1beta2 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/functions/v1beta2 + dest: google-cloud-functions/lib/google/cloud/functions/v1beta2 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-functions +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: functions/apiv1beta2 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: google-functions-v1beta2/cloud.google.com/go/functions/apiv1beta2 +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/functions + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v1beta2 + dest: packages/functions/src/v1beta2 +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/cloud/functions/functions.yaml b/handwritten/cloud-profiler/google/cloud/functions/functions.yaml new file mode 100644 index 00000000000..01c703bcdf7 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/functions/functions.yaml @@ -0,0 +1,20 @@ +type: google.api.Service +config_version: 0 +name: cloudfunctions.googleapis.com +title: Google Cloud Functions API + +apis: +- name: google.cloud.functions.v1beta2.CloudFunctionsService + +documentation: + summary: + 'Google Cloud Functions is a lightweight, event-based, asynchronous compute + solution that allows you to create small, single-purpose functions that + respond to cloud events without the need to manage a server or a runtime + environment.' + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/cloud/functions/v1beta2/functions.proto b/handwritten/cloud-profiler/google/cloud/functions/v1beta2/functions.proto new file mode 100644 index 00000000000..0280a8dea11 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/functions/v1beta2/functions.proto @@ -0,0 +1,295 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.functions.v1beta2; + +import "google/api/annotations.proto"; +import "google/api/auth.proto"; +import "google/cloud/functions/v1beta2/operations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/functions/v1beta2;functions"; +option java_multiple_files = true; +option java_outer_classname = "FunctionsProto"; +option java_package = "com.google.cloud.functions.v1beta2"; +option objc_class_prefix = "GCF"; + + +// A service that application uses to manipulate triggers and functions. +service CloudFunctionsService { + // Returns a list of functions that belong to the requested project. + rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) { + option (google.api.http) = { get: "/v1beta2/{location=projects/*/locations/*}/functions" }; + } + + // Returns a function with the given name from the requested project. + rpc GetFunction(GetFunctionRequest) returns (CloudFunction) { + option (google.api.http) = { get: "/v1beta2/{name=projects/*/locations/*/functions/*}" }; + } + + // Creates a new function. If a function with the given name already exists in + // the specified project, the long running operation will return + // `ALREADY_EXISTS` error. + rpc CreateFunction(CreateFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1beta2/{location=projects/*/locations/*}/functions" body: "function" }; + } + + // Updates existing function. + rpc UpdateFunction(UpdateFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { put: "/v1beta2/{name=projects/*/locations/*/functions/*}" body: "function" }; + } + + // Deletes a function with the given name from the specified project. If the + // given function is used by some trigger, the trigger will be updated to + // remove this function. + rpc DeleteFunction(DeleteFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { delete: "/v1beta2/{name=projects/*/locations/*/functions/*}" }; + } + + // Invokes synchronously deployed function. To be used for testing, very + // limited traffic allowed. + rpc CallFunction(CallFunctionRequest) returns (CallFunctionResponse) { + option (google.api.http) = { post: "/v1beta2/{name=projects/*/locations/*/functions/*}:call" body: "*" }; + } +} + +// Describes a Cloud Function that contains user computation executed in +// response to an event. It encapsulate function and triggers configurations. +message CloudFunction { + // A user-defined name of the function. Function names must be unique + // globally and match pattern `projects/*/locations/*/functions/*` + string name = 1; + + // The location of the function source code. + oneof source_code { + // The URL, starting with gs://, pointing to the zip archive which contains + // the function. + string source_archive_url = 14; + + // The hosted repository where the function is defined. + SourceRepository source_repository = 3; + } + + // An event that triggers the function. + oneof trigger { + // An HTTPS endpoint type of source that can be triggered via URL. + HTTPSTrigger https_trigger = 6; + + // A source that fires events in response to a condition in another service. + EventTrigger event_trigger = 12; + } + + // Output only. Status of the function deployment. + CloudFunctionStatus status = 7; + + // Output only. Name of the most recent operation modifying the function. If + // the function status is `DEPLOYING` or `DELETING`, then it points to the + // active operation. + string latest_operation = 8; + + // The name of the function (as defined in source code) that will be + // executed. Defaults to the resource name suffix, if not specified. For + // backward compatibility, if function with given name is not found, then the + // system will try to use function named "function". + // For Node.js this is name of a function exported by the module specified + // in `source_location`. + string entry_point = 9; + + // The function execution timeout. Execution is considered failed and + // can be terminated if the function is not completed at the end of the + // timeout period. Defaults to 60 seconds. + google.protobuf.Duration timeout = 10; + + // The amount of memory in MB available for a function. + // Defaults to 256MB. + int32 available_memory_mb = 11; + + // Output only. The service account of the function. + string service_account = 13; + + // Output only. The last update timestamp of a Cloud Function. + google.protobuf.Timestamp update_time = 15; +} + +// Describes HTTPSTrigger, could be used to connect web hooks to function. +message HTTPSTrigger { + // Output only. The deployed url for the function. + string url = 1; +} + +// Describes EventTrigger, used to request events be sent from another +// service. +message EventTrigger { + // `event_type` names contain the service that is sending an event and the + // kind of event that was fired. Must be of the form + // `providers/*/eventTypes/*` e.g. Directly handle a Message published to + // Google Cloud Pub/Sub `providers/cloud.pubsub/eventTypes/topic.publish` + // + // Handle an object changing in Google Cloud Storage + // `providers/cloud.storage/eventTypes/object.change` + // + // Handle a write to the Firebase Realtime Database + // `providers/firebase.database/eventTypes/data.write` + string event_type = 1; + + // Which instance of the source's service should send events. E.g. for Pub/Sub + // this would be a Pub/Sub topic at `projects/*/topics/*`. For Google Cloud + // Storage this would be a bucket at `projects/*/buckets/*`. For any source + // that only supports one instance per-project, this should be the name of the + // project (`projects/*`) + string resource = 2; +} + +// Describes the location of the function source in a remote repository. +message SourceRepository { + // URL to the hosted repository where the function is defined. Only paths in + // https://source.developers.google.com domain are supported. The path should + // contain the name of the repository. + string repository_url = 1; + + // The path within the repository where the function is defined. The path + // should point to the directory where Cloud Functions files are located. Use + // "/" if the function is defined directly in the root directory of a + // repository. + string source_path = 2; + + // The version of a function. Defaults to the latest version of the master + // branch. + oneof version { + // The name of the branch from which the function should be fetched. + string branch = 3; + + // The name of the tag that captures the state of the repository from + // which the function should be fetched. + string tag = 4; + + // The id of the revision that captures the state of the repository from + // which the function should be fetched. + string revision = 5; + } + + // Output only. The id of the revision that was resolved at the moment of + // function creation or update. For example when a user deployed from a + // branch, it will be the revision id of the latest change on this branch at + // that time. If user deployed from revision then this value will be always + // equal to the revision specified by the user. + string deployed_revision = 6; +} + +// Request for the `CreateFunction` method. +message CreateFunctionRequest { + // The project and location in which the function should be created, specified + // in the format `projects/*/locations/*` + string location = 1; + + // Function to be created. + CloudFunction function = 2; +} + +// Request for the `UpdateFunction` method. +message UpdateFunctionRequest { + // The name of the function to be updated. + string name = 1; + + // New version of the function. + CloudFunction function = 2; +} + +// Request for the `GetFunction` method. +message GetFunctionRequest { + // The name of the function which details should be obtained. + string name = 1; +} + +// Request for the `ListFunctions` method. +message ListFunctionsRequest { + // The project and location from which the function should be listed, + // specified in the format `projects/*/locations/*` + // If you want to list functions in all locations, use "-" in place of a + // location. + string location = 1; + + // Maximum number of functions to return per call. + int32 page_size = 2; + + // The value returned by the last + // `ListFunctionsResponse`; indicates that + // this is a continuation of a prior `ListFunctions` call, and that the + // system should return the next page of data. + string page_token = 3; +} + +// Response for the `ListFunctions` method. +message ListFunctionsResponse { + // The functions that match the request. + repeated CloudFunction functions = 1; + + // If not empty, indicates that there may be more functions that match + // the request; this value should be passed in a new + // [google.cloud.functions.v1beta2.ListFunctionsRequest][] + // to get more functions. + string next_page_token = 2; +} + +// Request for the `DeleteFunction` method. +message DeleteFunctionRequest { + // The name of the function which should be deleted. + string name = 1; +} + +// Request for the `CallFunction` method. +message CallFunctionRequest { + // The name of the function to be called. + string name = 1; + + // Input to be passed to the function. + string data = 2; +} + +// Response of `CallFunction` method. +message CallFunctionResponse { + // Execution id of function invocation. + string execution_id = 1; + + // Result populated for successful execution of synchronous function. Will + // not be populated if function does not return a result through context. + string result = 2; + + // Either system or user-function generated error. Set if execution + // was not successful. + string error = 3; +} + +// Describes the current stage of a deployment. +enum CloudFunctionStatus { + // Status not specified. + STATUS_UNSPECIFIED = 0; + + // Successfully deployed. + READY = 1; + + // Not deployed correctly - behavior is undefined. The item should be updated + // or deleted to move it out of this state. + FAILED = 2; + + // Creation or update in progress. + DEPLOYING = 3; + + // Deletion in progress. + DELETING = 4; +} diff --git a/handwritten/cloud-profiler/google/cloud/functions/v1beta2/functions_gapic.yaml b/handwritten/cloud-profiler/google/cloud/functions/v1beta2/functions_gapic.yaml new file mode 100644 index 00000000000..3632903f168 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/functions/v1beta2/functions_gapic.yaml @@ -0,0 +1,157 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.functions.v1beta2 + python: + package_name: google.cloud.functions_v1beta2.gapic + go: + package_name: cloud.google.com/go/cloud/functions/apiv1beta2 + csharp: + package_name: Google.Cloud.Functions.V1beta2 + ruby: + package_name: Google::Cloud::Functions::V1beta2 + php: + package_name: Google\Cloud\Functions\V1beta2 + nodejs: + package_name: functions.v1beta2 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.cloud.functions.v1beta2.CloudFunctionsService + collections: + - name_pattern: projects/{project}/locations/{location} + entity_name: location + - name_pattern: projects/{project}/locations/{location}/functions/{function} + entity_name: function + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + methods: + - name: ListFunctions + flattening: + groups: + - parameters: + - location + required_fields: + - location + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: functions + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + location: location + timeout_millis: 60000 + - name: GetFunction + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: function + timeout_millis: 60000 + - name: CreateFunction + flattening: + groups: + - parameters: + - location + - function + required_fields: + - location + - function + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + location: location + timeout_millis: 60000 + long_running: + return_type: google.cloud.functions.v1beta2.CloudFunction + metadata_type: google.cloud.functions.v1beta2.OperationMetadataV1Beta2 + initial_poll_delay_millis: 20000 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 45000 + total_poll_timeout_millis: 86400000 + - name: UpdateFunction + flattening: + groups: + - parameters: + - name + - function + required_fields: + - name + - function + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: function + timeout_millis: 60000 + long_running: + return_type: google.cloud.functions.v1beta2.CloudFunction + metadata_type: google.cloud.functions.v1beta2.OperationMetadataV1Beta2 + initial_poll_delay_millis: 20000 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 45000 + total_poll_timeout_millis: 86400000 + - name: DeleteFunction + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: function + timeout_millis: 60000 + long_running: + return_type: google.protobuf.Empty + metadata_type: google.cloud.functions.v1beta2.OperationMetadataV1Beta2 + initial_poll_delay_millis: 20000 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 45000 + total_poll_timeout_millis: 86400000 + - name: CallFunction + flattening: + groups: + - parameters: + - name + - data + required_fields: + - name + - data + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + name: function + timeout_millis: 60000 diff --git a/handwritten/cloud-profiler/google/cloud/functions/v1beta2/operations.proto b/handwritten/cloud-profiler/google/cloud/functions/v1beta2/operations.proto new file mode 100644 index 00000000000..2a6f267e845 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/functions/v1beta2/operations.proto @@ -0,0 +1,54 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.functions.v1beta2; + +import "google/api/annotations.proto"; +import "google/protobuf/any.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/functions/v1beta2;functions"; +option java_multiple_files = true; +option java_outer_classname = "FunctionsOperationsProto"; +option java_package = "com.google.cloud.functions.v1beta2"; + + +// Metadata describing an [Operation][google.longrunning.Operation] +message OperationMetadataV1Beta2 { + // Target of the operation - for example + // projects/project-1/locations/region-1/functions/function-1 + string target = 1; + + // Type of operation. + OperationType type = 2; + + // The original request that started the operation. + google.protobuf.Any request = 3; +} + +// A type of an operation. +enum OperationType { + // Unknown operation type. + OPERATION_UNSPECIFIED = 0; + + // Triggered by CreateFunction call + CREATE_FUNCTION = 1; + + // Triggered by UpdateFunction call + UPDATE_FUNCTION = 2; + + // Triggered by DeleteFunction call. + DELETE_FUNCTION = 3; +} diff --git a/handwritten/cloud-profiler/google/cloud/language/README.md b/handwritten/cloud-profiler/google/cloud/language/README.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/handwritten/cloud-profiler/google/cloud/language/artman_language_v1.yaml b/handwritten/cloud-profiler/google/cloud/language/artman_language_v1.yaml new file mode 100644 index 00000000000..dafe2731075 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/language/artman_language_v1.yaml @@ -0,0 +1,112 @@ +common: + api_name: language + api_version: v1 + organization_name: google-cloud + service_yaml: language_v1.yaml + gapic_yaml: v1/language_gapic.yaml + src_proto_paths: + - v1 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-language + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-language-v1 + - name: grpc + dest: generated/java/grpc-google-cloud-language-v1 + - name: proto + dest: generated/java/proto-google-cloud-language-v1 +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-language-v1 + - name: grpc + dest: generated/python/proto-google-cloud-language-v1 + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: google/cloud/language_v1 + dest: language/google/cloud/language_v1 + - src: tests/unit/gapic/v1 + dest: language/tests/gapic + - name: grpc + src: google/cloud/proto + dest: language/google/cloud/proto +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-language-v1 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-language + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/language/v1 + dest: google-cloud-language/lib/google/cloud/language/v1 +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: language/apiv1 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-cloud-language-v1/vendor +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + release_level: BETA + package_version: + grpc_dep_lower_bound: 0.11.0 + publish_targets: + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v1 + dest: packages/language/src/v1 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/language +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/cloud/language/artman_language_v1beta2.yaml b/handwritten/cloud-profiler/google/cloud/language/artman_language_v1beta2.yaml new file mode 100644 index 00000000000..27da616dffb --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/language/artman_language_v1beta2.yaml @@ -0,0 +1,112 @@ +common: + api_name: language + api_version: v1beta2 + organization_name: google-cloud + service_yaml: language_v1beta2.yaml + gapic_yaml: v1beta2/language_gapic.yaml + src_proto_paths: + - v1beta2 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-language + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-language-v1beta2 + - name: grpc + dest: generated/java/grpc-google-cloud-language-v1beta2 + - name: proto + dest: generated/java/proto-google-cloud-language-v1beta2 +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: google/cloud/language_v1beta2 + dest: language/google/cloud/language_v1beta2 + - src: tests/unit/gapic/v1beta2 + dest: language/tests/gapic + - name: grpc + src: google/cloud/proto/language/v1beta2 + dest: language/google/cloud/proto/language/v1beta2 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-language-v1beta2 + - name: grpc + dest: generated/python/proto-google-cloud-language-v1beta2 +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-language-v1beta2 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/language/v1beta2 + dest: google-cloud-language/lib/google/cloud/language/v1beta2 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-language-v1beta2 +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: language/apiv1beta2 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-cloud-language-v1beta2/vendor +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + release_level: BETA + package_version: + grpc_dep_lower_bound: 0.11.0 + publish_targets: + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v1beta2 + dest: packages/language/src/v1beta2 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/language-v1beta2 +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/cloud/language/language.yaml b/handwritten/cloud-profiler/google/cloud/language/language.yaml new file mode 100644 index 00000000000..02db1f6f0a2 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/language/language.yaml @@ -0,0 +1,30 @@ +type: google.api.Service +config_version: 3 +name: language.googleapis.com +title: Google Cloud Natural Language API + +apis: +- name: google.cloud.language.v1.LanguageService +- name: google.cloud.language.v1beta1.LanguageService +- name: google.cloud.language.v1beta2.LanguageService + +types: +- name: google.protobuf.Timestamp +- name: google.rpc.Status + +enums: +- name: google.rpc.Code + +documentation: + summary: |- + Provides natural language understanding technologies to developers. Examples + include sentiment analysis, entity recognition, entity sentiment analysis, + and text annotations. + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-language, + https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/cloud/language/language_v1.yaml b/handwritten/cloud-profiler/google/cloud/language/language_v1.yaml new file mode 100644 index 00000000000..7af5eaee694 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/language/language_v1.yaml @@ -0,0 +1,19 @@ +type: google.api.Service +config_version: 2 +name: language.googleapis.com +title: Google Cloud Natural Language API + +apis: +- name: google.cloud.language.v1.LanguageService + +documentation: + summary: + 'Google Cloud Natural Language API provides natural language understanding + technologies to developers. Examples include sentiment analysis, entity + recognition, and text annotations.' + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/cloud/language/language_v1beta2.yaml b/handwritten/cloud-profiler/google/cloud/language/language_v1beta2.yaml new file mode 100644 index 00000000000..aae1f6f55ec --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/language/language_v1beta2.yaml @@ -0,0 +1,19 @@ +type: google.api.Service +config_version: 2 +name: language.googleapis.com +title: Google Cloud Natural Language API + +apis: +- name: google.cloud.language.v1beta2.LanguageService + +documentation: + summary: + 'Google Cloud Natural Language API provides natural language understanding + technologies to developers. Examples include sentiment analysis, entity + recognition, and text annotations.' + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/cloud/language/v1/language_gapic.yaml b/handwritten/cloud-profiler/google/cloud/language/v1/language_gapic.yaml new file mode 100644 index 00000000000..cb902f889d5 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/language/v1/language_gapic.yaml @@ -0,0 +1,120 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.language.v1 + python: + package_name: google.cloud.language_v1.gapic + go: + package_name: cloud.google.com/go/language/apiv1 + release_level: GA + csharp: + package_name: Google.Cloud.Language.V1 + release_level: GA + ruby: + package_name: Google::Cloud::Language::V1 + php: + package_name: Google\Cloud\Language\V1 + nodejs: + package_name: language.v1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.cloud.language.v1.LanguageService + smoke_test: + method: AnalyzeSentiment + init_fields: + - document.content="Hello, world!" + - document.type=PLAIN_TEXT + collections: [] + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 60000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 60000 + total_timeout_millis: 600000 + methods: + - name: AnalyzeSentiment + flattening: + groups: + - parameters: + - document + required_fields: + - document + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 + - name: AnalyzeEntities + flattening: + groups: + - parameters: + - document + - encoding_type + required_fields: + - document + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 + - name: AnalyzeEntitySentiment + flattening: + groups: + - parameters: + - document + - encoding_type + required_fields: + - document + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 + - name: AnalyzeSyntax + flattening: + groups: + - parameters: + - document + - encoding_type + required_fields: + - document + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 + - name: ClassifyText + flattening: + groups: + - parameters: + - document + required_fields: + - document + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 + - name: AnnotateText + flattening: + groups: + - parameters: + - document + - features + - encoding_type + required_fields: + - document + - features + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 diff --git a/handwritten/cloud-profiler/google/cloud/language/v1/language_service.proto b/handwritten/cloud-profiler/google/cloud/language/v1/language_service.proto new file mode 100644 index 00000000000..6895b0d82d4 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/language/v1/language_service.proto @@ -0,0 +1,1040 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.language.v1; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/language/v1;language"; +option java_multiple_files = true; +option java_outer_classname = "LanguageServiceProto"; +option java_package = "com.google.cloud.language.v1"; + + +// Provides text analysis operations such as sentiment analysis and entity +// recognition. +service LanguageService { + // Analyzes the sentiment of the provided text. + rpc AnalyzeSentiment(AnalyzeSentimentRequest) returns (AnalyzeSentimentResponse) { + option (google.api.http) = { post: "/v1/documents:analyzeSentiment" body: "*" }; + } + + // Finds named entities (currently proper names and common nouns) in the text + // along with entity types, salience, mentions for each entity, and + // other properties. + rpc AnalyzeEntities(AnalyzeEntitiesRequest) returns (AnalyzeEntitiesResponse) { + option (google.api.http) = { post: "/v1/documents:analyzeEntities" body: "*" }; + } + + // Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes + // sentiment associated with each entity and its mentions. + rpc AnalyzeEntitySentiment(AnalyzeEntitySentimentRequest) returns (AnalyzeEntitySentimentResponse) { + option (google.api.http) = { post: "/v1/documents:analyzeEntitySentiment" body: "*" }; + } + + // Analyzes the syntax of the text and provides sentence boundaries and + // tokenization along with part of speech tags, dependency trees, and other + // properties. + rpc AnalyzeSyntax(AnalyzeSyntaxRequest) returns (AnalyzeSyntaxResponse) { + option (google.api.http) = { post: "/v1/documents:analyzeSyntax" body: "*" }; + } + + // Classifies a document into categories. + rpc ClassifyText(ClassifyTextRequest) returns (ClassifyTextResponse) { + option (google.api.http) = { post: "/v1/documents:classifyText" body: "*" }; + } + + // A convenience method that provides all the features that analyzeSentiment, + // analyzeEntities, and analyzeSyntax provide in one call. + rpc AnnotateText(AnnotateTextRequest) returns (AnnotateTextResponse) { + option (google.api.http) = { post: "/v1/documents:annotateText" body: "*" }; + } +} + +// ################################################################ # +// +// Represents the input to API methods. +message Document { + // The document types enum. + enum Type { + // The content type is not specified. + TYPE_UNSPECIFIED = 0; + + // Plain text + PLAIN_TEXT = 1; + + // HTML + HTML = 2; + } + + // Required. If the type is not set or is `TYPE_UNSPECIFIED`, + // returns an `INVALID_ARGUMENT` error. + Type type = 1; + + // The source of the document: a string containing the content or a + // Google Cloud Storage URI. + oneof source { + // The content of the input in string format. + string content = 2; + + // The Google Cloud Storage URI where the file content is located. + // This URI must be of the form: gs://bucket_name/object_name. For more + // details, see https://cloud.google.com/storage/docs/reference-uris. + // NOTE: Cloud Storage object versioning is not supported. + string gcs_content_uri = 3; + } + + // The language of the document (if not specified, the language is + // automatically detected). Both ISO and BCP-47 language codes are + // accepted.
+ // [Language Support](/natural-language/docs/languages) + // lists currently supported languages for each API method. + // If the language (either specified by the caller or automatically detected) + // is not supported by the called API method, an `INVALID_ARGUMENT` error + // is returned. + string language = 4; +} + +// Represents a sentence in the input document. +message Sentence { + // The sentence text. + TextSpan text = 1; + + // For calls to [AnalyzeSentiment][] or if + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment] is set to + // true, this field will contain the sentiment for the sentence. + Sentiment sentiment = 2; +} + +// Represents a phrase in the text that is a known entity, such as +// a person, an organization, or location. The API associates information, such +// as salience and mentions, with entities. +message Entity { + // The type of the entity. + enum Type { + // Unknown + UNKNOWN = 0; + + // Person + PERSON = 1; + + // Location + LOCATION = 2; + + // Organization + ORGANIZATION = 3; + + // Event + EVENT = 4; + + // Work of art + WORK_OF_ART = 5; + + // Consumer goods + CONSUMER_GOOD = 6; + + // Other types + OTHER = 7; + } + + // The representative name for the entity. + string name = 1; + + // The entity type. + Type type = 2; + + // Metadata associated with the entity. + // + // Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if + // available. The associated keys are "wikipedia_url" and "mid", respectively. + map metadata = 3; + + // The salience score associated with the entity in the [0, 1.0] range. + // + // The salience score for an entity provides information about the + // importance or centrality of that entity to the entire document text. + // Scores closer to 0 are less salient, while scores closer to 1.0 are highly + // salient. + float salience = 4; + + // The mentions of this entity in the input document. The API currently + // supports proper noun mentions. + repeated EntityMention mentions = 5; + + // For calls to [AnalyzeEntitySentiment][] or if + // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] is set to + // true, this field will contain the aggregate sentiment expressed for this + // entity in the provided document. + Sentiment sentiment = 6; +} + +// Represents the smallest syntactic building block of the text. +message Token { + // The token text. + TextSpan text = 1; + + // Parts of speech tag for this token. + PartOfSpeech part_of_speech = 2; + + // Dependency tree parse for this token. + DependencyEdge dependency_edge = 3; + + // [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + string lemma = 4; +} + +// Represents the feeling associated with the entire text or entities in +// the text. +message Sentiment { + // A non-negative number in the [0, +inf) range, which represents + // the absolute magnitude of sentiment regardless of score (positive or + // negative). + float magnitude = 2; + + // Sentiment score between -1.0 (negative sentiment) and 1.0 + // (positive sentiment). + float score = 3; +} + +// Represents part of speech information for a token. Parts of speech +// are as defined in +// http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf +message PartOfSpeech { + // The part of speech tags enum. + enum Tag { + // Unknown + UNKNOWN = 0; + + // Adjective + ADJ = 1; + + // Adposition (preposition and postposition) + ADP = 2; + + // Adverb + ADV = 3; + + // Conjunction + CONJ = 4; + + // Determiner + DET = 5; + + // Noun (common and proper) + NOUN = 6; + + // Cardinal number + NUM = 7; + + // Pronoun + PRON = 8; + + // Particle or other function word + PRT = 9; + + // Punctuation + PUNCT = 10; + + // Verb (all tenses and modes) + VERB = 11; + + // Other: foreign words, typos, abbreviations + X = 12; + + // Affix + AFFIX = 13; + } + + // The characteristic of a verb that expresses time flow during an event. + enum Aspect { + // Aspect is not applicable in the analyzed language or is not predicted. + ASPECT_UNKNOWN = 0; + + // Perfective + PERFECTIVE = 1; + + // Imperfective + IMPERFECTIVE = 2; + + // Progressive + PROGRESSIVE = 3; + } + + // The grammatical function performed by a noun or pronoun in a phrase, + // clause, or sentence. In some languages, other parts of speech, such as + // adjective and determiner, take case inflection in agreement with the noun. + enum Case { + // Case is not applicable in the analyzed language or is not predicted. + CASE_UNKNOWN = 0; + + // Accusative + ACCUSATIVE = 1; + + // Adverbial + ADVERBIAL = 2; + + // Complementive + COMPLEMENTIVE = 3; + + // Dative + DATIVE = 4; + + // Genitive + GENITIVE = 5; + + // Instrumental + INSTRUMENTAL = 6; + + // Locative + LOCATIVE = 7; + + // Nominative + NOMINATIVE = 8; + + // Oblique + OBLIQUE = 9; + + // Partitive + PARTITIVE = 10; + + // Prepositional + PREPOSITIONAL = 11; + + // Reflexive + REFLEXIVE_CASE = 12; + + // Relative + RELATIVE_CASE = 13; + + // Vocative + VOCATIVE = 14; + } + + // Depending on the language, Form can be categorizing different forms of + // verbs, adjectives, adverbs, etc. For example, categorizing inflected + // endings of verbs and adjectives or distinguishing between short and long + // forms of adjectives and participles + enum Form { + // Form is not applicable in the analyzed language or is not predicted. + FORM_UNKNOWN = 0; + + // Adnomial + ADNOMIAL = 1; + + // Auxiliary + AUXILIARY = 2; + + // Complementizer + COMPLEMENTIZER = 3; + + // Final ending + FINAL_ENDING = 4; + + // Gerund + GERUND = 5; + + // Realis + REALIS = 6; + + // Irrealis + IRREALIS = 7; + + // Short form + SHORT = 8; + + // Long form + LONG = 9; + + // Order form + ORDER = 10; + + // Specific form + SPECIFIC = 11; + } + + // Gender classes of nouns reflected in the behaviour of associated words. + enum Gender { + // Gender is not applicable in the analyzed language or is not predicted. + GENDER_UNKNOWN = 0; + + // Feminine + FEMININE = 1; + + // Masculine + MASCULINE = 2; + + // Neuter + NEUTER = 3; + } + + // The grammatical feature of verbs, used for showing modality and attitude. + enum Mood { + // Mood is not applicable in the analyzed language or is not predicted. + MOOD_UNKNOWN = 0; + + // Conditional + CONDITIONAL_MOOD = 1; + + // Imperative + IMPERATIVE = 2; + + // Indicative + INDICATIVE = 3; + + // Interrogative + INTERROGATIVE = 4; + + // Jussive + JUSSIVE = 5; + + // Subjunctive + SUBJUNCTIVE = 6; + } + + // Count distinctions. + enum Number { + // Number is not applicable in the analyzed language or is not predicted. + NUMBER_UNKNOWN = 0; + + // Singular + SINGULAR = 1; + + // Plural + PLURAL = 2; + + // Dual + DUAL = 3; + } + + // The distinction between the speaker, second person, third person, etc. + enum Person { + // Person is not applicable in the analyzed language or is not predicted. + PERSON_UNKNOWN = 0; + + // First + FIRST = 1; + + // Second + SECOND = 2; + + // Third + THIRD = 3; + + // Reflexive + REFLEXIVE_PERSON = 4; + } + + // This category shows if the token is part of a proper name. + enum Proper { + // Proper is not applicable in the analyzed language or is not predicted. + PROPER_UNKNOWN = 0; + + // Proper + PROPER = 1; + + // Not proper + NOT_PROPER = 2; + } + + // Reciprocal features of a pronoun. + enum Reciprocity { + // Reciprocity is not applicable in the analyzed language or is not + // predicted. + RECIPROCITY_UNKNOWN = 0; + + // Reciprocal + RECIPROCAL = 1; + + // Non-reciprocal + NON_RECIPROCAL = 2; + } + + // Time reference. + enum Tense { + // Tense is not applicable in the analyzed language or is not predicted. + TENSE_UNKNOWN = 0; + + // Conditional + CONDITIONAL_TENSE = 1; + + // Future + FUTURE = 2; + + // Past + PAST = 3; + + // Present + PRESENT = 4; + + // Imperfect + IMPERFECT = 5; + + // Pluperfect + PLUPERFECT = 6; + } + + // The relationship between the action that a verb expresses and the + // participants identified by its arguments. + enum Voice { + // Voice is not applicable in the analyzed language or is not predicted. + VOICE_UNKNOWN = 0; + + // Active + ACTIVE = 1; + + // Causative + CAUSATIVE = 2; + + // Passive + PASSIVE = 3; + } + + // The part of speech tag. + Tag tag = 1; + + // The grammatical aspect. + Aspect aspect = 2; + + // The grammatical case. + Case case = 3; + + // The grammatical form. + Form form = 4; + + // The grammatical gender. + Gender gender = 5; + + // The grammatical mood. + Mood mood = 6; + + // The grammatical number. + Number number = 7; + + // The grammatical person. + Person person = 8; + + // The grammatical properness. + Proper proper = 9; + + // The grammatical reciprocity. + Reciprocity reciprocity = 10; + + // The grammatical tense. + Tense tense = 11; + + // The grammatical voice. + Voice voice = 12; +} + +// Represents dependency parse tree information for a token. (For more +// information on dependency labels, see +// http://www.aclweb.org/anthology/P13-2017 +message DependencyEdge { + // The parse label enum for the token. + enum Label { + // Unknown + UNKNOWN = 0; + + // Abbreviation modifier + ABBREV = 1; + + // Adjectival complement + ACOMP = 2; + + // Adverbial clause modifier + ADVCL = 3; + + // Adverbial modifier + ADVMOD = 4; + + // Adjectival modifier of an NP + AMOD = 5; + + // Appositional modifier of an NP + APPOS = 6; + + // Attribute dependent of a copular verb + ATTR = 7; + + // Auxiliary (non-main) verb + AUX = 8; + + // Passive auxiliary + AUXPASS = 9; + + // Coordinating conjunction + CC = 10; + + // Clausal complement of a verb or adjective + CCOMP = 11; + + // Conjunct + CONJ = 12; + + // Clausal subject + CSUBJ = 13; + + // Clausal passive subject + CSUBJPASS = 14; + + // Dependency (unable to determine) + DEP = 15; + + // Determiner + DET = 16; + + // Discourse + DISCOURSE = 17; + + // Direct object + DOBJ = 18; + + // Expletive + EXPL = 19; + + // Goes with (part of a word in a text not well edited) + GOESWITH = 20; + + // Indirect object + IOBJ = 21; + + // Marker (word introducing a subordinate clause) + MARK = 22; + + // Multi-word expression + MWE = 23; + + // Multi-word verbal expression + MWV = 24; + + // Negation modifier + NEG = 25; + + // Noun compound modifier + NN = 26; + + // Noun phrase used as an adverbial modifier + NPADVMOD = 27; + + // Nominal subject + NSUBJ = 28; + + // Passive nominal subject + NSUBJPASS = 29; + + // Numeric modifier of a noun + NUM = 30; + + // Element of compound number + NUMBER = 31; + + // Punctuation mark + P = 32; + + // Parataxis relation + PARATAXIS = 33; + + // Participial modifier + PARTMOD = 34; + + // The complement of a preposition is a clause + PCOMP = 35; + + // Object of a preposition + POBJ = 36; + + // Possession modifier + POSS = 37; + + // Postverbal negative particle + POSTNEG = 38; + + // Predicate complement + PRECOMP = 39; + + // Preconjunt + PRECONJ = 40; + + // Predeterminer + PREDET = 41; + + // Prefix + PREF = 42; + + // Prepositional modifier + PREP = 43; + + // The relationship between a verb and verbal morpheme + PRONL = 44; + + // Particle + PRT = 45; + + // Associative or possessive marker + PS = 46; + + // Quantifier phrase modifier + QUANTMOD = 47; + + // Relative clause modifier + RCMOD = 48; + + // Complementizer in relative clause + RCMODREL = 49; + + // Ellipsis without a preceding predicate + RDROP = 50; + + // Referent + REF = 51; + + // Remnant + REMNANT = 52; + + // Reparandum + REPARANDUM = 53; + + // Root + ROOT = 54; + + // Suffix specifying a unit of number + SNUM = 55; + + // Suffix + SUFF = 56; + + // Temporal modifier + TMOD = 57; + + // Topic marker + TOPIC = 58; + + // Clause headed by an infinite form of the verb that modifies a noun + VMOD = 59; + + // Vocative + VOCATIVE = 60; + + // Open clausal complement + XCOMP = 61; + + // Name suffix + SUFFIX = 62; + + // Name title + TITLE = 63; + + // Adverbial phrase modifier + ADVPHMOD = 64; + + // Causative auxiliary + AUXCAUS = 65; + + // Helper auxiliary + AUXVV = 66; + + // Rentaishi (Prenominal modifier) + DTMOD = 67; + + // Foreign words + FOREIGN = 68; + + // Keyword + KW = 69; + + // List for chains of comparable items + LIST = 70; + + // Nominalized clause + NOMC = 71; + + // Nominalized clausal subject + NOMCSUBJ = 72; + + // Nominalized clausal passive + NOMCSUBJPASS = 73; + + // Compound of numeric modifier + NUMC = 74; + + // Copula + COP = 75; + + // Dislocated relation (for fronted/topicalized elements) + DISLOCATED = 76; + + // Aspect marker + ASP = 77; + + // Genitive modifier + GMOD = 78; + + // Genitive object + GOBJ = 79; + + // Infinitival modifier + INFMOD = 80; + + // Measure + MES = 81; + + // Nominal complement of a noun + NCOMP = 82; + } + + // Represents the head of this token in the dependency tree. + // This is the index of the token which has an arc going to this token. + // The index is the position of the token in the array of tokens returned + // by the API method. If this token is a root token, then the + // `head_token_index` is its own index. + int32 head_token_index = 1; + + // The parse label for the token. + Label label = 2; +} + +// Represents a mention for an entity in the text. Currently, proper noun +// mentions are supported. +message EntityMention { + // The supported types of mentions. + enum Type { + // Unknown + TYPE_UNKNOWN = 0; + + // Proper name + PROPER = 1; + + // Common noun (or noun compound) + COMMON = 2; + } + + // The mention text. + TextSpan text = 1; + + // The type of the entity mention. + Type type = 2; + + // For calls to [AnalyzeEntitySentiment][] or if + // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] is set to + // true, this field will contain the sentiment expressed for this mention of + // the entity in the provided document. + Sentiment sentiment = 3; +} + +// Represents an output piece of text. +message TextSpan { + // The content of the output text. + string content = 1; + + // The API calculates the beginning offset of the content in the original + // document according to the [EncodingType][google.cloud.language.v1.EncodingType] specified in the API request. + int32 begin_offset = 2; +} + +// Represents a category returned from the text classifier. +message ClassificationCategory { + // The name of the category representing the document. + string name = 1; + + // The classifier's confidence of the category. Number represents how certain + // the classifier is that this category represents the given text. + float confidence = 2; +} + +// The sentiment analysis request message. +message AnalyzeSentimentRequest { + // Input document. + Document document = 1; + + // The encoding type used by the API to calculate sentence offsets. + EncodingType encoding_type = 2; +} + +// The sentiment analysis response message. +message AnalyzeSentimentResponse { + // The overall sentiment of the input document. + Sentiment document_sentiment = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1.Document.language] field for more details. + string language = 2; + + // The sentiment for all the sentences in the document. + repeated Sentence sentences = 3; +} + +// The entity-level sentiment analysis request message. +message AnalyzeEntitySentimentRequest { + // Input document. + Document document = 1; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 2; +} + +// The entity-level sentiment analysis response message. +message AnalyzeEntitySentimentResponse { + // The recognized entities in the input document with associated sentiments. + repeated Entity entities = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1.Document.language] field for more details. + string language = 2; +} + +// The entity analysis request message. +message AnalyzeEntitiesRequest { + // Input document. + Document document = 1; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 2; +} + +// The entity analysis response message. +message AnalyzeEntitiesResponse { + // The recognized entities in the input document. + repeated Entity entities = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1.Document.language] field for more details. + string language = 2; +} + +// The syntax analysis request message. +message AnalyzeSyntaxRequest { + // Input document. + Document document = 1; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 2; +} + +// The syntax analysis response message. +message AnalyzeSyntaxResponse { + // Sentences in the input document. + repeated Sentence sentences = 1; + + // Tokens, along with their syntactic information, in the input document. + repeated Token tokens = 2; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1.Document.language] field for more details. + string language = 3; +} + +// The document classification request message. +message ClassifyTextRequest { + // Input document. + Document document = 1; +} + +// The document classification response message. +message ClassifyTextResponse { + // Categories representing the input document. + repeated ClassificationCategory categories = 1; +} + +// The request message for the text annotation API, which can perform multiple +// analysis types (sentiment, entities, and syntax) in one call. +message AnnotateTextRequest { + // All available features for sentiment, syntax, and semantic analysis. + // Setting each one to true will enable that specific analysis for the input. + message Features { + // Extract syntax information. + bool extract_syntax = 1; + + // Extract entities. + bool extract_entities = 2; + + // Extract document-level sentiment. + bool extract_document_sentiment = 3; + + // Extract entities and their associated sentiment. + bool extract_entity_sentiment = 4; + + // Classify the full document into categories. + bool classify_text = 6; + } + + // Input document. + Document document = 1; + + // The enabled features. + Features features = 2; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 3; +} + +// The text annotations response message. +message AnnotateTextResponse { + // Sentences in the input document. Populated if the user enables + // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. + repeated Sentence sentences = 1; + + // Tokens, along with their syntactic information, in the input document. + // Populated if the user enables + // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. + repeated Token tokens = 2; + + // Entities, along with their semantic information, in the input document. + // Populated if the user enables + // [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. + repeated Entity entities = 3; + + // The overall sentiment for the document. Populated if the user enables + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. + Sentiment document_sentiment = 4; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1.Document.language] field for more details. + string language = 5; + + // Categories identified in the input document. + repeated ClassificationCategory categories = 6; +} + +// Represents the text encoding that the caller uses to process the output. +// Providing an `EncodingType` is recommended because the API provides the +// beginning offsets for various outputs, such as tokens and mentions, and +// languages that natively use different text encodings may access offsets +// differently. +enum EncodingType { + // If `EncodingType` is not specified, encoding-dependent information (such as + // `begin_offset`) will be set at `-1`. + NONE = 0; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-8 encoding of the input. C++ and Go are examples of languages + // that use this encoding natively. + UTF8 = 1; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-16 encoding of the input. Java and Javascript are examples of + // languages that use this encoding natively. + UTF16 = 2; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-32 encoding of the input. Python is an example of a language + // that uses this encoding natively. + UTF32 = 3; +} diff --git a/handwritten/cloud-profiler/google/cloud/language/v1beta1/language_gapic.yaml b/handwritten/cloud-profiler/google/cloud/language/v1beta1/language_gapic.yaml new file mode 100644 index 00000000000..586242383d2 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/language/v1beta1/language_gapic.yaml @@ -0,0 +1,84 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.language.v1beta1 + python: + package_name: google.cloud.language_v1beta1.gapic + go: + package_name: cloud.google.com/go/language/apiv1beta1 + csharp: + package_name: Google.Cloud.Language.V1Beta1 + ruby: + package_name: Google::Cloud::Language::V1beta1 + php: + package_name: Google\Cloud\Language\V1Beta1 + nodejs: + package_name: language.v1beta1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.cloud.language.v1beta1.LanguageService + smoke_test: + method: AnalyzeSentiment + init_fields: + - document.type=PLAIN_TEXT + collections: [] + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 60000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 60000 + total_timeout_millis: 600000 + methods: + - name: AnalyzeSentiment + flattening: + groups: + - parameters: + - document + required_fields: + - document + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 + - name: AnalyzeEntities + flattening: + groups: + - parameters: + - document + - encoding_type + required_fields: + - document + - encoding_type + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 + - name: AnnotateText + flattening: + groups: + - parameters: + - document + - features + - encoding_type + required_fields: + - document + - features + - encoding_type + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 diff --git a/handwritten/cloud-profiler/google/cloud/language/v1beta1/language_service.proto b/handwritten/cloud-profiler/google/cloud/language/v1beta1/language_service.proto new file mode 100644 index 00000000000..27212ac726c --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/language/v1beta1/language_service.proto @@ -0,0 +1,950 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.language.v1beta1; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/language/v1beta1;language"; +option java_multiple_files = true; +option java_outer_classname = "LanguageServiceProto"; +option java_package = "com.google.cloud.language.v1beta1"; + + +// Provides text analysis operations such as sentiment analysis and entity +// recognition. +service LanguageService { + // Analyzes the sentiment of the provided text. + rpc AnalyzeSentiment(AnalyzeSentimentRequest) returns (AnalyzeSentimentResponse) { + option (google.api.http) = { post: "/v1beta1/documents:analyzeSentiment" body: "*" }; + } + + // Finds named entities (currently proper names and common nouns) in the text + // along with entity types, salience, mentions for each entity, and + // other properties. + rpc AnalyzeEntities(AnalyzeEntitiesRequest) returns (AnalyzeEntitiesResponse) { + option (google.api.http) = { post: "/v1beta1/documents:analyzeEntities" body: "*" }; + } + + // Analyzes the syntax of the text and provides sentence boundaries and + // tokenization along with part of speech tags, dependency trees, and other + // properties. + rpc AnalyzeSyntax(AnalyzeSyntaxRequest) returns (AnalyzeSyntaxResponse) { + option (google.api.http) = { post: "/v1beta1/documents:analyzeSyntax" body: "*" }; + } + + // A convenience method that provides all the features that analyzeSentiment, + // analyzeEntities, and analyzeSyntax provide in one call. + rpc AnnotateText(AnnotateTextRequest) returns (AnnotateTextResponse) { + option (google.api.http) = { post: "/v1beta1/documents:annotateText" body: "*" }; + } +} + +// ################################################################ # +// +// Represents the input to API methods. +message Document { + // The document types enum. + enum Type { + // The content type is not specified. + TYPE_UNSPECIFIED = 0; + + // Plain text + PLAIN_TEXT = 1; + + // HTML + HTML = 2; + } + + // Required. If the type is not set or is `TYPE_UNSPECIFIED`, + // returns an `INVALID_ARGUMENT` error. + Type type = 1; + + // The source of the document: a string containing the content or a + // Google Cloud Storage URI. + oneof source { + // The content of the input in string format. + string content = 2; + + // The Google Cloud Storage URI where the file content is located. + // This URI must be of the form: gs://bucket_name/object_name. For more + // details, see https://cloud.google.com/storage/docs/reference-uris. + // NOTE: Cloud Storage object versioning is not supported. + string gcs_content_uri = 3; + } + + // The language of the document (if not specified, the language is + // automatically detected). Both ISO and BCP-47 language codes are + // accepted.
+ // [Language Support](https://cloud.google.com/natural-language/docs/languages) + // lists currently supported languages for each API method. + // If the language (either specified by the caller or automatically detected) + // is not supported by the called API method, an `INVALID_ARGUMENT` error + // is returned. + string language = 4; +} + +// Represents a sentence in the input document. +message Sentence { + // The sentence text. + TextSpan text = 1; + + // For calls to [AnalyzeSentiment][] or if + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta1.AnnotateTextRequest.Features.extract_document_sentiment] is set to + // true, this field will contain the sentiment for the sentence. + Sentiment sentiment = 2; +} + +// Represents a phrase in the text that is a known entity, such as +// a person, an organization, or location. The API associates information, such +// as salience and mentions, with entities. +message Entity { + // The type of the entity. + enum Type { + // Unknown + UNKNOWN = 0; + + // Person + PERSON = 1; + + // Location + LOCATION = 2; + + // Organization + ORGANIZATION = 3; + + // Event + EVENT = 4; + + // Work of art + WORK_OF_ART = 5; + + // Consumer goods + CONSUMER_GOOD = 6; + + // Other types + OTHER = 7; + } + + // The representative name for the entity. + string name = 1; + + // The entity type. + Type type = 2; + + // Metadata associated with the entity. + // + // Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if + // available. The associated keys are "wikipedia_url" and "mid", respectively. + map metadata = 3; + + // The salience score associated with the entity in the [0, 1.0] range. + // + // The salience score for an entity provides information about the + // importance or centrality of that entity to the entire document text. + // Scores closer to 0 are less salient, while scores closer to 1.0 are highly + // salient. + float salience = 4; + + // The mentions of this entity in the input document. The API currently + // supports proper noun mentions. + repeated EntityMention mentions = 5; +} + +// Represents the smallest syntactic building block of the text. +message Token { + // The token text. + TextSpan text = 1; + + // Parts of speech tag for this token. + PartOfSpeech part_of_speech = 2; + + // Dependency tree parse for this token. + DependencyEdge dependency_edge = 3; + + // [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + string lemma = 4; +} + +// Represents the feeling associated with the entire text or entities in +// the text. +message Sentiment { + // DEPRECATED FIELD - This field is being deprecated in + // favor of score. Please refer to our documentation at + // https://cloud.google.com/natural-language/docs for more information. + float polarity = 1; + + // A non-negative number in the [0, +inf) range, which represents + // the absolute magnitude of sentiment regardless of score (positive or + // negative). + float magnitude = 2; + + // Sentiment score between -1.0 (negative sentiment) and 1.0 + // (positive sentiment). + float score = 3; +} + +// Represents part of speech information for a token. +message PartOfSpeech { + // The part of speech tags enum. + enum Tag { + // Unknown + UNKNOWN = 0; + + // Adjective + ADJ = 1; + + // Adposition (preposition and postposition) + ADP = 2; + + // Adverb + ADV = 3; + + // Conjunction + CONJ = 4; + + // Determiner + DET = 5; + + // Noun (common and proper) + NOUN = 6; + + // Cardinal number + NUM = 7; + + // Pronoun + PRON = 8; + + // Particle or other function word + PRT = 9; + + // Punctuation + PUNCT = 10; + + // Verb (all tenses and modes) + VERB = 11; + + // Other: foreign words, typos, abbreviations + X = 12; + + // Affix + AFFIX = 13; + } + + // The characteristic of a verb that expresses time flow during an event. + enum Aspect { + // Aspect is not applicable in the analyzed language or is not predicted. + ASPECT_UNKNOWN = 0; + + // Perfective + PERFECTIVE = 1; + + // Imperfective + IMPERFECTIVE = 2; + + // Progressive + PROGRESSIVE = 3; + } + + // The grammatical function performed by a noun or pronoun in a phrase, + // clause, or sentence. In some languages, other parts of speech, such as + // adjective and determiner, take case inflection in agreement with the noun. + enum Case { + // Case is not applicable in the analyzed language or is not predicted. + CASE_UNKNOWN = 0; + + // Accusative + ACCUSATIVE = 1; + + // Adverbial + ADVERBIAL = 2; + + // Complementive + COMPLEMENTIVE = 3; + + // Dative + DATIVE = 4; + + // Genitive + GENITIVE = 5; + + // Instrumental + INSTRUMENTAL = 6; + + // Locative + LOCATIVE = 7; + + // Nominative + NOMINATIVE = 8; + + // Oblique + OBLIQUE = 9; + + // Partitive + PARTITIVE = 10; + + // Prepositional + PREPOSITIONAL = 11; + + // Reflexive + REFLEXIVE_CASE = 12; + + // Relative + RELATIVE_CASE = 13; + + // Vocative + VOCATIVE = 14; + } + + // Depending on the language, Form can be categorizing different forms of + // verbs, adjectives, adverbs, etc. For example, categorizing inflected + // endings of verbs and adjectives or distinguishing between short and long + // forms of adjectives and participles + enum Form { + // Form is not applicable in the analyzed language or is not predicted. + FORM_UNKNOWN = 0; + + // Adnomial + ADNOMIAL = 1; + + // Auxiliary + AUXILIARY = 2; + + // Complementizer + COMPLEMENTIZER = 3; + + // Final ending + FINAL_ENDING = 4; + + // Gerund + GERUND = 5; + + // Realis + REALIS = 6; + + // Irrealis + IRREALIS = 7; + + // Short form + SHORT = 8; + + // Long form + LONG = 9; + + // Order form + ORDER = 10; + + // Specific form + SPECIFIC = 11; + } + + // Gender classes of nouns reflected in the behaviour of associated words. + enum Gender { + // Gender is not applicable in the analyzed language or is not predicted. + GENDER_UNKNOWN = 0; + + // Feminine + FEMININE = 1; + + // Masculine + MASCULINE = 2; + + // Neuter + NEUTER = 3; + } + + // The grammatical feature of verbs, used for showing modality and attitude. + enum Mood { + // Mood is not applicable in the analyzed language or is not predicted. + MOOD_UNKNOWN = 0; + + // Conditional + CONDITIONAL_MOOD = 1; + + // Imperative + IMPERATIVE = 2; + + // Indicative + INDICATIVE = 3; + + // Interrogative + INTERROGATIVE = 4; + + // Jussive + JUSSIVE = 5; + + // Subjunctive + SUBJUNCTIVE = 6; + } + + // Count distinctions. + enum Number { + // Number is not applicable in the analyzed language or is not predicted. + NUMBER_UNKNOWN = 0; + + // Singular + SINGULAR = 1; + + // Plural + PLURAL = 2; + + // Dual + DUAL = 3; + } + + // The distinction between the speaker, second person, third person, etc. + enum Person { + // Person is not applicable in the analyzed language or is not predicted. + PERSON_UNKNOWN = 0; + + // First + FIRST = 1; + + // Second + SECOND = 2; + + // Third + THIRD = 3; + + // Reflexive + REFLEXIVE_PERSON = 4; + } + + // This category shows if the token is part of a proper name. + enum Proper { + // Proper is not applicable in the analyzed language or is not predicted. + PROPER_UNKNOWN = 0; + + // Proper + PROPER = 1; + + // Not proper + NOT_PROPER = 2; + } + + // Reciprocal features of a pronoun. + enum Reciprocity { + // Reciprocity is not applicable in the analyzed language or is not + // predicted. + RECIPROCITY_UNKNOWN = 0; + + // Reciprocal + RECIPROCAL = 1; + + // Non-reciprocal + NON_RECIPROCAL = 2; + } + + // Time reference. + enum Tense { + // Tense is not applicable in the analyzed language or is not predicted. + TENSE_UNKNOWN = 0; + + // Conditional + CONDITIONAL_TENSE = 1; + + // Future + FUTURE = 2; + + // Past + PAST = 3; + + // Present + PRESENT = 4; + + // Imperfect + IMPERFECT = 5; + + // Pluperfect + PLUPERFECT = 6; + } + + // The relationship between the action that a verb expresses and the + // participants identified by its arguments. + enum Voice { + // Voice is not applicable in the analyzed language or is not predicted. + VOICE_UNKNOWN = 0; + + // Active + ACTIVE = 1; + + // Causative + CAUSATIVE = 2; + + // Passive + PASSIVE = 3; + } + + // The part of speech tag. + Tag tag = 1; + + // The grammatical aspect. + Aspect aspect = 2; + + // The grammatical case. + Case case = 3; + + // The grammatical form. + Form form = 4; + + // The grammatical gender. + Gender gender = 5; + + // The grammatical mood. + Mood mood = 6; + + // The grammatical number. + Number number = 7; + + // The grammatical person. + Person person = 8; + + // The grammatical properness. + Proper proper = 9; + + // The grammatical reciprocity. + Reciprocity reciprocity = 10; + + // The grammatical tense. + Tense tense = 11; + + // The grammatical voice. + Voice voice = 12; +} + +// Represents dependency parse tree information for a token. +message DependencyEdge { + // The parse label enum for the token. + enum Label { + // Unknown + UNKNOWN = 0; + + // Abbreviation modifier + ABBREV = 1; + + // Adjectival complement + ACOMP = 2; + + // Adverbial clause modifier + ADVCL = 3; + + // Adverbial modifier + ADVMOD = 4; + + // Adjectival modifier of an NP + AMOD = 5; + + // Appositional modifier of an NP + APPOS = 6; + + // Attribute dependent of a copular verb + ATTR = 7; + + // Auxiliary (non-main) verb + AUX = 8; + + // Passive auxiliary + AUXPASS = 9; + + // Coordinating conjunction + CC = 10; + + // Clausal complement of a verb or adjective + CCOMP = 11; + + // Conjunct + CONJ = 12; + + // Clausal subject + CSUBJ = 13; + + // Clausal passive subject + CSUBJPASS = 14; + + // Dependency (unable to determine) + DEP = 15; + + // Determiner + DET = 16; + + // Discourse + DISCOURSE = 17; + + // Direct object + DOBJ = 18; + + // Expletive + EXPL = 19; + + // Goes with (part of a word in a text not well edited) + GOESWITH = 20; + + // Indirect object + IOBJ = 21; + + // Marker (word introducing a subordinate clause) + MARK = 22; + + // Multi-word expression + MWE = 23; + + // Multi-word verbal expression + MWV = 24; + + // Negation modifier + NEG = 25; + + // Noun compound modifier + NN = 26; + + // Noun phrase used as an adverbial modifier + NPADVMOD = 27; + + // Nominal subject + NSUBJ = 28; + + // Passive nominal subject + NSUBJPASS = 29; + + // Numeric modifier of a noun + NUM = 30; + + // Element of compound number + NUMBER = 31; + + // Punctuation mark + P = 32; + + // Parataxis relation + PARATAXIS = 33; + + // Participial modifier + PARTMOD = 34; + + // The complement of a preposition is a clause + PCOMP = 35; + + // Object of a preposition + POBJ = 36; + + // Possession modifier + POSS = 37; + + // Postverbal negative particle + POSTNEG = 38; + + // Predicate complement + PRECOMP = 39; + + // Preconjunt + PRECONJ = 40; + + // Predeterminer + PREDET = 41; + + // Prefix + PREF = 42; + + // Prepositional modifier + PREP = 43; + + // The relationship between a verb and verbal morpheme + PRONL = 44; + + // Particle + PRT = 45; + + // Associative or possessive marker + PS = 46; + + // Quantifier phrase modifier + QUANTMOD = 47; + + // Relative clause modifier + RCMOD = 48; + + // Complementizer in relative clause + RCMODREL = 49; + + // Ellipsis without a preceding predicate + RDROP = 50; + + // Referent + REF = 51; + + // Remnant + REMNANT = 52; + + // Reparandum + REPARANDUM = 53; + + // Root + ROOT = 54; + + // Suffix specifying a unit of number + SNUM = 55; + + // Suffix + SUFF = 56; + + // Temporal modifier + TMOD = 57; + + // Topic marker + TOPIC = 58; + + // Clause headed by an infinite form of the verb that modifies a noun + VMOD = 59; + + // Vocative + VOCATIVE = 60; + + // Open clausal complement + XCOMP = 61; + + // Name suffix + SUFFIX = 62; + + // Name title + TITLE = 63; + + // Adverbial phrase modifier + ADVPHMOD = 64; + + // Causative auxiliary + AUXCAUS = 65; + + // Helper auxiliary + AUXVV = 66; + + // Rentaishi (Prenominal modifier) + DTMOD = 67; + + // Foreign words + FOREIGN = 68; + + // Keyword + KW = 69; + + // List for chains of comparable items + LIST = 70; + + // Nominalized clause + NOMC = 71; + + // Nominalized clausal subject + NOMCSUBJ = 72; + + // Nominalized clausal passive + NOMCSUBJPASS = 73; + + // Compound of numeric modifier + NUMC = 74; + + // Copula + COP = 75; + + // Dislocated relation (for fronted/topicalized elements) + DISLOCATED = 76; + } + + // Represents the head of this token in the dependency tree. + // This is the index of the token which has an arc going to this token. + // The index is the position of the token in the array of tokens returned + // by the API method. If this token is a root token, then the + // `head_token_index` is its own index. + int32 head_token_index = 1; + + // The parse label for the token. + Label label = 2; +} + +// Represents a mention for an entity in the text. Currently, proper noun +// mentions are supported. +message EntityMention { + // The supported types of mentions. + enum Type { + // Unknown + TYPE_UNKNOWN = 0; + + // Proper name + PROPER = 1; + + // Common noun (or noun compound) + COMMON = 2; + } + + // The mention text. + TextSpan text = 1; + + // The type of the entity mention. + Type type = 2; +} + +// Represents an output piece of text. +message TextSpan { + // The content of the output text. + string content = 1; + + // The API calculates the beginning offset of the content in the original + // document according to the [EncodingType][google.cloud.language.v1beta1.EncodingType] specified in the API request. + int32 begin_offset = 2; +} + +// The sentiment analysis request message. +message AnalyzeSentimentRequest { + // Input document. + Document document = 1; + + // The encoding type used by the API to calculate sentence offsets for the + // sentence sentiment. + EncodingType encoding_type = 2; +} + +// The sentiment analysis response message. +message AnalyzeSentimentResponse { + // The overall sentiment of the input document. + Sentiment document_sentiment = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta1.Document.language] field for more details. + string language = 2; + + // The sentiment for all the sentences in the document. + repeated Sentence sentences = 3; +} + +// The entity analysis request message. +message AnalyzeEntitiesRequest { + // Input document. + Document document = 1; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 2; +} + +// The entity analysis response message. +message AnalyzeEntitiesResponse { + // The recognized entities in the input document. + repeated Entity entities = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta1.Document.language] field for more details. + string language = 2; +} + +// The syntax analysis request message. +message AnalyzeSyntaxRequest { + // Input document. + Document document = 1; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 2; +} + +// The syntax analysis response message. +message AnalyzeSyntaxResponse { + // Sentences in the input document. + repeated Sentence sentences = 1; + + // Tokens, along with their syntactic information, in the input document. + repeated Token tokens = 2; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta1.Document.language] field for more details. + string language = 3; +} + +// The request message for the text annotation API, which can perform multiple +// analysis types (sentiment, entities, and syntax) in one call. +message AnnotateTextRequest { + // All available features for sentiment, syntax, and semantic analysis. + // Setting each one to true will enable that specific analysis for the input. + message Features { + // Extract syntax information. + bool extract_syntax = 1; + + // Extract entities. + bool extract_entities = 2; + + // Extract document-level sentiment. + bool extract_document_sentiment = 3; + } + + // Input document. + Document document = 1; + + // The enabled features. + Features features = 2; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 3; +} + +// The text annotations response message. +message AnnotateTextResponse { + // Sentences in the input document. Populated if the user enables + // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta1.AnnotateTextRequest.Features.extract_syntax]. + repeated Sentence sentences = 1; + + // Tokens, along with their syntactic information, in the input document. + // Populated if the user enables + // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta1.AnnotateTextRequest.Features.extract_syntax]. + repeated Token tokens = 2; + + // Entities, along with their semantic information, in the input document. + // Populated if the user enables + // [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta1.AnnotateTextRequest.Features.extract_entities]. + repeated Entity entities = 3; + + // The overall sentiment for the document. Populated if the user enables + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta1.AnnotateTextRequest.Features.extract_document_sentiment]. + Sentiment document_sentiment = 4; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta1.Document.language] field for more details. + string language = 5; +} + +// Represents the text encoding that the caller uses to process the output. +// Providing an `EncodingType` is recommended because the API provides the +// beginning offsets for various outputs, such as tokens and mentions, and +// languages that natively use different text encodings may access offsets +// differently. +enum EncodingType { + // If `EncodingType` is not specified, encoding-dependent information (such as + // `begin_offset`) will be set at `-1`. + NONE = 0; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-8 encoding of the input. C++ and Go are examples of languages + // that use this encoding natively. + UTF8 = 1; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-16 encoding of the input. Java and Javascript are examples of + // languages that use this encoding natively. + UTF16 = 2; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-32 encoding of the input. Python is an example of a language + // that uses this encoding natively. + UTF32 = 3; +} diff --git a/handwritten/cloud-profiler/google/cloud/language/v1beta2/language_gapic.yaml b/handwritten/cloud-profiler/google/cloud/language/v1beta2/language_gapic.yaml new file mode 100644 index 00000000000..1f040098a5d --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/language/v1beta2/language_gapic.yaml @@ -0,0 +1,118 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.language.v1beta2 + python: + package_name: google.cloud.language_v1beta2.gapic + go: + package_name: cloud.google.com/go/language/apiv1beta2 + csharp: + package_name: Google.Cloud.Language.V1beta2 + ruby: + package_name: Google::Cloud::Language::V1beta2 + php: + package_name: Google\Cloud\Language\V1beta2 + nodejs: + package_name: language.v1beta2 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.cloud.language.v1beta2.LanguageService + smoke_test: + method: AnalyzeSentiment + init_fields: + - document.content="Hello, world!" + - document.type=PLAIN_TEXT + collections: [] + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 60000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 60000 + total_timeout_millis: 600000 + methods: + - name: AnalyzeSentiment + flattening: + groups: + - parameters: + - document + required_fields: + - document + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 + - name: AnalyzeEntities + flattening: + groups: + - parameters: + - document + - encoding_type + required_fields: + - document + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 + - name: AnalyzeEntitySentiment + flattening: + groups: + - parameters: + - document + - encoding_type + required_fields: + - document + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 + - name: AnalyzeSyntax + flattening: + groups: + - parameters: + - document + - encoding_type + required_fields: + - document + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 + - name: ClassifyText + flattening: + groups: + - parameters: + - document + required_fields: + - document + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 + - name: AnnotateText + flattening: + groups: + - parameters: + - document + - features + - encoding_type + required_fields: + - document + - features + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 diff --git a/handwritten/cloud-profiler/google/cloud/language/v1beta2/language_service.proto b/handwritten/cloud-profiler/google/cloud/language/v1beta2/language_service.proto new file mode 100644 index 00000000000..54c6638cd88 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/language/v1beta2/language_service.proto @@ -0,0 +1,1040 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.language.v1beta2; + +import "google/api/annotations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/language/v1beta2;language"; +option java_multiple_files = true; +option java_outer_classname = "LanguageServiceProto"; +option java_package = "com.google.cloud.language.v1beta2"; + + +// Provides text analysis operations such as sentiment analysis and entity +// recognition. +service LanguageService { + // Analyzes the sentiment of the provided text. + rpc AnalyzeSentiment(AnalyzeSentimentRequest) returns (AnalyzeSentimentResponse) { + option (google.api.http) = { post: "/v1beta2/documents:analyzeSentiment" body: "*" }; + } + + // Finds named entities (currently proper names and common nouns) in the text + // along with entity types, salience, mentions for each entity, and + // other properties. + rpc AnalyzeEntities(AnalyzeEntitiesRequest) returns (AnalyzeEntitiesResponse) { + option (google.api.http) = { post: "/v1beta2/documents:analyzeEntities" body: "*" }; + } + + // Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text and analyzes + // sentiment associated with each entity and its mentions. + rpc AnalyzeEntitySentiment(AnalyzeEntitySentimentRequest) returns (AnalyzeEntitySentimentResponse) { + option (google.api.http) = { post: "/v1beta2/documents:analyzeEntitySentiment" body: "*" }; + } + + // Analyzes the syntax of the text and provides sentence boundaries and + // tokenization along with part of speech tags, dependency trees, and other + // properties. + rpc AnalyzeSyntax(AnalyzeSyntaxRequest) returns (AnalyzeSyntaxResponse) { + option (google.api.http) = { post: "/v1beta2/documents:analyzeSyntax" body: "*" }; + } + + // Classifies a document into categories. + rpc ClassifyText(ClassifyTextRequest) returns (ClassifyTextResponse) { + option (google.api.http) = { post: "/v1beta2/documents:classifyText" body: "*" }; + } + + // A convenience method that provides all syntax, sentiment, entity, and + // classification features in one call. + rpc AnnotateText(AnnotateTextRequest) returns (AnnotateTextResponse) { + option (google.api.http) = { post: "/v1beta2/documents:annotateText" body: "*" }; + } +} + +// ################################################################ # +// +// Represents the input to API methods. +message Document { + // The document types enum. + enum Type { + // The content type is not specified. + TYPE_UNSPECIFIED = 0; + + // Plain text + PLAIN_TEXT = 1; + + // HTML + HTML = 2; + } + + // Required. If the type is not set or is `TYPE_UNSPECIFIED`, + // returns an `INVALID_ARGUMENT` error. + Type type = 1; + + // The source of the document: a string containing the content or a + // Google Cloud Storage URI. + oneof source { + // The content of the input in string format. + string content = 2; + + // The Google Cloud Storage URI where the file content is located. + // This URI must be of the form: gs://bucket_name/object_name. For more + // details, see https://cloud.google.com/storage/docs/reference-uris. + // NOTE: Cloud Storage object versioning is not supported. + string gcs_content_uri = 3; + } + + // The language of the document (if not specified, the language is + // automatically detected). Both ISO and BCP-47 language codes are + // accepted.
+ // [Language Support](/natural-language/docs/languages) + // lists currently supported languages for each API method. + // If the language (either specified by the caller or automatically detected) + // is not supported by the called API method, an `INVALID_ARGUMENT` error + // is returned. + string language = 4; +} + +// Represents a sentence in the input document. +message Sentence { + // The sentence text. + TextSpan text = 1; + + // For calls to [AnalyzeSentiment][] or if + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment] is set to + // true, this field will contain the sentiment for the sentence. + Sentiment sentiment = 2; +} + +// Represents a phrase in the text that is a known entity, such as +// a person, an organization, or location. The API associates information, such +// as salience and mentions, with entities. +message Entity { + // The type of the entity. + enum Type { + // Unknown + UNKNOWN = 0; + + // Person + PERSON = 1; + + // Location + LOCATION = 2; + + // Organization + ORGANIZATION = 3; + + // Event + EVENT = 4; + + // Work of art + WORK_OF_ART = 5; + + // Consumer goods + CONSUMER_GOOD = 6; + + // Other types + OTHER = 7; + } + + // The representative name for the entity. + string name = 1; + + // The entity type. + Type type = 2; + + // Metadata associated with the entity. + // + // Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if + // available. The associated keys are "wikipedia_url" and "mid", respectively. + map metadata = 3; + + // The salience score associated with the entity in the [0, 1.0] range. + // + // The salience score for an entity provides information about the + // importance or centrality of that entity to the entire document text. + // Scores closer to 0 are less salient, while scores closer to 1.0 are highly + // salient. + float salience = 4; + + // The mentions of this entity in the input document. The API currently + // supports proper noun mentions. + repeated EntityMention mentions = 5; + + // For calls to [AnalyzeEntitySentiment][] or if + // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to + // true, this field will contain the aggregate sentiment expressed for this + // entity in the provided document. + Sentiment sentiment = 6; +} + +// Represents the smallest syntactic building block of the text. +message Token { + // The token text. + TextSpan text = 1; + + // Parts of speech tag for this token. + PartOfSpeech part_of_speech = 2; + + // Dependency tree parse for this token. + DependencyEdge dependency_edge = 3; + + // [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + string lemma = 4; +} + +// Represents the feeling associated with the entire text or entities in +// the text. +message Sentiment { + // A non-negative number in the [0, +inf) range, which represents + // the absolute magnitude of sentiment regardless of score (positive or + // negative). + float magnitude = 2; + + // Sentiment score between -1.0 (negative sentiment) and 1.0 + // (positive sentiment). + float score = 3; +} + +// Represents part of speech information for a token. +message PartOfSpeech { + // The part of speech tags enum. + enum Tag { + // Unknown + UNKNOWN = 0; + + // Adjective + ADJ = 1; + + // Adposition (preposition and postposition) + ADP = 2; + + // Adverb + ADV = 3; + + // Conjunction + CONJ = 4; + + // Determiner + DET = 5; + + // Noun (common and proper) + NOUN = 6; + + // Cardinal number + NUM = 7; + + // Pronoun + PRON = 8; + + // Particle or other function word + PRT = 9; + + // Punctuation + PUNCT = 10; + + // Verb (all tenses and modes) + VERB = 11; + + // Other: foreign words, typos, abbreviations + X = 12; + + // Affix + AFFIX = 13; + } + + // The characteristic of a verb that expresses time flow during an event. + enum Aspect { + // Aspect is not applicable in the analyzed language or is not predicted. + ASPECT_UNKNOWN = 0; + + // Perfective + PERFECTIVE = 1; + + // Imperfective + IMPERFECTIVE = 2; + + // Progressive + PROGRESSIVE = 3; + } + + // The grammatical function performed by a noun or pronoun in a phrase, + // clause, or sentence. In some languages, other parts of speech, such as + // adjective and determiner, take case inflection in agreement with the noun. + enum Case { + // Case is not applicable in the analyzed language or is not predicted. + CASE_UNKNOWN = 0; + + // Accusative + ACCUSATIVE = 1; + + // Adverbial + ADVERBIAL = 2; + + // Complementive + COMPLEMENTIVE = 3; + + // Dative + DATIVE = 4; + + // Genitive + GENITIVE = 5; + + // Instrumental + INSTRUMENTAL = 6; + + // Locative + LOCATIVE = 7; + + // Nominative + NOMINATIVE = 8; + + // Oblique + OBLIQUE = 9; + + // Partitive + PARTITIVE = 10; + + // Prepositional + PREPOSITIONAL = 11; + + // Reflexive + REFLEXIVE_CASE = 12; + + // Relative + RELATIVE_CASE = 13; + + // Vocative + VOCATIVE = 14; + } + + // Depending on the language, Form can be categorizing different forms of + // verbs, adjectives, adverbs, etc. For example, categorizing inflected + // endings of verbs and adjectives or distinguishing between short and long + // forms of adjectives and participles + enum Form { + // Form is not applicable in the analyzed language or is not predicted. + FORM_UNKNOWN = 0; + + // Adnomial + ADNOMIAL = 1; + + // Auxiliary + AUXILIARY = 2; + + // Complementizer + COMPLEMENTIZER = 3; + + // Final ending + FINAL_ENDING = 4; + + // Gerund + GERUND = 5; + + // Realis + REALIS = 6; + + // Irrealis + IRREALIS = 7; + + // Short form + SHORT = 8; + + // Long form + LONG = 9; + + // Order form + ORDER = 10; + + // Specific form + SPECIFIC = 11; + } + + // Gender classes of nouns reflected in the behaviour of associated words. + enum Gender { + // Gender is not applicable in the analyzed language or is not predicted. + GENDER_UNKNOWN = 0; + + // Feminine + FEMININE = 1; + + // Masculine + MASCULINE = 2; + + // Neuter + NEUTER = 3; + } + + // The grammatical feature of verbs, used for showing modality and attitude. + enum Mood { + // Mood is not applicable in the analyzed language or is not predicted. + MOOD_UNKNOWN = 0; + + // Conditional + CONDITIONAL_MOOD = 1; + + // Imperative + IMPERATIVE = 2; + + // Indicative + INDICATIVE = 3; + + // Interrogative + INTERROGATIVE = 4; + + // Jussive + JUSSIVE = 5; + + // Subjunctive + SUBJUNCTIVE = 6; + } + + // Count distinctions. + enum Number { + // Number is not applicable in the analyzed language or is not predicted. + NUMBER_UNKNOWN = 0; + + // Singular + SINGULAR = 1; + + // Plural + PLURAL = 2; + + // Dual + DUAL = 3; + } + + // The distinction between the speaker, second person, third person, etc. + enum Person { + // Person is not applicable in the analyzed language or is not predicted. + PERSON_UNKNOWN = 0; + + // First + FIRST = 1; + + // Second + SECOND = 2; + + // Third + THIRD = 3; + + // Reflexive + REFLEXIVE_PERSON = 4; + } + + // This category shows if the token is part of a proper name. + enum Proper { + // Proper is not applicable in the analyzed language or is not predicted. + PROPER_UNKNOWN = 0; + + // Proper + PROPER = 1; + + // Not proper + NOT_PROPER = 2; + } + + // Reciprocal features of a pronoun. + enum Reciprocity { + // Reciprocity is not applicable in the analyzed language or is not + // predicted. + RECIPROCITY_UNKNOWN = 0; + + // Reciprocal + RECIPROCAL = 1; + + // Non-reciprocal + NON_RECIPROCAL = 2; + } + + // Time reference. + enum Tense { + // Tense is not applicable in the analyzed language or is not predicted. + TENSE_UNKNOWN = 0; + + // Conditional + CONDITIONAL_TENSE = 1; + + // Future + FUTURE = 2; + + // Past + PAST = 3; + + // Present + PRESENT = 4; + + // Imperfect + IMPERFECT = 5; + + // Pluperfect + PLUPERFECT = 6; + } + + // The relationship between the action that a verb expresses and the + // participants identified by its arguments. + enum Voice { + // Voice is not applicable in the analyzed language or is not predicted. + VOICE_UNKNOWN = 0; + + // Active + ACTIVE = 1; + + // Causative + CAUSATIVE = 2; + + // Passive + PASSIVE = 3; + } + + // The part of speech tag. + Tag tag = 1; + + // The grammatical aspect. + Aspect aspect = 2; + + // The grammatical case. + Case case = 3; + + // The grammatical form. + Form form = 4; + + // The grammatical gender. + Gender gender = 5; + + // The grammatical mood. + Mood mood = 6; + + // The grammatical number. + Number number = 7; + + // The grammatical person. + Person person = 8; + + // The grammatical properness. + Proper proper = 9; + + // The grammatical reciprocity. + Reciprocity reciprocity = 10; + + // The grammatical tense. + Tense tense = 11; + + // The grammatical voice. + Voice voice = 12; +} + +// Represents dependency parse tree information for a token. +message DependencyEdge { + // The parse label enum for the token. + enum Label { + // Unknown + UNKNOWN = 0; + + // Abbreviation modifier + ABBREV = 1; + + // Adjectival complement + ACOMP = 2; + + // Adverbial clause modifier + ADVCL = 3; + + // Adverbial modifier + ADVMOD = 4; + + // Adjectival modifier of an NP + AMOD = 5; + + // Appositional modifier of an NP + APPOS = 6; + + // Attribute dependent of a copular verb + ATTR = 7; + + // Auxiliary (non-main) verb + AUX = 8; + + // Passive auxiliary + AUXPASS = 9; + + // Coordinating conjunction + CC = 10; + + // Clausal complement of a verb or adjective + CCOMP = 11; + + // Conjunct + CONJ = 12; + + // Clausal subject + CSUBJ = 13; + + // Clausal passive subject + CSUBJPASS = 14; + + // Dependency (unable to determine) + DEP = 15; + + // Determiner + DET = 16; + + // Discourse + DISCOURSE = 17; + + // Direct object + DOBJ = 18; + + // Expletive + EXPL = 19; + + // Goes with (part of a word in a text not well edited) + GOESWITH = 20; + + // Indirect object + IOBJ = 21; + + // Marker (word introducing a subordinate clause) + MARK = 22; + + // Multi-word expression + MWE = 23; + + // Multi-word verbal expression + MWV = 24; + + // Negation modifier + NEG = 25; + + // Noun compound modifier + NN = 26; + + // Noun phrase used as an adverbial modifier + NPADVMOD = 27; + + // Nominal subject + NSUBJ = 28; + + // Passive nominal subject + NSUBJPASS = 29; + + // Numeric modifier of a noun + NUM = 30; + + // Element of compound number + NUMBER = 31; + + // Punctuation mark + P = 32; + + // Parataxis relation + PARATAXIS = 33; + + // Participial modifier + PARTMOD = 34; + + // The complement of a preposition is a clause + PCOMP = 35; + + // Object of a preposition + POBJ = 36; + + // Possession modifier + POSS = 37; + + // Postverbal negative particle + POSTNEG = 38; + + // Predicate complement + PRECOMP = 39; + + // Preconjunt + PRECONJ = 40; + + // Predeterminer + PREDET = 41; + + // Prefix + PREF = 42; + + // Prepositional modifier + PREP = 43; + + // The relationship between a verb and verbal morpheme + PRONL = 44; + + // Particle + PRT = 45; + + // Associative or possessive marker + PS = 46; + + // Quantifier phrase modifier + QUANTMOD = 47; + + // Relative clause modifier + RCMOD = 48; + + // Complementizer in relative clause + RCMODREL = 49; + + // Ellipsis without a preceding predicate + RDROP = 50; + + // Referent + REF = 51; + + // Remnant + REMNANT = 52; + + // Reparandum + REPARANDUM = 53; + + // Root + ROOT = 54; + + // Suffix specifying a unit of number + SNUM = 55; + + // Suffix + SUFF = 56; + + // Temporal modifier + TMOD = 57; + + // Topic marker + TOPIC = 58; + + // Clause headed by an infinite form of the verb that modifies a noun + VMOD = 59; + + // Vocative + VOCATIVE = 60; + + // Open clausal complement + XCOMP = 61; + + // Name suffix + SUFFIX = 62; + + // Name title + TITLE = 63; + + // Adverbial phrase modifier + ADVPHMOD = 64; + + // Causative auxiliary + AUXCAUS = 65; + + // Helper auxiliary + AUXVV = 66; + + // Rentaishi (Prenominal modifier) + DTMOD = 67; + + // Foreign words + FOREIGN = 68; + + // Keyword + KW = 69; + + // List for chains of comparable items + LIST = 70; + + // Nominalized clause + NOMC = 71; + + // Nominalized clausal subject + NOMCSUBJ = 72; + + // Nominalized clausal passive + NOMCSUBJPASS = 73; + + // Compound of numeric modifier + NUMC = 74; + + // Copula + COP = 75; + + // Dislocated relation (for fronted/topicalized elements) + DISLOCATED = 76; + + // Aspect marker + ASP = 77; + + // Genitive modifier + GMOD = 78; + + // Genitive object + GOBJ = 79; + + // Infinitival modifier + INFMOD = 80; + + // Measure + MES = 81; + + // Nominal complement of a noun + NCOMP = 82; + } + + // Represents the head of this token in the dependency tree. + // This is the index of the token which has an arc going to this token. + // The index is the position of the token in the array of tokens returned + // by the API method. If this token is a root token, then the + // `head_token_index` is its own index. + int32 head_token_index = 1; + + // The parse label for the token. + Label label = 2; +} + +// Represents a mention for an entity in the text. Currently, proper noun +// mentions are supported. +message EntityMention { + // The supported types of mentions. + enum Type { + // Unknown + TYPE_UNKNOWN = 0; + + // Proper name + PROPER = 1; + + // Common noun (or noun compound) + COMMON = 2; + } + + // The mention text. + TextSpan text = 1; + + // The type of the entity mention. + Type type = 2; + + // For calls to [AnalyzeEntitySentiment][] or if + // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to + // true, this field will contain the sentiment expressed for this mention of + // the entity in the provided document. + Sentiment sentiment = 3; +} + +// Represents an output piece of text. +message TextSpan { + // The content of the output text. + string content = 1; + + // The API calculates the beginning offset of the content in the original + // document according to the [EncodingType][google.cloud.language.v1beta2.EncodingType] specified in the API request. + int32 begin_offset = 2; +} + +// Represents a category returned from the text classifier. +message ClassificationCategory { + // The name of the category representing the document. + string name = 1; + + // The classifier's confidence of the category. Number represents how certain + // the classifier is that this category represents the given text. + float confidence = 2; +} + +// The sentiment analysis request message. +message AnalyzeSentimentRequest { + // Input document. + Document document = 1; + + // The encoding type used by the API to calculate sentence offsets for the + // sentence sentiment. + EncodingType encoding_type = 2; +} + +// The sentiment analysis response message. +message AnalyzeSentimentResponse { + // The overall sentiment of the input document. + Sentiment document_sentiment = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + string language = 2; + + // The sentiment for all the sentences in the document. + repeated Sentence sentences = 3; +} + +// The entity-level sentiment analysis request message. +message AnalyzeEntitySentimentRequest { + // Input document. + Document document = 1; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 2; +} + +// The entity-level sentiment analysis response message. +message AnalyzeEntitySentimentResponse { + // The recognized entities in the input document with associated sentiments. + repeated Entity entities = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + string language = 2; +} + +// The entity analysis request message. +message AnalyzeEntitiesRequest { + // Input document. + Document document = 1; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 2; +} + +// The entity analysis response message. +message AnalyzeEntitiesResponse { + // The recognized entities in the input document. + repeated Entity entities = 1; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + string language = 2; +} + +// The syntax analysis request message. +message AnalyzeSyntaxRequest { + // Input document. + Document document = 1; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 2; +} + +// The syntax analysis response message. +message AnalyzeSyntaxResponse { + // Sentences in the input document. + repeated Sentence sentences = 1; + + // Tokens, along with their syntactic information, in the input document. + repeated Token tokens = 2; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + string language = 3; +} + +// The document classification request message. +message ClassifyTextRequest { + // Input document. + Document document = 1; +} + +// The document classification response message. +message ClassifyTextResponse { + // Categories representing the input document. + repeated ClassificationCategory categories = 1; +} + +// The request message for the text annotation API, which can perform multiple +// analysis types (sentiment, entities, and syntax) in one call. +message AnnotateTextRequest { + // All available features for sentiment, syntax, and semantic analysis. + // Setting each one to true will enable that specific analysis for the input. + message Features { + // Extract syntax information. + bool extract_syntax = 1; + + // Extract entities. + bool extract_entities = 2; + + // Extract document-level sentiment. + bool extract_document_sentiment = 3; + + // Extract entities and their associated sentiment. + bool extract_entity_sentiment = 4; + + // Classify the full document into categories. + bool classify_text = 6; + } + + // Input document. + Document document = 1; + + // The enabled features. + Features features = 2; + + // The encoding type used by the API to calculate offsets. + EncodingType encoding_type = 3; +} + +// The text annotations response message. +message AnnotateTextResponse { + // Sentences in the input document. Populated if the user enables + // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. + repeated Sentence sentences = 1; + + // Tokens, along with their syntactic information, in the input document. + // Populated if the user enables + // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. + repeated Token tokens = 2; + + // Entities, along with their semantic information, in the input document. + // Populated if the user enables + // [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entities]. + repeated Entity entities = 3; + + // The overall sentiment for the document. Populated if the user enables + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment]. + Sentiment document_sentiment = 4; + + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + string language = 5; + + // Categories identified in the input document. + repeated ClassificationCategory categories = 6; +} + +// Represents the text encoding that the caller uses to process the output. +// Providing an `EncodingType` is recommended because the API provides the +// beginning offsets for various outputs, such as tokens and mentions, and +// languages that natively use different text encodings may access offsets +// differently. +enum EncodingType { + // If `EncodingType` is not specified, encoding-dependent information (such as + // `begin_offset`) will be set at `-1`. + NONE = 0; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-8 encoding of the input. C++ and Go are examples of languages + // that use this encoding natively. + UTF8 = 1; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-16 encoding of the input. Java and Javascript are examples of + // languages that use this encoding natively. + UTF16 = 2; + + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-32 encoding of the input. Python is an example of a language + // that uses this encoding natively. + UTF32 = 3; +} diff --git a/handwritten/cloud-profiler/google/cloud/location/location.yaml b/handwritten/cloud-profiler/google/cloud/location/location.yaml new file mode 100644 index 00000000000..56d80a0f700 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/location/location.yaml @@ -0,0 +1,14 @@ +type: google.api.Service +config_version: 1 +name: cloudlocations.googleapis.com +title: Google Cloud Location API + +apis: +- name: google.cloud.location.Locations + +documentation: + overview: |- + # Google Cloud Locations API + + This package contains the definition of an abstract interface that manages + locations within API services. diff --git a/handwritten/cloud-profiler/google/cloud/location/locations.proto b/handwritten/cloud-profiler/google/cloud/location/locations.proto new file mode 100644 index 00000000000..b8f9706a714 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/location/locations.proto @@ -0,0 +1,91 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.location; + +import "google/api/annotations.proto"; +import "google/protobuf/any.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/cloud/location;location"; +option java_multiple_files = true; +option java_outer_classname = "LocationsProto"; +option java_package = "com.google.cloud.location"; + + +// An abstract interface that provides location-related information for +// a service. Service-specific metadata is provided through the +// [Location.metadata][google.cloud.location.Location.metadata] field. +service Locations { + // Lists information about the supported locations for this service. + rpc ListLocations(ListLocationsRequest) returns (ListLocationsResponse) { + option (google.api.http) = { get: "/v1/{name=projects/*}/locations" }; + } + + // Get information about a location. + rpc GetLocation(GetLocationRequest) returns (Location) { + option (google.api.http) = { get: "/v1/{name=projects/*/locations/*}" }; + } +} + +// The request message for [Locations.ListLocations][google.cloud.location.Locations.ListLocations]. +message ListLocationsRequest { + // The resource that owns the locations collection, if applicable. + string name = 1; + + // The standard list filter. + string filter = 2; + + // The standard list page size. + int32 page_size = 3; + + // The standard list page token. + string page_token = 4; +} + +// The response message for [Locations.ListLocations][google.cloud.location.Locations.ListLocations]. +message ListLocationsResponse { + // A list of locations that matches the specified filter in the request. + repeated Location locations = 1; + + // The standard List next-page token. + string next_page_token = 2; +} + +// The request message for [Locations.GetLocation][google.cloud.location.Locations.GetLocation]. +message GetLocationRequest { + // Resource name for the location. + string name = 1; +} + +// A resource that represents Google Cloud Platform location. +message Location { + // Resource name for the location, which may vary between implementations. + // For example: `"projects/example-project/locations/us-east1"` + string name = 1; + + // The canonical id for this location. For example: `"us-east1"`. + string location_id = 4; + + // Cross-service attributes for the location. For example + // + // {"cloud.googleapis.com/region": "us-east1"} + map labels = 2; + + // Service-specific metadata. For example the available capacity at the given + // location. + google.protobuf.Any metadata = 3; +} diff --git a/handwritten/cloud-profiler/google/cloud/ml/v1/job_service.proto b/handwritten/cloud-profiler/google/cloud/ml/v1/job_service.proto new file mode 100644 index 00000000000..93beed1c079 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/ml/v1/job_service.proto @@ -0,0 +1,605 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.ml.v1; + +import "google/api/annotations.proto"; +import "google/api/auth.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/ml/v1;ml"; +option java_multiple_files = true; +option java_outer_classname = "JobServiceProto"; +option java_package = "com.google.cloud.ml.api.v1"; + +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Proto file for the Google Cloud Machine Learning Engine. +// Describes the 'job service' to manage training and prediction jobs. + + + +// Service to create and manage training and batch prediction jobs. +service JobService { + // Creates a training or a batch prediction job. + rpc CreateJob(CreateJobRequest) returns (Job) { + option (google.api.http) = { post: "/v1/{parent=projects/*}/jobs" body: "job" }; + } + + // Lists the jobs in the project. + rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { + option (google.api.http) = { get: "/v1/{parent=projects/*}/jobs" }; + } + + // Describes a job. + rpc GetJob(GetJobRequest) returns (Job) { + option (google.api.http) = { get: "/v1/{name=projects/*/jobs/*}" }; + } + + // Cancels a running job. + rpc CancelJob(CancelJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1/{name=projects/*/jobs/*}:cancel" body: "*" }; + } +} + +// Represents input parameters for a training job. +message TrainingInput { + // A scale tier is an abstract representation of the resources Cloud ML + // will allocate to a training job. When selecting a scale tier for your + // training job, you should consider the size of your training dataset and + // the complexity of your model. As the tiers increase, virtual machines are + // added to handle your job, and the individual machines in the cluster + // generally have more memory and greater processing power than they do at + // lower tiers. The number of training units charged per hour of processing + // increases as tiers get more advanced. Refer to the + // [pricing guide](/ml/pricing) for more details. Note that in addition to + // incurring costs, your use of training resources is constrained by the + // [quota policy](/ml/quota). + enum ScaleTier { + // A single worker instance. This tier is suitable for learning how to use + // Cloud ML, and for experimenting with new models using small datasets. + BASIC = 0; + + // Many workers and a few parameter servers. + STANDARD_1 = 1; + + // A large number of workers with many parameter servers. + PREMIUM_1 = 3; + + // A single worker instance [with a GPU](ml/docs/how-tos/using-gpus). + BASIC_GPU = 6; + + // The CUSTOM tier is not a set tier, but rather enables you to use your + // own cluster specification. When you use this tier, set values to + // configure your processing cluster according to these guidelines: + // + // * You _must_ set `TrainingInput.masterType` to specify the type + // of machine to use for your master node. This is the only required + // setting. + // + // * You _may_ set `TrainingInput.workerCount` to specify the number of + // workers to use. If you specify one or more workers, you _must_ also + // set `TrainingInput.workerType` to specify the type of machine to use + // for your worker nodes. + // + // * You _may_ set `TrainingInput.parameterServerCount` to specify the + // number of parameter servers to use. If you specify one or more + // parameter servers, you _must_ also set + // `TrainingInput.parameterServerType` to specify the type of machine to + // use for your parameter servers. + // + // Note that all of your workers must use the same machine type, which can + // be different from your parameter server type and master type. Your + // parameter servers must likewise use the same machine type, which can be + // different from your worker type and master type. + CUSTOM = 5; + } + + // Required. Specifies the machine types, the number of replicas for workers + // and parameter servers. + ScaleTier scale_tier = 1; + + // Optional. Specifies the type of virtual machine to use for your training + // job's master worker. + // + // The following types are supported: + // + //
+ //
standard
+ //
+ // A basic machine configuration suitable for training simple models with + // small to moderate datasets. + //
+ //
large_model
+ //
+ // A machine with a lot of memory, specially suited for parameter servers + // when your model is large (having many hidden layers or layers with very + // large numbers of nodes). + //
+ //
complex_model_s
+ //
+ // A machine suitable for the master and workers of the cluster when your + // model requires more computation than the standard machine can handle + // satisfactorily. + //
+ //
complex_model_m
+ //
+ // A machine with roughly twice the number of cores and roughly double the + // memory of complex_model_s. + //
+ //
complex_model_l
+ //
+ // A machine with roughly twice the number of cores and roughly double the + // memory of complex_model_m. + //
+ //
standard_gpu
+ //
+ // A machine equivalent to standard that + // also includes a + // + // GPU that you can use in your trainer. + //
+ //
complex_model_m_gpu
+ //
+ // A machine equivalent to + // coplex_model_m that also includes + // four GPUs. + //
+ //
+ // + // You must set this value when `scaleTier` is set to `CUSTOM`. + string master_type = 2; + + // Optional. Specifies the type of virtual machine to use for your training + // job's worker nodes. + // + // The supported values are the same as those described in the entry for + // `masterType`. + // + // This value must be present when `scaleTier` is set to `CUSTOM` and + // `workerCount` is greater than zero. + string worker_type = 3; + + // Optional. Specifies the type of virtual machine to use for your training + // job's parameter server. + // + // The supported values are the same as those described in the entry for + // `master_type`. + // + // This value must be present when `scaleTier` is set to `CUSTOM` and + // `parameter_server_count` is greater than zero. + string parameter_server_type = 4; + + // Optional. The number of worker replicas to use for the training job. Each + // replica in the cluster will be of the type specified in `worker_type`. + // + // This value can only be used when `scale_tier` is set to `CUSTOM`. If you + // set this value, you must also set `worker_type`. + int64 worker_count = 5; + + // Optional. The number of parameter server replicas to use for the training + // job. Each replica in the cluster will be of the type specified in + // `parameter_server_type`. + // + // This value can only be used when `scale_tier` is set to `CUSTOM`.If you + // set this value, you must also set `parameter_server_type`. + int64 parameter_server_count = 6; + + // Required. The Google Cloud Storage location of the packages with + // the training program and any additional dependencies. + repeated string package_uris = 7; + + // Required. The Python module name to run after installing the packages. + string python_module = 8; + + // Optional. Command line arguments to pass to the program. + repeated string args = 10; + + // Optional. The set of Hyperparameters to tune. + HyperparameterSpec hyperparameters = 12; + + // Required. The Google Compute Engine region to run the training job in. + string region = 14; + + // Optional. A Google Cloud Storage path in which to store training outputs + // and other data needed for training. This path is passed to your TensorFlow + // program as the 'job_dir' command-line argument. The benefit of specifying + // this field is that Cloud ML validates the path for use in training. + string job_dir = 16; + + // Optional. The Google Cloud ML runtime version to use for training. If not + // set, Google Cloud ML will choose the latest stable version. + string runtime_version = 15; +} + +// Represents a set of hyperparameters to optimize. +message HyperparameterSpec { + // The available types of optimization goals. + enum GoalType { + // Goal Type will default to maximize. + GOAL_TYPE_UNSPECIFIED = 0; + + // Maximize the goal metric. + MAXIMIZE = 1; + + // Minimize the goal metric. + MINIMIZE = 2; + } + + // Required. The type of goal to use for tuning. Available types are + // `MAXIMIZE` and `MINIMIZE`. + // + // Defaults to `MAXIMIZE`. + GoalType goal = 1; + + // Required. The set of parameters to tune. + repeated ParameterSpec params = 2; + + // Optional. How many training trials should be attempted to optimize + // the specified hyperparameters. + // + // Defaults to one. + int32 max_trials = 3; + + // Optional. The number of training trials to run concurrently. + // You can reduce the time it takes to perform hyperparameter tuning by adding + // trials in parallel. However, each trail only benefits from the information + // gained in completed trials. That means that a trial does not get access to + // the results of trials running at the same time, which could reduce the + // quality of the overall optimization. + // + // Each trial will use the same scale tier and machine types. + // + // Defaults to one. + int32 max_parallel_trials = 4; + + // Optional. The Tensorflow summary tag name to use for optimizing trials. For + // current versions of Tensorflow, this tag name should exactly match what is + // shown in Tensorboard, including all scopes. For versions of Tensorflow + // prior to 0.12, this should be only the tag passed to tf.Summary. + // By default, "training/hptuning/metric" will be used. + string hyperparameter_metric_tag = 5; +} + +// Represents a single hyperparameter to optimize. +message ParameterSpec { + // The type of the parameter. + enum ParameterType { + // You must specify a valid type. Using this unspecified type will result in + // an error. + PARAMETER_TYPE_UNSPECIFIED = 0; + + // Type for real-valued parameters. + DOUBLE = 1; + + // Type for integral parameters. + INTEGER = 2; + + // The parameter is categorical, with a value chosen from the categories + // field. + CATEGORICAL = 3; + + // The parameter is real valued, with a fixed set of feasible points. If + // `type==DISCRETE`, feasible_points must be provided, and + // {`min_value`, `max_value`} will be ignored. + DISCRETE = 4; + } + + // The type of scaling that should be applied to this parameter. + enum ScaleType { + // By default, no scaling is applied. + NONE = 0; + + // Scales the feasible space to (0, 1) linearly. + UNIT_LINEAR_SCALE = 1; + + // Scales the feasible space logarithmically to (0, 1). The entire feasible + // space must be strictly positive. + UNIT_LOG_SCALE = 2; + + // Scales the feasible space "reverse" logarithmically to (0, 1). The result + // is that values close to the top of the feasible space are spread out more + // than points near the bottom. The entire feasible space must be strictly + // positive. + UNIT_REVERSE_LOG_SCALE = 3; + } + + // Required. The parameter name must be unique amongst all ParameterConfigs in + // a HyperparameterSpec message. E.g., "learning_rate". + string parameter_name = 1; + + // Required. The type of the parameter. + ParameterType type = 4; + + // Required if type is `DOUBLE` or `INTEGER`. This field + // should be unset if type is `CATEGORICAL`. This value should be integers if + // type is INTEGER. + double min_value = 2; + + // Required if typeis `DOUBLE` or `INTEGER`. This field + // should be unset if type is `CATEGORICAL`. This value should be integers if + // type is `INTEGER`. + double max_value = 3; + + // Required if type is `CATEGORICAL`. The list of possible categories. + repeated string categorical_values = 5; + + // Required if type is `DISCRETE`. + // A list of feasible points. + // The list should be in strictly increasing order. For instance, this + // parameter might have possible settings of 1.5, 2.5, and 4.0. This list + // should not contain more than 1,000 values. + repeated double discrete_values = 6; + + // Optional. How the parameter should be scaled to the hypercube. + // Leave unset for categorical parameters. + // Some kind of scaling is strongly recommended for real or integral + // parameters (e.g., `UNIT_LINEAR_SCALE`). + ScaleType scale_type = 7; +} + +// Represents the result of a single hyperparameter tuning trial from a +// training job. The TrainingOutput object that is returned on successful +// completion of a training job with hyperparameter tuning includes a list +// of HyperparameterOutput objects, one for each successful trial. +message HyperparameterOutput { + // An observed value of a metric. + message HyperparameterMetric { + // The global training step for this metric. + int64 training_step = 1; + + // The objective value at this training step. + double objective_value = 2; + } + + // The trial id for these results. + string trial_id = 1; + + // The hyperparameters given to this trial. + map hyperparameters = 2; + + // The final objective metric seen for this trial. + HyperparameterMetric final_metric = 3; + + // All recorded object metrics for this trial. + repeated HyperparameterMetric all_metrics = 4; +} + +// Represents results of a training job. Output only. +message TrainingOutput { + // The number of hyperparameter tuning trials that completed successfully. + // Only set for hyperparameter tuning jobs. + int64 completed_trial_count = 1; + + // Results for individual Hyperparameter trials. + // Only set for hyperparameter tuning jobs. + repeated HyperparameterOutput trials = 2; + + // The amount of ML units consumed by the job. + double consumed_ml_units = 3; + + // Whether this job is a hyperparameter tuning job. + bool is_hyperparameter_tuning_job = 4; +} + +// Represents input parameters for a prediction job. +message PredictionInput { + // The format used to separate data instances in the source files. + enum DataFormat { + // Unspecified format. + DATA_FORMAT_UNSPECIFIED = 0; + + // The source file is a text file with instances separated by the + // new-line character. + TEXT = 1; + + // The source file is a TFRecord file. + TF_RECORD = 2; + + // The source file is a GZIP-compressed TFRecord file. + TF_RECORD_GZIP = 3; + } + + // Required. The model or the version to use for prediction. + oneof model_version { + // Use this field if you want to use the default version for the specified + // model. The string must use the following format: + // + // `"projects/[YOUR_PROJECT]/models/[YOUR_MODEL]"` + string model_name = 1; + + // Use this field if you want to specify a version of the model to use. The + // string is formatted the same way as `model_version`, with the addition + // of the version information: + // + // `"projects/[YOUR_PROJECT]/models/YOUR_MODEL/versions/[YOUR_VERSION]"` + string version_name = 2; + + // Use this field if you want to specify a Google Cloud Storage path for + // the model to use. + string uri = 9; + } + + // Required. The format of the input data files. + DataFormat data_format = 3; + + // Required. The Google Cloud Storage location of the input data files. + // May contain wildcards. + repeated string input_paths = 4; + + // Required. The output Google Cloud Storage location. + string output_path = 5; + + // Optional. The maximum number of workers to be used for parallel processing. + // Defaults to 10 if not specified. + int64 max_worker_count = 6; + + // Required. The Google Compute Engine region to run the prediction job in. + string region = 7; + + // Optional. The Google Cloud ML runtime version to use for this batch + // prediction. If not set, Google Cloud ML will pick the runtime version used + // during the CreateVersion request for this model version, or choose the + // latest stable version when model version information is not available + // such as when the model is specified by uri. + string runtime_version = 8; +} + +// Represents results of a prediction job. +message PredictionOutput { + // The output Google Cloud Storage location provided at the job creation time. + string output_path = 1; + + // The number of generated predictions. + int64 prediction_count = 2; + + // The number of data instances which resulted in errors. + int64 error_count = 3; + + // Node hours used by the batch prediction job. + double node_hours = 4; +} + +// Represents a training or prediction job. +message Job { + // Describes the job state. + enum State { + // The job state is unspecified. + STATE_UNSPECIFIED = 0; + + // The job has been just created and processing has not yet begun. + QUEUED = 1; + + // The service is preparing to run the job. + PREPARING = 2; + + // The job is in progress. + RUNNING = 3; + + // The job completed successfully. + SUCCEEDED = 4; + + // The job failed. + // `error_message` should contain the details of the failure. + FAILED = 5; + + // The job is being cancelled. + // `error_message` should describe the reason for the cancellation. + CANCELLING = 6; + + // The job has been cancelled. + // `error_message` should describe the reason for the cancellation. + CANCELLED = 7; + } + + // Required. The user-specified id of the job. + string job_id = 1; + + // Required. Parameters to create a job. + oneof input { + // Input parameters to create a training job. + TrainingInput training_input = 2; + + // Input parameters to create a prediction job. + PredictionInput prediction_input = 3; + } + + // Output only. When the job was created. + google.protobuf.Timestamp create_time = 4; + + // Output only. When the job processing was started. + google.protobuf.Timestamp start_time = 5; + + // Output only. When the job processing was completed. + google.protobuf.Timestamp end_time = 6; + + // Output only. The detailed state of a job. + State state = 7; + + // Output only. The details of a failure or a cancellation. + string error_message = 8; + + // Output only. The current result of the job. + oneof output { + // The current training job result. + TrainingOutput training_output = 9; + + // The current prediction job result. + PredictionOutput prediction_output = 10; + } +} + +// Request message for the CreateJob method. +message CreateJobRequest { + // Required. The project name. + // + // Authorization: requires `Editor` role on the specified project. + string parent = 1; + + // Required. The job to create. + Job job = 2; +} + +// Request message for the ListJobs method. +message ListJobsRequest { + // Required. The name of the project for which to list jobs. + // + // Authorization: requires `Viewer` role on the specified project. + string parent = 1; + + // Optional. Specifies the subset of jobs to retrieve. + string filter = 2; + + // Optional. A page token to request the next page of results. + // + // You get the token from the `next_page_token` field of the response from + // the previous call. + string page_token = 4; + + // Optional. The number of jobs to retrieve per "page" of results. If there + // are more remaining results than this number, the response message will + // contain a valid value in the `next_page_token` field. + // + // The default value is 20, and the maximum page size is 100. + int32 page_size = 5; +} + +// Response message for the ListJobs method. +message ListJobsResponse { + // The list of jobs. + repeated Job jobs = 1; + + // Optional. Pass this token as the `page_token` field of the request for a + // subsequent call. + string next_page_token = 2; +} + +// Request message for the GetJob method. +message GetJobRequest { + // Required. The name of the job to get the description of. + // + // Authorization: requires `Viewer` role on the parent project. + string name = 1; +} + +// Request message for the CancelJob method. +message CancelJobRequest { + // Required. The name of the job to cancel. + // + // Authorization: requires `Editor` role on the parent project. + string name = 1; +} diff --git a/handwritten/cloud-profiler/google/cloud/ml/v1/model_service.proto b/handwritten/cloud-profiler/google/cloud/ml/v1/model_service.proto new file mode 100644 index 00000000000..783ba871345 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/ml/v1/model_service.proto @@ -0,0 +1,371 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.ml.v1; + +import "google/api/annotations.proto"; +import "google/api/auth.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/ml/v1;ml"; +option java_multiple_files = true; +option java_outer_classname = "ModelServiceProto"; +option java_package = "com.google.cloud.ml.api.v1"; + +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Proto file for the Google Cloud Machine Learning Engine. +// Describes the 'models service' to work with the 'model' and 'version' +// resources. + + + +// Provides methods that create and manage machine learning models and their +// versions. +// +// A model in this context is a container for versions. The model can't provide +// predictions without first having a version created for it. +// +// Each version is a trained machine learning model, and each is assumed to be +// an iteration of the same machine learning problem as the other versions of +// the same model. +// +// Your project can define multiple models, each with multiple versions. +// +// The basic life cycle of a model is: +// +// * Create and train the machine learning model and save it to a +// Google Cloud Storage location. +// * Use +// [projects.models.create](/ml/reference/rest/v1/projects.models/create) +// to make a new model in your project. +// * Use +// [projects.models.versions.create](/ml/reference/rest/v1/projects.models.versions/create) +// to deploy your saved model. +// * Use [projects.predict](/ml/reference/rest/v1/projects/predict to +// request predictions of a version of your model, or use +// [projects.jobs.create](/ml/reference/rest/v1/projects.jobs/create) +// to start a batch prediction job. +service ModelService { + // Creates a model which will later contain one or more versions. + // + // You must add at least one version before you can request predictions from + // the model. Add versions by calling + // [projects.models.versions.create](/ml/reference/rest/v1/projects.models.versions/create). + rpc CreateModel(CreateModelRequest) returns (Model) { + option (google.api.http) = { post: "/v1/{parent=projects/*}/models" body: "model" }; + } + + // Lists the models in a project. + // + // Each project can contain multiple models, and each model can have multiple + // versions. + rpc ListModels(ListModelsRequest) returns (ListModelsResponse) { + option (google.api.http) = { get: "/v1/{parent=projects/*}/models" }; + } + + // Gets information about a model, including its name, the description (if + // set), and the default version (if at least one version of the model has + // been deployed). + rpc GetModel(GetModelRequest) returns (Model) { + option (google.api.http) = { get: "/v1/{name=projects/*/models/*}" }; + } + + // Deletes a model. + // + // You can only delete a model if there are no versions in it. You can delete + // versions by calling + // [projects.models.versions.delete](/ml/reference/rest/v1/projects.models.versions/delete). + rpc DeleteModel(DeleteModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { delete: "/v1/{name=projects/*/models/*}" }; + } + + // Creates a new version of a model from a trained TensorFlow model. + // + // If the version created in the cloud by this call is the first deployed + // version of the specified model, it will be made the default version of the + // model. When you add a version to a model that already has one or more + // versions, the default version does not automatically change. If you want a + // new version to be the default, you must call + // [projects.models.versions.setDefault](/ml/reference/rest/v1/projects.models.versions/setDefault). + rpc CreateVersion(CreateVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/{parent=projects/*/models/*}/versions" body: "version" }; + } + + // Gets basic information about all the versions of a model. + // + // If you expect that a model has a lot of versions, or if you need to handle + // only a limited number of results at a time, you can request that the list + // be retrieved in batches (called pages): + rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { + option (google.api.http) = { get: "/v1/{parent=projects/*/models/*}/versions" }; + } + + // Gets information about a model version. + // + // Models can have multiple versions. You can call + // [projects.models.versions.list](/ml/reference/rest/v1/projects.models.versions/list) + // to get the same information that this method returns for all of the + // versions of a model. + rpc GetVersion(GetVersionRequest) returns (Version) { + option (google.api.http) = { get: "/v1/{name=projects/*/models/*/versions/*}" }; + } + + // Deletes a model version. + // + // Each model can have multiple versions deployed and in use at any given + // time. Use this method to remove a single version. + // + // Note: You cannot delete the version that is set as the default version + // of the model unless it is the only remaining version. + rpc DeleteVersion(DeleteVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { delete: "/v1/{name=projects/*/models/*/versions/*}" }; + } + + // Designates a version to be the default for the model. + // + // The default version is used for prediction requests made against the model + // that don't specify a version. + // + // The first version to be created for a model is automatically set as the + // default. You must make any subsequent changes to the default version + // setting manually using this method. + rpc SetDefaultVersion(SetDefaultVersionRequest) returns (Version) { + option (google.api.http) = { post: "/v1/{name=projects/*/models/*/versions/*}:setDefault" body: "*" }; + } +} + +// Represents a machine learning solution. +// +// A model can have multiple versions, each of which is a deployed, trained +// model ready to receive prediction requests. The model itself is just a +// container. +message Model { + // Required. The name specified for the model when it was created. + // + // The model name must be unique within the project it is created in. + string name = 1; + + // Optional. The description specified for the model when it was created. + string description = 2; + + // Output only. The default version of the model. This version will be used to + // handle prediction requests that do not specify a version. + // + // You can change the default version by calling + // [projects.methods.versions.setDefault](/ml/reference/rest/v1/projects.models.versions/setDefault). + Version default_version = 3; + + // Optional. The list of regions where the model is going to be deployed. + // Currently only one region per model is supported. + // Defaults to 'us-central1' if nothing is set. + repeated string regions = 4; + + // Optional. If true, enables StackDriver Logging for online prediction. + // Default is false. + bool online_prediction_logging = 5; +} + +// Represents a version of the model. +// +// Each version is a trained model deployed in the cloud, ready to handle +// prediction requests. A model can have multiple versions. You can get +// information about all of the versions of a given model by calling +// [projects.models.versions.list](/ml/reference/rest/v1/projects.models.versions/list). +message Version { + // Required.The name specified for the version when it was created. + // + // The version name must be unique within the model it is created in. + string name = 1; + + // Optional. The description specified for the version when it was created. + string description = 2; + + // Output only. If true, this version will be used to handle prediction + // requests that do not specify a version. + // + // You can change the default version by calling + // [projects.methods.versions.setDefault](/ml/reference/rest/v1/projects.models.versions/setDefault). + bool is_default = 3; + + // Required. The Google Cloud Storage location of the trained model used to + // create the version. See the + // [overview of model deployment](/ml/docs/concepts/deployment-overview) for + // more informaiton. + // + // When passing Version to + // [projects.models.versions.create](/ml/reference/rest/v1/projects.models.versions/create) + // the model service uses the specified location as the source of the model. + // Once deployed, the model version is hosted by the prediction service, so + // this location is useful only as a historical record. + string deployment_uri = 4; + + // Output only. The time the version was created. + google.protobuf.Timestamp create_time = 5; + + // Output only. The time the version was last used for prediction. + google.protobuf.Timestamp last_use_time = 6; + + // Optional. The Google Cloud ML runtime version to use for this deployment. + // If not set, Google Cloud ML will choose a version. + string runtime_version = 8; + + // Optional. Manually select the number of nodes to use for serving the + // model. If unset (i.e., by default), the number of nodes used to serve + // the model automatically scales with traffic. However, care should be + // taken to ramp up traffic according to the model's ability to scale. If + // your model needs to handle bursts of traffic beyond it's ability to + // scale, it is recommended you set this field appropriately. + ManualScaling manual_scaling = 9; +} + +// Options for manually scaling a model. +message ManualScaling { + // The number of nodes to allocate for this model. These nodes are always up, + // starting from the time the model is deployed, so the cost of operating + // this model will be proportional to nodes * number of hours since + // deployment. + int32 nodes = 1; +} + +// Request message for the CreateModel method. +message CreateModelRequest { + // Required. The project name. + // + // Authorization: requires `Editor` role on the specified project. + string parent = 1; + + // Required. The model to create. + Model model = 2; +} + +// Request message for the ListModels method. +message ListModelsRequest { + // Required. The name of the project whose models are to be listed. + // + // Authorization: requires `Viewer` role on the specified project. + string parent = 1; + + // Optional. A page token to request the next page of results. + // + // You get the token from the `next_page_token` field of the response from + // the previous call. + string page_token = 4; + + // Optional. The number of models to retrieve per "page" of results. If there + // are more remaining results than this number, the response message will + // contain a valid value in the `next_page_token` field. + // + // The default value is 20, and the maximum page size is 100. + int32 page_size = 5; +} + +// Response message for the ListModels method. +message ListModelsResponse { + // The list of models. + repeated Model models = 1; + + // Optional. Pass this token as the `page_token` field of the request for a + // subsequent call. + string next_page_token = 2; +} + +// Request message for the GetModel method. +message GetModelRequest { + // Required. The name of the model. + // + // Authorization: requires `Viewer` role on the parent project. + string name = 1; +} + +// Request message for the DeleteModel method. +message DeleteModelRequest { + // Required. The name of the model. + // + // Authorization: requires `Editor` role on the parent project. + string name = 1; +} + +// Uploads the provided trained model version to Cloud Machine Learning. +message CreateVersionRequest { + // Required. The name of the model. + // + // Authorization: requires `Editor` role on the parent project. + string parent = 1; + + // Required. The version details. + Version version = 2; +} + +// Request message for the ListVersions method. +message ListVersionsRequest { + // Required. The name of the model for which to list the version. + // + // Authorization: requires `Viewer` role on the parent project. + string parent = 1; + + // Optional. A page token to request the next page of results. + // + // You get the token from the `next_page_token` field of the response from + // the previous call. + string page_token = 4; + + // Optional. The number of versions to retrieve per "page" of results. If + // there are more remaining results than this number, the response message + // will contain a valid value in the `next_page_token` field. + // + // The default value is 20, and the maximum page size is 100. + int32 page_size = 5; +} + +// Response message for the ListVersions method. +message ListVersionsResponse { + // The list of versions. + repeated Version versions = 1; + + // Optional. Pass this token as the `page_token` field of the request for a + // subsequent call. + string next_page_token = 2; +} + +// Request message for the GetVersion method. +message GetVersionRequest { + // Required. The name of the version. + // + // Authorization: requires `Viewer` role on the parent project. + string name = 1; +} + +// Request message for the DeleteVerionRequest method. +message DeleteVersionRequest { + // Required. The name of the version. You can get the names of all the + // versions of a model by calling + // [projects.models.versions.list](/ml/reference/rest/v1/projects.models.versions/list). + // + // Authorization: requires `Editor` role on the parent project. + string name = 1; +} + +// Request message for the SetDefaultVersion request. +message SetDefaultVersionRequest { + // Required. The name of the version to make the default for the model. You + // can get the names of all the versions of a model by calling + // [projects.models.versions.list](/ml/reference/rest/v1/projects.models.versions/list). + // + // Authorization: requires `Editor` role on the parent project. + string name = 1; +} diff --git a/handwritten/cloud-profiler/google/cloud/ml/v1/operation_metadata.proto b/handwritten/cloud-profiler/google/cloud/ml/v1/operation_metadata.proto new file mode 100644 index 00000000000..c29a7892592 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/ml/v1/operation_metadata.proto @@ -0,0 +1,72 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.ml.v1; + +import "google/api/annotations.proto"; +import "google/cloud/ml/v1/model_service.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/ml/v1;ml"; +option java_multiple_files = true; +option java_outer_classname = "OperationMetadataProto"; +option java_package = "com.google.cloud.ml.api.v1"; + +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Proto file for the Google Cloud Machine Learning Engine. +// Describes the metadata for longrunning operations. + + + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // The operation type. + enum OperationType { + // Unspecified operation type. + OPERATION_TYPE_UNSPECIFIED = 0; + + // An operation to create a new version. + CREATE_VERSION = 1; + + // An operation to delete an existing version. + DELETE_VERSION = 2; + + // An operation to delete an existing model. + DELETE_MODEL = 3; + } + + // The time the operation was submitted. + google.protobuf.Timestamp create_time = 1; + + // The time operation processing started. + google.protobuf.Timestamp start_time = 2; + + // The time operation processing completed. + google.protobuf.Timestamp end_time = 3; + + // Indicates whether a request to cancel this operation has been made. + bool is_cancellation_requested = 4; + + // The operation type. + OperationType operation_type = 5; + + // Contains the name of the model associated with the operation. + string model_name = 6; + + // Contains the version associated with the operation. + Version version = 7; +} diff --git a/handwritten/cloud-profiler/google/cloud/ml/v1/prediction_service.proto b/handwritten/cloud-profiler/google/cloud/ml/v1/prediction_service.proto new file mode 100644 index 00000000000..c5e25dcd3b1 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/ml/v1/prediction_service.proto @@ -0,0 +1,240 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.ml.v1; + +import "google/api/annotations.proto"; +import "google/api/httpbody.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/ml/v1;ml"; +option java_multiple_files = true; +option java_outer_classname = "PredictionServiceProto"; +option java_package = "com.google.cloud.ml.api.v1"; + +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Proto file for the Google Cloud Machine Learning Engine. +// Describes the online prediction service. + + + +// The Prediction API, which serves predictions for models managed by +// ModelService. +service OnlinePredictionService { + // Performs prediction on the data in the request. + // + // **** REMOVE FROM GENERATED DOCUMENTATION + rpc Predict(PredictRequest) returns (google.api.HttpBody) { + option (google.api.http) = { post: "/v1/{name=projects/**}:predict" body: "*" }; + } +} + +// Request for predictions to be issued against a trained model. +// +// The body of the request is a single JSON object with a single top-level +// field: +// +//
+//
instances
+//
A JSON array containing values representing the instances to use for +// prediction.
+//
+// +// The structure of each element of the instances list is determined by your +// model's input definition. Instances can include named inputs or can contain +// only unlabeled values. +// +// Not all data includes named inputs. Some instances will be simple +// JSON values (boolean, number, or string). However, instances are often lists +// of simple values, or complex nested lists. Here are some examples of request +// bodies: +// +// CSV data with each row encoded as a string value: +//
+// {"instances": ["1.0,true,\\"x\\"", "-2.0,false,\\"y\\""]}
+// 
+// Plain text: +//
+// {"instances": ["the quick brown fox", "la bruja le dio"]}
+// 
+// Sentences encoded as lists of words (vectors of strings): +//
+// {
+//   "instances": [
+//     ["the","quick","brown"],
+//     ["la","bruja","le"],
+//     ...
+//   ]
+// }
+// 
+// Floating point scalar values: +//
+// {"instances": [0.0, 1.1, 2.2]}
+// 
+// Vectors of integers: +//
+// {
+//   "instances": [
+//     [0, 1, 2],
+//     [3, 4, 5],
+//     ...
+//   ]
+// }
+// 
+// Tensors (in this case, two-dimensional tensors): +//
+// {
+//   "instances": [
+//     [
+//       [0, 1, 2],
+//       [3, 4, 5]
+//     ],
+//     ...
+//   ]
+// }
+// 
+// Images can be represented different ways. In this encoding scheme the first +// two dimensions represent the rows and columns of the image, and the third +// contains lists (vectors) of the R, G, and B values for each pixel. +//
+// {
+//   "instances": [
+//     [
+//       [
+//         [138, 30, 66],
+//         [130, 20, 56],
+//         ...
+//       ],
+//       [
+//         [126, 38, 61],
+//         [122, 24, 57],
+//         ...
+//       ],
+//       ...
+//     ],
+//     ...
+//   ]
+// }
+// 
+// JSON strings must be encoded as UTF-8. To send binary data, you must +// base64-encode the data and mark it as binary. To mark a JSON string +// as binary, replace it with a JSON object with a single attribute named `b64`: +//
{"b64": "..."} 
+// For example: +// +// Two Serialized tf.Examples (fake data, for illustrative purposes only): +//
+// {"instances": [{"b64": "X5ad6u"}, {"b64": "IA9j4nx"}]}
+// 
+// Two JPEG image byte strings (fake data, for illustrative purposes only): +//
+// {"instances": [{"b64": "ASa8asdf"}, {"b64": "JLK7ljk3"}]}
+// 
+// If your data includes named references, format each instance as a JSON object +// with the named references as the keys: +// +// JSON input data to be preprocessed: +//
+// {
+//   "instances": [
+//     {
+//       "a": 1.0,
+//       "b": true,
+//       "c": "x"
+//     },
+//     {
+//       "a": -2.0,
+//       "b": false,
+//       "c": "y"
+//     }
+//   ]
+// }
+// 
+// Some models have an underlying TensorFlow graph that accepts multiple input +// tensors. In this case, you should use the names of JSON name/value pairs to +// identify the input tensors, as shown in the following exmaples: +// +// For a graph with input tensor aliases "tag" (string) and "image" +// (base64-encoded string): +//
+// {
+//   "instances": [
+//     {
+//       "tag": "beach",
+//       "image": {"b64": "ASa8asdf"}
+//     },
+//     {
+//       "tag": "car",
+//       "image": {"b64": "JLK7ljk3"}
+//     }
+//   ]
+// }
+// 
+// For a graph with input tensor aliases "tag" (string) and "image" +// (3-dimensional array of 8-bit ints): +//
+// {
+//   "instances": [
+//     {
+//       "tag": "beach",
+//       "image": [
+//         [
+//           [138, 30, 66],
+//           [130, 20, 56],
+//           ...
+//         ],
+//         [
+//           [126, 38, 61],
+//           [122, 24, 57],
+//           ...
+//         ],
+//         ...
+//       ]
+//     },
+//     {
+//       "tag": "car",
+//       "image": [
+//         [
+//           [255, 0, 102],
+//           [255, 0, 97],
+//           ...
+//         ],
+//         [
+//           [254, 1, 101],
+//           [254, 2, 93],
+//           ...
+//         ],
+//         ...
+//       ]
+//     },
+//     ...
+//   ]
+// }
+// 
+// If the call is successful, the response body will contain one prediction +// entry per instance in the request body. If prediction fails for any +// instance, the response body will contain no predictions and will contian +// a single error entry instead. +message PredictRequest { + // Required. The resource name of a model or a version. + // + // Authorization: requires `Viewer` role on the parent project. + string name = 1; + + // + // Required. The prediction request body. + google.api.HttpBody http_body = 2; +} diff --git a/handwritten/cloud-profiler/google/cloud/ml/v1/project_service.proto b/handwritten/cloud-profiler/google/cloud/ml/v1/project_service.proto new file mode 100644 index 00000000000..f54eadf6a39 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/ml/v1/project_service.proto @@ -0,0 +1,59 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.ml.v1; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/ml/v1;ml"; +option java_multiple_files = true; +option java_outer_classname = "ProjectServiceProto"; +option java_package = "com.google.cloud.ml.api.v1"; + +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Proto file for the Google Cloud Machine Learning Engine. +// Describes the project management service. + + + +// Allows retrieving project related information. +service ProjectManagementService { + // Get the service account information associated with your project. You need + // this information in order to grant the service account persmissions for + // the Google Cloud Storage location where you put your model training code + // for training the model with Google Cloud Machine Learning. + rpc GetConfig(GetConfigRequest) returns (GetConfigResponse) { + option (google.api.http) = { get: "/v1/{name=projects/*}:getConfig" }; + } +} + +// Requests service account information associated with a project. +message GetConfigRequest { + // Required. The project name. + // + // Authorization: requires `Viewer` role on the specified project. + string name = 1; +} + +// Returns service account information associated with a project. +message GetConfigResponse { + // The service account Cloud ML uses to access resources in the project. + string service_account = 1; + + // The project number for `service_account`. + int64 service_account_project = 2; +} diff --git a/handwritten/cloud-profiler/google/cloud/ml/v1beta1/job_service.proto b/handwritten/cloud-profiler/google/cloud/ml/v1beta1/job_service.proto new file mode 100644 index 00000000000..1ac71e175cb --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/ml/v1beta1/job_service.proto @@ -0,0 +1,605 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.ml.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/auth.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/ml/v1beta1;ml"; +option java_multiple_files = true; +option java_outer_classname = "JobServiceProto"; +option java_package = "com.google.cloud.ml.api.v1beta1"; + +// Copyright 2016 Google Inc. All Rights Reserved. +// +// Proto file for the Google Cloud Machine Learning Engine. +// Describes the 'job service' to manage training and prediction jobs. + + + +// Service to create and manage training and batch prediction jobs. +service JobService { + // Creates a training or a batch prediction job. + rpc CreateJob(CreateJobRequest) returns (Job) { + option (google.api.http) = { post: "/v1beta1/{parent=projects/*}/jobs" body: "job" }; + } + + // Lists the jobs in the project. + rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { + option (google.api.http) = { get: "/v1beta1/{parent=projects/*}/jobs" }; + } + + // Describes a job. + rpc GetJob(GetJobRequest) returns (Job) { + option (google.api.http) = { get: "/v1beta1/{name=projects/*/jobs/*}" }; + } + + // Cancels a running job. + rpc CancelJob(CancelJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1beta1/{name=projects/*/jobs/*}:cancel" body: "*" }; + } +} + +// Represents input parameters for a training job. +message TrainingInput { + // A scale tier is an abstract representation of the resources Cloud ML + // will allocate to a training job. When selecting a scale tier for your + // training job, you should consider the size of your training dataset and + // the complexity of your model. As the tiers increase, virtual machines are + // added to handle your job, and the individual machines in the cluster + // generally have more memory and greater processing power than they do at + // lower tiers. The number of training units charged per hour of processing + // increases as tiers get more advanced. Refer to the + // [pricing guide](/ml/pricing) for more details. Note that in addition to + // incurring costs, your use of training resources is constrained by the + // [quota policy](/ml/quota). + enum ScaleTier { + // A single worker instance. This tier is suitable for learning how to use + // Cloud ML, and for experimenting with new models using small datasets. + BASIC = 0; + + // Many workers and a few parameter servers. + STANDARD_1 = 1; + + // A large number of workers with many parameter servers. + PREMIUM_1 = 3; + + // A single worker instance [with a GPU](ml/docs/how-tos/using-gpus). + BASIC_GPU = 6; + + // The CUSTOM tier is not a set tier, but rather enables you to use your + // own cluster specification. When you use this tier, set values to + // configure your processing cluster according to these guidelines: + // + // * You _must_ set `TrainingInput.masterType` to specify the type + // of machine to use for your master node. This is the only required + // setting. + // + // * You _may_ set `TrainingInput.workerCount` to specify the number of + // workers to use. If you specify one or more workers, you _must_ also + // set `TrainingInput.workerType` to specify the type of machine to use + // for your worker nodes. + // + // * You _may_ set `TrainingInput.parameterServerCount` to specify the + // number of parameter servers to use. If you specify one or more + // parameter servers, you _must_ also set + // `TrainingInput.parameterServerType` to specify the type of machine to + // use for your parameter servers. + // + // Note that all of your workers must use the same machine type, which can + // be different from your parameter server type and master type. Your + // parameter servers must likewise use the same machine type, which can be + // different from your worker type and master type. + CUSTOM = 5; + } + + // Required. Specifies the machine types, the number of replicas for workers + // and parameter servers. + ScaleTier scale_tier = 1; + + // Optional. Specifies the type of virtual machine to use for your training + // job's master worker. + // + // The following types are supported: + // + //
+ //
standard
+ //
+ // A basic machine configuration suitable for training simple models with + // small to moderate datasets. + //
+ //
large_model
+ //
+ // A machine with a lot of memory, specially suited for parameter servers + // when your model is large (having many hidden layers or layers with very + // large numbers of nodes). + //
+ //
complex_model_s
+ //
+ // A machine suitable for the master and workers of the cluster when your + // model requires more computation than the standard machine can handle + // satisfactorily. + //
+ //
complex_model_m
+ //
+ // A machine with roughly twice the number of cores and roughly double the + // memory of complex_model_s. + //
+ //
complex_model_l
+ //
+ // A machine with roughly twice the number of cores and roughly double the + // memory of complex_model_m. + //
+ //
standard_gpu
+ //
+ // A machine equivalent to standard that + // also includes a + // + // GPU that you can use in your trainer. + //
+ //
complex_model_m_gpu
+ //
+ // A machine equivalent to + // coplex_model_m that also includes + // four GPUs. + //
+ //
+ // + // You must set this value when `scaleTier` is set to `CUSTOM`. + string master_type = 2; + + // Optional. Specifies the type of virtual machine to use for your training + // job's worker nodes. + // + // The supported values are the same as those described in the entry for + // `masterType`. + // + // This value must be present when `scaleTier` is set to `CUSTOM` and + // `workerCount` is greater than zero. + string worker_type = 3; + + // Optional. Specifies the type of virtual machine to use for your training + // job's parameter server. + // + // The supported values are the same as those described in the entry for + // `master_type`. + // + // This value must be present when `scaleTier` is set to `CUSTOM` and + // `parameter_server_count` is greater than zero. + string parameter_server_type = 4; + + // Optional. The number of worker replicas to use for the training job. Each + // replica in the cluster will be of the type specified in `worker_type`. + // + // This value can only be used when `scale_tier` is set to `CUSTOM`. If you + // set this value, you must also set `worker_type`. + int64 worker_count = 5; + + // Optional. The number of parameter server replicas to use for the training + // job. Each replica in the cluster will be of the type specified in + // `parameter_server_type`. + // + // This value can only be used when `scale_tier` is set to `CUSTOM`.If you + // set this value, you must also set `parameter_server_type`. + int64 parameter_server_count = 6; + + // Required. The Google Cloud Storage location of the packages with + // the training program and any additional dependencies. + repeated string package_uris = 7; + + // Required. The Python module name to run after installing the packages. + string python_module = 8; + + // Optional. Command line arguments to pass to the program. + repeated string args = 10; + + // Optional. The set of Hyperparameters to tune. + HyperparameterSpec hyperparameters = 12; + + // Required. The Google Compute Engine region to run the training job in. + string region = 14; + + // Optional. A Google Cloud Storage path in which to store training outputs + // and other data needed for training. This path is passed to your TensorFlow + // program as the 'job_dir' command-line argument. The benefit of specifying + // this field is that Cloud ML validates the path for use in training. + string job_dir = 16; + + // Optional. The Google Cloud ML runtime version to use for training. If not + // set, Google Cloud ML will choose the latest stable version. + string runtime_version = 15; +} + +// Represents a set of hyperparameters to optimize. +message HyperparameterSpec { + // The available types of optimization goals. + enum GoalType { + // Goal Type will default to maximize. + GOAL_TYPE_UNSPECIFIED = 0; + + // Maximize the goal metric. + MAXIMIZE = 1; + + // Minimize the goal metric. + MINIMIZE = 2; + } + + // Required. The type of goal to use for tuning. Available types are + // `MAXIMIZE` and `MINIMIZE`. + // + // Defaults to `MAXIMIZE`. + GoalType goal = 1; + + // Required. The set of parameters to tune. + repeated ParameterSpec params = 2; + + // Optional. How many training trials should be attempted to optimize + // the specified hyperparameters. + // + // Defaults to one. + int32 max_trials = 3; + + // Optional. The number of training trials to run concurrently. + // You can reduce the time it takes to perform hyperparameter tuning by adding + // trials in parallel. However, each trail only benefits from the information + // gained in completed trials. That means that a trial does not get access to + // the results of trials running at the same time, which could reduce the + // quality of the overall optimization. + // + // Each trial will use the same scale tier and machine types. + // + // Defaults to one. + int32 max_parallel_trials = 4; + + // Optional. The Tensorflow summary tag name to use for optimizing trials. For + // current versions of Tensorflow, this tag name should exactly match what is + // shown in Tensorboard, including all scopes. For versions of Tensorflow + // prior to 0.12, this should be only the tag passed to tf.Summary. + // By default, "training/hptuning/metric" will be used. + string hyperparameter_metric_tag = 5; +} + +// Represents a single hyperparameter to optimize. +message ParameterSpec { + // The type of the parameter. + enum ParameterType { + // You must specify a valid type. Using this unspecified type will result in + // an error. + PARAMETER_TYPE_UNSPECIFIED = 0; + + // Type for real-valued parameters. + DOUBLE = 1; + + // Type for integral parameters. + INTEGER = 2; + + // The parameter is categorical, with a value chosen from the categories + // field. + CATEGORICAL = 3; + + // The parameter is real valued, with a fixed set of feasible points. If + // `type==DISCRETE`, feasible_points must be provided, and + // {`min_value`, `max_value`} will be ignored. + DISCRETE = 4; + } + + // The type of scaling that should be applied to this parameter. + enum ScaleType { + // By default, no scaling is applied. + NONE = 0; + + // Scales the feasible space to (0, 1) linearly. + UNIT_LINEAR_SCALE = 1; + + // Scales the feasible space logarithmically to (0, 1). The entire feasible + // space must be strictly positive. + UNIT_LOG_SCALE = 2; + + // Scales the feasible space "reverse" logarithmically to (0, 1). The result + // is that values close to the top of the feasible space are spread out more + // than points near the bottom. The entire feasible space must be strictly + // positive. + UNIT_REVERSE_LOG_SCALE = 3; + } + + // Required. The parameter name must be unique amongst all ParameterConfigs in + // a HyperparameterSpec message. E.g., "learning_rate". + string parameter_name = 1; + + // Required. The type of the parameter. + ParameterType type = 4; + + // Required if type is `DOUBLE` or `INTEGER`. This field + // should be unset if type is `CATEGORICAL`. This value should be integers if + // type is INTEGER. + double min_value = 2; + + // Required if typeis `DOUBLE` or `INTEGER`. This field + // should be unset if type is `CATEGORICAL`. This value should be integers if + // type is `INTEGER`. + double max_value = 3; + + // Required if type is `CATEGORICAL`. The list of possible categories. + repeated string categorical_values = 5; + + // Required if type is `DISCRETE`. + // A list of feasible points. + // The list should be in strictly increasing order. For instance, this + // parameter might have possible settings of 1.5, 2.5, and 4.0. This list + // should not contain more than 1,000 values. + repeated double discrete_values = 6; + + // Optional. How the parameter should be scaled to the hypercube. + // Leave unset for categorical parameters. + // Some kind of scaling is strongly recommended for real or integral + // parameters (e.g., `UNIT_LINEAR_SCALE`). + ScaleType scale_type = 7; +} + +// Represents the result of a single hyperparameter tuning trial from a +// training job. The TrainingOutput object that is returned on successful +// completion of a training job with hyperparameter tuning includes a list +// of HyperparameterOutput objects, one for each successful trial. +message HyperparameterOutput { + // An observed value of a metric. + message HyperparameterMetric { + // The global training step for this metric. + int64 training_step = 1; + + // The objective value at this training step. + double objective_value = 2; + } + + // The trial id for these results. + string trial_id = 1; + + // The hyperparameters given to this trial. + map hyperparameters = 2; + + // The final objective metric seen for this trial. + HyperparameterMetric final_metric = 3; + + // All recorded object metrics for this trial. + repeated HyperparameterMetric all_metrics = 4; +} + +// Represents results of a training job. Output only. +message TrainingOutput { + // The number of hyperparameter tuning trials that completed successfully. + // Only set for hyperparameter tuning jobs. + int64 completed_trial_count = 1; + + // Results for individual Hyperparameter trials. + // Only set for hyperparameter tuning jobs. + repeated HyperparameterOutput trials = 2; + + // The amount of ML units consumed by the job. + double consumed_ml_units = 3; + + // Whether this job is a hyperparameter tuning job. + bool is_hyperparameter_tuning_job = 4; +} + +// Represents input parameters for a prediction job. +message PredictionInput { + // The format used to separate data instances in the source files. + enum DataFormat { + // Unspecified format. + DATA_FORMAT_UNSPECIFIED = 0; + + // The source file is a text file with instances separated by the + // new-line character. + TEXT = 1; + + // The source file is a TFRecord file. + TF_RECORD = 2; + + // The source file is a GZIP-compressed TFRecord file. + TF_RECORD_GZIP = 3; + } + + // Required. The model or the version to use for prediction. + oneof model_version { + // Use this field if you want to use the default version for the specified + // model. The string must use the following format: + // + // `"projects/[YOUR_PROJECT]/models/[YOUR_MODEL]"` + string model_name = 1; + + // Use this field if you want to specify a version of the model to use. The + // string is formatted the same way as `model_version`, with the addition + // of the version information: + // + // `"projects/[YOUR_PROJECT]/models/YOUR_MODEL/versions/[YOUR_VERSION]"` + string version_name = 2; + + // Use this field if you want to specify a Google Cloud Storage path for + // the model to use. + string uri = 9; + } + + // Required. The format of the input data files. + DataFormat data_format = 3; + + // Required. The Google Cloud Storage location of the input data files. + // May contain wildcards. + repeated string input_paths = 4; + + // Required. The output Google Cloud Storage location. + string output_path = 5; + + // Optional. The maximum number of workers to be used for parallel processing. + // Defaults to 10 if not specified. + int64 max_worker_count = 6; + + // Required. The Google Compute Engine region to run the prediction job in. + string region = 7; + + // Optional. The Google Cloud ML runtime version to use for this batch + // prediction. If not set, Google Cloud ML will pick the runtime version used + // during the CreateVersion request for this model version, or choose the + // latest stable version when model version information is not available + // such as when the model is specified by uri. + string runtime_version = 8; +} + +// Represents results of a prediction job. +message PredictionOutput { + // The output Google Cloud Storage location provided at the job creation time. + string output_path = 1; + + // The number of generated predictions. + int64 prediction_count = 2; + + // The number of data instances which resulted in errors. + int64 error_count = 3; + + // Node hours used by the batch prediction job. + double node_hours = 4; +} + +// Represents a training or prediction job. +message Job { + // Describes the job state. + enum State { + // The job state is unspecified. + STATE_UNSPECIFIED = 0; + + // The job has been just created and processing has not yet begun. + QUEUED = 1; + + // The service is preparing to run the job. + PREPARING = 2; + + // The job is in progress. + RUNNING = 3; + + // The job completed successfully. + SUCCEEDED = 4; + + // The job failed. + // `error_message` should contain the details of the failure. + FAILED = 5; + + // The job is being cancelled. + // `error_message` should describe the reason for the cancellation. + CANCELLING = 6; + + // The job has been cancelled. + // `error_message` should describe the reason for the cancellation. + CANCELLED = 7; + } + + // Required. The user-specified id of the job. + string job_id = 1; + + // Required. Parameters to create a job. + oneof input { + // Input parameters to create a training job. + TrainingInput training_input = 2; + + // Input parameters to create a prediction job. + PredictionInput prediction_input = 3; + } + + // Output only. When the job was created. + google.protobuf.Timestamp create_time = 4; + + // Output only. When the job processing was started. + google.protobuf.Timestamp start_time = 5; + + // Output only. When the job processing was completed. + google.protobuf.Timestamp end_time = 6; + + // Output only. The detailed state of a job. + State state = 7; + + // Output only. The details of a failure or a cancellation. + string error_message = 8; + + // Output only. The current result of the job. + oneof output { + // The current training job result. + TrainingOutput training_output = 9; + + // The current prediction job result. + PredictionOutput prediction_output = 10; + } +} + +// Request message for the CreateJob method. +message CreateJobRequest { + // Required. The project name. + // + // Authorization: requires `Editor` role on the specified project. + string parent = 1; + + // Required. The job to create. + Job job = 2; +} + +// Request message for the ListJobs method. +message ListJobsRequest { + // Required. The name of the project for which to list jobs. + // + // Authorization: requires `Viewer` role on the specified project. + string parent = 1; + + // Optional. Specifies the subset of jobs to retrieve. + string filter = 2; + + // Optional. A page token to request the next page of results. + // + // You get the token from the `next_page_token` field of the response from + // the previous call. + string page_token = 4; + + // Optional. The number of jobs to retrieve per "page" of results. If there + // are more remaining results than this number, the response message will + // contain a valid value in the `next_page_token` field. + // + // The default value is 20, and the maximum page size is 100. + int32 page_size = 5; +} + +// Response message for the ListJobs method. +message ListJobsResponse { + // The list of jobs. + repeated Job jobs = 1; + + // Optional. Pass this token as the `page_token` field of the request for a + // subsequent call. + string next_page_token = 2; +} + +// Request message for the GetJob method. +message GetJobRequest { + // Required. The name of the job to get the description of. + // + // Authorization: requires `Viewer` role on the parent project. + string name = 1; +} + +// Request message for the CancelJob method. +message CancelJobRequest { + // Required. The name of the job to cancel. + // + // Authorization: requires `Editor` role on the parent project. + string name = 1; +} diff --git a/handwritten/cloud-profiler/google/cloud/ml/v1beta1/model_service.proto b/handwritten/cloud-profiler/google/cloud/ml/v1beta1/model_service.proto new file mode 100644 index 00000000000..08b0d37a54c --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/ml/v1beta1/model_service.proto @@ -0,0 +1,371 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.ml.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/auth.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/ml/v1beta1;ml"; +option java_multiple_files = true; +option java_outer_classname = "ModelServiceProto"; +option java_package = "com.google.cloud.ml.api.v1beta1"; + +// Copyright 2016 Google Inc. All Rights Reserved. +// +// Proto file for the Google Cloud Machine Learning Engine. +// Describes the 'models service' to work with the 'model' and 'version' +// resources. + + + +// Provides methods that create and manage machine learning models and their +// versions. +// +// A model in this context is a container for versions. The model can't provide +// predictions without first having a version created for it. +// +// Each version is a trained machine learning model, and each is assumed to be +// an iteration of the same machine learning problem as the other versions of +// the same model. +// +// Your project can define multiple models, each with multiple versions. +// +// The basic life cycle of a model is: +// +// * Create and train the machine learning model and save it to a +// Google Cloud Storage location. +// * Use +// [projects.models.create](/ml/reference/rest/v1beta1/projects.models/create) +// to make a new model in your project. +// * Use +// [projects.models.versions.create](/ml/reference/rest/v1beta1/projects.models.versions/create) +// to deploy your saved model. +// * Use [projects.predict](/ml/reference/rest/v1beta1/projects/predict to +// request predictions of a version of your model, or use +// [projects.jobs.create](/ml/reference/rest/v1beta1/projects.jobs/create) +// to start a batch prediction job. +service ModelService { + // Creates a model which will later contain one or more versions. + // + // You must add at least one version before you can request predictions from + // the model. Add versions by calling + // [projects.models.versions.create](/ml/reference/rest/v1beta1/projects.models.versions/create). + rpc CreateModel(CreateModelRequest) returns (Model) { + option (google.api.http) = { post: "/v1beta1/{parent=projects/*}/models" body: "model" }; + } + + // Lists the models in a project. + // + // Each project can contain multiple models, and each model can have multiple + // versions. + rpc ListModels(ListModelsRequest) returns (ListModelsResponse) { + option (google.api.http) = { get: "/v1beta1/{parent=projects/*}/models" }; + } + + // Gets information about a model, including its name, the description (if + // set), and the default version (if at least one version of the model has + // been deployed). + rpc GetModel(GetModelRequest) returns (Model) { + option (google.api.http) = { get: "/v1beta1/{name=projects/*/models/*}" }; + } + + // Deletes a model. + // + // You can only delete a model if there are no versions in it. You can delete + // versions by calling + // [projects.models.versions.delete](/ml/reference/rest/v1beta1/projects.models.versions/delete). + rpc DeleteModel(DeleteModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { delete: "/v1beta1/{name=projects/*/models/*}" }; + } + + // Creates a new version of a model from a trained TensorFlow model. + // + // If the version created in the cloud by this call is the first deployed + // version of the specified model, it will be made the default version of the + // model. When you add a version to a model that already has one or more + // versions, the default version does not automatically change. If you want a + // new version to be the default, you must call + // [projects.models.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault). + rpc CreateVersion(CreateVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1beta1/{parent=projects/*/models/*}/versions" body: "version" }; + } + + // Gets basic information about all the versions of a model. + // + // If you expect that a model has a lot of versions, or if you need to handle + // only a limited number of results at a time, you can request that the list + // be retrieved in batches (called pages): + rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { + option (google.api.http) = { get: "/v1beta1/{parent=projects/*/models/*}/versions" }; + } + + // Gets information about a model version. + // + // Models can have multiple versions. You can call + // [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list) + // to get the same information that this method returns for all of the + // versions of a model. + rpc GetVersion(GetVersionRequest) returns (Version) { + option (google.api.http) = { get: "/v1beta1/{name=projects/*/models/*/versions/*}" }; + } + + // Deletes a model version. + // + // Each model can have multiple versions deployed and in use at any given + // time. Use this method to remove a single version. + // + // Note: You cannot delete the version that is set as the default version + // of the model unless it is the only remaining version. + rpc DeleteVersion(DeleteVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { delete: "/v1beta1/{name=projects/*/models/*/versions/*}" }; + } + + // Designates a version to be the default for the model. + // + // The default version is used for prediction requests made against the model + // that don't specify a version. + // + // The first version to be created for a model is automatically set as the + // default. You must make any subsequent changes to the default version + // setting manually using this method. + rpc SetDefaultVersion(SetDefaultVersionRequest) returns (Version) { + option (google.api.http) = { post: "/v1beta1/{name=projects/*/models/*/versions/*}:setDefault" body: "*" }; + } +} + +// Represents a machine learning solution. +// +// A model can have multiple versions, each of which is a deployed, trained +// model ready to receive prediction requests. The model itself is just a +// container. +message Model { + // Required. The name specified for the model when it was created. + // + // The model name must be unique within the project it is created in. + string name = 1; + + // Optional. The description specified for the model when it was created. + string description = 2; + + // Output only. The default version of the model. This version will be used to + // handle prediction requests that do not specify a version. + // + // You can change the default version by calling + // [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault). + Version default_version = 3; + + // Optional. The list of regions where the model is going to be deployed. + // Currently only one region per model is supported. + // Defaults to 'us-central1' if nothing is set. + repeated string regions = 4; + + // Optional. If true, enables StackDriver Logging for online prediction. + // Default is false. + bool online_prediction_logging = 5; +} + +// Represents a version of the model. +// +// Each version is a trained model deployed in the cloud, ready to handle +// prediction requests. A model can have multiple versions. You can get +// information about all of the versions of a given model by calling +// [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list). +message Version { + // Required.The name specified for the version when it was created. + // + // The version name must be unique within the model it is created in. + string name = 1; + + // Optional. The description specified for the version when it was created. + string description = 2; + + // Output only. If true, this version will be used to handle prediction + // requests that do not specify a version. + // + // You can change the default version by calling + // [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault). + bool is_default = 3; + + // Required. The Google Cloud Storage location of the trained model used to + // create the version. See the + // [overview of model deployment](/ml/docs/concepts/deployment-overview) for + // more informaiton. + // + // When passing Version to + // [projects.models.versions.create](/ml/reference/rest/v1beta1/projects.models.versions/create) + // the model service uses the specified location as the source of the model. + // Once deployed, the model version is hosted by the prediction service, so + // this location is useful only as a historical record. + string deployment_uri = 4; + + // Output only. The time the version was created. + google.protobuf.Timestamp create_time = 5; + + // Output only. The time the version was last used for prediction. + google.protobuf.Timestamp last_use_time = 6; + + // Optional. The Google Cloud ML runtime version to use for this deployment. + // If not set, Google Cloud ML will choose a version. + string runtime_version = 8; + + // Optional. Manually select the number of nodes to use for serving the + // model. If unset (i.e., by default), the number of nodes used to serve + // the model automatically scales with traffic. However, care should be + // taken to ramp up traffic according to the model's ability to scale. If + // your model needs to handle bursts of traffic beyond it's ability to + // scale, it is recommended you set this field appropriately. + ManualScaling manual_scaling = 9; +} + +// Options for manually scaling a model. +message ManualScaling { + // The number of nodes to allocate for this model. These nodes are always up, + // starting from the time the model is deployed, so the cost of operating + // this model will be proportional to nodes * number of hours since + // deployment. + int32 nodes = 1; +} + +// Request message for the CreateModel method. +message CreateModelRequest { + // Required. The project name. + // + // Authorization: requires `Editor` role on the specified project. + string parent = 1; + + // Required. The model to create. + Model model = 2; +} + +// Request message for the ListModels method. +message ListModelsRequest { + // Required. The name of the project whose models are to be listed. + // + // Authorization: requires `Viewer` role on the specified project. + string parent = 1; + + // Optional. A page token to request the next page of results. + // + // You get the token from the `next_page_token` field of the response from + // the previous call. + string page_token = 4; + + // Optional. The number of models to retrieve per "page" of results. If there + // are more remaining results than this number, the response message will + // contain a valid value in the `next_page_token` field. + // + // The default value is 20, and the maximum page size is 100. + int32 page_size = 5; +} + +// Response message for the ListModels method. +message ListModelsResponse { + // The list of models. + repeated Model models = 1; + + // Optional. Pass this token as the `page_token` field of the request for a + // subsequent call. + string next_page_token = 2; +} + +// Request message for the GetModel method. +message GetModelRequest { + // Required. The name of the model. + // + // Authorization: requires `Viewer` role on the parent project. + string name = 1; +} + +// Request message for the DeleteModel method. +message DeleteModelRequest { + // Required. The name of the model. + // + // Authorization: requires `Editor` role on the parent project. + string name = 1; +} + +// Uploads the provided trained model version to Cloud Machine Learning. +message CreateVersionRequest { + // Required. The name of the model. + // + // Authorization: requires `Editor` role on the parent project. + string parent = 1; + + // Required. The version details. + Version version = 2; +} + +// Request message for the ListVersions method. +message ListVersionsRequest { + // Required. The name of the model for which to list the version. + // + // Authorization: requires `Viewer` role on the parent project. + string parent = 1; + + // Optional. A page token to request the next page of results. + // + // You get the token from the `next_page_token` field of the response from + // the previous call. + string page_token = 4; + + // Optional. The number of versions to retrieve per "page" of results. If + // there are more remaining results than this number, the response message + // will contain a valid value in the `next_page_token` field. + // + // The default value is 20, and the maximum page size is 100. + int32 page_size = 5; +} + +// Response message for the ListVersions method. +message ListVersionsResponse { + // The list of versions. + repeated Version versions = 1; + + // Optional. Pass this token as the `page_token` field of the request for a + // subsequent call. + string next_page_token = 2; +} + +// Request message for the GetVersion method. +message GetVersionRequest { + // Required. The name of the version. + // + // Authorization: requires `Viewer` role on the parent project. + string name = 1; +} + +// Request message for the DeleteVerionRequest method. +message DeleteVersionRequest { + // Required. The name of the version. You can get the names of all the + // versions of a model by calling + // [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list). + // + // Authorization: requires `Editor` role on the parent project. + string name = 1; +} + +// Request message for the SetDefaultVersion request. +message SetDefaultVersionRequest { + // Required. The name of the version to make the default for the model. You + // can get the names of all the versions of a model by calling + // [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list). + // + // Authorization: requires `Editor` role on the parent project. + string name = 1; +} diff --git a/handwritten/cloud-profiler/google/cloud/ml/v1beta1/operation_metadata.proto b/handwritten/cloud-profiler/google/cloud/ml/v1beta1/operation_metadata.proto new file mode 100644 index 00000000000..a72647191c2 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/ml/v1beta1/operation_metadata.proto @@ -0,0 +1,72 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.ml.v1beta1; + +import "google/api/annotations.proto"; +import "google/cloud/ml/v1beta1/model_service.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/ml/v1beta1;ml"; +option java_multiple_files = true; +option java_outer_classname = "OperationMetadataProto"; +option java_package = "com.google.cloud.ml.api.v1beta1"; + +// Copyright 2016 Google Inc. All Rights Reserved. +// +// Proto file for the Google Cloud Machine Learning Engine. +// Describes the metadata for longrunning operations. + + + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // The operation type. + enum OperationType { + // Unspecified operation type. + OPERATION_TYPE_UNSPECIFIED = 0; + + // An operation to create a new version. + CREATE_VERSION = 1; + + // An operation to delete an existing version. + DELETE_VERSION = 2; + + // An operation to delete an existing model. + DELETE_MODEL = 3; + } + + // The time the operation was submitted. + google.protobuf.Timestamp create_time = 1; + + // The time operation processing started. + google.protobuf.Timestamp start_time = 2; + + // The time operation processing completed. + google.protobuf.Timestamp end_time = 3; + + // Indicates whether a request to cancel this operation has been made. + bool is_cancellation_requested = 4; + + // The operation type. + OperationType operation_type = 5; + + // Contains the name of the model associated with the operation. + string model_name = 6; + + // Contains the version associated with the operation. + Version version = 7; +} diff --git a/handwritten/cloud-profiler/google/cloud/ml/v1beta1/prediction_service.proto b/handwritten/cloud-profiler/google/cloud/ml/v1beta1/prediction_service.proto new file mode 100644 index 00000000000..6374ca22559 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/ml/v1beta1/prediction_service.proto @@ -0,0 +1,240 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.ml.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/httpbody.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/ml/v1beta1;ml"; +option java_multiple_files = true; +option java_outer_classname = "PredictionServiceProto"; +option java_package = "com.google.cloud.ml.api.v1beta1"; + +// Copyright 2016 Google Inc. All Rights Reserved. +// +// Proto file for the Google Cloud Machine Learning Engine. +// Describes the online prediction service. + + + +// The Prediction API, which serves predictions for models managed by +// ModelService. +service OnlinePredictionService { + // Performs prediction on the data in the request. + // + // **** REMOVE FROM GENERATED DOCUMENTATION + rpc Predict(PredictRequest) returns (google.api.HttpBody) { + option (google.api.http) = { post: "/v1beta1/{name=projects/**}:predict" body: "*" }; + } +} + +// Request for predictions to be issued against a trained model. +// +// The body of the request is a single JSON object with a single top-level +// field: +// +//
+//
instances
+//
A JSON array containing values representing the instances to use for +// prediction.
+//
+// +// The structure of each element of the instances list is determined by your +// model's input definition. Instances can include named inputs or can contain +// only unlabeled values. +// +// Not all data includes named inputs. Some instances will be simple +// JSON values (boolean, number, or string). However, instances are often lists +// of simple values, or complex nested lists. Here are some examples of request +// bodies: +// +// CSV data with each row encoded as a string value: +//
+// {"instances": ["1.0,true,\\"x\\"", "-2.0,false,\\"y\\""]}
+// 
+// Plain text: +//
+// {"instances": ["the quick brown fox", "la bruja le dio"]}
+// 
+// Sentences encoded as lists of words (vectors of strings): +//
+// {
+//   "instances": [
+//     ["the","quick","brown"],
+//     ["la","bruja","le"],
+//     ...
+//   ]
+// }
+// 
+// Floating point scalar values: +//
+// {"instances": [0.0, 1.1, 2.2]}
+// 
+// Vectors of integers: +//
+// {
+//   "instances": [
+//     [0, 1, 2],
+//     [3, 4, 5],
+//     ...
+//   ]
+// }
+// 
+// Tensors (in this case, two-dimensional tensors): +//
+// {
+//   "instances": [
+//     [
+//       [0, 1, 2],
+//       [3, 4, 5]
+//     ],
+//     ...
+//   ]
+// }
+// 
+// Images can be represented different ways. In this encoding scheme the first +// two dimensions represent the rows and columns of the image, and the third +// contains lists (vectors) of the R, G, and B values for each pixel. +//
+// {
+//   "instances": [
+//     [
+//       [
+//         [138, 30, 66],
+//         [130, 20, 56],
+//         ...
+//       ],
+//       [
+//         [126, 38, 61],
+//         [122, 24, 57],
+//         ...
+//       ],
+//       ...
+//     ],
+//     ...
+//   ]
+// }
+// 
+// JSON strings must be encoded as UTF-8. To send binary data, you must +// base64-encode the data and mark it as binary. To mark a JSON string +// as binary, replace it with a JSON object with a single attribute named `b64`: +//
{"b64": "..."} 
+// For example: +// +// Two Serialized tf.Examples (fake data, for illustrative purposes only): +//
+// {"instances": [{"b64": "X5ad6u"}, {"b64": "IA9j4nx"}]}
+// 
+// Two JPEG image byte strings (fake data, for illustrative purposes only): +//
+// {"instances": [{"b64": "ASa8asdf"}, {"b64": "JLK7ljk3"}]}
+// 
+// If your data includes named references, format each instance as a JSON object +// with the named references as the keys: +// +// JSON input data to be preprocessed: +//
+// {
+//   "instances": [
+//     {
+//       "a": 1.0,
+//       "b": true,
+//       "c": "x"
+//     },
+//     {
+//       "a": -2.0,
+//       "b": false,
+//       "c": "y"
+//     }
+//   ]
+// }
+// 
+// Some models have an underlying TensorFlow graph that accepts multiple input +// tensors. In this case, you should use the names of JSON name/value pairs to +// identify the input tensors, as shown in the following exmaples: +// +// For a graph with input tensor aliases "tag" (string) and "image" +// (base64-encoded string): +//
+// {
+//   "instances": [
+//     {
+//       "tag": "beach",
+//       "image": {"b64": "ASa8asdf"}
+//     },
+//     {
+//       "tag": "car",
+//       "image": {"b64": "JLK7ljk3"}
+//     }
+//   ]
+// }
+// 
+// For a graph with input tensor aliases "tag" (string) and "image" +// (3-dimensional array of 8-bit ints): +//
+// {
+//   "instances": [
+//     {
+//       "tag": "beach",
+//       "image": [
+//         [
+//           [138, 30, 66],
+//           [130, 20, 56],
+//           ...
+//         ],
+//         [
+//           [126, 38, 61],
+//           [122, 24, 57],
+//           ...
+//         ],
+//         ...
+//       ]
+//     },
+//     {
+//       "tag": "car",
+//       "image": [
+//         [
+//           [255, 0, 102],
+//           [255, 0, 97],
+//           ...
+//         ],
+//         [
+//           [254, 1, 101],
+//           [254, 2, 93],
+//           ...
+//         ],
+//         ...
+//       ]
+//     },
+//     ...
+//   ]
+// }
+// 
+// If the call is successful, the response body will contain one prediction +// entry per instance in the request body. If prediction fails for any +// instance, the response body will contain no predictions and will contian +// a single error entry instead. +message PredictRequest { + // Required. The resource name of a model or a version. + // + // Authorization: requires `Viewer` role on the parent project. + string name = 1; + + // + // Required. The prediction request body. + google.api.HttpBody http_body = 2; +} diff --git a/handwritten/cloud-profiler/google/cloud/ml/v1beta1/project_service.proto b/handwritten/cloud-profiler/google/cloud/ml/v1beta1/project_service.proto new file mode 100644 index 00000000000..1f8b2d5e0ab --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/ml/v1beta1/project_service.proto @@ -0,0 +1,59 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.ml.v1beta1; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/ml/v1beta1;ml"; +option java_multiple_files = true; +option java_outer_classname = "ProjectServiceProto"; +option java_package = "com.google.cloud.ml.api.v1beta1"; + +// Copyright 2016 Google Inc. All Rights Reserved. +// +// Proto file for the Google Cloud Machine Learning Engine. +// Describes the project management service. + + + +// Allows retrieving project related information. +service ProjectManagementService { + // Get the service account information associated with your project. You need + // this information in order to grant the service account persmissions for + // the Google Cloud Storage location where you put your model training code + // for training the model with Google Cloud Machine Learning. + rpc GetConfig(GetConfigRequest) returns (GetConfigResponse) { + option (google.api.http) = { get: "/v1beta1/{name=projects/*}:getConfig" }; + } +} + +// Requests service account information associated with a project. +message GetConfigRequest { + // Required. The project name. + // + // Authorization: requires `Viewer` role on the specified project. + string name = 1; +} + +// Returns service account information associated with a project. +message GetConfigResponse { + // The service account Cloud ML uses to access resources in the project. + string service_account = 1; + + // The project number for `service_account`. + int64 service_account_project = 2; +} diff --git a/handwritten/cloud-profiler/google/cloud/runtimeconfig/README.md b/handwritten/cloud-profiler/google/cloud/runtimeconfig/README.md new file mode 100644 index 00000000000..49c1d8717ff --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/runtimeconfig/README.md @@ -0,0 +1,39 @@ +[TOC] + +# Introduction + +The RuntimeConfig service provides Google Cloud Platform users the ability to +dynamically configure your service. + +The RuntimConfig service creates and manages RuntimeConfig resources +within a Google Cloud Project and various variables within said resource. + +## Details + +Each cloud project can create multiple **Config** objects. A **Config** object +by itself does not contain any configuration information, but rather is a +logical grouping of variables. Variable names are hierarchical and follow file +system style, where only leaf nodes can contain values. + +For example, you can have a configuration called *Flags*. Within that +configuration object, you can create the following variables. + +* `/ports/service_port` +* `/ports/monitoring_port` +* `/ports/admin_port` + +This creates three variables: `/ports/serve_port`, `/ports/monitoring_port`, +`/ports/admin_port`. Note that `/ports` cannot have a value but it can be +listed. + +### Setup + +In order to make requests to RuntimeConfig service, you need to enable the API +for your project. + +To achieve that, go to the +[Google Cloud Console](https://console.cloud.google.com/apis/api/runtimeconfig.googleapis.com/overview) +and enable *Google Cloud RuntimeConfig API* for your project. + +The documentation for this service is located +[here](https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/). diff --git a/handwritten/cloud-profiler/google/cloud/runtimeconfig/runtimeconfig.yaml b/handwritten/cloud-profiler/google/cloud/runtimeconfig/runtimeconfig.yaml new file mode 100644 index 00000000000..1f66c9b605b --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/runtimeconfig/runtimeconfig.yaml @@ -0,0 +1,49 @@ +type: google.api.Service +config_version: 3 +name: runtimeconfig.googleapis.com +title: Google Cloud RuntimeConfig API + +apis: +- name: google.longrunning.Operations +- name: google.cloud.runtimeconfig.v1beta1.RuntimeConfigManager +- name: google.iam.v1.IAMPolicy + +# Documentation section +documentation: + summary: + Provides capabilities for dynamic configuration and coordination for applications running on Google Cloud Platform. + + +http: + rules: + - selector: google.longrunning.Operations.GetOperation + get: '/v1beta1/{name=projects/*/configs/*/operations/**}' + + - selector: google.iam.v1.IAMPolicy.SetIamPolicy + post: '/v1beta1/{resource=projects/*/configs/*}:setIamPolicy' + body: '*' + + - selector: google.iam.v1.IAMPolicy.GetIamPolicy + get: '/v1beta1/{resource=projects/*/configs/*}:getIamPolicy' + + - selector: google.iam.v1.IAMPolicy.TestIamPermissions + post: '/v1beta1/{resource=projects/*/configs/*}:testIamPermissions' + body: '*' + additional_bindings: + - post: '/v1beta1/{resource=projects/*/configs/*/waiters/*}:testIamPermissions' + body: '*' + + - post: '/v1beta1/{resource=projects/*/configs/*/variables/**}:testIamPermissions' + body: '*' + + - post: '/v1beta1/{resource=projects/*/configs/*/operations/**}:testIamPermissions' + body: '*' + + +# Auth section +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloudruntimeconfig diff --git a/handwritten/cloud-profiler/google/cloud/runtimeconfig/v1beta1/resources.proto b/handwritten/cloud-profiler/google/cloud/runtimeconfig/v1beta1/resources.proto new file mode 100644 index 00000000000..908722a0eea --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/runtimeconfig/v1beta1/resources.proto @@ -0,0 +1,208 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.runtimeconfig.v1beta1; + +import "google/api/annotations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.RuntimeConfig.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/runtimeconfig/v1beta1;runtimeconfig"; +option java_multiple_files = true; +option java_package = "com.google.cloud.runtimeconfig.v1beta1"; + + +// A RuntimeConfig resource is the primary resource in the Cloud RuntimeConfig +// service. A RuntimeConfig resource consists of metadata and a hierarchy of +// variables. +message RuntimeConfig { + // The resource name of a runtime config. The name must have the format: + // + // projects/[PROJECT_ID]/configs/[CONFIG_NAME] + // + // The `[PROJECT_ID]` must be a valid project ID, and `[CONFIG_NAME]` is an + // arbitrary name that matches RFC 1035 segment specification. The length of + // `[CONFIG_NAME]` must be less than 64 bytes. + // + // You pick the RuntimeConfig resource name, but the server will validate that + // the name adheres to this format. After you create the resource, you cannot + // change the resource's name. + string name = 1; + + // An optional description of the RuntimeConfig object. + string description = 2; +} + +// Describes a single variable within a RuntimeConfig resource. +// The name denotes the hierarchical variable name. For example, +// `ports/serving_port` is a valid variable name. The variable value is an +// opaque string and only leaf variables can have values (that is, variables +// that do not have any child variables). +message Variable { + // The name of the variable resource, in the format: + // + // projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIABLE_NAME] + // + // The `[PROJECT_ID]` must be a valid project ID, `[CONFIG_NAME]` must be a + // valid RuntimeConfig reource and `[VARIABLE_NAME]` follows Unix file system + // file path naming. + // + // The `[VARIABLE_NAME]` can contain ASCII letters, numbers, slashes and + // dashes. Slashes are used as path element separators and are not part of the + // `[VARIABLE_NAME]` itself, so `[VARIABLE_NAME]` must contain at least one + // non-slash character. Multiple slashes are coalesced into single slash + // character. Each path segment should follow RFC 1035 segment specification. + // The length of a `[VARIABLE_NAME]` must be less than 256 bytes. + // + // Once you create a variable, you cannot change the variable name. + string name = 1; + + // The the value of the variable. It can be either a binary or a string + // value. You must specify one of either `value` or `text`. Specifying both + // will cause the server to return an error. + oneof contents { + // The binary value of the variable. The length of the value must be less + // than 4096 bytes. Empty values are also accepted. The value must be + // base64 encoded. Only one of `value` or `text` can be set. + bytes value = 2; + + // The string value of the variable. The length of the value must be less + // than 4096 bytes. Empty values are also accepted. For example, + // `text: "my text value"`. The string must be valid UTF-8. + string text = 5; + } + + // [Output Only] The time of the last variable update. + google.protobuf.Timestamp update_time = 3; + + // [Ouput only] The current state of the variable. The variable state indicates + // the outcome of the `variables().watch` call and is visible through the + // `get` and `list` calls. + VariableState state = 4; +} + +// The condition that a Waiter resource is waiting for. +message EndCondition { + // A Cardinality condition for the Waiter resource. A cardinality condition is + // met when the number of variables under a specified path prefix reaches a + // predefined number. For example, if you set a Cardinality condition where + // the `path` is set to `/foo` and the number of paths is set to 2, the + // following variables would meet the condition in a RuntimeConfig resource: + // + // + `/foo/variable1 = "value1"` + // + `/foo/variable2 = "value2"` + // + `/bar/variable3 = "value3"` + // + // It would not would not satisify the same condition with the `number` set to + // 3, however, because there is only 2 paths that start with `/foo`. + // Cardinality conditions are recursive; all subtrees under the specific + // path prefix are counted. + message Cardinality { + // The root of the variable subtree to monitor. For example, `/foo`. + string path = 1; + + // The number variables under the `path` that must exist to meet this + // condition. Defaults to 1 if not specified. + int32 number = 2; + } + + // The condition oneof holds the available condition types for this + // EndCondition. Currently, the only available type is Cardinality. + oneof condition { + // The cardinality of the `EndCondition`. + Cardinality cardinality = 1; + } +} + +// A Waiter resource waits for some end condition within a RuntimeConfig resource +// to be met before it returns. For example, assume you have a distributed +// system where each node writes to a Variable resource indidicating the node's +// readiness as part of the startup process. +// +// You then configure a Waiter resource with the success condition set to wait +// until some number of nodes have checked in. Afterwards, your application +// runs some arbitrary code after the condition has been met and the waiter +// returns successfully. +// +// Once created, a Waiter resource is immutable. +// +// To learn more about using waiters, read the +// [Creating a Waiter](/deployment-manager/runtime-configurator/creating-a-waiter) +// documentation. +message Waiter { + // The name of the Waiter resource, in the format: + // + // projects/[PROJECT_ID]/configs/[CONFIG_NAME]/waiters/[WAITER_NAME] + // + // The `[PROJECT_ID]` must be a valid Google Cloud project ID, + // the `[CONFIG_NAME]` must be a valid RuntimeConfig resource, the + // `[WAITER_NAME]` must match RFC 1035 segment specification, and the length + // of `[WAITER_NAME]` must be less than 64 bytes. + // + // After you create a Waiter resource, you cannot change the resource name. + string name = 1; + + // [Required] Specifies the timeout of the waiter in seconds, beginning from + // the instant that `waiters().create` method is called. If this time elapses + // before the success or failure conditions are met, the waiter fails and sets + // the `error` code to `DEADLINE_EXCEEDED`. + google.protobuf.Duration timeout = 2; + + // [Optional] The failure condition of this waiter. If this condition is met, + // `done` will be set to `true` and the `error` code will be set to `ABORTED`. + // The failure condition takes precedence over the success condition. If both + // conditions are met, a failure will be indicated. This value is optional; if + // no failure condition is set, the only failure scenario will be a timeout. + EndCondition failure = 3; + + // [Required] The success condition. If this condition is met, `done` will be + // set to `true` and the `error` value will remain unset. The failure condition + // takes precedence over the success condition. If both conditions are met, a + // failure will be indicated. + EndCondition success = 4; + + // [Output Only] The instant at which this Waiter resource was created. Adding + // the value of `timeout` to this instant yields the timeout deadline for the + // waiter. + google.protobuf.Timestamp create_time = 5; + + // [Output Only] If the value is `false`, it means the waiter is still waiting + // for one of its conditions to be met. + // + // If true, the waiter has finished. If the waiter finished due to a timeout + // or failure, `error` will be set. + bool done = 6; + + // [Output Only] If the waiter ended due to a failure or timeout, this value + // will be set. + google.rpc.Status error = 7; +} + +// The `VariableState` describes the last known state of the variable and is +// used during a `variables().watch` call to distinguish the state of the +// variable. +enum VariableState { + // Default variable state. + VARIABLE_STATE_UNSPECIFIED = 0; + + // The variable was updated, while `variables().watch` was executing. + UPDATED = 1; + + // The variable was deleted, while `variables().watch` was executing. + DELETED = 2; +} diff --git a/handwritten/cloud-profiler/google/cloud/runtimeconfig/v1beta1/runtimeconfig.proto b/handwritten/cloud-profiler/google/cloud/runtimeconfig/v1beta1/runtimeconfig.proto new file mode 100644 index 00000000000..4ebcfadf2f1 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/runtimeconfig/v1beta1/runtimeconfig.proto @@ -0,0 +1,410 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.runtimeconfig.v1beta1; + +import "google/api/annotations.proto"; +import "google/cloud/runtimeconfig/v1beta1/resources.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.RuntimeConfig.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/runtimeconfig/v1beta1;runtimeconfig"; +option java_multiple_files = true; +option java_package = "com.google.cloud.runtimeconfig.v1beta1"; + + +// RuntimeConfig API represents configuration objects and operations on those +// configuration objects. +// RuntimeConfig objects consist of Variables logically grouped in the those +// objects. +// Variables are simple key-value pairs. Variables can be watched for changes or +// deletions. Variable key can be hieararchical, e.g. ports/serving_port, +// ports/monitoring_port, etc. Variable names can be hierarchical. No variable +// name can be prefix of another. +// Config objects represent logical containers for variables, e.g. flags, +// passwords, etc. +service RuntimeConfigManager { + // Lists all the RuntimeConfig resources within project. + rpc ListConfigs(ListConfigsRequest) returns (ListConfigsResponse) { + option (google.api.http) = { get: "/v1beta1/{parent=projects/*}/configs" }; + } + + // Gets information about a RuntimeConfig resource. + rpc GetConfig(GetConfigRequest) returns (RuntimeConfig) { + option (google.api.http) = { get: "/v1beta1/{name=projects/*/configs/*}" }; + } + + // Creates a new RuntimeConfig resource. The configuration name must be + // unique within project. + rpc CreateConfig(CreateConfigRequest) returns (RuntimeConfig) { + option (google.api.http) = { post: "/v1beta1/{parent=projects/*}/configs" body: "config" }; + } + + // Updates a RuntimeConfig resource. The configuration must exist beforehand. + rpc UpdateConfig(UpdateConfigRequest) returns (RuntimeConfig) { + option (google.api.http) = { put: "/v1beta1/{name=projects/*/configs/*}" body: "config" }; + } + + // Deletes a RuntimeConfig resource. + rpc DeleteConfig(DeleteConfigRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1beta1/{name=projects/*/configs/*}" }; + } + + // Lists variables within given a configuration, matching any provided filters. + // This only lists variable names, not the values, unless `return_values` is + // true, in which case only variables that user has IAM permission to + // GetVariable will be returned. + rpc ListVariables(ListVariablesRequest) returns (ListVariablesResponse) { + option (google.api.http) = { get: "/v1beta1/{parent=projects/*/configs/*}/variables" }; + } + + // Gets information about a single variable. + rpc GetVariable(GetVariableRequest) returns (Variable) { + option (google.api.http) = { get: "/v1beta1/{name=projects/*/configs/*/variables/**}" }; + } + + // Watches a specific variable and waits for a change in the variable's value. + // When there is a change, this method returns the new value or times out. + // + // If a variable is deleted while being watched, the `variableState` state is + // set to `DELETED` and the method returns the last known variable `value`. + // + // If you set the deadline for watching to a larger value than internal timeout + // (60 seconds), the current variable value is returned and the `variableState` + // will be `VARIABLE_STATE_UNSPECIFIED`. + // + // To learn more about creating a watcher, read the + // [Watching a Variable for Changes](/deployment-manager/runtime-configurator/watching-a-variable) + // documentation. + rpc WatchVariable(WatchVariableRequest) returns (Variable) { + option (google.api.http) = { post: "/v1beta1/{name=projects/*/configs/*/variables/**}:watch" body: "*" }; + } + + // Creates a variable within the given configuration. You cannot create + // a variable with a name that is a prefix of an existing variable name, or a + // name that has an existing variable name as a prefix. + // + // To learn more about creating a variable, read the + // [Setting and Getting Data](/deployment-manager/runtime-configurator/set-and-get-variables) + // documentation. + rpc CreateVariable(CreateVariableRequest) returns (Variable) { + option (google.api.http) = { post: "/v1beta1/{parent=projects/*/configs/*}/variables" body: "variable" }; + } + + // Updates an existing variable with a new value. + rpc UpdateVariable(UpdateVariableRequest) returns (Variable) { + option (google.api.http) = { put: "/v1beta1/{name=projects/*/configs/*/variables/**}" body: "variable" }; + } + + // Deletes a variable or multiple variables. + // + // If you specify a variable name, then that variable is deleted. If you + // specify a prefix and `recursive` is true, then all variables with that + // prefix are deleted. You must set a `recursive` to true if you delete + // variables by prefix. + rpc DeleteVariable(DeleteVariableRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1beta1/{name=projects/*/configs/*/variables/**}" }; + } + + // List waiters within the given configuration. + rpc ListWaiters(ListWaitersRequest) returns (ListWaitersResponse) { + option (google.api.http) = { get: "/v1beta1/{parent=projects/*/configs/*}/waiters" }; + } + + // Gets information about a single waiter. + rpc GetWaiter(GetWaiterRequest) returns (Waiter) { + option (google.api.http) = { get: "/v1beta1/{name=projects/*/configs/*/waiters/*}" }; + } + + // Creates a Waiter resource. This operation returns a long-running Operation + // resource which can be polled for completion. However, a waiter with the + // given name will exist (and can be retrieved) prior to the operation + // completing. If the operation fails, the failed Waiter resource will + // still exist and must be deleted prior to subsequent creation attempts. + rpc CreateWaiter(CreateWaiterRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1beta1/{parent=projects/*/configs/*}/waiters" body: "waiter" }; + } + + // Deletes the waiter with the specified name. + rpc DeleteWaiter(DeleteWaiterRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1beta1/{name=projects/*/configs/*/waiters/*}" }; + } +} + +// Request for the `ListConfigs()` method. +message ListConfigsRequest { + // The [project ID](https://support.google.com/cloud/answer/6158840?hl=en&ref_topic=6158848) + // for this request, in the format `projects/[PROJECT_ID]`. + string parent = 1; + + // Specifies the number of results to return per page. If there are fewer + // elements than the specified number, returns all elements. + int32 page_size = 2; + + // Specifies a page token to use. Set `pageToken` to a `nextPageToken` + // returned by a previous list request to get the next page of results. + string page_token = 3; +} + +// `ListConfigs()` returns the following response. The order of returned +// objects is arbitrary; that is, it is not ordered in any particular way. +message ListConfigsResponse { + // A list of the configurations in the project. The order of returned + // objects is arbitrary; that is, it is not ordered in any particular way. + repeated RuntimeConfig configs = 1; + + // This token allows you to get the next page of results for list requests. + // If the number of results is larger than `pageSize`, use the `nextPageToken` + // as a value for the query parameter `pageToken` in the next list request. + // Subsequent list requests will have their own `nextPageToken` to continue + // paging through the results + string next_page_token = 2; +} + +// Gets a RuntimeConfig resource. +message GetConfigRequest { + // The name of the RuntimeConfig resource to retrieve, in the format: + // + // `projects/[PROJECT_ID]/configs/[CONFIG_NAME]` + string name = 2; +} + +// Creates a RuntimeConfig resource. +message CreateConfigRequest { + // The [project ID](https://support.google.com/cloud/answer/6158840?hl=en&ref_topic=6158848) + // for this request, in the format `projects/[PROJECT_ID]`. + string parent = 1; + + // The RuntimeConfig to create. + RuntimeConfig config = 2; + + // An optional but recommended unique `request_id`. If the server + // receives two `create()` requests with the same + // `request_id`, then the second request will be ignored and the + // first resource created and stored in the backend is returned. + // Empty `request_id` fields are ignored. + // + // It is responsibility of the client to ensure uniqueness of the + // `request_id` strings. + // + // `request_id` strings are limited to 64 characters. + string request_id = 3; +} + +// Request message for `UpdateConfig()` method. +message UpdateConfigRequest { + // The name of the RuntimeConfig resource to update, in the format: + // + // `projects/[PROJECT_ID]/configs/[CONFIG_NAME]` + string name = 1; + + // The config resource to update. + RuntimeConfig config = 2; +} + +// Request for the `DeleteConfig()` method. +message DeleteConfigRequest { + // The RuntimeConfig resource to delete, in the format: + // + // `projects/[PROJECT_ID]/configs/[CONFIG_NAME]` + string name = 1; +} + +// Request for the `ListVariables()` method. +message ListVariablesRequest { + // The path to the RuntimeConfig resource for which you want to list variables. + // The configuration must exist beforehand; the path must by in the format: + // + // `projects/[PROJECT_ID]/configs/[CONFIG_NAME]` + string parent = 1; + + // Filters variables by matching the specified filter. For example: + // + // `projects/example-project/config/[CONFIG_NAME]/variables/example-variable`. + string filter = 2; + + // Specifies the number of results to return per page. If there are fewer + // elements than the specified number, returns all elements. + int32 page_size = 3; + + // Specifies a page token to use. Set `pageToken` to a `nextPageToken` + // returned by a previous list request to get the next page of results. + string page_token = 4; + + // The flag indicates whether the user wants to return values of variables. + // If true, then only those variables that user has IAM GetVariable permission + // will be returned along with their values. + bool return_values = 5; +} + +// Response for the `ListVariables()` method. +message ListVariablesResponse { + // A list of variables and their values. The order of returned variable + // objects is arbitrary. + repeated Variable variables = 1; + + // This token allows you to get the next page of results for list requests. + // If the number of results is larger than `pageSize`, use the `nextPageToken` + // as a value for the query parameter `pageToken` in the next list request. + // Subsequent list requests will have their own `nextPageToken` to continue + // paging through the results + string next_page_token = 2; +} + +// Request for the `WatchVariable()` method. +message WatchVariableRequest { + // The name of the variable to watch, in the format: + // + // `projects/[PROJECT_ID]/configs/[CONFIG_NAME]` + string name = 1; + + // If specified, checks the current timestamp of the variable and if the + // current timestamp is newer than `newerThan` timestamp, the method returns + // immediately. + // + // If not specified or the variable has an older timestamp, the watcher waits + // for a the value to change before returning. + google.protobuf.Timestamp newer_than = 4; +} + +// Request for the `GetVariable()` method. +message GetVariableRequest { + // The name of the variable to return, in the format: + // + // `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIBLE_NAME]` + string name = 1; +} + +// Request for the `CreateVariable()` method. +message CreateVariableRequest { + // The path to the RutimeConfig resource that this variable should belong to. + // The configuration must exist beforehand; the path must by in the format: + // + // `projects/[PROJECT_ID]/configs/[CONFIG_NAME]` + string parent = 1; + + // The variable to create. + Variable variable = 2; + + // An optional but recommended unique `request_id`. If the server + // receives two `create()` requests with the same + // `request_id`, then the second request will be ignored and the + // first resource created and stored in the backend is returned. + // Empty `request_id` fields are ignored. + // + // It is responsibility of the client to ensure uniqueness of the + // `request_id` strings. + // + // `request_id` strings are limited to 64 characters. + string request_id = 3; +} + +// Request for the `UpdateVariable()` method. +message UpdateVariableRequest { + // The name of the variable to update, in the format: + // + // `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIABLE_NAME]` + string name = 1; + + // The variable to update. + Variable variable = 2; +} + +// Request for the `DeleteVariable()` method. +message DeleteVariableRequest { + // The name of the variable to delete, in the format: + // + // `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIABLE_NAME]` + string name = 1; + + // Set to `true` to recursively delete multiple variables with the same + // prefix. + bool recursive = 2; +} + +// Request for the `ListWaiters()` method. +message ListWaitersRequest { + // The path to the configuration for which you want to get a list of waiters. + // The configuration must exist beforehand; the path must by in the format: + // + // `projects/[PROJECT_ID]/configs/[CONFIG_NAME]` + string parent = 1; + + // Specifies the number of results to return per page. If there are fewer + // elements than the specified number, returns all elements. + int32 page_size = 2; + + // Specifies a page token to use. Set `pageToken` to a `nextPageToken` + // returned by a previous list request to get the next page of results. + string page_token = 3; +} + +// Response for the `ListWaiters()` method. +// Order of returned waiter objects is arbitrary. +message ListWaitersResponse { + // Found waiters in the project. + repeated Waiter waiters = 1; + + // This token allows you to get the next page of results for list requests. + // If the number of results is larger than `pageSize`, use the `nextPageToken` + // as a value for the query parameter `pageToken` in the next list request. + // Subsequent list requests will have their own `nextPageToken` to continue + // paging through the results + string next_page_token = 2; +} + +// Request for the `GetWaiter()` method. +message GetWaiterRequest { + // The fully-qualified name of the Waiter resource object to retrieve, in the + // format: + // + // `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/waiters/[WAITER_NAME]` + string name = 1; +} + +// Request message for `CreateWaiter()` method. +message CreateWaiterRequest { + // The path to the configuration that will own the waiter. + // The configuration must exist beforehand; the path must by in the format: + // + // `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`. + string parent = 1; + + // The Waiter resource to create. + Waiter waiter = 2; + + // An optional but recommended unique `request_id`. If the server + // receives two `create()` requests with the same + // `request_id`, then the second request will be ignored and the + // first resource created and stored in the backend is returned. + // Empty `request_id` fields are ignored. + // + // It is responsibility of the client to ensure uniqueness of the + // `request_id` strings. + // + // `request_id` strings are limited to 64 characters. + string request_id = 3; +} + +// Request for the `DeleteWaiter()` method. +message DeleteWaiterRequest { + // The Waiter resource to delete, in the format: + // + // `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/waiters/[WAITER_NAME]` + string name = 1; +} diff --git a/handwritten/cloud-profiler/google/cloud/speech/README.md b/handwritten/cloud-profiler/google/cloud/speech/README.md new file mode 100644 index 00000000000..c45f0f21a16 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/speech/README.md @@ -0,0 +1,3 @@ +# Introduction + +Google Cloud Speech API provides speech recognition as a service. diff --git a/handwritten/cloud-profiler/google/cloud/speech/artman_speech_v1.yaml b/handwritten/cloud-profiler/google/cloud/speech/artman_speech_v1.yaml new file mode 100644 index 00000000000..c4b910b9bf7 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/speech/artman_speech_v1.yaml @@ -0,0 +1,112 @@ +common: + api_name: speech + api_version: v1 + organization_name: google-cloud + service_yaml: cloud_speech_v1.yaml + gapic_yaml: v1/cloud_speech_gapic.yaml + src_proto_paths: + - v1 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-speech-v1 + - name: grpc + dest: generated/java/grpc-google-cloud-speech-v1 + - name: proto + dest: generated/java/proto-google-cloud-speech-v1 + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-speech +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-speech-v1 + - name: grpc + dest: generated/python/proto-google-cloud-speech-v1 + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: google/cloud/speech_v1 + dest: speech/google/cloud/speech_v1 + - src: tests/unit/gapic/v1 + dest: speech/tests/gapic + - name: grpc + src: google/cloud/proto + dest: speech/google/cloud/proto +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-speech-v1 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-speech-v1 + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/speech/v1 + dest: google-cloud-speech/lib/google/cloud/speech/v1 +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-speech-v1/vendor + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: speech/apiv1 +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + release_level: BETA + package_version: + grpc_dep_lower_bound: 0.10.0 + publish_targets: + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v1 + dest: packages/speech/src/v1 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/speech +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/cloud/speech/artman_speech_v1beta1.yaml b/handwritten/cloud-profiler/google/cloud/speech/artman_speech_v1beta1.yaml new file mode 100644 index 00000000000..209e5a02a74 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/speech/artman_speech_v1beta1.yaml @@ -0,0 +1,94 @@ +common: + api_name: speech + api_version: v1beta1 + organization_name: google-cloud + service_yaml: cloud_speech_v1beta1.yaml + gapic_yaml: v1beta1/cloud_speech_gapic.yaml + src_proto_paths: + - v1beta1 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-speech-v1beta1 + - name: grpc + dest: generated/java/grpc-google-cloud-speech-v1beta1 + - name: proto + dest: generated/java/proto-google-cloud-speech-v1beta1 +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-speech-v1beta1 + - name: grpc + dest: generated/python/proto-google-cloud-speech-v1beta1 + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: google/cloud/speech_v1beta1 + dest: speech/google/cloud/speech_v1beta1 + - src: tests/unit/gapic/v1beta1 + dest: speech/tests/gapic + - name: grpc + src: google/cloud/proto/speech/v1beta1 + dest: speech/google/cloud/proto/speech/v1beta1 +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-speech-v1beta1 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-speech-v1beta1 +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: speech/apiv1beta1 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-speech-v1beta1/vendor +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + package_version: + grpc_dep_lower_bound: 0.10.0 + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/speech-v1beta1 +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/cloud/speech/cloud_speech_v1.yaml b/handwritten/cloud-profiler/google/cloud/speech/cloud_speech_v1.yaml new file mode 100644 index 00000000000..92b23141686 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/speech/cloud_speech_v1.yaml @@ -0,0 +1,20 @@ +# Google Cloud Speech API service configuration + +type: google.api.Service +config_version: 3 +name: speech.googleapis.com + +title: Google Cloud Speech API + +documentation: + summary: + Google Cloud Speech API. + +apis: +- name: google.cloud.speech.v1.Speech + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/cloud/speech/cloud_speech_v1_1beta1.yaml b/handwritten/cloud-profiler/google/cloud/speech/cloud_speech_v1_1beta1.yaml new file mode 100644 index 00000000000..55ce330f27c --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/speech/cloud_speech_v1_1beta1.yaml @@ -0,0 +1,20 @@ +# Google Cloud Speech API service configuration + +type: google.api.Service +config_version: 3 +name: speech.googleapis.com + +title: Google Cloud Speech API + +documentation: + summary: + Google Cloud Speech API. + +apis: +- name: google.cloud.speech.v1p1beta1.Speech + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/cloud/speech/cloud_speech_v1beta1.yaml b/handwritten/cloud-profiler/google/cloud/speech/cloud_speech_v1beta1.yaml new file mode 100644 index 00000000000..c64a81aaa83 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/speech/cloud_speech_v1beta1.yaml @@ -0,0 +1,20 @@ +# Google Cloud Speech API service configuration + +type: google.api.Service +config_version: 3 +name: speech.googleapis.com + +title: Google Cloud Speech API + +documentation: + summary: + Google Cloud Speech API. + +apis: +- name: google.cloud.speech.v1beta1.Speech + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/cloud/speech/speech.yaml b/handwritten/cloud-profiler/google/cloud/speech/speech.yaml new file mode 100644 index 00000000000..4e7c59fb568 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/speech/speech.yaml @@ -0,0 +1,56 @@ +type: google.api.Service +config_version: 3 +name: speech.googleapis.com +title: Google Cloud Speech API + +apis: +- name: google.cloud.speech.v1.Speech +- name: google.cloud.speech.v1p1beta1.Speech +- name: google.cloud.speech.v1beta1.Speech + +types: +- name: google.rpc.Status +- name: google.protobuf.Timestamp + +enums: +- name: google.rpc.Code + +documentation: + summary: Converts audio to text by applying powerful neural network models. + overview: |- + # Introduction + + Google Cloud Speech API provides speech recognition as a service. + +http: + rules: + - selector: google.longrunning.Operations.ListOperations + get: /v1/operations + additional_bindings: + - get: /v1beta1/operations + + - selector: google.longrunning.Operations.GetOperation + get: '/v1/operations/{name=*}' + additional_bindings: + - get: '/v1beta1/operations/{name=*}' + + - get: '/v1p1beta1/operations/{name=*}' + + - selector: google.longrunning.Operations.DeleteOperation + delete: '/v1/operations/{name=*}' + additional_bindings: + - delete: '/v1beta1/operations/{name=*}' + + - selector: google.longrunning.Operations.CancelOperation + post: '/v1/operations/{name=*}:cancel' + body: '*' + additional_bindings: + - post: '/v1beta1/operations/{name=*}:cancel' + + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/cloud/speech/v1/cloud_speech.proto b/handwritten/cloud-profiler/google/cloud/speech/v1/cloud_speech.proto new file mode 100644 index 00000000000..b1bac7df2b0 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/speech/v1/cloud_speech.proto @@ -0,0 +1,445 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.speech.v1; + +import "google/api/annotations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/cloud/speech/v1;speech"; +option java_multiple_files = true; +option java_outer_classname = "SpeechProto"; +option java_package = "com.google.cloud.speech.v1"; + + +// Service that implements Google Cloud Speech API. +service Speech { + // Performs synchronous speech recognition: receive results after all audio + // has been sent and processed. + rpc Recognize(RecognizeRequest) returns (RecognizeResponse) { + option (google.api.http) = { post: "/v1/speech:recognize" body: "*" }; + } + + // Performs asynchronous speech recognition: receive results via the + // google.longrunning.Operations interface. Returns either an + // `Operation.error` or an `Operation.response` which contains + // a `LongRunningRecognizeResponse` message. + rpc LongRunningRecognize(LongRunningRecognizeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/speech:longrunningrecognize" body: "*" }; + } + + // Performs bidirectional streaming speech recognition: receive results while + // sending audio. This method is only available via the gRPC API (not REST). + rpc StreamingRecognize(stream StreamingRecognizeRequest) returns (stream StreamingRecognizeResponse); +} + +// The top-level message sent by the client for the `Recognize` method. +message RecognizeRequest { + // *Required* Provides information to the recognizer that specifies how to + // process the request. + RecognitionConfig config = 1; + + // *Required* The audio data to be recognized. + RecognitionAudio audio = 2; +} + +// The top-level message sent by the client for the `LongRunningRecognize` +// method. +message LongRunningRecognizeRequest { + // *Required* Provides information to the recognizer that specifies how to + // process the request. + RecognitionConfig config = 1; + + // *Required* The audio data to be recognized. + RecognitionAudio audio = 2; +} + +// The top-level message sent by the client for the `StreamingRecognize` method. +// Multiple `StreamingRecognizeRequest` messages are sent. The first message +// must contain a `streaming_config` message and must not contain `audio` data. +// All subsequent messages must contain `audio` data and must not contain a +// `streaming_config` message. +message StreamingRecognizeRequest { + // The streaming request, which is either a streaming config or audio content. + oneof streaming_request { + // Provides information to the recognizer that specifies how to process the + // request. The first `StreamingRecognizeRequest` message must contain a + // `streaming_config` message. + StreamingRecognitionConfig streaming_config = 1; + + // The audio data to be recognized. Sequential chunks of audio data are sent + // in sequential `StreamingRecognizeRequest` messages. The first + // `StreamingRecognizeRequest` message must not contain `audio_content` data + // and all subsequent `StreamingRecognizeRequest` messages must contain + // `audio_content` data. The audio bytes must be encoded as specified in + // `RecognitionConfig`. Note: as with all bytes fields, protobuffers use a + // pure binary representation (not base64). See + // [audio limits](https://cloud.google.com/speech/limits#content). + bytes audio_content = 2; + } +} + +// Provides information to the recognizer that specifies how to process the +// request. +message StreamingRecognitionConfig { + // *Required* Provides information to the recognizer that specifies how to + // process the request. + RecognitionConfig config = 1; + + // *Optional* If `false` or omitted, the recognizer will perform continuous + // recognition (continuing to wait for and process audio even if the user + // pauses speaking) until the client closes the input stream (gRPC API) or + // until the maximum time limit has been reached. May return multiple + // `StreamingRecognitionResult`s with the `is_final` flag set to `true`. + // + // If `true`, the recognizer will detect a single spoken utterance. When it + // detects that the user has paused or stopped speaking, it will return an + // `END_OF_SINGLE_UTTERANCE` event and cease recognition. It will return no + // more than one `StreamingRecognitionResult` with the `is_final` flag set to + // `true`. + bool single_utterance = 2; + + // *Optional* If `true`, interim results (tentative hypotheses) may be + // returned as they become available (these interim results are indicated with + // the `is_final=false` flag). + // If `false` or omitted, only `is_final=true` result(s) are returned. + bool interim_results = 3; +} + +// Provides information to the recognizer that specifies how to process the +// request. +message RecognitionConfig { + // Audio encoding of the data sent in the audio message. All encodings support + // only 1 channel (mono) audio. Only `FLAC` and `WAV` include a header that + // describes the bytes of audio that follow the header. The other encodings + // are raw audio bytes with no header. + // + // For best results, the audio source should be captured and transmitted using + // a lossless encoding (`FLAC` or `LINEAR16`). Recognition accuracy may be + // reduced if lossy codecs, which include the other codecs listed in + // this section, are used to capture or transmit the audio, particularly if + // background noise is present. + enum AudioEncoding { + // Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + LINEAR16 = 1; + + // [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio + // Codec) is the recommended encoding because it is + // lossless--therefore recognition is not compromised--and + // requires only about half the bandwidth of `LINEAR16`. `FLAC` stream + // encoding supports 16-bit and 24-bit samples, however, not all fields in + // `STREAMINFO` are supported. + FLAC = 2; + + // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + MULAW = 3; + + // Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. + AMR = 4; + + // Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. + AMR_WB = 5; + + // Opus encoded audio frames in Ogg container + // ([OggOpus](https://wiki.xiph.org/OggOpus)). + // `sample_rate_hertz` must be 16000. + OGG_OPUS = 6; + + // Although the use of lossy encodings is not recommended, if a very low + // bitrate encoding is required, `OGG_OPUS` is highly preferred over + // Speex encoding. The [Speex](https://speex.org/) encoding supported by + // Cloud Speech API has a header byte in each block, as in MIME type + // `audio/x-speex-with-header-byte`. + // It is a variant of the RTP Speex encoding defined in + // [RFC 5574](https://tools.ietf.org/html/rfc5574). + // The stream is a sequence of blocks, one block per RTP packet. Each block + // starts with a byte containing the length of the block, in bytes, followed + // by one or more frames of Speex data, padded to an integral number of + // bytes (octets) as specified in RFC 5574. In other words, each RTP header + // is replaced with a single byte containing the block length. Only Speex + // wideband is supported. `sample_rate_hertz` must be 16000. + SPEEX_WITH_HEADER_BYTE = 7; + } + + // *Required* Encoding of audio data sent in all `RecognitionAudio` messages. + AudioEncoding encoding = 1; + + // *Required* Sample rate in Hertz of the audio data sent in all + // `RecognitionAudio` messages. Valid values are: 8000-48000. + // 16000 is optimal. For best results, set the sampling rate of the audio + // source to 16000 Hz. If that's not possible, use the native sample rate of + // the audio source (instead of re-sampling). + int32 sample_rate_hertz = 2; + + // *Required* The language of the supplied audio as a + // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + // Example: "en-US". + // See [Language Support](https://cloud.google.com/speech/docs/languages) + // for a list of the currently supported language codes. + string language_code = 3; + + // *Optional* Maximum number of recognition hypotheses to be returned. + // Specifically, the maximum number of `SpeechRecognitionAlternative` messages + // within each `SpeechRecognitionResult`. + // The server may return fewer than `max_alternatives`. + // Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of + // one. If omitted, will return a maximum of one. + int32 max_alternatives = 4; + + // *Optional* If set to `true`, the server will attempt to filter out + // profanities, replacing all but the initial character in each filtered word + // with asterisks, e.g. "f***". If set to `false` or omitted, profanities + // won't be filtered out. + bool profanity_filter = 5; + + // *Optional* A means to provide context to assist the speech recognition. + repeated SpeechContext speech_contexts = 6; + + // *Optional* If `true`, the top result includes a list of words and + // the start and end time offsets (timestamps) for those words. If + // `false`, no word-level time offset information is returned. The default is + // `false`. + bool enable_word_time_offsets = 8; +} + +// Provides "hints" to the speech recognizer to favor specific words and phrases +// in the results. +message SpeechContext { + // *Optional* A list of strings containing words and phrases "hints" so that + // the speech recognition is more likely to recognize them. This can be used + // to improve the accuracy for specific words and phrases, for example, if + // specific commands are typically spoken by the user. This can also be used + // to add additional words to the vocabulary of the recognizer. See + // [usage limits](https://cloud.google.com/speech/limits#content). + repeated string phrases = 1; +} + +// Contains audio data in the encoding specified in the `RecognitionConfig`. +// Either `content` or `uri` must be supplied. Supplying both or neither +// returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. See +// [audio limits](https://cloud.google.com/speech/limits#content). +message RecognitionAudio { + // The audio source, which is either inline content or a Google Cloud + // Storage uri. + oneof audio_source { + // The audio data bytes encoded as specified in + // `RecognitionConfig`. Note: as with all bytes fields, protobuffers use a + // pure binary representation, whereas JSON representations use base64. + bytes content = 1; + + // URI that points to a file that contains audio data bytes as specified in + // `RecognitionConfig`. Currently, only Google Cloud Storage URIs are + // supported, which must be specified in the following format: + // `gs://bucket_name/object_name` (other URI formats return + // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see + // [Request URIs](https://cloud.google.com/storage/docs/reference-uris). + string uri = 2; + } +} + +// The only message returned to the client by the `Recognize` method. It +// contains the result as zero or more sequential `SpeechRecognitionResult` +// messages. +message RecognizeResponse { + // *Output-only* Sequential list of transcription results corresponding to + // sequential portions of audio. + repeated SpeechRecognitionResult results = 2; +} + +// The only message returned to the client by the `LongRunningRecognize` method. +// It contains the result as zero or more sequential `SpeechRecognitionResult` +// messages. It is included in the `result.response` field of the `Operation` +// returned by the `GetOperation` call of the `google::longrunning::Operations` +// service. +message LongRunningRecognizeResponse { + // *Output-only* Sequential list of transcription results corresponding to + // sequential portions of audio. + repeated SpeechRecognitionResult results = 2; +} + +// Describes the progress of a long-running `LongRunningRecognize` call. It is +// included in the `metadata` field of the `Operation` returned by the +// `GetOperation` call of the `google::longrunning::Operations` service. +message LongRunningRecognizeMetadata { + // Approximate percentage of audio processed thus far. Guaranteed to be 100 + // when the audio is fully processed and the results are available. + int32 progress_percent = 1; + + // Time when the request was received. + google.protobuf.Timestamp start_time = 2; + + // Time of the most recent processing update. + google.protobuf.Timestamp last_update_time = 3; +} + +// `StreamingRecognizeResponse` is the only message returned to the client by +// `StreamingRecognize`. A series of zero or more `StreamingRecognizeResponse` +// messages are streamed back to the client. If there is no recognizable +// audio, and `single_utterance` is set to false, then no messages are streamed +// back to the client. +// +// Here's an example of a series of ten `StreamingRecognizeResponse`s that might +// be returned while processing audio: +// +// 1. results { alternatives { transcript: "tube" } stability: 0.01 } +// +// 2. results { alternatives { transcript: "to be a" } stability: 0.01 } +// +// 3. results { alternatives { transcript: "to be" } stability: 0.9 } +// results { alternatives { transcript: " or not to be" } stability: 0.01 } +// +// 4. results { alternatives { transcript: "to be or not to be" +// confidence: 0.92 } +// alternatives { transcript: "to bee or not to bee" } +// is_final: true } +// +// 5. results { alternatives { transcript: " that's" } stability: 0.01 } +// +// 6. results { alternatives { transcript: " that is" } stability: 0.9 } +// results { alternatives { transcript: " the question" } stability: 0.01 } +// +// 7. results { alternatives { transcript: " that is the question" +// confidence: 0.98 } +// alternatives { transcript: " that was the question" } +// is_final: true } +// +// Notes: +// +// - Only two of the above responses #4 and #7 contain final results; they are +// indicated by `is_final: true`. Concatenating these together generates the +// full transcript: "to be or not to be that is the question". +// +// - The others contain interim `results`. #3 and #6 contain two interim +// `results`: the first portion has a high stability and is less likely to +// change; the second portion has a low stability and is very likely to +// change. A UI designer might choose to show only high stability `results`. +// +// - The specific `stability` and `confidence` values shown above are only for +// illustrative purposes. Actual values may vary. +// +// - In each response, only one of these fields will be set: +// `error`, +// `speech_event_type`, or +// one or more (repeated) `results`. +message StreamingRecognizeResponse { + // Indicates the type of speech event. + enum SpeechEventType { + // No speech event specified. + SPEECH_EVENT_UNSPECIFIED = 0; + + // This event indicates that the server has detected the end of the user's + // speech utterance and expects no additional speech. Therefore, the server + // will not process additional audio (although it may subsequently return + // additional results). The client should stop sending additional audio + // data, half-close the gRPC connection, and wait for any additional results + // until the server closes the gRPC connection. This event is only sent if + // `single_utterance` was set to `true`, and is not used otherwise. + END_OF_SINGLE_UTTERANCE = 1; + } + + // *Output-only* If set, returns a [google.rpc.Status][google.rpc.Status] message that + // specifies the error for the operation. + google.rpc.Status error = 1; + + // *Output-only* This repeated list contains zero or more results that + // correspond to consecutive portions of the audio currently being processed. + // It contains zero or more `is_final=false` results followed by zero or one + // `is_final=true` result (the newly settled portion). + repeated StreamingRecognitionResult results = 2; + + // *Output-only* Indicates the type of speech event. + SpeechEventType speech_event_type = 4; +} + +// A streaming speech recognition result corresponding to a portion of the audio +// that is currently being processed. +message StreamingRecognitionResult { + // *Output-only* May contain one or more recognition hypotheses (up to the + // maximum specified in `max_alternatives`). + repeated SpeechRecognitionAlternative alternatives = 1; + + // *Output-only* If `false`, this `StreamingRecognitionResult` represents an + // interim result that may change. If `true`, this is the final time the + // speech service will return this particular `StreamingRecognitionResult`, + // the recognizer will not return any further hypotheses for this portion of + // the transcript and corresponding audio. + bool is_final = 2; + + // *Output-only* An estimate of the likelihood that the recognizer will not + // change its guess about this interim result. Values range from 0.0 + // (completely unstable) to 1.0 (completely stable). + // This field is only provided for interim results (`is_final=false`). + // The default of 0.0 is a sentinel value indicating `stability` was not set. + float stability = 3; +} + +// A speech recognition result corresponding to a portion of the audio. +message SpeechRecognitionResult { + // *Output-only* May contain one or more recognition hypotheses (up to the + // maximum specified in `max_alternatives`). + // These alternatives are ordered in terms of accuracy, with the top (first) + // alternative being the most probable, as ranked by the recognizer. + repeated SpeechRecognitionAlternative alternatives = 1; +} + +// Alternative hypotheses (a.k.a. n-best list). +message SpeechRecognitionAlternative { + // *Output-only* Transcript text representing the words that the user spoke. + string transcript = 1; + + // *Output-only* The confidence estimate between 0.0 and 1.0. A higher number + // indicates an estimated greater likelihood that the recognized words are + // correct. This field is typically provided only for the top hypothesis, and + // only for `is_final=true` results. Clients should not rely on the + // `confidence` field as it is not guaranteed to be accurate or consistent. + // The default of 0.0 is a sentinel value indicating `confidence` was not set. + float confidence = 2; + + // *Output-only* A list of word-specific information for each recognized word. + repeated WordInfo words = 3; +} + +// Word-specific information for recognized words. Word information is only +// included in the response when certain request parameters are set, such +// as `enable_word_time_offsets`. +message WordInfo { + // *Output-only* Time offset relative to the beginning of the audio, + // and corresponding to the start of the spoken word. + // This field is only set if `enable_word_time_offsets=true` and only + // in the top hypothesis. + // This is an experimental feature and the accuracy of the time offset can + // vary. + google.protobuf.Duration start_time = 1; + + // *Output-only* Time offset relative to the beginning of the audio, + // and corresponding to the end of the spoken word. + // This field is only set if `enable_word_time_offsets=true` and only + // in the top hypothesis. + // This is an experimental feature and the accuracy of the time offset can + // vary. + google.protobuf.Duration end_time = 2; + + // *Output-only* The word corresponding to this set of information. + string word = 3; +} diff --git a/handwritten/cloud-profiler/google/cloud/speech/v1/cloud_speech_gapic.yaml b/handwritten/cloud-profiler/google/cloud/speech/v1/cloud_speech_gapic.yaml new file mode 100644 index 00000000000..c6e6709943c --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/speech/v1/cloud_speech_gapic.yaml @@ -0,0 +1,98 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.speech.v1 + python: + package_name: google.cloud.speech_v1.gapic + go: + package_name: cloud.google.com/go/speech/apiv1 + release_level: GA + csharp: + package_name: Google.Cloud.Speech.V1 + release_level: GA + ruby: + package_name: Google::Cloud::Speech::V1 + php: + package_name: Google\Cloud\Speech\V1 + nodejs: + package_name: speech.v1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.cloud.speech.v1.Speech + smoke_test: + method: Recognize + init_fields: + - config.language_code="en-US" + - config.sample_rate_hertz=44100 + - config.encoding=FLAC + - audio.uri="gs://gapic-toolkit/hello.flac" + collections: [] + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 190000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 190000 + total_timeout_millis: 600000 + methods: + - name: Recognize + flattening: + groups: + - parameters: + - config + - audio + required_fields: + - config + - audio + sample_code_init_fields: + - config.encoding=FLAC + - config.sample_rate_hertz=44100 + - config.language_code="en-US" + - audio.uri=gs://bucket_name/file_name.flac + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 190000 + - name: LongRunningRecognize + flattening: + groups: + - parameters: + - config + - audio + required_fields: + - config + - audio + sample_code_init_fields: + - config.encoding=FLAC + - config.sample_rate_hertz=44100 + - config.language_code="en-US" + - audio.uri=gs://bucket_name/file_name.flac + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + long_running: + return_type: google.cloud.speech.v1.LongRunningRecognizeResponse + metadata_type: google.cloud.speech.v1.LongRunningRecognizeMetadata + initial_poll_delay_millis: 20000 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 45000 + total_poll_timeout_millis: 86400000 + - name: StreamingRecognize + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 600000 diff --git a/handwritten/cloud-profiler/google/cloud/speech/v1_1beta1/cloud_speech.proto b/handwritten/cloud-profiler/google/cloud/speech/v1_1beta1/cloud_speech.proto new file mode 100644 index 00000000000..269c6006ec7 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/speech/v1_1beta1/cloud_speech.proto @@ -0,0 +1,607 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.speech.v1p1beta1; + +import "google/api/annotations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1;speech"; +option java_multiple_files = true; +option java_outer_classname = "SpeechProto"; +option java_package = "com.google.cloud.speech.v1p1beta1"; + + +// Service that implements Google Cloud Speech API. +service Speech { + // Performs synchronous speech recognition: receive results after all audio + // has been sent and processed. + rpc Recognize(RecognizeRequest) returns (RecognizeResponse) { + option (google.api.http) = { post: "/v1p1beta1/speech:recognize" body: "*" }; + } + + // Performs asynchronous speech recognition: receive results via the + // google.longrunning.Operations interface. Returns either an + // `Operation.error` or an `Operation.response` which contains + // a `LongRunningRecognizeResponse` message. + rpc LongRunningRecognize(LongRunningRecognizeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1p1beta1/speech:longrunningrecognize" body: "*" }; + } + + // Performs bidirectional streaming speech recognition: receive results while + // sending audio. This method is only available via the gRPC API (not REST). + rpc StreamingRecognize(stream StreamingRecognizeRequest) returns (stream StreamingRecognizeResponse); +} + +// The top-level message sent by the client for the `Recognize` method. +message RecognizeRequest { + // *Required* Provides information to the recognizer that specifies how to + // process the request. + RecognitionConfig config = 1; + + // *Required* The audio data to be recognized. + RecognitionAudio audio = 2; +} + +// The top-level message sent by the client for the `LongRunningRecognize` +// method. +message LongRunningRecognizeRequest { + // *Required* Provides information to the recognizer that specifies how to + // process the request. + RecognitionConfig config = 1; + + // *Required* The audio data to be recognized. + RecognitionAudio audio = 2; +} + +// The top-level message sent by the client for the `StreamingRecognize` method. +// Multiple `StreamingRecognizeRequest` messages are sent. The first message +// must contain a `streaming_config` message and must not contain `audio` data. +// All subsequent messages must contain `audio` data and must not contain a +// `streaming_config` message. +message StreamingRecognizeRequest { + // The streaming request, which is either a streaming config or audio content. + oneof streaming_request { + // Provides information to the recognizer that specifies how to process the + // request. The first `StreamingRecognizeRequest` message must contain a + // `streaming_config` message. + StreamingRecognitionConfig streaming_config = 1; + + // The audio data to be recognized. Sequential chunks of audio data are sent + // in sequential `StreamingRecognizeRequest` messages. The first + // `StreamingRecognizeRequest` message must not contain `audio_content` data + // and all subsequent `StreamingRecognizeRequest` messages must contain + // `audio_content` data. The audio bytes must be encoded as specified in + // `RecognitionConfig`. Note: as with all bytes fields, protobuffers use a + // pure binary representation (not base64). See + // [audio limits](https://cloud.google.com/speech/limits#content). + bytes audio_content = 2; + } +} + +// Provides information to the recognizer that specifies how to process the +// request. +message StreamingRecognitionConfig { + // *Required* Provides information to the recognizer that specifies how to + // process the request. + RecognitionConfig config = 1; + + // *Optional* If `false` or omitted, the recognizer will perform continuous + // recognition (continuing to wait for and process audio even if the user + // pauses speaking) until the client closes the input stream (gRPC API) or + // until the maximum time limit has been reached. May return multiple + // `StreamingRecognitionResult`s with the `is_final` flag set to `true`. + // + // If `true`, the recognizer will detect a single spoken utterance. When it + // detects that the user has paused or stopped speaking, it will return an + // `END_OF_SINGLE_UTTERANCE` event and cease recognition. It will return no + // more than one `StreamingRecognitionResult` with the `is_final` flag set to + // `true`. + bool single_utterance = 2; + + // *Optional* If `true`, interim results (tentative hypotheses) may be + // returned as they become available (these interim results are indicated with + // the `is_final=false` flag). + // If `false` or omitted, only `is_final=true` result(s) are returned. + bool interim_results = 3; +} + +// Provides information to the recognizer that specifies how to process the +// request. +message RecognitionConfig { + // Audio encoding of the data sent in the audio message. All encodings support + // only 1 channel (mono) audio. Only `FLAC` includes a header that describes + // the bytes of audio that follow the header. The other encodings are raw + // audio bytes with no header. + // + // For best results, the audio source should be captured and transmitted using + // a lossless encoding (`FLAC` or `LINEAR16`). Recognition accuracy may be + // reduced if lossy codecs, which include the other codecs listed in + // this section, are used to capture or transmit the audio, particularly if + // background noise is present. + enum AudioEncoding { + // Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + LINEAR16 = 1; + + // [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio + // Codec) is the recommended encoding because it is + // lossless--therefore recognition is not compromised--and + // requires only about half the bandwidth of `LINEAR16`. `FLAC` stream + // encoding supports 16-bit and 24-bit samples, however, not all fields in + // `STREAMINFO` are supported. + FLAC = 2; + + // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + MULAW = 3; + + // Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. + AMR = 4; + + // Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. + AMR_WB = 5; + + // Opus encoded audio frames in Ogg container + // ([OggOpus](https://wiki.xiph.org/OggOpus)). + // `sample_rate_hertz` must be 16000. + OGG_OPUS = 6; + + // Although the use of lossy encodings is not recommended, if a very low + // bitrate encoding is required, `OGG_OPUS` is highly preferred over + // Speex encoding. The [Speex](https://speex.org/) encoding supported by + // Cloud Speech API has a header byte in each block, as in MIME type + // `audio/x-speex-with-header-byte`. + // It is a variant of the RTP Speex encoding defined in + // [RFC 5574](https://tools.ietf.org/html/rfc5574). + // The stream is a sequence of blocks, one block per RTP packet. Each block + // starts with a byte containing the length of the block, in bytes, followed + // by one or more frames of Speex data, padded to an integral number of + // bytes (octets) as specified in RFC 5574. In other words, each RTP header + // is replaced with a single byte containing the block length. Only Speex + // wideband is supported. `sample_rate_hertz` must be 16000. + SPEEX_WITH_HEADER_BYTE = 7; + } + + // *Required* Encoding of audio data sent in all `RecognitionAudio` messages. + AudioEncoding encoding = 1; + + // *Required* Sample rate in Hertz of the audio data sent in all + // `RecognitionAudio` messages. Valid values are: 8000-48000. + // 16000 is optimal. For best results, set the sampling rate of the audio + // source to 16000 Hz. If that's not possible, use the native sample rate of + // the audio source (instead of re-sampling). + int32 sample_rate_hertz = 2; + + // *Required* The language of the supplied audio as a + // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + // Example: "en-US". + // See [Language Support](https://cloud.google.com/speech/docs/languages) + // for a list of the currently supported language codes. + string language_code = 3; + + // *Optional* Maximum number of recognition hypotheses to be returned. + // Specifically, the maximum number of `SpeechRecognitionAlternative` messages + // within each `SpeechRecognitionResult`. + // The server may return fewer than `max_alternatives`. + // Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of + // one. If omitted, will return a maximum of one. + int32 max_alternatives = 4; + + // *Optional* If set to `true`, the server will attempt to filter out + // profanities, replacing all but the initial character in each filtered word + // with asterisks, e.g. "f***". If set to `false` or omitted, profanities + // won't be filtered out. + bool profanity_filter = 5; + + // *Optional* A means to provide context to assist the speech recognition. + repeated SpeechContext speech_contexts = 6; + + // *Optional* If `true`, the top result includes a list of words and + // the start and end time offsets (timestamps) for those words. If + // `false`, no word-level time offset information is returned. The default is + // `false`. + bool enable_word_time_offsets = 8; + + // *Optional* If 'true', adds punctuation to recognition result hypotheses. + // This feature is only available in select languages. Setting this for + // requests in other languages has no effect at all. + // The default 'false' value does not add punctuation to result hypotheses. + // NOTE: "This is currently offered as an experimental service, complimentary + // to all users. In the future this may be exclusively available as a + // premium feature." + bool enable_automatic_punctuation = 11; + + // *Optional* Metadata regarding this request. + RecognitionMetadata metadata = 9; +} + +// Description of audio data to be recognized. +message RecognitionMetadata { + // Use case categories that the audio recognition request can be described + // by. + enum InteractionType { + // Use case is either unknown or is something other than one of the other + // values below. + INTERACTION_TYPE_UNSPECIFIED = 0; + + // Multiple people in a conversation or discussion. For example in a + // meeting with two or more people actively participating. Typically + // all the primary people speaking would be in the same room (if not, + // see PHONE_CALL) + DISCUSSION = 1; + + // One or more persons lecturing or presenting to others, mostly + // uninterrupted. + PRESENTATION = 2; + + // A phone-call or video-conference in which two or more people, who are + // not in the same room, are actively participating. + PHONE_CALL = 3; + + // A recorded message intended for another person to listen to. + VOICEMAIL = 4; + + // Professionally produced audio (eg. TV Show, Podcast). + PROFESSIONALLY_PRODUCED = 5; + + // Transcribe spoken questions and queries into text. + VOICE_SEARCH = 6; + + // Transcribe voice commands, such as for controlling a device. + VOICE_COMMAND = 7; + + // Transcribe speech to text to create a written document, such as a + // text-message, email or report. + DICTATION = 8; + } + + // Enumerates the types of capture settings describing an audio file. + enum MicrophoneDistance { + // Audio type is not known. + MICROPHONE_DISTANCE_UNSPECIFIED = 0; + + // The audio was captured from a closely placed microphone. Eg. phone, + // dictaphone, or handheld microphone. Generally if there speaker is within + // 1 meter of the microphone. + NEARFIELD = 1; + + // The speaker if within 3 meters of the microphone. + MIDFIELD = 2; + + // The speaker is more than 3 meters away from the microphone. + FARFIELD = 3; + } + + // The original media the speech was recorded on. + enum OriginalMediaType { + // Unknown original media type. + ORIGINAL_MEDIA_TYPE_UNSPECIFIED = 0; + + // The speech data is an audio recording. + AUDIO = 1; + + // The speech data originally recorded on a video. + VIDEO = 2; + } + + // How many speakers expected in the speech to be recognized. + enum NumberOfSpeakers { + // Unknown number of persons speaking. + NUMBER_OF_SPEAKERS_UNSPECIFIED = 0; + + // Only one person is the prominent speaker (ignore background voices). + ONE_SPEAKER = 1; + + // Two people are the prominent speakers (transcript should focus + // on the two most prominent speakers). + TWO_SPEAKERS = 2; + + // Transcribe all voices. + MULTIPLE_SPEAKERS = 3; + } + + // The type of device the speech was recorded with. + enum RecordingDeviceType { + // The recording device is unknown. + RECORDING_DEVICE_TYPE_UNSPECIFIED = 0; + + // Speech was recorded on a smartphone. + SMARTPHONE = 1; + + // Speech was recorded using a personal computer or tablet. + PC = 2; + + // Speech was recorded over a phone line. + PHONE_LINE = 3; + + // Speech was recorded in a vehicle. + VEHICLE = 4; + + // Speech was recorded outdoors. + OTHER_OUTDOOR_DEVICE = 5; + + // Speech was recorded indoors. + OTHER_INDOOR_DEVICE = 6; + } + + // The use case most closely describing the audio content to be recognized. + InteractionType interaction_type = 1; + + // The industry vertical to which this speech recognition request most + // closely applies. This is most indicative of the topics contained + // in the audio. Use the 6-digit NAICS code to identify the industry + // vertical - see https://www.naics.com/search/. + uint32 industry_naics_code_of_audio = 3; + + // The audio type that most closely describes the audio being recognized. + MicrophoneDistance microphone_distance = 4; + + // The original media the speech was recorded on. + OriginalMediaType original_media_type = 5; + + // How many people are speaking prominently in the audio and expected to be + // recognized. + NumberOfSpeakers number_of_speakers = 6; + + // The type of device the speech was recorded with. + RecordingDeviceType recording_device_type = 7; + + // The device used to make the recording. Examples 'Nexus 5X' or + // 'Polycom SoundStation IP 6000' or 'POTS' or 'VoIP' or + // 'Cardioid Microphone'. + string recording_device_name = 8; + + // Mime type of the original audio file. For example `audio/m4a`, + // `audio/x-alaw-basic`, `audio/mp3`, `audio/3gpp`. + // A list of possible audio mime types is maintained at + // http://www.iana.org/assignments/media-types/media-types.xhtml#audio + string original_mime_type = 9; + + // Obfuscated (privacy-protected) ID of the user, to identify number of + // unique users using the service. + int64 obfuscated_id = 10; + + // Description of the content. Eg. "Recordings of federal supreme court + // hearings from 2012". + string audio_topic = 11; +} + +// Provides "hints" to the speech recognizer to favor specific words and phrases +// in the results. +message SpeechContext { + // *Optional* A list of strings containing words and phrases "hints" so that + // the speech recognition is more likely to recognize them. This can be used + // to improve the accuracy for specific words and phrases, for example, if + // specific commands are typically spoken by the user. This can also be used + // to add additional words to the vocabulary of the recognizer. See + // [usage limits](https://cloud.google.com/speech/limits#content). + repeated string phrases = 1; +} + +// Contains audio data in the encoding specified in the `RecognitionConfig`. +// Either `content` or `uri` must be supplied. Supplying both or neither +// returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. See +// [audio limits](https://cloud.google.com/speech/limits#content). +message RecognitionAudio { + // The audio source, which is either inline content or a GCS uri. + oneof audio_source { + // The audio data bytes encoded as specified in + // `RecognitionConfig`. Note: as with all bytes fields, protobuffers use a + // pure binary representation, whereas JSON representations use base64. + bytes content = 1; + + // URI that points to a file that contains audio data bytes as specified in + // `RecognitionConfig`. Currently, only Google Cloud Storage URIs are + // supported, which must be specified in the following format: + // `gs://bucket_name/object_name` (other URI formats return + // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see + // [Request URIs](https://cloud.google.com/storage/docs/reference-uris). + string uri = 2; + } +} + +// The only message returned to the client by the `Recognize` method. It +// contains the result as zero or more sequential `SpeechRecognitionResult` +// messages. +message RecognizeResponse { + // *Output-only* Sequential list of transcription results corresponding to + // sequential portions of audio. + repeated SpeechRecognitionResult results = 2; +} + +// The only message returned to the client by the `LongRunningRecognize` method. +// It contains the result as zero or more sequential `SpeechRecognitionResult` +// messages. It is included in the `result.response` field of the `Operation` +// returned by the `GetOperation` call of the `google::longrunning::Operations` +// service. +message LongRunningRecognizeResponse { + // *Output-only* Sequential list of transcription results corresponding to + // sequential portions of audio. + repeated SpeechRecognitionResult results = 2; +} + +// Describes the progress of a long-running `LongRunningRecognize` call. It is +// included in the `metadata` field of the `Operation` returned by the +// `GetOperation` call of the `google::longrunning::Operations` service. +message LongRunningRecognizeMetadata { + // Approximate percentage of audio processed thus far. Guaranteed to be 100 + // when the audio is fully processed and the results are available. + int32 progress_percent = 1; + + // Time when the request was received. + google.protobuf.Timestamp start_time = 2; + + // Time of the most recent processing update. + google.protobuf.Timestamp last_update_time = 3; +} + +// `StreamingRecognizeResponse` is the only message returned to the client by +// `StreamingRecognize`. A series of zero or more `StreamingRecognizeResponse` +// messages are streamed back to the client. If there is no recognizable +// audio, and `single_utterance` is set to false, then no messages are streamed +// back to the client. +// +// Here's an example of a series of ten `StreamingRecognizeResponse`s that might +// be returned while processing audio: +// +// 1. results { alternatives { transcript: "tube" } stability: 0.01 } +// +// 2. results { alternatives { transcript: "to be a" } stability: 0.01 } +// +// 3. results { alternatives { transcript: "to be" } stability: 0.9 } +// results { alternatives { transcript: " or not to be" } stability: 0.01 } +// +// 4. results { alternatives { transcript: "to be or not to be" +// confidence: 0.92 } +// alternatives { transcript: "to bee or not to bee" } +// is_final: true } +// +// 5. results { alternatives { transcript: " that's" } stability: 0.01 } +// +// 6. results { alternatives { transcript: " that is" } stability: 0.9 } +// results { alternatives { transcript: " the question" } stability: 0.01 } +// +// 7. results { alternatives { transcript: " that is the question" +// confidence: 0.98 } +// alternatives { transcript: " that was the question" } +// is_final: true } +// +// Notes: +// +// - Only two of the above responses #4 and #7 contain final results; they are +// indicated by `is_final: true`. Concatenating these together generates the +// full transcript: "to be or not to be that is the question". +// +// - The others contain interim `results`. #3 and #6 contain two interim +// `results`: the first portion has a high stability and is less likely to +// change; the second portion has a low stability and is very likely to +// change. A UI designer might choose to show only high stability `results`. +// +// - The specific `stability` and `confidence` values shown above are only for +// illustrative purposes. Actual values may vary. +// +// - In each response, only one of these fields will be set: +// `error`, +// `speech_event_type`, or +// one or more (repeated) `results`. +message StreamingRecognizeResponse { + // Indicates the type of speech event. + enum SpeechEventType { + // No speech event specified. + SPEECH_EVENT_UNSPECIFIED = 0; + + // This event indicates that the server has detected the end of the user's + // speech utterance and expects no additional speech. Therefore, the server + // will not process additional audio (although it may subsequently return + // additional results). The client should stop sending additional audio + // data, half-close the gRPC connection, and wait for any additional results + // until the server closes the gRPC connection. This event is only sent if + // `single_utterance` was set to `true`, and is not used otherwise. + END_OF_SINGLE_UTTERANCE = 1; + } + + // *Output-only* If set, returns a [google.rpc.Status][google.rpc.Status] message that + // specifies the error for the operation. + google.rpc.Status error = 1; + + // *Output-only* This repeated list contains zero or more results that + // correspond to consecutive portions of the audio currently being processed. + // It contains zero or more `is_final=false` results followed by zero or one + // `is_final=true` result (the newly settled portion). + repeated StreamingRecognitionResult results = 2; + + // *Output-only* Indicates the type of speech event. + SpeechEventType speech_event_type = 4; +} + +// A streaming speech recognition result corresponding to a portion of the audio +// that is currently being processed. +message StreamingRecognitionResult { + // *Output-only* May contain one or more recognition hypotheses (up to the + // maximum specified in `max_alternatives`). + repeated SpeechRecognitionAlternative alternatives = 1; + + // *Output-only* If `false`, this `StreamingRecognitionResult` represents an + // interim result that may change. If `true`, this is the final time the + // speech service will return this particular `StreamingRecognitionResult`, + // the recognizer will not return any further hypotheses for this portion of + // the transcript and corresponding audio. + bool is_final = 2; + + // *Output-only* An estimate of the likelihood that the recognizer will not + // change its guess about this interim result. Values range from 0.0 + // (completely unstable) to 1.0 (completely stable). + // This field is only provided for interim results (`is_final=false`). + // The default of 0.0 is a sentinel value indicating `stability` was not set. + float stability = 3; +} + +// A speech recognition result corresponding to a portion of the audio. +message SpeechRecognitionResult { + // *Output-only* May contain one or more recognition hypotheses (up to the + // maximum specified in `max_alternatives`). + // These alternatives are ordered in terms of accuracy, with the top (first) + // alternative being the most probable, as ranked by the recognizer. + repeated SpeechRecognitionAlternative alternatives = 1; +} + +// Alternative hypotheses (a.k.a. n-best list). +message SpeechRecognitionAlternative { + // *Output-only* Transcript text representing the words that the user spoke. + string transcript = 1; + + // *Output-only* The confidence estimate between 0.0 and 1.0. A higher number + // indicates an estimated greater likelihood that the recognized words are + // correct. This field is typically provided only for the top hypothesis, and + // only for `is_final=true` results. Clients should not rely on the + // `confidence` field as it is not guaranteed to be accurate, or even set, in + // any of the results. + // The default of 0.0 is a sentinel value indicating `confidence` was not set. + float confidence = 2; + + // *Output-only* A list of word-specific information for each recognized word. + repeated WordInfo words = 3; +} + +// Word-specific information for recognized words. Word information is only +// included in the response when certain request parameters are set, such +// as `enable_word_time_offsets`. +message WordInfo { + // *Output-only* Time offset relative to the beginning of the audio, + // and corresponding to the start of the spoken word. + // This field is only set if `enable_word_time_offsets=true` and only + // in the top hypothesis. + // This is an experimental feature and the accuracy of the time offset can + // vary. + google.protobuf.Duration start_time = 1; + + // *Output-only* Time offset relative to the beginning of the audio, + // and corresponding to the end of the spoken word. + // This field is only set if `enable_word_time_offsets=true` and only + // in the top hypothesis. + // This is an experimental feature and the accuracy of the time offset can + // vary. + google.protobuf.Duration end_time = 2; + + // *Output-only* The word corresponding to this set of information. + string word = 3; +} diff --git a/handwritten/cloud-profiler/google/cloud/speech/v1_1beta1/cloud_speech_gapic.yaml b/handwritten/cloud-profiler/google/cloud/speech/v1_1beta1/cloud_speech_gapic.yaml new file mode 100644 index 00000000000..bbdca9782de --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/speech/v1_1beta1/cloud_speech_gapic.yaml @@ -0,0 +1,96 @@ + +type: com.google.api.codegen.ConfigProto +language_settings: + java: + package_name: com.google.cloud.speech.v1_1beta1 + python: + package_name: google.cloud.gapic.speech.v1_1beta1 + go: + package_name: cloud.google.com/go/speech/apiv1_1beta1 + csharp: + package_name: Google.Cloud.Speech.V1_1Beta1 + ruby: + package_name: Google::Cloud::Speech::V1_1beta1 + php: + package_name: Google\Cloud\Speech\V1_1Beta1 + nodejs: + package_name: speech.v1_1beta1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.cloud.speech.v1p1beta1.Speech + smoke_test: + method: Recognize + init_fields: + - config.language_code="en-US" + - config.sample_rate_hertz=44100 + - config.encoding=FLAC + - audio.uri="gs://gapic-toolkit/hello.flac" + collections: [] + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 190000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 190000 + total_timeout_millis: 600000 + methods: + - name: Recognize + flattening: + groups: + - parameters: + - config + - audio + required_fields: + - config + - audio + sample_code_init_fields: + - config.encoding=FLAC + - config.sample_rate_hertz=44100 + - config.language_code="en-US" + - audio.uri=gs://bucket_name/file_name.flac + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 190000 + - name: LongRunningRecognize + flattening: + groups: + - parameters: + - config + - audio + required_fields: + - config + - audio + sample_code_init_fields: + - config.encoding=FLAC + - config.sample_rate_hertz=44100 + - config.language_code="en-US" + - audio.uri=gs://bucket_name/file_name.flac + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + long_running: + return_type: google.cloud.speech.v1p1beta1.LongRunningRecognizeResponse + metadata_type: google.cloud.speech.v1p1beta1.LongRunningRecognizeMetadata + initial_poll_delay_millis: 20000 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 45000 + total_poll_timeout_millis: 86400000 + - name: StreamingRecognize + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 190000 diff --git a/handwritten/cloud-profiler/google/cloud/speech/v1beta1/cloud_speech.proto b/handwritten/cloud-profiler/google/cloud/speech/v1beta1/cloud_speech.proto new file mode 100644 index 00000000000..82b82d3c023 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/speech/v1beta1/cloud_speech.proto @@ -0,0 +1,421 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.speech.v1beta1; + +import "google/api/annotations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/speech/v1beta1;speech"; +option java_multiple_files = true; +option java_outer_classname = "SpeechProto"; +option java_package = "com.google.cloud.speech.v1beta1"; + + +// Service that implements Google Cloud Speech API. +service Speech { + // Performs synchronous speech recognition: receive results after all audio + // has been sent and processed. + rpc SyncRecognize(SyncRecognizeRequest) returns (SyncRecognizeResponse) { + option (google.api.http) = { post: "/v1beta1/speech:syncrecognize" body: "*" }; + } + + // Performs asynchronous speech recognition: receive results via the + // [google.longrunning.Operations] + // (/speech/reference/rest/v1beta1/operations#Operation) + // interface. Returns either an + // `Operation.error` or an `Operation.response` which contains + // an `AsyncRecognizeResponse` message. + rpc AsyncRecognize(AsyncRecognizeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1beta1/speech:asyncrecognize" body: "*" }; + } + + // Performs bidirectional streaming speech recognition: receive results while + // sending audio. This method is only available via the gRPC API (not REST). + rpc StreamingRecognize(stream StreamingRecognizeRequest) returns (stream StreamingRecognizeResponse); +} + +// The top-level message sent by the client for the `SyncRecognize` method. +message SyncRecognizeRequest { + // *Required* Provides information to the recognizer that specifies how to + // process the request. + RecognitionConfig config = 1; + + // *Required* The audio data to be recognized. + RecognitionAudio audio = 2; +} + +// The top-level message sent by the client for the `AsyncRecognize` method. +message AsyncRecognizeRequest { + // *Required* Provides information to the recognizer that specifies how to + // process the request. + RecognitionConfig config = 1; + + // *Required* The audio data to be recognized. + RecognitionAudio audio = 2; +} + +// The top-level message sent by the client for the `StreamingRecognize` method. +// Multiple `StreamingRecognizeRequest` messages are sent. The first message +// must contain a `streaming_config` message and must not contain `audio` data. +// All subsequent messages must contain `audio` data and must not contain a +// `streaming_config` message. +message StreamingRecognizeRequest { + // The streaming request, which is either a streaming config or audio content. + oneof streaming_request { + // Provides information to the recognizer that specifies how to process the + // request. The first `StreamingRecognizeRequest` message must contain a + // `streaming_config` message. + StreamingRecognitionConfig streaming_config = 1; + + // The audio data to be recognized. Sequential chunks of audio data are sent + // in sequential `StreamingRecognizeRequest` messages. The first + // `StreamingRecognizeRequest` message must not contain `audio_content` data + // and all subsequent `StreamingRecognizeRequest` messages must contain + // `audio_content` data. The audio bytes must be encoded as specified in + // `RecognitionConfig`. Note: as with all bytes fields, protobuffers use a + // pure binary representation (not base64). See + // [audio limits](https://cloud.google.com/speech/limits#content). + bytes audio_content = 2; + } +} + +// Provides information to the recognizer that specifies how to process the +// request. +message StreamingRecognitionConfig { + // *Required* Provides information to the recognizer that specifies how to + // process the request. + RecognitionConfig config = 1; + + // *Optional* If `false` or omitted, the recognizer will perform continuous + // recognition (continuing to wait for and process audio even if the user + // pauses speaking) until the client closes the input stream (gRPC API) or + // until the maximum time limit has been reached. May return multiple + // `StreamingRecognitionResult`s with the `is_final` flag set to `true`. + // + // If `true`, the recognizer will detect a single spoken utterance. When it + // detects that the user has paused or stopped speaking, it will return an + // `END_OF_UTTERANCE` event and cease recognition. It will return no more than + // one `StreamingRecognitionResult` with the `is_final` flag set to `true`. + bool single_utterance = 2; + + // *Optional* If `true`, interim results (tentative hypotheses) may be + // returned as they become available (these interim results are indicated with + // the `is_final=false` flag). + // If `false` or omitted, only `is_final=true` result(s) are returned. + bool interim_results = 3; +} + +// Provides information to the recognizer that specifies how to process the +// request. +message RecognitionConfig { + // Audio encoding of the data sent in the audio message. All encodings support + // only 1 channel (mono) audio. Only `FLAC` includes a header that describes + // the bytes of audio that follow the header. The other encodings are raw + // audio bytes with no header. + // + // For best results, the audio source should be captured and transmitted using + // a lossless encoding (`FLAC` or `LINEAR16`). Recognition accuracy may be + // reduced if lossy codecs (such as AMR, AMR_WB and MULAW) are used to capture + // or transmit the audio, particularly if background noise is present. + enum AudioEncoding { + // Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + // This is the only encoding that may be used by `AsyncRecognize`. + LINEAR16 = 1; + + // This is the recommended encoding for `SyncRecognize` and + // `StreamingRecognize` because it uses lossless compression; therefore + // recognition accuracy is not compromised by a lossy codec. + // + // The stream FLAC (Free Lossless Audio Codec) encoding is specified at: + // http://flac.sourceforge.net/documentation.html. + // 16-bit and 24-bit samples are supported. + // Not all fields in STREAMINFO are supported. + FLAC = 2; + + // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + MULAW = 3; + + // Adaptive Multi-Rate Narrowband codec. `sample_rate` must be 8000 Hz. + AMR = 4; + + // Adaptive Multi-Rate Wideband codec. `sample_rate` must be 16000 Hz. + AMR_WB = 5; + } + + // *Required* Encoding of audio data sent in all `RecognitionAudio` messages. + AudioEncoding encoding = 1; + + // *Required* Sample rate in Hertz of the audio data sent in all + // `RecognitionAudio` messages. Valid values are: 8000-48000. + // 16000 is optimal. For best results, set the sampling rate of the audio + // source to 16000 Hz. If that's not possible, use the native sample rate of + // the audio source (instead of re-sampling). + int32 sample_rate = 2; + + // *Optional* The language of the supplied audio as a BCP-47 language tag. + // Example: "en-GB" https://www.rfc-editor.org/rfc/bcp/bcp47.txt + // If omitted, defaults to "en-US". See + // [Language Support](https://cloud.google.com/speech/docs/languages) + // for a list of the currently supported language codes. + string language_code = 3; + + // *Optional* Maximum number of recognition hypotheses to be returned. + // Specifically, the maximum number of `SpeechRecognitionAlternative` messages + // within each `SpeechRecognitionResult`. + // The server may return fewer than `max_alternatives`. + // Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of + // one. If omitted, will return a maximum of one. + int32 max_alternatives = 4; + + // *Optional* If set to `true`, the server will attempt to filter out + // profanities, replacing all but the initial character in each filtered word + // with asterisks, e.g. "f***". If set to `false` or omitted, profanities + // won't be filtered out. + bool profanity_filter = 5; + + // *Optional* A means to provide context to assist the speech recognition. + SpeechContext speech_context = 6; +} + +// Provides "hints" to the speech recognizer to favor specific words and phrases +// in the results. +message SpeechContext { + // *Optional* A list of strings containing words and phrases "hints" so that + // the speech recognition is more likely to recognize them. This can be used + // to improve the accuracy for specific words and phrases, for example, if + // specific commands are typically spoken by the user. This can also be used + // to add additional words to the vocabulary of the recognizer. See + // [usage limits](https://cloud.google.com/speech/limits#content). + repeated string phrases = 1; +} + +// Contains audio data in the encoding specified in the `RecognitionConfig`. +// Either `content` or `uri` must be supplied. Supplying both or neither +// returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. See +// [audio limits](https://cloud.google.com/speech/limits#content). +message RecognitionAudio { + // The audio source, which is either inline content or a GCS uri. + oneof audio_source { + // The audio data bytes encoded as specified in + // `RecognitionConfig`. Note: as with all bytes fields, protobuffers use a + // pure binary representation, whereas JSON representations use base64. + bytes content = 1; + + // URI that points to a file that contains audio data bytes as specified in + // `RecognitionConfig`. Currently, only Google Cloud Storage URIs are + // supported, which must be specified in the following format: + // `gs://bucket_name/object_name` (other URI formats return + // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see + // [Request URIs](https://cloud.google.com/storage/docs/reference-uris). + string uri = 2; + } +} + +// The only message returned to the client by `SyncRecognize`. method. It +// contains the result as zero or more sequential `SpeechRecognitionResult` +// messages. +message SyncRecognizeResponse { + // *Output-only* Sequential list of transcription results corresponding to + // sequential portions of audio. + repeated SpeechRecognitionResult results = 2; +} + +// The only message returned to the client by `AsyncRecognize`. It contains the +// result as zero or more sequential `SpeechRecognitionResult` messages. It is +// included in the `result.response` field of the `Operation` returned by the +// `GetOperation` call of the `google::longrunning::Operations` service. +message AsyncRecognizeResponse { + // *Output-only* Sequential list of transcription results corresponding to + // sequential portions of audio. + repeated SpeechRecognitionResult results = 2; +} + +// Describes the progress of a long-running `AsyncRecognize` call. It is +// included in the `metadata` field of the `Operation` returned by the +// `GetOperation` call of the `google::longrunning::Operations` service. +message AsyncRecognizeMetadata { + // Approximate percentage of audio processed thus far. Guaranteed to be 100 + // when the audio is fully processed and the results are available. + int32 progress_percent = 1; + + // Time when the request was received. + google.protobuf.Timestamp start_time = 2; + + // Time of the most recent processing update. + google.protobuf.Timestamp last_update_time = 3; +} + +// `StreamingRecognizeResponse` is the only message returned to the client by +// `StreamingRecognize`. A series of one or more `StreamingRecognizeResponse` +// messages are streamed back to the client. +// +// Here's an example of a series of ten `StreamingRecognizeResponse`s that might +// be returned while processing audio: +// +// 1. endpointer_type: START_OF_SPEECH +// +// 2. results { alternatives { transcript: "tube" } stability: 0.01 } +// result_index: 0 +// +// 3. results { alternatives { transcript: "to be a" } stability: 0.01 } +// result_index: 0 +// +// 4. results { alternatives { transcript: "to be" } stability: 0.9 } +// results { alternatives { transcript: " or not to be" } stability: 0.01 } +// result_index: 0 +// +// 5. results { alternatives { transcript: "to be or not to be" +// confidence: 0.92 } +// alternatives { transcript: "to bee or not to bee" } +// is_final: true } +// result_index: 0 +// +// 6. results { alternatives { transcript: " that's" } stability: 0.01 } +// result_index: 1 +// +// 7. results { alternatives { transcript: " that is" } stability: 0.9 } +// results { alternatives { transcript: " the question" } stability: 0.01 } +// result_index: 1 +// +// 8. endpointer_type: END_OF_SPEECH +// +// 9. results { alternatives { transcript: " that is the question" +// confidence: 0.98 } +// alternatives { transcript: " that was the question" } +// is_final: true } +// result_index: 1 +// +// 10. endpointer_type: END_OF_AUDIO +// +// Notes: +// +// - Only two of the above responses #5 and #9 contain final results, they are +// indicated by `is_final: true`. Concatenating these together generates the +// full transcript: "to be or not to be that is the question". +// +// - The others contain interim `results`. #4 and #7 contain two interim +// `results`, the first portion has a high stability and is less likely to +// change, the second portion has a low stability and is very likely to +// change. A UI designer might choose to show only high stability `results`. +// +// - The specific `stability` and `confidence` values shown above are only for +// illustrative purposes. Actual values may vary. +// +// - The `result_index` indicates the portion of audio that has had final +// results returned, and is no longer being processed. For example, the +// `results` in #6 and later correspond to the portion of audio after +// "to be or not to be". +message StreamingRecognizeResponse { + // Indicates the type of endpointer event. + enum EndpointerType { + // No endpointer event specified. + ENDPOINTER_EVENT_UNSPECIFIED = 0; + + // Speech has been detected in the audio stream, and the service is + // beginning to process it. + START_OF_SPEECH = 1; + + // Speech has ceased to be detected in the audio stream. (For example, the + // user may have paused after speaking.) If `single_utterance` is `false`, + // the service will continue to process audio, and if subsequent speech is + // detected, will send another START_OF_SPEECH event. + END_OF_SPEECH = 2; + + // This event is sent after the client has half-closed the input stream gRPC + // connection and the server has received all of the audio. (The server may + // still be processing the audio and may subsequently return additional + // results.) + END_OF_AUDIO = 3; + + // This event is only sent when `single_utterance` is `true`. It indicates + // that the server has detected the end of the user's speech utterance and + // expects no additional speech. Therefore, the server will not process + // additional audio (although it may subsequently return additional + // results). The client should stop sending additional audio data, + // half-close the gRPC connection, and wait for any additional results + // until the server closes the gRPC connection. + END_OF_UTTERANCE = 4; + } + + // *Output-only* If set, returns a [google.rpc.Status][google.rpc.Status] message that + // specifies the error for the operation. + google.rpc.Status error = 1; + + // *Output-only* This repeated list contains zero or more results that + // correspond to consecutive portions of the audio currently being processed. + // It contains zero or one `is_final=true` result (the newly settled portion), + // followed by zero or more `is_final=false` results. + repeated StreamingRecognitionResult results = 2; + + // *Output-only* Indicates the lowest index in the `results` array that has + // changed. The repeated `StreamingRecognitionResult` results overwrite past + // results at this index and higher. + int32 result_index = 3; + + // *Output-only* Indicates the type of endpointer event. + EndpointerType endpointer_type = 4; +} + +// A streaming speech recognition result corresponding to a portion of the audio +// that is currently being processed. +message StreamingRecognitionResult { + // *Output-only* May contain one or more recognition hypotheses (up to the + // maximum specified in `max_alternatives`). + repeated SpeechRecognitionAlternative alternatives = 1; + + // *Output-only* If `false`, this `StreamingRecognitionResult` represents an + // interim result that may change. If `true`, this is the final time the + // speech service will return this particular `StreamingRecognitionResult`, + // the recognizer will not return any further hypotheses for this portion of + // the transcript and corresponding audio. + bool is_final = 2; + + // *Output-only* An estimate of the likelihood that the recognizer will not + // change its guess about this interim result. Values range from 0.0 + // (completely unstable) to 1.0 (completely stable). + // This field is only provided for interim results (`is_final=false`). + // The default of 0.0 is a sentinel value indicating `stability` was not set. + float stability = 3; +} + +// A speech recognition result corresponding to a portion of the audio. +message SpeechRecognitionResult { + // *Output-only* May contain one or more recognition hypotheses (up to the + // maximum specified in `max_alternatives`). + repeated SpeechRecognitionAlternative alternatives = 1; +} + +// Alternative hypotheses (a.k.a. n-best list). +message SpeechRecognitionAlternative { + // *Output-only* Transcript text representing the words that the user spoke. + string transcript = 1; + + // *Output-only* The confidence estimate between 0.0 and 1.0. A higher number + // indicates an estimated greater likelihood that the recognized words are + // correct. This field is typically provided only for the top hypothesis, and + // only for `is_final=true` results. Clients should not rely on the + // `confidence` field as it is not guaranteed to be accurate, or even set, in + // any of the results. + // The default of 0.0 is a sentinel value indicating `confidence` was not set. + float confidence = 2; +} diff --git a/handwritten/cloud-profiler/google/cloud/speech/v1beta1/cloud_speech_gapic.yaml b/handwritten/cloud-profiler/google/cloud/speech/v1beta1/cloud_speech_gapic.yaml new file mode 100644 index 00000000000..c7553e1569c --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/speech/v1beta1/cloud_speech_gapic.yaml @@ -0,0 +1,93 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.speech.v1beta1 + python: + package_name: google.cloud.speech_v1beta1.gapic + go: + package_name: cloud.google.com/go/speech/apiv1beta1 + csharp: + package_name: Google.Cloud.Speech.V1Beta1 + ruby: + package_name: Google::Cloud::Speech::V1beta1 + php: + package_name: Google\Cloud\Speech\V1beta1 + nodejs: + package_name: speech.v1beta1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.cloud.speech.v1beta1.Speech + smoke_test: + method: SyncRecognize + init_fields: + - config.language_code="en-US" + - config.sample_rate=44100 + - config.encoding=FLAC + - audio.uri="gs://gapic-toolkit/hello.flac" + collections: [] + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 190000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 190000 + total_timeout_millis: 600000 + methods: + - name: SyncRecognize + flattening: + groups: + - parameters: + - config + - audio + required_fields: + - config + - audio + sample_code_init_fields: + - config.encoding=FLAC + - config.sample_rate=44100 + - audio.uri=gs://bucket_name/file_name.flac + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: AsyncRecognize + flattening: + groups: + - parameters: + - config + - audio + required_fields: + - config + - audio + sample_code_init_fields: + - config.encoding=FLAC + - config.sample_rate=44100 + - audio.uri=gs://bucket_name/file_name.flac + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + long_running: + return_type: google.cloud.speech.v1beta1.AsyncRecognizeResponse + metadata_type: google.cloud.speech.v1beta1.AsyncRecognizeMetadata + initial_poll_delay_millis: 20000 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 45000 + total_poll_timeout_millis: 86400000 + - name: StreamingRecognize + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 190000 diff --git a/handwritten/cloud-profiler/google/cloud/support/common.proto b/handwritten/cloud-profiler/google/cloud/support/common.proto new file mode 100644 index 00000000000..374d69c1f00 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/support/common.proto @@ -0,0 +1,334 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.support.common; + +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/support/common;common"; +option java_outer_classname = "CloudSupportProto"; +option java_package = "com.google.cloud.support.common"; + + +// A Google Cloud Platform account that identifies support eligibility for a +// Cloud resource. Currently the Cloud resource can only be an Organization +// but this might change in future. +message SupportAccount { + // The current state of this SupportAccount. + enum State { + // Account is in an unknown state. + STATE_UNSPECIFIED = 0; + + // Account is in an active state. + ACTIVE = 1; + + // Account has been created but is being provisioned in support systems. + PENDING = 2; + + // Account deletion has been requested by the user. + PENDING_DELETION = 3; + } + + // Pricing model applicable to this support account. + enum PricingModel { + // This account is subscribed to an unknown pricing model. + PRICING_MODEL_UNKNOWN = 0; + + // Package based pricing (Platinum, Gold, Silver, Bronze). + PACKAGES = 1; + + // Support charges are calculated based on user seats a.k.a, + // "Pick Your Team" model. + USER_ROLES = 2; + } + + // The resource name for a support account in format + // `supportAccounts/{account_id}`. + // Output only. + string name = 1; + + // Identifier for this entity that gets persisted in storage system. The + // resource name is populated using this field in format + // `supportAccounts/{account_id}`. + string account_id = 2; + + // The Cloud resource with which this support account is associated. + string cloud_resource = 3; + + // A user friendly display name assigned to this support account. + string display_name = 4; + + // Indicates the current state of an account. + State state = 5; + + // Time when this account was created. + // Output only. + google.protobuf.Timestamp create_time = 6; + + // The resource name of a billing account associated with this support + // account. For example, `billingAccounts/ABCDEF-012345-567890`. + string billing_account_name = 7; + + string unify_account_id = 8; + + // The PricingModel applicable to this support account. + PricingModel pricing_model = 9; +} + +// A support case created by the user. +message Case { + // The case priority with P0 being the most urgent and P4 the least. + enum Priority { + // Priority is undefined or has not been set yet. + PRIORITY_UNSPECIFIED = 0; + + // Extreme impact on a production service - Service is hard down. + P0 = 1; + + // Critical impact on a production service - Service is currently unusable. + P1 = 2; + + // Severe impact on a production service - Service is usable but greatly + // impaired. + P2 = 3; + + // Medium impact on a production service - Service is available, but + // moderately impaired. + P3 = 4; + + // General questions or minor issues - Production service is fully + // available. + P4 = 5; + } + + // The state of a case. + enum State { + // Case is in an unknown state. + STATE_UNSPECIFIED = 0; + + // Case has been created but no one is assigned to work on it yet. + NEW = 1; + + // Case has been assigned to a support agent. + ASSIGNED = 2; + + // A support agent is currently investigating the case. + IN_PROGRESS_GOOGLE_SUPPORT = 3; + + // Case has been forwarded to product team for further investigation. + IN_PROGRESS_GOOGLE_ENG = 4; + + // Case is under investigation and relates to a known issue. + IN_PROGRESS_KNOWN_ISSUE = 5; + + // Case is waiting for a response from the customer. + WAITING_FOR_CUSTOMER_RESPONSE = 6; + + // A solution has been offered for the case but it isn't closed yet. + SOLUTION_OFFERED = 7; + + // Cases has been fully resolved and is in a closed state. + CLOSED = 8; + } + + // The resource name for the Case in format + // `supportAccounts/{account_id}/cases/{case_id}` + string name = 1; + + // The short summary of the issue reported in this case. + string display_name = 2; + + // The board description of issue provided with initial summary. + string description = 3; + + // The product component for which this Case is reported. + string component = 4; + + // The product subcomponent for which this Case is reported. + string subcomponent = 5; + + // Timezone the client sending this request is in. + // It should be in a format IANA recognizes: https://www.iana.org/time-zone + // There is no additional validation done by the API. + string client_timezone = 6; + + // The email addresses that can be copied to receive updates on this case. + // Users can specify a maximum of 10 email addresses. + repeated string cc_addresses = 7; + + // The Google Cloud Platform project ID for which this case is created. + string project_id = 8; + + // List of customer issues associated with this case. + repeated CustomerIssue issues = 10; + + // The current priority of this case. + Priority priority = 11; + + // The current state of this case. + State state = 12; + + // Time when this case was created. + // Output only. + google.protobuf.Timestamp create_time = 13; + + // Time when this case was last updated. + // Output only. + google.protobuf.Timestamp update_time = 14; + + // Email address of user who created this case. + // Output only. It is inferred from credentials supplied during case creation. + string creator_email = 15; + + // The issue category applicable to this case. + string category = 16; +} + +// Reference to a Google internal ticket used for investigating a support case. +// Not every support case will have an internal ticket associated with it. +// A support case can have multiple tickets linked to it. +message CustomerIssue { + // The status of a customer issue. + enum IssueState { + // Issue in an unknown state. + ISSUE_STATE_UNSPECIFIED = 0; + + // Issue is currently open but the work on it has not been started. + OPEN = 1; + + // Issue is currently being worked on. + IN_PROGRESS = 2; + + // Issue is fixed. + FIXED = 3; + + // Issue has been marked as invalid. + WONT_FIX = 4; + + // Issue verified and in production. + VERIFIED = 5; + } + + // Unique identifier for the internal issue. + // Output only. + string issue_id = 1; + + // Represents current status of the internal ticket. + // Output only. + IssueState state = 2; + + // Time when the internal issue was created. + // Output only. + google.protobuf.Timestamp create_time = 3; + + // Time when the internal issue was marked as resolved. + // Output only. + google.protobuf.Timestamp resolve_time = 4; + + // Time when the internal issue was last updated. + // Output only. + google.protobuf.Timestamp update_time = 5; +} + +// A message that contains mapping of a user and their role under a support +// account. +message SupportRole { + // A role which determines the support resources and features a user might + // get access to. + enum Role { + // An unknown role. + ROLE_UNSPECIFIED = 0; + + // The basic support role. + BASIC = 1; + + // The developer role. + DEVELOPER = 2; + + // The operation role. + OPERATION = 3; + + // The site reliability role. + SITE_RELIABILITY = 4; + } + + // Email address of user being added through this Role. + string email = 1; + + // The type of role assigned to user. + Role role = 2; +} + +// The comment text associated with a `Case`. +message Comment { + // Text containing a maximum of 3000 characters. + string text = 1; + + // Time when this update was created. + // Output only. + google.protobuf.Timestamp create_time = 2; + + // The email address/name of user who created this comment. + // Output only. + string author = 3; + + // The resource name for this comment in format + // `supportAccounts/{account_id}/cases/{case_id}/{comment_id}`. + // Output only. + string name = 4; +} + +// Represents the product component taxonomy that is to be used while creating +// or updating a `Case`. A client should obtain the list of issue categories, +// component/subcomponent from this object and specify it in `Case.category`, +// `Case.component` and `Case.subcomponent` fields respectively. +message IssueTaxonomy { + // The representation of a product component. It is composed of a canonical + // name for the product (e.g., Google App Engine), languages in which a + // support ticket can be created under this component, a template that + // provides hints on important details to be filled out before submitting a + // case. It also contains an embedded list of product subcomponents that have + // similar attributes as top-level components. + // (e.g., Google App Engine > Memcache). + message Component { + // User friendly name of this component. + string display_name = 1; + + // List of languages in which a support case can be created under this + // component. Represented by language codes in ISO_639-1 standard. + repeated string languages = 2; + + // Template to be used while filling the description of a support case. + string template = 3; + + // List of subcomponents under this component. + repeated Component subcomponents = 4; + } + + // Represents the category of issue (Technical or Non-Technical) + // reported through a support case. + message Category { + // User friendly name of this category. + string display_name = 1; + + // Map of product components under this category. + map components = 2; + } + + // Map of available categories. + map categories = 1; +} diff --git a/handwritten/cloud-profiler/google/cloud/support/v1alpha1/cloud_support.proto b/handwritten/cloud-profiler/google/cloud/support/v1alpha1/cloud_support.proto new file mode 100644 index 00000000000..101298c96f4 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/support/v1alpha1/cloud_support.proto @@ -0,0 +1,199 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.support.v1alpha1; + +import "google/api/annotations.proto"; +import "google/cloud/support/common.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/support/v1alpha1;support"; +option java_outer_classname = "CloudSupportProto"; +option java_package = "com.google.cloud.support.v1alpha1"; + + +// Retrieves the list of Google Cloud Platform Support accounts and manages +// support cases associated with them. +service CloudSupport { + // Retrieves the support account details given an account identifier. + // The authenticated user calling this method must be the account owner. + rpc GetSupportAccount(GetSupportAccountRequest) returns (google.cloud.support.common.SupportAccount) { + option (google.api.http) = { get: "/v1alpha1/{name=supportAccounts/*}" }; + } + + // Retrieves the list of accounts the current authenticated user has access + // to. + rpc ListSupportAccounts(ListSupportAccountsRequest) returns (ListSupportAccountsResponse) { + option (google.api.http) = { get: "/v1alpha1/supportAccounts" }; + } + + // Retrieves the details for a support case. The current authenticated user + // calling this method must have permissions to view this case. + rpc GetCase(GetCaseRequest) returns (google.cloud.support.common.Case) { + option (google.api.http) = { get: "/v1alpha1/{name=supportAccounts/*/cases/*}" }; + } + + // Retrieves the list of support cases associated with an account. The current + // authenticated user must have the permission to list and view these cases. + rpc ListCases(ListCasesRequest) returns (ListCasesResponse) { + option (google.api.http) = { get: "/v1alpha1/{name=supportAccounts/*}/cases" }; + } + + // Lists all comments from a case. + rpc ListComments(ListCommentsRequest) returns (ListCommentsResponse) { + option (google.api.http) = { get: "/v1alpha1/{name=supportAccounts/*/cases/*}/comments" }; + } + + // Creates a case and associates it with a + // [SupportAccount][google.cloud.support.v1alpha2.SupportAcccount]. The + // authenticated user attempting this action must have permissions to create a + // `Case` under that [SupportAccount]. + rpc CreateCase(CreateCaseRequest) returns (google.cloud.support.common.Case) { + option (google.api.http) = { post: "/v1alpha1/{parent=supportAccounts/*}/cases" body: "case" }; + } + + // Updates a support case. Only a small set of details (priority, subject and + // cc_address) can be update after a case is created. + rpc UpdateCase(UpdateCaseRequest) returns (google.cloud.support.common.Case) { + option (google.api.http) = { patch: "/v1alpha1/{case.name=supportAccounts/*/cases/*}" body: "case" }; + } + + // Adds a new comment to a case. + rpc CreateComment(CreateCommentRequest) returns (google.cloud.support.common.Comment) { + option (google.api.http) = { post: "/v1alpha1/{name=supportAccounts/*/cases/*}/comments" body: "comment" }; + } + + // Retrieves the taxonomy of product categories and components to be used + // while creating a support case. + rpc GetIssueTaxonomy(GetIssueTaxonomyRequest) returns (google.cloud.support.common.IssueTaxonomy) { + option (google.api.http) = { get: "/v1alpha1:getIssueTaxonomy" }; + } +} + +// The request message for `GetSupportAccount`. +message GetSupportAccountRequest { + // The resource name of the support accounts. For example: + // `supportAccounts/accountA`. + string name = 1; +} + +// The request message for `ListSupportAccount`. +message ListSupportAccountsRequest { + // The filter applied to search results. It only supports filtering a support + // account list by a cloud_resource. For example, to filter results by support + // accounts associated with an Organization, its value should be: + // "cloud_resource:organizations/" + string filter = 1; + + // Maximum number of accounts fetched with each request. + int64 page_size = 2; + + // A token identifying the page of results to return. If unspecified, the + // first page is retrieved. + string page_token = 3; +} + +// The response message for `ListSupportAccount`. +message ListSupportAccountsResponse { + // A list of support accounts. + repeated google.cloud.support.common.SupportAccount accounts = 1; + + // A token to retrieve the next page of results. This should be passed on in + // `page_token` field of `ListSupportAccountRequest` for next request. If + // unspecified, there are no more results to retrieve. + string next_page_token = 2; +} + +// The request message for `GetCase` method. +message GetCaseRequest { + // Name of case resource requested. + // For example: "supportAccounts/accountA/cases/123" + string name = 1; +} + +// The request message for `ListCase` method. +message ListCasesRequest { + // Name of the account resource for which cases are requested. For example: + // "supportAccounts/accountA" + string name = 1; + + // The filter applied to the search results. Currently it only accepts "OPEN" + // or "CLOSED" strings, filtering out cases that are open or resolved. + string filter = 2; + + // Maximum number of cases fetched with each request. + int64 page_size = 3; + + // A token identifying the page of results to return. If unspecified, the + // first page is retrieved. + string page_token = 4; +} + +// The response message for `ListCase` method. +message ListCasesResponse { + // A list of cases. + repeated google.cloud.support.common.Case cases = 1; + + // A token to retrieve the next page of results. This should be passed on in + // `page_token` field of `ListCaseRequest` for next request. If unspecified, + // there are no more results to retrieve. + string next_page_token = 2; +} + +// The request message for `ListComments` method. +message ListCommentsRequest { + // The resource name of case for which comments should be listed. + string name = 1; +} + +// The response message for `ListComments` method. +message ListCommentsResponse { + // A list of comments. + repeated google.cloud.support.common.Comment comments = 1; +} + +// The request message for `CreateCase` method. +message CreateCaseRequest { + // The resource name for `SupportAccount` under which this case is created. + string parent = 1; + + // The case resource to create. + google.cloud.support.common.Case case = 2; +} + +// The request message for `UpdateCase` method. +message UpdateCaseRequest { + // The case resource to update. + google.cloud.support.common.Case case = 1; + + // A field that represents attributes of a Case object that should be updated + // as part of this request. + google.protobuf.FieldMask update_mask = 2; +} + +// The request message for `CreateComment` method. +message CreateCommentRequest { + // The resource name of case to which this comment should be added. + string name = 1; + + // The `Comment` to be added to this case. + google.cloud.support.common.Comment comment = 2; +} + +// The request message for `GetIssueTaxonomy` method. +message GetIssueTaxonomyRequest { +} diff --git a/handwritten/cloud-profiler/google/cloud/videointelligence/artman_videointelligence_v1beta1.yaml b/handwritten/cloud-profiler/google/cloud/videointelligence/artman_videointelligence_v1beta1.yaml new file mode 100644 index 00000000000..b21bda41c6e --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/videointelligence/artman_videointelligence_v1beta1.yaml @@ -0,0 +1,116 @@ +common: + api_name: video-intelligence + api_version: v1beta1 + organization_name: google-cloud + service_yaml: videointelligence.yaml + gapic_yaml: v1beta1/videointelligence_gapic.yaml + src_proto_paths: + - v1beta1 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-videointelligence + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-video-intelligence-v1beta1 + - name: grpc + dest: generated/java/grpc-google-cloud-video-intelligence-v1beta1 + - name: proto + dest: generated/java/proto-google-cloud-video-intelligence-v1beta1 +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: google/cloud/gapic + dest: videointelligence/google/cloud/gapic + - src: tests/unit/gapic/v1beta1 + dest: videointelligence/tests/gapic + - name: grpc + src: google/cloud/proto + dest: videointelligence/google/cloud/proto + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-video-intelligence-v1beta1 + - name: grpc + dest: generated/python/proto-google-cloud-video-intelligence-v1beta1 +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-video-intelligence-v1beta1 + - name: grpc + dest: generated/php/google-cloud-video-intelligence-v1beta1/proto +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/video_intelligence/v1beta1 + dest: google-cloud-video_intelligence/lib/google/cloud/video_intelligence/v1beta1 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-ruby/google-cloud-video_intelligence +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-cloud-videointelligence-v1beta1/vendor + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: video-intelligence/apiv1beta1 +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + release_level: BETA + package_version: + grpc_dep_lower_bound: 0.1.0 + publish_targets: + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v1beta1 + dest: packages/video-intelligence/src/v1beta1 + - src: test/gapic-v1beta1.js + dest: packages/video-intelligence/test/gapic-v1beta1.js + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/videointelligence +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/cloud/videointelligence/artman_videointelligence_v1beta2.yaml b/handwritten/cloud-profiler/google/cloud/videointelligence/artman_videointelligence_v1beta2.yaml new file mode 100644 index 00000000000..7595a67bc08 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/videointelligence/artman_videointelligence_v1beta2.yaml @@ -0,0 +1,116 @@ +common: + api_name: video-intelligence + api_version: v1beta2 + organization_name: google-cloud + service_yaml: videointelligence_v1beta2.yaml + gapic_yaml: v1beta2/videointelligence_gapic.yaml + src_proto_paths: + - v1beta2 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-videointelligence + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-video-intelligence-v1beta2 + - name: grpc + dest: generated/java/grpc-google-cloud-video-intelligence-v1beta2 + - name: proto + dest: generated/java/proto-google-cloud-video-intelligence-v1beta2 +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-video-intelligence-v1beta2 + - name: grpc + dest: generated/python/proto-google-cloud-video-intelligence-v1beta2 + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: google/cloud/gapic + dest: videointelligence/google/cloud/gapic + - src: tests/unit/gapic/v1beta2 + dest: videointelligence/tests/gapic + - name: grpc + src: google/cloud/proto + dest: videointelligence/google/cloud/proto +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-video-intelligence-v1beta2 + - name: grpc + dest: generated/php/google-cloud-video-intelligence-v1beta2/proto +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/video_intelligence/v1beta2 + dest: google-cloud-video_intelligence/lib/google/cloud/video_intelligence/v1beta2 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-ruby/google-cloud-video_intelligence +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: video-intelligence/apiv1beta2 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-cloud-videointelligence-v1beta2/vendor +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + release_level: BETA + package_version: + grpc_dep_lower_bound: 0.1.0 + publish_targets: + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v1beta2 + dest: packages/video-intelligence/src/v1beta2 + - src: test/gapic-v1beta2.js + dest: packages/video-intelligence/test/gapic-v1beta2.js + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/videointelligence +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/cloud/videointelligence/v1beta1/video_intelligence.proto b/handwritten/cloud-profiler/google/cloud/videointelligence/v1beta1/video_intelligence.proto new file mode 100644 index 00000000000..0b9703462d7 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/videointelligence/v1beta1/video_intelligence.proto @@ -0,0 +1,340 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.videointelligence.v1beta1; + +import "google/api/annotations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.VideoIntelligence.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta1;videointelligence"; +option java_multiple_files = true; +option java_outer_classname = "VideoIntelligenceServiceProto"; +option java_package = "com.google.cloud.videointelligence.v1beta1"; + + +// Service that implements Google Cloud Video Intelligence API. +service VideoIntelligenceService { + // Performs asynchronous video annotation. Progress and results can be + // retrieved through the `google.longrunning.Operations` interface. + // `Operation.metadata` contains `AnnotateVideoProgress` (progress). + // `Operation.response` contains `AnnotateVideoResponse` (results). + rpc AnnotateVideo(AnnotateVideoRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1beta1/videos:annotate" body: "*" }; + } +} + +// Video annotation request. +message AnnotateVideoRequest { + // Input video location. Currently, only + // [Google Cloud Storage](https://cloud.google.com/storage/) URIs are + // supported, which must be specified in the following format: + // `gs://bucket-id/object-id` (other URI formats return + // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see + // [Request URIs](/storage/docs/reference-uris). + // A video URI may include wildcards in `object-id`, and thus identify + // multiple videos. Supported wildcards: '*' to match 0 or more characters; + // '?' to match 1 character. If unset, the input video should be embedded + // in the request as `input_content`. If set, `input_content` should be unset. + string input_uri = 1; + + // The video data bytes. Encoding: base64. If unset, the input video(s) + // should be specified via `input_uri`. If set, `input_uri` should be unset. + string input_content = 6; + + // Requested video annotation features. + repeated Feature features = 2; + + // Additional video context and/or feature-specific parameters. + VideoContext video_context = 3; + + // Optional location where the output (in JSON format) should be stored. + // Currently, only [Google Cloud Storage](https://cloud.google.com/storage/) + // URIs are supported, which must be specified in the following format: + // `gs://bucket-id/object-id` (other URI formats return + // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see + // [Request URIs](/storage/docs/reference-uris). + string output_uri = 4; + + // Optional cloud region where annotation should take place. Supported cloud + // regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region + // is specified, a region will be determined based on video file location. + string location_id = 5; +} + +// Video context and/or feature-specific parameters. +message VideoContext { + // Video segments to annotate. The segments may overlap and are not required + // to be contiguous or span the whole video. If unspecified, each video + // is treated as a single segment. + repeated VideoSegment segments = 1; + + // If label detection has been requested, what labels should be detected + // in addition to video-level labels or segment-level labels. If unspecified, + // defaults to `SHOT_MODE`. + LabelDetectionMode label_detection_mode = 2; + + // Whether the video has been shot from a stationary (i.e. non-moving) camera. + // When set to true, might improve detection accuracy for moving objects. + bool stationary_camera = 3; + + // Model to use for label detection. + // Supported values: "latest" and "stable" (the default). + string label_detection_model = 4; + + // Model to use for face detection. + // Supported values: "latest" and "stable" (the default). + string face_detection_model = 5; + + // Model to use for shot change detection. + // Supported values: "latest" and "stable" (the default). + string shot_change_detection_model = 6; + + // Model to use for safe search detection. + // Supported values: "latest" and "stable" (the default). + string safe_search_detection_model = 7; +} + +// Video segment. +message VideoSegment { + // Start offset in microseconds (inclusive). Unset means 0. + int64 start_time_offset = 1; + + // End offset in microseconds (inclusive). Unset means 0. + int64 end_time_offset = 2; +} + +// Label location. +message LabelLocation { + // Video segment. Set to [-1, -1] for video-level labels. + // Set to [timestamp, timestamp] for frame-level labels. + // Otherwise, corresponds to one of `AnnotateSpec.segments` + // (if specified) or to shot boundaries (if requested). + VideoSegment segment = 1; + + // Confidence that the label is accurate. Range: [0, 1]. + float confidence = 2; + + // Label level. + LabelLevel level = 3; +} + +// Label annotation. +message LabelAnnotation { + // Textual description, e.g. `Fixed-gear bicycle`. + string description = 1; + + // Language code for `description` in BCP-47 format. + string language_code = 2; + + // Where the label was detected and with what confidence. + repeated LabelLocation locations = 3; +} + +// Safe search annotation (based on per-frame visual signals only). +// If no unsafe content has been detected in a frame, no annotations +// are present for that frame. If only some types of unsafe content +// have been detected in a frame, the likelihood is set to `UNKNOWN` +// for all other types of unsafe content. +message SafeSearchAnnotation { + // Likelihood of adult content. + Likelihood adult = 1; + + // Likelihood that an obvious modification was made to the original + // version to make it appear funny or offensive. + Likelihood spoof = 2; + + // Likelihood of medical content. + Likelihood medical = 3; + + // Likelihood of violent content. + Likelihood violent = 4; + + // Likelihood of racy content. + Likelihood racy = 5; + + // Video time offset in microseconds. + int64 time_offset = 6; +} + +// Bounding box. +message BoundingBox { + // Left X coordinate. + int32 left = 1; + + // Right X coordinate. + int32 right = 2; + + // Bottom Y coordinate. + int32 bottom = 3; + + // Top Y coordinate. + int32 top = 4; +} + +// Face location. +message FaceLocation { + // Bounding box in a frame. + BoundingBox bounding_box = 1; + + // Video time offset in microseconds. + int64 time_offset = 2; +} + +// Face annotation. +message FaceAnnotation { + // Thumbnail of a representative face view (in JPEG format). Encoding: base64. + string thumbnail = 1; + + // All locations where a face was detected. + // Faces are detected and tracked on a per-video basis + // (as opposed to across multiple videos). + repeated VideoSegment segments = 2; + + // Face locations at one frame per second. + repeated FaceLocation locations = 3; +} + +// Annotation results for a single video. +message VideoAnnotationResults { + // Video file location in + // [Google Cloud Storage](https://cloud.google.com/storage/). + string input_uri = 1; + + // Label annotations. There is exactly one element for each unique label. + repeated LabelAnnotation label_annotations = 2; + + // Face annotations. There is exactly one element for each unique face. + repeated FaceAnnotation face_annotations = 3; + + // Shot annotations. Each shot is represented as a video segment. + repeated VideoSegment shot_annotations = 4; + + // Safe search annotations. + repeated SafeSearchAnnotation safe_search_annotations = 6; + + // If set, indicates an error. Note that for a single `AnnotateVideoRequest` + // some videos may succeed and some may fail. + google.rpc.Status error = 5; +} + +// Video annotation response. Included in the `response` +// field of the `Operation` returned by the `GetOperation` +// call of the `google::longrunning::Operations` service. +message AnnotateVideoResponse { + // Annotation results for all videos specified in `AnnotateVideoRequest`. + repeated VideoAnnotationResults annotation_results = 1; +} + +// Annotation progress for a single video. +message VideoAnnotationProgress { + // Video file location in + // [Google Cloud Storage](https://cloud.google.com/storage/). + string input_uri = 1; + + // Approximate percentage processed thus far. + // Guaranteed to be 100 when fully processed. + int32 progress_percent = 2; + + // Time when the request was received. + google.protobuf.Timestamp start_time = 3; + + // Time of the most recent update. + google.protobuf.Timestamp update_time = 4; +} + +// Video annotation progress. Included in the `metadata` +// field of the `Operation` returned by the `GetOperation` +// call of the `google::longrunning::Operations` service. +message AnnotateVideoProgress { + // Progress metadata for all videos specified in `AnnotateVideoRequest`. + repeated VideoAnnotationProgress annotation_progress = 1; +} + +// Video annotation feature. +enum Feature { + // Unspecified. + FEATURE_UNSPECIFIED = 0; + + // Label detection. Detect objects, such as dog or flower. + LABEL_DETECTION = 1; + + // Human face detection and tracking. + FACE_DETECTION = 2; + + // Shot change detection. + SHOT_CHANGE_DETECTION = 3; + + // Safe search detection. + SAFE_SEARCH_DETECTION = 4; +} + +// Label level (scope). +enum LabelLevel { + // Unspecified. + LABEL_LEVEL_UNSPECIFIED = 0; + + // Video-level. Corresponds to the whole video. + VIDEO_LEVEL = 1; + + // Segment-level. Corresponds to one of `AnnotateSpec.segments`. + SEGMENT_LEVEL = 2; + + // Shot-level. Corresponds to a single shot (i.e. a series of frames + // without a major camera position or background change). + SHOT_LEVEL = 3; + + // Frame-level. Corresponds to a single video frame. + FRAME_LEVEL = 4; +} + +// Label detection mode. +enum LabelDetectionMode { + // Unspecified. + LABEL_DETECTION_MODE_UNSPECIFIED = 0; + + // Detect shot-level labels. + SHOT_MODE = 1; + + // Detect frame-level labels. + FRAME_MODE = 2; + + // Detect both shot-level and frame-level labels. + SHOT_AND_FRAME_MODE = 3; +} + +// Bucketized representation of likelihood. +enum Likelihood { + // Unknown likelihood. + UNKNOWN = 0; + + // Very unlikely. + VERY_UNLIKELY = 1; + + // Unlikely. + UNLIKELY = 2; + + // Possible. + POSSIBLE = 3; + + // Likely. + LIKELY = 4; + + // Very likely. + VERY_LIKELY = 5; +} diff --git a/handwritten/cloud-profiler/google/cloud/videointelligence/v1beta1/videointelligence_gapic.yaml b/handwritten/cloud-profiler/google/cloud/videointelligence/v1beta1/videointelligence_gapic.yaml new file mode 100644 index 00000000000..73cf474e284 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/videointelligence/v1beta1/videointelligence_gapic.yaml @@ -0,0 +1,64 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.videointelligence.v1beta1 + python: + package_name: google.cloud.videointelligence_v1beta1.gapic + go: + package_name: cloud.google.com/go/videointelligence/apiv1beta1 + csharp: + package_name: Google.Cloud.VideoIntelligence.V1Beta1 + ruby: + package_name: Google::Cloud::VideoIntelligence::V1beta1 + php: + package_name: Google\Cloud\VideoIntelligence\V1beta1 + nodejs: + package_name: videointelligence.v1beta1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.cloud.videointelligence.v1beta1.VideoIntelligenceService + collections: [] + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 1000 + retry_delay_multiplier: 2.5 + max_retry_delay_millis: 120000 + initial_rpc_timeout_millis: 120000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 120000 + total_timeout_millis: 600000 + methods: + - name: AnnotateVideo + flattening: + groups: + - parameters: + - input_uri + - features + long_running: + return_type: google.cloud.videointelligence.v1beta1.AnnotateVideoResponse + metadata_type: google.cloud.videointelligence.v1beta1.AnnotateVideoProgress + initial_poll_delay_millis: 20000 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 45000 + total_poll_timeout_millis: 86400000 + required_fields: + - input_uri + - features + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + sample_code_init_fields: + - input_uri=gs://demomaker/cat.mp4 + - features[0]=LABEL_DETECTION diff --git a/handwritten/cloud-profiler/google/cloud/videointelligence/v1beta2/video_intelligence.proto b/handwritten/cloud-profiler/google/cloud/videointelligence/v1beta2/video_intelligence.proto new file mode 100644 index 00000000000..b7ff5af6a2e --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/videointelligence/v1beta2/video_intelligence.proto @@ -0,0 +1,390 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.videointelligence.v1beta2; + +import "google/api/annotations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.VideoIntelligence.V1beta2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta2;videointelligence"; +option java_multiple_files = true; +option java_outer_classname = "VideoIntelligenceServiceProto"; +option java_package = "com.google.cloud.videointelligence.v1beta2"; + + +// Service that implements Google Cloud Video Intelligence API. +service VideoIntelligenceService { + // Performs asynchronous video annotation. Progress and results can be + // retrieved through the `google.longrunning.Operations` interface. + // `Operation.metadata` contains `AnnotateVideoProgress` (progress). + // `Operation.response` contains `AnnotateVideoResponse` (results). + rpc AnnotateVideo(AnnotateVideoRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1beta2/videos:annotate" body: "*" }; + } +} + +// Video annotation request. +message AnnotateVideoRequest { + // Input video location. Currently, only + // [Google Cloud Storage](https://cloud.google.com/storage/) URIs are + // supported, which must be specified in the following format: + // `gs://bucket-id/object-id` (other URI formats return + // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see + // [Request URIs](/storage/docs/reference-uris). + // A video URI may include wildcards in `object-id`, and thus identify + // multiple videos. Supported wildcards: '*' to match 0 or more characters; + // '?' to match 1 character. If unset, the input video should be embedded + // in the request as `input_content`. If set, `input_content` should be unset. + string input_uri = 1; + + // The video data bytes. Encoding: base64. If unset, the input video(s) + // should be specified via `input_uri`. If set, `input_uri` should be unset. + bytes input_content = 6; + + // Requested video annotation features. + repeated Feature features = 2; + + // Additional video context and/or feature-specific parameters. + VideoContext video_context = 3; + + // Optional location where the output (in JSON format) should be stored. + // Currently, only [Google Cloud Storage](https://cloud.google.com/storage/) + // URIs are supported, which must be specified in the following format: + // `gs://bucket-id/object-id` (other URI formats return + // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see + // [Request URIs](/storage/docs/reference-uris). + string output_uri = 4; + + // Optional cloud region where annotation should take place. Supported cloud + // regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region + // is specified, a region will be determined based on video file location. + string location_id = 5; +} + +// Video context and/or feature-specific parameters. +message VideoContext { + // Video segments to annotate. The segments may overlap and are not required + // to be contiguous or span the whole video. If unspecified, each video + // is treated as a single segment. + repeated VideoSegment segments = 1; + + // Config for LABEL_DETECTION. + LabelDetectionConfig label_detection_config = 2; + + // Config for SHOT_CHANGE_DETECTION. + ShotChangeDetectionConfig shot_change_detection_config = 3; + + // Config for EXPLICIT_CONTENT_DETECTION. + ExplicitContentDetectionConfig explicit_content_detection_config = 4; + + // Config for FACE_DETECTION. + FaceDetectionConfig face_detection_config = 5; +} + +// Config for LABEL_DETECTION. +message LabelDetectionConfig { + // What labels should be detected with LABEL_DETECTION, in addition to + // video-level labels or segment-level labels. + // If unspecified, defaults to `SHOT_MODE`. + LabelDetectionMode label_detection_mode = 1; + + // Whether the video has been shot from a stationary (i.e. non-moving) camera. + // When set to true, might improve detection accuracy for moving objects. + // Should be used with `SHOT_AND_FRAME_MODE` enabled. + bool stationary_camera = 2; + + // Model to use for label detection. + // Supported values: "builtin/stable" (the default if unset) and + // "builtin/latest". + string model = 3; +} + +// Config for SHOT_CHANGE_DETECTION. +message ShotChangeDetectionConfig { + // Model to use for shot change detection. + // Supported values: "builtin/stable" (the default if unset) and + // "builtin/latest". + string model = 1; +} + +// Config for EXPLICIT_CONTENT_DETECTION. +message ExplicitContentDetectionConfig { + // Model to use for explicit content detection. + // Supported values: "builtin/stable" (the default if unset) and + // "builtin/latest". + string model = 1; +} + +// Config for FACE_DETECTION. +message FaceDetectionConfig { + // Model to use for face detection. + // Supported values: "builtin/stable" (the default if unset) and + // "builtin/latest". + string model = 1; + + // Whether bounding boxes be included in the face annotation output. + bool include_bounding_boxes = 2; +} + +// Video segment. +message VideoSegment { + // Time-offset, relative to the beginning of the video, + // corresponding to the start of the segment (inclusive). + google.protobuf.Duration start_time_offset = 1; + + // Time-offset, relative to the beginning of the video, + // corresponding to the end of the segment (inclusive). + google.protobuf.Duration end_time_offset = 2; +} + +// Video segment level annotation results for label detection. +message LabelSegment { + // Video segment where a label was detected. + VideoSegment segment = 1; + + // Confidence that the label is accurate. Range: [0, 1]. + float confidence = 2; +} + +// Video frame level annotation results for label detection. +message LabelFrame { + // Time-offset, relative to the beginning of the video, corresponding to the + // video frame for this location. + google.protobuf.Duration time_offset = 1; + + // Confidence that the label is accurate. Range: [0, 1]. + float confidence = 2; +} + +// Detected entity from video analysis. +message Entity { + // Opaque entity ID. Some IDs may be available in + // [Google Knowledge Graph Search + // API](https://developers.google.com/knowledge-graph/). + string entity_id = 1; + + // Textual description, e.g. `Fixed-gear bicycle`. + string description = 2; + + // Language code for `description` in BCP-47 format. + string language_code = 3; +} + +// Label annotation. +message LabelAnnotation { + // Detected entity. + Entity entity = 1; + + // Common categories for the detected entity. + // E.g. when the label is `Terrier` the category is likely `dog`. And in some + // cases there might be more than one categories e.g. `Terrier` could also be + // a `pet`. + repeated Entity category_entities = 2; + + // All video segments where a label was detected. + repeated LabelSegment segments = 3; + + // All video frames where a label was detected. + repeated LabelFrame frames = 4; +} + +// Video frame level annotation results for explicit content. +message ExplicitContentFrame { + // Time-offset, relative to the beginning of the video, corresponding to the + // video frame for this location. + google.protobuf.Duration time_offset = 1; + + // Likelihood of the pornography content.. + Likelihood pornography_likelihood = 2; +} + +// Explicit content annotation (based on per-frame visual signals only). +// If no explicit content has been detected in a frame, no annotations are +// present for that frame. +message ExplicitContentAnnotation { + // All video frames where explicit content was detected. + repeated ExplicitContentFrame frames = 1; +} + +// Normalized bounding box. +// The normalized vertex coordinates are relative to the original image. +// Range: [0, 1]. +message NormalizedBoundingBox { + // Left X coordinate. + float left = 1; + + // Top Y coordinate. + float top = 2; + + // Right X coordinate. + float right = 3; + + // Bottom Y coordinate. + float bottom = 4; +} + +// Video segment level annotation results for face detection. +message FaceSegment { + // Video segment where a face was detected. + VideoSegment segment = 1; +} + +// Video frame level annotation results for face detection. +message FaceFrame { + // Normalized Bounding boxes in a frame. + // There can be more than one boxes if the same face is detected in multiple + // locations within the current frame. + repeated NormalizedBoundingBox normalized_bounding_boxes = 1; + + // Time-offset, relative to the beginning of the video, + // corresponding to the video frame for this location. + google.protobuf.Duration time_offset = 2; +} + +// Face annotation. +message FaceAnnotation { + // Thumbnail of a representative face view (in JPEG format). Encoding: base64. + bytes thumbnail = 1; + + // All video segments where a face was detected. + repeated FaceSegment segments = 2; + + // All video frames where a face was detected. + repeated FaceFrame frames = 3; +} + +// Annotation results for a single video. +message VideoAnnotationResults { + // Video file location in + // [Google Cloud Storage](https://cloud.google.com/storage/). + string input_uri = 1; + + // Label annotations on video level or user specified segment level. + // There is exactly one element for each unique label. + repeated LabelAnnotation segment_label_annotations = 2; + + // Label annotations on shot level. + // There is exactly one element for each unique label. + repeated LabelAnnotation shot_label_annotations = 3; + + // Label annotations on frame level. + // There is exactly one element for each unique label. + repeated LabelAnnotation frame_label_annotations = 4; + + // Face annotations. There is exactly one element for each unique face. + repeated FaceAnnotation face_annotations = 5; + + // Shot annotations. Each shot is represented as a video segment. + repeated VideoSegment shot_annotations = 6; + + // Explicit content annotation. + ExplicitContentAnnotation explicit_annotation = 7; + + // If set, indicates an error. Note that for a single `AnnotateVideoRequest` + // some videos may succeed and some may fail. + google.rpc.Status error = 9; +} + +// Video annotation response. Included in the `response` +// field of the `Operation` returned by the `GetOperation` +// call of the `google::longrunning::Operations` service. +message AnnotateVideoResponse { + // Annotation results for all videos specified in `AnnotateVideoRequest`. + repeated VideoAnnotationResults annotation_results = 1; +} + +// Annotation progress for a single video. +message VideoAnnotationProgress { + // Video file location in + // [Google Cloud Storage](https://cloud.google.com/storage/). + string input_uri = 1; + + // Approximate percentage processed thus far. + // Guaranteed to be 100 when fully processed. + int32 progress_percent = 2; + + // Time when the request was received. + google.protobuf.Timestamp start_time = 3; + + // Time of the most recent update. + google.protobuf.Timestamp update_time = 4; +} + +// Video annotation progress. Included in the `metadata` +// field of the `Operation` returned by the `GetOperation` +// call of the `google::longrunning::Operations` service. +message AnnotateVideoProgress { + // Progress metadata for all videos specified in `AnnotateVideoRequest`. + repeated VideoAnnotationProgress annotation_progress = 1; +} + +// Video annotation feature. +enum Feature { + // Unspecified. + FEATURE_UNSPECIFIED = 0; + + // Label detection. Detect objects, such as dog or flower. + LABEL_DETECTION = 1; + + // Shot change detection. + SHOT_CHANGE_DETECTION = 2; + + // Explicit content detection. + EXPLICIT_CONTENT_DETECTION = 3; + + // Human face detection and tracking. + FACE_DETECTION = 4; +} + +// Label detection mode. +enum LabelDetectionMode { + // Unspecified. + LABEL_DETECTION_MODE_UNSPECIFIED = 0; + + // Detect shot-level labels. + SHOT_MODE = 1; + + // Detect frame-level labels. + FRAME_MODE = 2; + + // Detect both shot-level and frame-level labels. + SHOT_AND_FRAME_MODE = 3; +} + +// Bucketized representation of likelihood. +enum Likelihood { + // Unspecified likelihood. + LIKELIHOOD_UNSPECIFIED = 0; + + // Very unlikely. + VERY_UNLIKELY = 1; + + // Unlikely. + UNLIKELY = 2; + + // Possible. + POSSIBLE = 3; + + // Likely. + LIKELY = 4; + + // Very likely. + VERY_LIKELY = 5; +} diff --git a/handwritten/cloud-profiler/google/cloud/videointelligence/v1beta2/videointelligence_gapic.yaml b/handwritten/cloud-profiler/google/cloud/videointelligence/v1beta2/videointelligence_gapic.yaml new file mode 100644 index 00000000000..19f6c6647bc --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/videointelligence/v1beta2/videointelligence_gapic.yaml @@ -0,0 +1,61 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.videointelligence.v1beta2 + python: + package_name: google.cloud.videointelligence_v1beta2.gapic + go: + package_name: cloud.google.com/go/videointelligence/apiv1beta2 + csharp: + package_name: Google.Cloud.VideoIntelligence.V1Beta2 + ruby: + package_name: Google::Cloud::VideoIntelligence::V1beta2 + php: + package_name: Google\Cloud\VideoIntelligence\V1beta2 + nodejs: + package_name: video-intelligence.v1beta2 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.cloud.videointelligence.v1beta2.VideoIntelligenceService + collections: [] + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 1000 + retry_delay_multiplier: 2.5 + max_retry_delay_millis: 120000 + initial_rpc_timeout_millis: 120000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 120000 + total_timeout_millis: 600000 + methods: + - name: AnnotateVideo + flattening: + groups: + - parameters: + - input_uri + - features + long_running: + return_type: google.cloud.videointelligence.v1beta2.AnnotateVideoResponse + metadata_type: google.cloud.videointelligence.v1beta2.AnnotateVideoProgress + initial_poll_delay_millis: 20000 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 45000 + total_poll_timeout_millis: 86400000 + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + sample_code_init_fields: + - input_uri=gs://demomaker/cat.mp4 + - features[0]=LABEL_DETECTION diff --git a/handwritten/cloud-profiler/google/cloud/videointelligence/videointelligence.yaml b/handwritten/cloud-profiler/google/cloud/videointelligence/videointelligence.yaml new file mode 100644 index 00000000000..62e1227a918 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/videointelligence/videointelligence.yaml @@ -0,0 +1,35 @@ +type: google.api.Service +config_version: 3 +name: videointelligence.googleapis.com +title: Google Cloud Video Intelligence API + +apis: +- name: google.cloud.videointelligence.v1beta1.VideoIntelligenceService + +documentation: + summary: + Google Cloud Video Intelligence API. + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: https://www.googleapis.com/auth/cloud-platform + +types: +- name: google.cloud.videointelligence.v1beta1.AnnotateVideoResponse +- name: google.cloud.videointelligence.v1beta1.AnnotateVideoProgress +- name: google.cloud.videointelligence.v1beta1.VideoSegment +- name: google.rpc.Status + +http: + rules: + - selector: google.longrunning.Operations.GetOperation + get: '/v1/operations/{name=*}' + - selector: google.longrunning.Operations.ListOperations + get: '/v1/operations' + - selector: google.longrunning.Operations.CancelOperation + post: '/v1/operations/{name=*}:cancel' + body: '*' + - selector: google.longrunning.Operations.DeleteOperation + delete: '/v1/operations/{name=*}' diff --git a/handwritten/cloud-profiler/google/cloud/videointelligence/videointelligence_v1beta2.yaml b/handwritten/cloud-profiler/google/cloud/videointelligence/videointelligence_v1beta2.yaml new file mode 100644 index 00000000000..37918a95f9d --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/videointelligence/videointelligence_v1beta2.yaml @@ -0,0 +1,37 @@ +type: google.api.Service +config_version: 3 +name: videointelligence.googleapis.com +title: Google Cloud Video Intelligence API + +apis: +- name: google.cloud.videointelligence.v1beta2.VideoIntelligenceService + +documentation: + summary: + Google Cloud Video Intelligence API. + +authentication: + rules: + - selector: '*' + allow_without_credential: true + oauth: + canonical_scopes: https://www.googleapis.com/auth/cloud-platform + +types: +- name: google.cloud.videointelligence.v1beta2.AnnotateVideoResponse +- name: google.cloud.videointelligence.v1beta2.AnnotateVideoProgress +- name: google.cloud.videointelligence.v1beta2.VideoSegment +- name: google.rpc.Status + +# HTTP overrides. +http: + rules: + - selector: google.longrunning.Operations.GetOperation + get: '/v1/operations/{name=*}' + - selector: google.longrunning.Operations.ListOperations + get: '/v1/operations' + - selector: google.longrunning.Operations.CancelOperation + post: '/v1/operations/{name=*}:cancel' + body: '*' + - selector: google.longrunning.Operations.DeleteOperation + delete: '/v1/operations/{name=*}' diff --git a/handwritten/cloud-profiler/google/cloud/vision/artman_vision.yaml b/handwritten/cloud-profiler/google/cloud/vision/artman_vision.yaml new file mode 100644 index 00000000000..de450786c91 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/vision/artman_vision.yaml @@ -0,0 +1,118 @@ +common: + api_name: vision + api_version: v1 + organization_name: google-cloud + service_yaml: vision.yaml + gapic_yaml: v1/vision_gapic.yaml + src_proto_paths: + - v1 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-vision-v1 + - name: grpc + dest: generated/java/grpc-google-cloud-vision-v1 + - name: proto + dest: generated/java/proto-google-cloud-vision-v1 + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-vision +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + release_level: BETA + package_version: + grpc_dep_lower_bound: 0.90.3 + grpc_dep_upper_bound: 0.91dev + publish_targets: + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: google/cloud/vision_v1 + dest: vision/google/cloud/vision_v1 + - src: tests/unit/gapic/v1 + dest: vision/tests/gapic + - name: grpc + src: google/cloud/proto + dest: vision/google/cloud/proto + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-vision-v1 + - name: grpc + dest: generated/python/proto-google-cloud-vision-v1 +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-vision-v1 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-vision + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/vision/v1 + dest: google-cloud-vision/lib/google/cloud/vision/v1 +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-vision-v1/vendor + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: vision/apiv1 +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + release_level: BETA + package_version: + grpc_dep_lower_bound: 0.12.0 + publish_targets: + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v1 + dest: packages/vision/src/v1 + - src: test/test.js + dest: packages/vision/test/gapic-v1.js + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/vision +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/cloud/vision/v1/geometry.proto b/handwritten/cloud-profiler/google/cloud/vision/v1/geometry.proto new file mode 100644 index 00000000000..5586c2eb3ad --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/vision/v1/geometry.proto @@ -0,0 +1,54 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.vision.v1; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1;vision"; +option java_multiple_files = true; +option java_outer_classname = "GeometryProto"; +option java_package = "com.google.cloud.vision.v1"; + + +// A vertex represents a 2D point in the image. +// NOTE: the vertex coordinates are in the same scale as the original image. +message Vertex { + // X coordinate. + int32 x = 1; + + // Y coordinate. + int32 y = 2; +} + +// A bounding polygon for the detected image annotation. +message BoundingPoly { + // The bounding polygon vertices. + repeated Vertex vertices = 1; +} + +// A 3D position in the image, used primarily for Face detection landmarks. +// A valid Position must have both x and y coordinates. +// The position coordinates are in the same scale as the original image. +message Position { + // X coordinate. + float x = 1; + + // Y coordinate. + float y = 2; + + // Z coordinate (or depth). + float z = 3; +} diff --git a/handwritten/cloud-profiler/google/cloud/vision/v1/image_annotator.proto b/handwritten/cloud-profiler/google/cloud/vision/v1/image_annotator.proto new file mode 100644 index 00000000000..c17f8aeb6fe --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/vision/v1/image_annotator.proto @@ -0,0 +1,569 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.vision.v1; + +import "google/api/annotations.proto"; +import "google/cloud/vision/v1/geometry.proto"; +import "google/cloud/vision/v1/text_annotation.proto"; +import "google/cloud/vision/v1/web_detection.proto"; +import "google/rpc/status.proto"; +import "google/type/color.proto"; +import "google/type/latlng.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1;vision"; +option java_multiple_files = true; +option java_outer_classname = "ImageAnnotatorProto"; +option java_package = "com.google.cloud.vision.v1"; + + +// Service that performs Google Cloud Vision API detection tasks over client +// images, such as face, landmark, logo, label, and text detection. The +// ImageAnnotator service returns detected entities from the images. +service ImageAnnotator { + // Run image detection and annotation for a batch of images. + rpc BatchAnnotateImages(BatchAnnotateImagesRequest) returns (BatchAnnotateImagesResponse) { + option (google.api.http) = { post: "/v1/images:annotate" body: "*" }; + } +} + +// Users describe the type of Google Cloud Vision API tasks to perform over +// images by using *Feature*s. Each Feature indicates a type of image +// detection task to perform. Features encode the Cloud Vision API +// vertical to operate on and the number of top-scoring results to return. +message Feature { + // Type of image feature. + enum Type { + // Unspecified feature type. + TYPE_UNSPECIFIED = 0; + + // Run face detection. + FACE_DETECTION = 1; + + // Run landmark detection. + LANDMARK_DETECTION = 2; + + // Run logo detection. + LOGO_DETECTION = 3; + + // Run label detection. + LABEL_DETECTION = 4; + + // Run OCR. + TEXT_DETECTION = 5; + + // Run dense text document OCR. Takes precedence when both + // DOCUMENT_TEXT_DETECTION and TEXT_DETECTION are present. + DOCUMENT_TEXT_DETECTION = 11; + + // Run computer vision models to compute image safe-search properties. + SAFE_SEARCH_DETECTION = 6; + + // Compute a set of image properties, such as the image's dominant colors. + IMAGE_PROPERTIES = 7; + + // Run crop hints. + CROP_HINTS = 9; + + // Run web detection. + WEB_DETECTION = 10; + } + + // The feature type. + Type type = 1; + + // Maximum number of results of this type. + int32 max_results = 2; +} + +// External image source (Google Cloud Storage image location). +message ImageSource { + // NOTE: For new code `image_uri` below is preferred. + // Google Cloud Storage image URI, which must be in the following form: + // `gs://bucket_name/object_name` (for details, see + // [Google Cloud Storage Request + // URIs](https://cloud.google.com/storage/docs/reference-uris)). + // NOTE: Cloud Storage object versioning is not supported. + string gcs_image_uri = 1; + + // Image URI which supports: + // 1) Google Cloud Storage image URI, which must be in the following form: + // `gs://bucket_name/object_name` (for details, see + // [Google Cloud Storage Request + // URIs](https://cloud.google.com/storage/docs/reference-uris)). + // NOTE: Cloud Storage object versioning is not supported. + // 2) Publicly accessible image HTTP/HTTPS URL. + // This is preferred over the legacy `gcs_image_uri` above. When both + // `gcs_image_uri` and `image_uri` are specified, `image_uri` takes + // precedence. + string image_uri = 2; +} + +// Client image to perform Google Cloud Vision API tasks over. +message Image { + // Image content, represented as a stream of bytes. + // Note: as with all `bytes` fields, protobuffers use a pure binary + // representation, whereas JSON representations use base64. + bytes content = 1; + + // Google Cloud Storage image location. If both `content` and `source` + // are provided for an image, `content` takes precedence and is + // used to perform the image annotation request. + ImageSource source = 2; +} + +// A face annotation object contains the results of face detection. +message FaceAnnotation { + // A face-specific landmark (for example, a face feature). + // Landmark positions may fall outside the bounds of the image + // if the face is near one or more edges of the image. + // Therefore it is NOT guaranteed that `0 <= x < width` or + // `0 <= y < height`. + message Landmark { + // Face landmark (feature) type. + // Left and right are defined from the vantage of the viewer of the image + // without considering mirror projections typical of photos. So, `LEFT_EYE`, + // typically, is the person's right eye. + enum Type { + // Unknown face landmark detected. Should not be filled. + UNKNOWN_LANDMARK = 0; + + // Left eye. + LEFT_EYE = 1; + + // Right eye. + RIGHT_EYE = 2; + + // Left of left eyebrow. + LEFT_OF_LEFT_EYEBROW = 3; + + // Right of left eyebrow. + RIGHT_OF_LEFT_EYEBROW = 4; + + // Left of right eyebrow. + LEFT_OF_RIGHT_EYEBROW = 5; + + // Right of right eyebrow. + RIGHT_OF_RIGHT_EYEBROW = 6; + + // Midpoint between eyes. + MIDPOINT_BETWEEN_EYES = 7; + + // Nose tip. + NOSE_TIP = 8; + + // Upper lip. + UPPER_LIP = 9; + + // Lower lip. + LOWER_LIP = 10; + + // Mouth left. + MOUTH_LEFT = 11; + + // Mouth right. + MOUTH_RIGHT = 12; + + // Mouth center. + MOUTH_CENTER = 13; + + // Nose, bottom right. + NOSE_BOTTOM_RIGHT = 14; + + // Nose, bottom left. + NOSE_BOTTOM_LEFT = 15; + + // Nose, bottom center. + NOSE_BOTTOM_CENTER = 16; + + // Left eye, top boundary. + LEFT_EYE_TOP_BOUNDARY = 17; + + // Left eye, right corner. + LEFT_EYE_RIGHT_CORNER = 18; + + // Left eye, bottom boundary. + LEFT_EYE_BOTTOM_BOUNDARY = 19; + + // Left eye, left corner. + LEFT_EYE_LEFT_CORNER = 20; + + // Right eye, top boundary. + RIGHT_EYE_TOP_BOUNDARY = 21; + + // Right eye, right corner. + RIGHT_EYE_RIGHT_CORNER = 22; + + // Right eye, bottom boundary. + RIGHT_EYE_BOTTOM_BOUNDARY = 23; + + // Right eye, left corner. + RIGHT_EYE_LEFT_CORNER = 24; + + // Left eyebrow, upper midpoint. + LEFT_EYEBROW_UPPER_MIDPOINT = 25; + + // Right eyebrow, upper midpoint. + RIGHT_EYEBROW_UPPER_MIDPOINT = 26; + + // Left ear tragion. + LEFT_EAR_TRAGION = 27; + + // Right ear tragion. + RIGHT_EAR_TRAGION = 28; + + // Left eye pupil. + LEFT_EYE_PUPIL = 29; + + // Right eye pupil. + RIGHT_EYE_PUPIL = 30; + + // Forehead glabella. + FOREHEAD_GLABELLA = 31; + + // Chin gnathion. + CHIN_GNATHION = 32; + + // Chin left gonion. + CHIN_LEFT_GONION = 33; + + // Chin right gonion. + CHIN_RIGHT_GONION = 34; + } + + // Face landmark type. + Type type = 3; + + // Face landmark position. + Position position = 4; + } + + // The bounding polygon around the face. The coordinates of the bounding box + // are in the original image's scale, as returned in `ImageParams`. + // The bounding box is computed to "frame" the face in accordance with human + // expectations. It is based on the landmarker results. + // Note that one or more x and/or y coordinates may not be generated in the + // `BoundingPoly` (the polygon will be unbounded) if only a partial face + // appears in the image to be annotated. + BoundingPoly bounding_poly = 1; + + // The `fd_bounding_poly` bounding polygon is tighter than the + // `boundingPoly`, and encloses only the skin part of the face. Typically, it + // is used to eliminate the face from any image analysis that detects the + // "amount of skin" visible in an image. It is not based on the + // landmarker results, only on the initial face detection, hence + // the fd (face detection) prefix. + BoundingPoly fd_bounding_poly = 2; + + // Detected face landmarks. + repeated Landmark landmarks = 3; + + // Roll angle, which indicates the amount of clockwise/anti-clockwise rotation + // of the face relative to the image vertical about the axis perpendicular to + // the face. Range [-180,180]. + float roll_angle = 4; + + // Yaw angle, which indicates the leftward/rightward angle that the face is + // pointing relative to the vertical plane perpendicular to the image. Range + // [-180,180]. + float pan_angle = 5; + + // Pitch angle, which indicates the upwards/downwards angle that the face is + // pointing relative to the image's horizontal plane. Range [-180,180]. + float tilt_angle = 6; + + // Detection confidence. Range [0, 1]. + float detection_confidence = 7; + + // Face landmarking confidence. Range [0, 1]. + float landmarking_confidence = 8; + + // Joy likelihood. + Likelihood joy_likelihood = 9; + + // Sorrow likelihood. + Likelihood sorrow_likelihood = 10; + + // Anger likelihood. + Likelihood anger_likelihood = 11; + + // Surprise likelihood. + Likelihood surprise_likelihood = 12; + + // Under-exposed likelihood. + Likelihood under_exposed_likelihood = 13; + + // Blurred likelihood. + Likelihood blurred_likelihood = 14; + + // Headwear likelihood. + Likelihood headwear_likelihood = 15; +} + +// Detected entity location information. +message LocationInfo { + // lat/long location coordinates. + google.type.LatLng lat_lng = 1; +} + +// A `Property` consists of a user-supplied name/value pair. +message Property { + // Name of the property. + string name = 1; + + // Value of the property. + string value = 2; +} + +// Set of detected entity features. +message EntityAnnotation { + // Opaque entity ID. Some IDs may be available in + // [Google Knowledge Graph Search API](https://developers.google.com/knowledge-graph/). + string mid = 1; + + // The language code for the locale in which the entity textual + // `description` is expressed. + string locale = 2; + + // Entity textual description, expressed in its `locale` language. + string description = 3; + + // Overall score of the result. Range [0, 1]. + float score = 4; + + // The accuracy of the entity detection in an image. + // For example, for an image in which the "Eiffel Tower" entity is detected, + // this field represents the confidence that there is a tower in the query + // image. Range [0, 1]. + float confidence = 5; + + // The relevancy of the ICA (Image Content Annotation) label to the + // image. For example, the relevancy of "tower" is likely higher to an image + // containing the detected "Eiffel Tower" than to an image containing a + // detected distant towering building, even though the confidence that + // there is a tower in each image may be the same. Range [0, 1]. + float topicality = 6; + + // Image region to which this entity belongs. Currently not produced + // for `LABEL_DETECTION` features. For `TEXT_DETECTION` (OCR), `boundingPoly`s + // are produced for the entire text detected in an image region, followed by + // `boundingPoly`s for each word within the detected text. + BoundingPoly bounding_poly = 7; + + // The location information for the detected entity. Multiple + // `LocationInfo` elements can be present because one location may + // indicate the location of the scene in the image, and another location + // may indicate the location of the place where the image was taken. + // Location information is usually present for landmarks. + repeated LocationInfo locations = 8; + + // Some entities may have optional user-supplied `Property` (name/value) + // fields, such a score or string that qualifies the entity. + repeated Property properties = 9; +} + +// Set of features pertaining to the image, computed by computer vision +// methods over safe-search verticals (for example, adult, spoof, medical, +// violence). +message SafeSearchAnnotation { + // Represents the adult content likelihood for the image. + Likelihood adult = 1; + + // Spoof likelihood. The likelihood that an modification + // was made to the image's canonical version to make it appear + // funny or offensive. + Likelihood spoof = 2; + + // Likelihood that this is a medical image. + Likelihood medical = 3; + + // Violence likelihood. + Likelihood violence = 4; +} + +// Rectangle determined by min and max `LatLng` pairs. +message LatLongRect { + // Min lat/long pair. + google.type.LatLng min_lat_lng = 1; + + // Max lat/long pair. + google.type.LatLng max_lat_lng = 2; +} + +// Color information consists of RGB channels, score, and the fraction of +// the image that the color occupies in the image. +message ColorInfo { + // RGB components of the color. + google.type.Color color = 1; + + // Image-specific score for this color. Value in range [0, 1]. + float score = 2; + + // The fraction of pixels the color occupies in the image. + // Value in range [0, 1]. + float pixel_fraction = 3; +} + +// Set of dominant colors and their corresponding scores. +message DominantColorsAnnotation { + // RGB color values with their score and pixel fraction. + repeated ColorInfo colors = 1; +} + +// Stores image properties, such as dominant colors. +message ImageProperties { + // If present, dominant colors completed successfully. + DominantColorsAnnotation dominant_colors = 1; +} + +// Single crop hint that is used to generate a new crop when serving an image. +message CropHint { + // The bounding polygon for the crop region. The coordinates of the bounding + // box are in the original image's scale, as returned in `ImageParams`. + BoundingPoly bounding_poly = 1; + + // Confidence of this being a salient region. Range [0, 1]. + float confidence = 2; + + // Fraction of importance of this salient region with respect to the original + // image. + float importance_fraction = 3; +} + +// Set of crop hints that are used to generate new crops when serving images. +message CropHintsAnnotation { + repeated CropHint crop_hints = 1; +} + +// Parameters for crop hints annotation request. +message CropHintsParams { + // Aspect ratios in floats, representing the ratio of the width to the height + // of the image. For example, if the desired aspect ratio is 4/3, the + // corresponding float value should be 1.33333. If not specified, the + // best possible crop is returned. The number of provided aspect ratios is + // limited to a maximum of 16; any aspect ratios provided after the 16th are + // ignored. + repeated float aspect_ratios = 1; +} + +// Image context and/or feature-specific parameters. +message ImageContext { + // lat/long rectangle that specifies the location of the image. + LatLongRect lat_long_rect = 1; + + // List of languages to use for TEXT_DETECTION. In most cases, an empty value + // yields the best results since it enables automatic language detection. For + // languages based on the Latin alphabet, setting `language_hints` is not + // needed. In rare cases, when the language of the text in the image is known, + // setting a hint will help get better results (although it will be a + // significant hindrance if the hint is wrong). Text detection returns an + // error if one or more of the specified languages is not one of the + // [supported languages](/vision/docs/languages). + repeated string language_hints = 2; + + // Parameters for crop hints annotation request. + CropHintsParams crop_hints_params = 4; +} + +// Request for performing Google Cloud Vision API tasks over a user-provided +// image, with user-requested features. +message AnnotateImageRequest { + // The image to be processed. + Image image = 1; + + // Requested features. + repeated Feature features = 2; + + // Additional context that may accompany the image. + ImageContext image_context = 3; +} + +// Response to an image annotation request. +message AnnotateImageResponse { + // If present, face detection has completed successfully. + repeated FaceAnnotation face_annotations = 1; + + // If present, landmark detection has completed successfully. + repeated EntityAnnotation landmark_annotations = 2; + + // If present, logo detection has completed successfully. + repeated EntityAnnotation logo_annotations = 3; + + // If present, label detection has completed successfully. + repeated EntityAnnotation label_annotations = 4; + + // If present, text (OCR) detection or document (OCR) text detection has + // completed successfully. + repeated EntityAnnotation text_annotations = 5; + + // If present, text (OCR) detection or document (OCR) text detection has + // completed successfully. + // This annotation provides the structural hierarchy for the OCR detected + // text. + TextAnnotation full_text_annotation = 12; + + // If present, safe-search annotation has completed successfully. + SafeSearchAnnotation safe_search_annotation = 6; + + // If present, image properties were extracted successfully. + ImageProperties image_properties_annotation = 8; + + // If present, crop hints have completed successfully. + CropHintsAnnotation crop_hints_annotation = 11; + + // If present, web detection has completed successfully. + WebDetection web_detection = 13; + + // If set, represents the error message for the operation. + // Note that filled-in image annotations are guaranteed to be + // correct, even when `error` is set. + google.rpc.Status error = 9; +} + +// Multiple image annotation requests are batched into a single service call. +message BatchAnnotateImagesRequest { + // Individual image annotation requests for this batch. + repeated AnnotateImageRequest requests = 1; +} + +// Response to a batch image annotation request. +message BatchAnnotateImagesResponse { + // Individual responses to image annotation requests within the batch. + repeated AnnotateImageResponse responses = 1; +} + +// A bucketized representation of likelihood, which is intended to give clients +// highly stable results across model upgrades. +enum Likelihood { + // Unknown likelihood. + UNKNOWN = 0; + + // It is very unlikely that the image belongs to the specified vertical. + VERY_UNLIKELY = 1; + + // It is unlikely that the image belongs to the specified vertical. + UNLIKELY = 2; + + // It is possible that the image belongs to the specified vertical. + POSSIBLE = 3; + + // It is likely that the image belongs to the specified vertical. + LIKELY = 4; + + // It is very likely that the image belongs to the specified vertical. + VERY_LIKELY = 5; +} diff --git a/handwritten/cloud-profiler/google/cloud/vision/v1/text_annotation.proto b/handwritten/cloud-profiler/google/cloud/vision/v1/text_annotation.proto new file mode 100644 index 00000000000..938820a3a00 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/vision/v1/text_annotation.proto @@ -0,0 +1,237 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.vision.v1; + +import "google/api/annotations.proto"; +import "google/cloud/vision/v1/geometry.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1;vision"; +option java_multiple_files = true; +option java_outer_classname = "TextAnnotationProto"; +option java_package = "com.google.cloud.vision.v1"; + + +// TextAnnotation contains a structured representation of OCR extracted text. +// The hierarchy of an OCR extracted text structure is like this: +// TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol +// Each structural component, starting from Page, may further have their own +// properties. Properties describe detected languages, breaks etc.. Please +// refer to the [google.cloud.vision.v1.TextAnnotation.TextProperty][google.cloud.vision.v1.TextAnnotation.TextProperty] message +// definition below for more detail. +message TextAnnotation { + // Detected language for a structural component. + message DetectedLanguage { + // The BCP-47 language code, such as "en-US" or "sr-Latn". For more + // information, see + // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + string language_code = 1; + + // Confidence of detected language. Range [0, 1]. + float confidence = 2; + } + + // Detected start or end of a structural component. + message DetectedBreak { + // Enum to denote the type of break found. New line, space etc. + enum BreakType { + // Unknown break label type. + UNKNOWN = 0; + + // Regular space. + SPACE = 1; + + // Sure space (very wide). + SURE_SPACE = 2; + + // Line-wrapping break. + EOL_SURE_SPACE = 3; + + // End-line hyphen that is not present in text; does + HYPHEN = 4; + + // not co-occur with SPACE, LEADER_SPACE, or + // LINE_BREAK. + // Line break that ends a paragraph. + LINE_BREAK = 5; + } + + BreakType type = 1; + + // True if break prepends the element. + bool is_prefix = 2; + } + + // Additional information detected on the structural component. + message TextProperty { + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 1; + + // Detected start or end of a text segment. + DetectedBreak detected_break = 2; + } + + // List of pages detected by OCR. + repeated Page pages = 1; + + // UTF-8 text detected on the pages. + string text = 2; +} + +// Detected page from OCR. +message Page { + // Additional information detected on the page. + TextAnnotation.TextProperty property = 1; + + // Page width in pixels. + int32 width = 2; + + // Page height in pixels. + int32 height = 3; + + // List of blocks of text, images etc on this page. + repeated Block blocks = 4; +} + +// Logical element on the page. +message Block { + // Type of a block (text, image etc) as identified by OCR. + enum BlockType { + // Unknown block type. + UNKNOWN = 0; + + // Regular text block. + TEXT = 1; + + // Table block. + TABLE = 2; + + // Image block. + PICTURE = 3; + + // Horizontal/vertical line box. + RULER = 4; + + // Barcode block. + BARCODE = 5; + } + + // Additional information detected for the block. + TextAnnotation.TextProperty property = 1; + + // The bounding box for the block. + // The vertices are in the order of top-left, top-right, bottom-right, + // bottom-left. When a rotation of the bounding box is detected the rotation + // is represented as around the top-left corner as defined when the text is + // read in the 'natural' orientation. + // For example: + // * when the text is horizontal it might look like: + // 0----1 + // | | + // 3----2 + // * when it's rotated 180 degrees around the top-left corner it becomes: + // 2----3 + // | | + // 1----0 + // and the vertice order will still be (0, 1, 2, 3). + BoundingPoly bounding_box = 2; + + // List of paragraphs in this block (if this blocks is of type text). + repeated Paragraph paragraphs = 3; + + // Detected block type (text, image etc) for this block. + BlockType block_type = 4; +} + +// Structural unit of text representing a number of words in certain order. +message Paragraph { + // Additional information detected for the paragraph. + TextAnnotation.TextProperty property = 1; + + // The bounding box for the paragraph. + // The vertices are in the order of top-left, top-right, bottom-right, + // bottom-left. When a rotation of the bounding box is detected the rotation + // is represented as around the top-left corner as defined when the text is + // read in the 'natural' orientation. + // For example: + // * when the text is horizontal it might look like: + // 0----1 + // | | + // 3----2 + // * when it's rotated 180 degrees around the top-left corner it becomes: + // 2----3 + // | | + // 1----0 + // and the vertice order will still be (0, 1, 2, 3). + BoundingPoly bounding_box = 2; + + // List of words in this paragraph. + repeated Word words = 3; +} + +// A word representation. +message Word { + // Additional information detected for the word. + TextAnnotation.TextProperty property = 1; + + // The bounding box for the word. + // The vertices are in the order of top-left, top-right, bottom-right, + // bottom-left. When a rotation of the bounding box is detected the rotation + // is represented as around the top-left corner as defined when the text is + // read in the 'natural' orientation. + // For example: + // * when the text is horizontal it might look like: + // 0----1 + // | | + // 3----2 + // * when it's rotated 180 degrees around the top-left corner it becomes: + // 2----3 + // | | + // 1----0 + // and the vertice order will still be (0, 1, 2, 3). + BoundingPoly bounding_box = 2; + + // List of symbols in the word. + // The order of the symbols follows the natural reading order. + repeated Symbol symbols = 3; +} + +// A single symbol representation. +message Symbol { + // Additional information detected for the symbol. + TextAnnotation.TextProperty property = 1; + + // The bounding box for the symbol. + // The vertices are in the order of top-left, top-right, bottom-right, + // bottom-left. When a rotation of the bounding box is detected the rotation + // is represented as around the top-left corner as defined when the text is + // read in the 'natural' orientation. + // For example: + // * when the text is horizontal it might look like: + // 0----1 + // | | + // 3----2 + // * when it's rotated 180 degrees around the top-left corner it becomes: + // 2----3 + // | | + // 1----0 + // and the vertice order will still be (0, 1, 2, 3). + BoundingPoly bounding_box = 2; + + // The actual UTF-8 representation of the symbol. + string text = 3; +} diff --git a/handwritten/cloud-profiler/google/cloud/vision/v1/vision_gapic.yaml b/handwritten/cloud-profiler/google/cloud/vision/v1/vision_gapic.yaml new file mode 100644 index 00000000000..8ca51a09f76 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/vision/v1/vision_gapic.yaml @@ -0,0 +1,59 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.vision.v1 + python: + package_name: google.cloud.vision_v1.gapic + go: + package_name: cloud.google.com/go/vision/apiv1 + release_level: GA + csharp: + package_name: Google.Cloud.Vision.V1 + release_level: GA + ruby: + package_name: Google::Cloud::Vision::V1 + php: + package_name: Google\Cloud\Vision\V1 + nodejs: + package_name: vision.v1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.cloud.vision.v1.ImageAnnotator + smoke_test: + method: BatchAnnotateImages + init_fields: + - requests[0].image.source.gcs_image_uri="gs://gapic-toolkit/President_Barack_Obama.jpg" + - requests[0].features[0].type=FACE_DETECTION + collections: [] + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 60000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 60000 + total_timeout_millis: 600000 + methods: + - name: BatchAnnotateImages + flattening: + groups: + - parameters: + - requests + required_fields: + - requests + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 diff --git a/handwritten/cloud-profiler/google/cloud/vision/v1/web_detection.proto b/handwritten/cloud-profiler/google/cloud/vision/v1/web_detection.proto new file mode 100644 index 00000000000..6da89756ee3 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/vision/v1/web_detection.proto @@ -0,0 +1,78 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.cloud.vision.v1; + +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1;vision"; +option java_multiple_files = true; +option java_outer_classname = "WebDetectionProto"; +option java_package = "com.google.cloud.vision.v1"; + + +// Relevant information for the image from the Internet. +message WebDetection { + // Entity deduced from similar images on the Internet. + message WebEntity { + // Opaque entity ID. + string entity_id = 1; + + // Overall relevancy score for the entity. + // Not normalized and not comparable across different image queries. + float score = 2; + + // Canonical description of the entity, in English. + string description = 3; + } + + // Metadata for online images. + message WebImage { + // The result image URL. + string url = 1; + + // Overall relevancy score for the image. + // Not normalized and not comparable across different image queries. + float score = 2; + } + + // Metadata for web pages. + message WebPage { + // The result web page URL. + string url = 1; + + // Overall relevancy score for the web page. + // Not normalized and not comparable across different image queries. + float score = 2; + } + + // Deduced entities from similar images on the Internet. + repeated WebEntity web_entities = 1; + + // Fully matching images from the Internet. + // They're definite neardups and most often a copy of the query image with + // merely a size change. + repeated WebImage full_matching_images = 2; + + // Partial matching images from the Internet. + // Those images are similar enough to share some key-point features. For + // example an original image will likely have partial matching for its crops. + repeated WebImage partial_matching_images = 3; + + // Web pages containing the matching images from the Internet. + repeated WebPage pages_with_matching_images = 4; +} diff --git a/handwritten/cloud-profiler/google/cloud/vision/vision.yaml b/handwritten/cloud-profiler/google/cloud/vision/vision.yaml new file mode 100644 index 00000000000..77c3349ffe7 --- /dev/null +++ b/handwritten/cloud-profiler/google/cloud/vision/vision.yaml @@ -0,0 +1,19 @@ +type: google.api.Service +config_version: 2 +name: vision.googleapis.com +title: Google Cloud Vision API + +apis: +- name: google.cloud.vision.v1.ImageAnnotator + +documentation: + summary: + 'Integrates Google Vision features, including image labeling, face, logo, + and landmark detection, optical character recognition (OCR), and detection + of explicit content, into applications.' + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/container/README.md b/handwritten/cloud-profiler/google/container/README.md new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/handwritten/cloud-profiler/google/container/README.md @@ -0,0 +1 @@ + diff --git a/handwritten/cloud-profiler/google/container/container.yaml b/handwritten/cloud-profiler/google/container/container.yaml new file mode 100644 index 00000000000..e8f9ea1069b --- /dev/null +++ b/handwritten/cloud-profiler/google/container/container.yaml @@ -0,0 +1,21 @@ +type: google.api.Service +config_version: 3 +name: container.googleapis.com +title: Google Container Engine API + +apis: +- name: google.container.v1.ClusterManager +- name: google.container.v1alpha1.ClusterManager +- name: google.container.v1beta1.ClusterManager + +documentation: + summary: |- + The Google Container Engine API is used for building and managing container + based applications, powered by the open source Kubernetes technology. + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/container/v1/cluster_service.proto b/handwritten/cloud-profiler/google/container/v1/cluster_service.proto new file mode 100644 index 00000000000..7b3b09abb27 --- /dev/null +++ b/handwritten/cloud-profiler/google/container/v1/cluster_service.proto @@ -0,0 +1,1681 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.container.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; + +option go_package = "google.golang.org/genproto/googleapis/container/v1;container"; +option java_multiple_files = true; +option java_outer_classname = "ClusterServiceProto"; +option java_package = "com.google.container.v1"; + + +// Google Container Engine Cluster Manager v1 +service ClusterManager { + // Lists all clusters owned by a project in either the specified zone or all + // zones. + rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { + option (google.api.http) = { get: "/v1/projects/{project_id}/zones/{zone}/clusters" }; + } + + // Gets the details of a specific cluster. + rpc GetCluster(GetClusterRequest) returns (Cluster) { + option (google.api.http) = { get: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" }; + } + + // Creates a cluster, consisting of the specified number and type of Google + // Compute Engine instances. + // + // By default, the cluster is created in the project's + // [default network](/compute/docs/networks-and-firewalls#networks). + // + // One firewall is added for the cluster. After cluster creation, + // the cluster creates routes for each node to allow the containers + // on that node to communicate with all other instances in the + // cluster. + // + // Finally, an entry is added to the project's global metadata indicating + // which CIDR range is being used by the cluster. + rpc CreateCluster(CreateClusterRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters" body: "*" }; + } + + // Updates the settings of a specific cluster. + rpc UpdateCluster(UpdateClusterRequest) returns (Operation) { + option (google.api.http) = { put: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" body: "*" }; + } + + // Updates the version and/or image type of a specific node pool. + rpc UpdateNodePool(UpdateNodePoolRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/update" body: "*" }; + } + + // Sets the autoscaling settings of a specific node pool. + rpc SetNodePoolAutoscaling(SetNodePoolAutoscalingRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/autoscaling" body: "*" }; + } + + // Sets the logging service of a specific cluster. + rpc SetLoggingService(SetLoggingServiceRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/logging" body: "*" }; + } + + // Sets the monitoring service of a specific cluster. + rpc SetMonitoringService(SetMonitoringServiceRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/monitoring" body: "*" }; + } + + // Sets the addons of a specific cluster. + rpc SetAddonsConfig(SetAddonsConfigRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/addons" body: "*" }; + } + + // Sets the locations of a specific cluster. + rpc SetLocations(SetLocationsRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/locations" body: "*" }; + } + + // Updates the master of a specific cluster. + rpc UpdateMaster(UpdateMasterRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/master" body: "*" }; + } + + // Used to set master auth materials. Currently supports :- + // Changing the admin password of a specific cluster. + // This can be either via password generation or explicitly set the password. + rpc SetMasterAuth(SetMasterAuthRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setMasterAuth" body: "*" }; + } + + // Deletes the cluster, including the Kubernetes endpoint and all worker + // nodes. + // + // Firewalls and routes that were configured during cluster creation + // are also deleted. + // + // Other Google Compute Engine resources that might be in use by the cluster + // (e.g. load balancer resources) will not be deleted if they weren't present + // at the initial create time. + rpc DeleteCluster(DeleteClusterRequest) returns (Operation) { + option (google.api.http) = { delete: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" }; + } + + // Lists all operations in a project in a specific zone or all zones. + rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) { + option (google.api.http) = { get: "/v1/projects/{project_id}/zones/{zone}/operations" }; + } + + // Gets the specified operation. + rpc GetOperation(GetOperationRequest) returns (Operation) { + option (google.api.http) = { get: "/v1/projects/{project_id}/zones/{zone}/operations/{operation_id}" }; + } + + // Cancels the specified operation. + rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/operations/{operation_id}:cancel" body: "*" }; + } + + // Returns configuration info about the Container Engine service. + rpc GetServerConfig(GetServerConfigRequest) returns (ServerConfig) { + option (google.api.http) = { get: "/v1/projects/{project_id}/zones/{zone}/serverconfig" }; + } + + // Lists the node pools for a cluster. + rpc ListNodePools(ListNodePoolsRequest) returns (ListNodePoolsResponse) { + option (google.api.http) = { get: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools" }; + } + + // Retrieves the node pool requested. + rpc GetNodePool(GetNodePoolRequest) returns (NodePool) { + option (google.api.http) = { get: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}" }; + } + + // Creates a node pool for a cluster. + rpc CreateNodePool(CreateNodePoolRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools" body: "*" }; + } + + // Deletes a node pool from a cluster. + rpc DeleteNodePool(DeleteNodePoolRequest) returns (Operation) { + option (google.api.http) = { delete: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}" }; + } + + // Roll back the previously Aborted or Failed NodePool upgrade. + // This will be an no-op if the last upgrade successfully completed. + rpc RollbackNodePoolUpgrade(RollbackNodePoolUpgradeRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}:rollback" body: "*" }; + } + + // Sets the NodeManagement options for a node pool. + rpc SetNodePoolManagement(SetNodePoolManagementRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/setManagement" body: "*" }; + } + + // Sets labels on a cluster. + rpc SetLabels(SetLabelsRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/resourceLabels" body: "*" }; + } + + // Enables or disables the ABAC authorization mechanism on a cluster. + rpc SetLegacyAbac(SetLegacyAbacRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/legacyAbac" body: "*" }; + } + + // Start master IP rotation. + rpc StartIPRotation(StartIPRotationRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:startIpRotation" body: "*" }; + } + + // Completes master IP rotation. + rpc CompleteIPRotation(CompleteIPRotationRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:completeIpRotation" body: "*" }; + } + + // Sets the size of a specific node pool. + rpc SetNodePoolSize(SetNodePoolSizeRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/setSize" body: "*" }; + } + + // Enables/Disables Network Policy for a cluster. + rpc SetNetworkPolicy(SetNetworkPolicyRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setNetworkPolicy" body: "*" }; + } + + // Sets the maintenance policy for a cluster. + rpc SetMaintenancePolicy(SetMaintenancePolicyRequest) returns (Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setMaintenancePolicy" body: "*" }; + } +} + +// Parameters that describe the nodes in a cluster. +message NodeConfig { + // The name of a Google Compute Engine [machine + // type](/compute/docs/machine-types) (e.g. + // `n1-standard-1`). + // + // If unspecified, the default machine type is + // `n1-standard-1`. + string machine_type = 1; + + // Size of the disk attached to each node, specified in GB. + // The smallest allowed disk size is 10GB. + // + // If unspecified, the default disk size is 100GB. + int32 disk_size_gb = 2; + + // The set of Google API scopes to be made available on all of the + // node VMs under the "default" service account. + // + // The following scopes are recommended, but not required, and by default are + // not included: + // + // * `https://www.googleapis.com/auth/compute` is required for mounting + // persistent storage on your nodes. + // * `https://www.googleapis.com/auth/devstorage.read_only` is required for + // communicating with **gcr.io** + // (the [Google Container Registry](/container-registry/)). + // + // If unspecified, no scopes are added, unless Cloud Logging or Cloud + // Monitoring are enabled, in which case their required scopes will be added. + repeated string oauth_scopes = 3; + + // The Google Cloud Platform Service Account to be used by the node VMs. If + // no Service Account is specified, the "default" service account is used. + string service_account = 9; + + // The metadata key/value pairs assigned to instances in the cluster. + // + // Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes + // in length. These are reflected as part of a URL in the metadata server. + // Additionally, to avoid ambiguity, keys must not conflict with any other + // metadata keys for the project or be one of the four reserved keys: + // "instance-template", "kube-env", "startup-script", and "user-data" + // + // Values are free-form strings, and only have meaning as interpreted by + // the image running in the instance. The only restriction placed on them is + // that each value's size must be less than or equal to 32 KB. + // + // The total size of all keys and values must be less than 512 KB. + map metadata = 4; + + // The image type to use for this node. Note that for a given image type, + // the latest version of it will be used. + string image_type = 5; + + // The map of Kubernetes labels (key/value pairs) to be applied to each node. + // These will added in addition to any default label(s) that + // Kubernetes may apply to the node. + // In case of conflict in label keys, the applied set may differ depending on + // the Kubernetes version -- it's best to assume the behavior is undefined + // and conflicts should be avoided. + // For more information, including usage and the valid values, see: + // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ + map labels = 6; + + // The number of local SSD disks to be attached to the node. + // + // The limit for this value is dependant upon the maximum number of + // disks available on a machine per zone. See: + // https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits + // for more information. + int32 local_ssd_count = 7; + + // The list of instance tags applied to all nodes. Tags are used to identify + // valid sources or targets for network firewalls and are specified by + // the client during cluster or node pool creation. Each tag within the list + // must comply with RFC1035. + repeated string tags = 8; + + // Whether the nodes are created as preemptible VM instances. See: + // https://cloud.google.com/compute/docs/instances/preemptible for more + // information about preemptible VM instances. + bool preemptible = 10; + + // A list of hardware accelerators to be attached to each node. + // See https://cloud.google.com/compute/docs/gpus for more information about + // support for GPUs. + repeated AcceleratorConfig accelerators = 11; + + // Minimum CPU platform to be used by this instance. The instance may be + // scheduled on the specified or newer CPU platform. Applicable values are the + // friendly names of CPU platforms, such as + // minCpuPlatform: "Intel Haswell" or + // minCpuPlatform: "Intel Sandy Bridge". For more + // information, read [how to specify min CPU platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform) + string min_cpu_platform = 13; +} + +// The authentication information for accessing the master endpoint. +// Authentication can be done using HTTP basic auth or using client +// certificates. +message MasterAuth { + // The username to use for HTTP basic authentication to the master endpoint. + // For clusters v1.6.0 and later, you can disable basic authentication by + // providing an empty username. + string username = 1; + + // The password to use for HTTP basic authentication to the master endpoint. + // Because the master endpoint is open to the Internet, you should create a + // strong password. If a password is provided for cluster creation, username + // must be non-empty. + string password = 2; + + // Configuration for client certificate authentication on the cluster. If no + // configuration is specified, a client certificate is issued. + ClientCertificateConfig client_certificate_config = 3; + + // [Output only] Base64-encoded public certificate that is the root of + // trust for the cluster. + string cluster_ca_certificate = 100; + + // [Output only] Base64-encoded public certificate used by clients to + // authenticate to the cluster endpoint. + string client_certificate = 101; + + // [Output only] Base64-encoded private key used by clients to authenticate + // to the cluster endpoint. + string client_key = 102; +} + +// Configuration for client certificates on the cluster. +message ClientCertificateConfig { + // Issue a client certificate. + bool issue_client_certificate = 1; +} + +// Configuration for the addons that can be automatically spun up in the +// cluster, enabling additional functionality. +message AddonsConfig { + // Configuration for the HTTP (L7) load balancing controller addon, which + // makes it easy to set up HTTP load balancers for services in a cluster. + HttpLoadBalancing http_load_balancing = 1; + + // Configuration for the horizontal pod autoscaling feature, which + // increases or decreases the number of replica pods a replication controller + // has based on the resource usage of the existing pods. + HorizontalPodAutoscaling horizontal_pod_autoscaling = 2; + + // Configuration for the Kubernetes Dashboard. + KubernetesDashboard kubernetes_dashboard = 3; + + // Configuration for NetworkPolicy. This only tracks whether the addon + // is enabled or not on the Master, it does not track whether network policy + // is enabled for the nodes. + NetworkPolicyConfig network_policy_config = 4; +} + +// Configuration options for the HTTP (L7) load balancing controller addon, +// which makes it easy to set up HTTP load balancers for services in a cluster. +message HttpLoadBalancing { + // Whether the HTTP Load Balancing controller is enabled in the cluster. + // When enabled, it runs a small pod in the cluster that manages the load + // balancers. + bool disabled = 1; +} + +// Configuration options for the horizontal pod autoscaling feature, which +// increases or decreases the number of replica pods a replication controller +// has based on the resource usage of the existing pods. +message HorizontalPodAutoscaling { + // Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. + // When enabled, it ensures that a Heapster pod is running in the cluster, + // which is also used by the Cloud Monitoring service. + bool disabled = 1; +} + +// Configuration for the Kubernetes Dashboard. +message KubernetesDashboard { + // Whether the Kubernetes Dashboard is enabled for this cluster. + bool disabled = 1; +} + +// Configuration for NetworkPolicy. This only tracks whether the addon +// is enabled or not on the Master, it does not track whether network policy +// is enabled for the nodes. +message NetworkPolicyConfig { + // Whether NetworkPolicy is enabled for this cluster. + bool disabled = 1; +} + +// Master authorized networks is a Beta feature. +// Configuration options for the master authorized networks feature. Enabled +// master authorized networks will disallow all external traffic to access +// Kubernetes master through HTTPS except traffic from the given CIDR blocks, +// Google Compute Engine Public IPs and Google Prod IPs. +message MasterAuthorizedNetworksConfig { + // CidrBlock contains an optional name and one CIDR block. + message CidrBlock { + // display_name is an optional field for users to identify CIDR blocks. + string display_name = 1; + + // cidr_block must be specified in CIDR notation. + string cidr_block = 2; + } + + // Whether or not master authorized networks is enabled. + bool enabled = 1; + + // cidr_blocks define up to 10 external networks that could access + // Kubernetes master through HTTPS. + repeated CidrBlock cidr_blocks = 2; +} + +// Configuration for the legacy Attribute Based Access Control authorization +// mode. +message LegacyAbac { + // Whether the ABAC authorizer is enabled for this cluster. When enabled, + // identities in the system, including service accounts, nodes, and + // controllers, will have statically granted permissions beyond those + // provided by the RBAC configuration or IAM. + bool enabled = 1; +} + +// Configuration options for the NetworkPolicy feature. +// https://kubernetes.io/docs/concepts/services-networking/networkpolicies/ +message NetworkPolicy { + // Allowed Network Policy providers. + enum Provider { + // Not set + PROVIDER_UNSPECIFIED = 0; + + // Tigera (Calico Felix). + CALICO = 1; + } + + // The selected network policy provider. + Provider provider = 1; + + // Whether network policy is enabled on the cluster. + bool enabled = 2; +} + +// Configuration for controlling how IPs are allocated in the cluster. +message IPAllocationPolicy { + // Whether alias IPs will be used for pod IPs in the cluster. + bool use_ip_aliases = 1; + + // Whether a new subnetwork will be created automatically for the cluster. + // + // This field is only applicable when `use_ip_aliases` is true. + bool create_subnetwork = 2; + + // A custom subnetwork name to be used if `create_subnetwork` is true. If + // this field is empty, then an automatic name will be chosen for the new + // subnetwork. + string subnetwork_name = 3; + + // This field is deprecated, use cluster_ipv4_cidr_block. + string cluster_ipv4_cidr = 4; + + // This field is deprecated, use node_ipv4_cidr_block. + string node_ipv4_cidr = 5; + + // This field is deprecated, use services_ipv4_cidr_block. + string services_ipv4_cidr = 6; + + // The name of the secondary range to be used for the cluster CIDR + // block. The secondary range will be used for pod IP + // addresses. This must be an existing secondary range associated + // with the cluster subnetwork. + // + // This field is only applicable with use_ip_aliases is true and + // create_subnetwork is false. + string cluster_secondary_range_name = 7; + + // The name of the secondary range to be used as for the services + // CIDR block. The secondary range will be used for service + // ClusterIPs. This must be an existing secondary range associated + // with the cluster subnetwork. + // + // This field is only applicable with use_ip_aliases is true and + // create_subnetwork is false. + string services_secondary_range_name = 8; + + // The IP address range for the cluster pod IPs. If this field is set, then + // `cluster.cluster_ipv4_cidr` must be left blank. + // + // This field is only applicable when `use_ip_aliases` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string cluster_ipv4_cidr_block = 9; + + // The IP address range of the instance IPs in this cluster. + // + // This is applicable only if `create_subnetwork` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string node_ipv4_cidr_block = 10; + + // The IP address range of the services IPs in this cluster. If blank, a range + // will be automatically chosen with the default size. + // + // This field is only applicable when `use_ip_aliases` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string services_ipv4_cidr_block = 11; +} + +// A Google Container Engine cluster. +message Cluster { + // The current status of the cluster. + enum Status { + // Not set. + STATUS_UNSPECIFIED = 0; + + // The PROVISIONING state indicates the cluster is being created. + PROVISIONING = 1; + + // The RUNNING state indicates the cluster has been created and is fully + // usable. + RUNNING = 2; + + // The RECONCILING state indicates that some work is actively being done on + // the cluster, such as upgrading the master or node software. Details can + // be found in the `statusMessage` field. + RECONCILING = 3; + + // The STOPPING state indicates the cluster is being deleted. + STOPPING = 4; + + // The ERROR state indicates the cluster may be unusable. Details + // can be found in the `statusMessage` field. + ERROR = 5; + } + + // The name of this cluster. The name must be unique within this project + // and zone, and can be up to 40 characters with the following restrictions: + // + // * Lowercase letters, numbers, and hyphens only. + // * Must start with a letter. + // * Must end with a number or a letter. + string name = 1; + + // An optional description of this cluster. + string description = 2; + + // The number of nodes to create in this cluster. You must ensure that your + // Compute Engine resource quota + // is sufficient for this number of instances. You must also have available + // firewall and routes quota. + // For requests, this field should only be used in lieu of a + // "node_pool" object, since this configuration (along with the + // "node_config") will be used to create a "NodePool" object with an + // auto-generated name. Do not use this and a node_pool at the same time. + int32 initial_node_count = 3; + + // Parameters used in creating the cluster's nodes. + // See `nodeConfig` for the description of its properties. + // For requests, this field should only be used in lieu of a + // "node_pool" object, since this configuration (along with the + // "initial_node_count") will be used to create a "NodePool" object with an + // auto-generated name. Do not use this and a node_pool at the same time. + // For responses, this field will be populated with the node configuration of + // the first node pool. + // + // If unspecified, the defaults are used. + NodeConfig node_config = 4; + + // The authentication information for accessing the master endpoint. + MasterAuth master_auth = 5; + + // The logging service the cluster should use to write logs. + // Currently available options: + // + // * `logging.googleapis.com` - the Google Cloud Logging service. + // * `none` - no logs will be exported from the cluster. + // * if left as an empty string,`logging.googleapis.com` will be used. + string logging_service = 6; + + // The monitoring service the cluster should use to write metrics. + // Currently available options: + // + // * `monitoring.googleapis.com` - the Google Cloud Monitoring service. + // * `none` - no metrics will be exported from the cluster. + // * if left as an empty string, `monitoring.googleapis.com` will be used. + string monitoring_service = 7; + + // The name of the Google Compute Engine + // [network](/compute/docs/networks-and-firewalls#networks) to which the + // cluster is connected. If left unspecified, the `default` network + // will be used. + string network = 8; + + // The IP address range of the container pods in this cluster, in + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`). Leave blank to have + // one automatically chosen or specify a `/14` block in `10.0.0.0/8`. + string cluster_ipv4_cidr = 9; + + // Configurations for the various addons available to run in the cluster. + AddonsConfig addons_config = 10; + + // The name of the Google Compute Engine + // [subnetwork](/compute/docs/subnetworks) to which the + // cluster is connected. + string subnetwork = 11; + + // The node pools associated with this cluster. + // This field should not be set if "node_config" or "initial_node_count" are + // specified. + repeated NodePool node_pools = 12; + + // The list of Google Compute Engine + // [locations](/compute/docs/zones#available) in which the cluster's nodes + // should be located. + repeated string locations = 13; + + // Kubernetes alpha features are enabled on this cluster. This includes alpha + // API groups (e.g. v1alpha1) and features that may not be production ready in + // the kubernetes version of the master and nodes. + // The cluster has no SLA for uptime and master/node upgrades are disabled. + // Alpha enabled clusters are automatically deleted thirty days after + // creation. + bool enable_kubernetes_alpha = 14; + + // The resource labels for the cluster to use to annotate any related + // Google Compute Engine resources. + map resource_labels = 15; + + // The fingerprint of the set of labels for this cluster. + string label_fingerprint = 16; + + // Configuration for the legacy ABAC authorization mode. + LegacyAbac legacy_abac = 18; + + // Configuration options for the NetworkPolicy feature. + NetworkPolicy network_policy = 19; + + // Configuration for cluster IP allocation. + IPAllocationPolicy ip_allocation_policy = 20; + + // Master authorized networks is a Beta feature. + // The configuration options for master authorized networks feature. + MasterAuthorizedNetworksConfig master_authorized_networks_config = 22; + + // Configure the maintenance policy for this cluster. + MaintenancePolicy maintenance_policy = 23; + + // [Output only] Server-defined URL for the resource. + string self_link = 100; + + // [Output only] The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 101; + + // [Output only] The IP address of this cluster's master endpoint. + // The endpoint can be accessed from the internet at + // `https://username:password@endpoint/`. + // + // See the `masterAuth` property of this resource for username and + // password information. + string endpoint = 102; + + // The initial Kubernetes version for this cluster. Valid versions are those + // found in validMasterVersions returned by getServerConfig. The version can + // be upgraded over time; such upgrades are reflected in + // currentMasterVersion and currentNodeVersion. + string initial_cluster_version = 103; + + // [Output only] The current software version of the master endpoint. + string current_master_version = 104; + + // [Output only] The current version of the node software components. + // If they are currently at multiple versions because they're in the process + // of being upgraded, this reflects the minimum version of all nodes. + string current_node_version = 105; + + // [Output only] The time the cluster was created, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string create_time = 106; + + // [Output only] The current status of this cluster. + Status status = 107; + + // [Output only] Additional information about the current status of this + // cluster, if available. + string status_message = 108; + + // [Output only] The size of the address space on each node for hosting + // containers. This is provisioned from within the `container_ipv4_cidr` + // range. + int32 node_ipv4_cidr_size = 109; + + // [Output only] The IP address range of the Kubernetes services in + // this cluster, in + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `1.2.3.4/29`). Service addresses are + // typically put in the last `/16` from the container CIDR. + string services_ipv4_cidr = 110; + + // [Output only] The resource URLs of [instance + // groups](/compute/docs/instance-groups/) associated with this + // cluster. + repeated string instance_group_urls = 111; + + // [Output only] The number of nodes currently in the cluster. + int32 current_node_count = 112; + + // [Output only] The time the cluster will be automatically + // deleted in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string expire_time = 113; +} + +// ClusterUpdate describes an update to the cluster. Exactly one update can +// be applied to a cluster with each request, so at most one field can be +// provided. +message ClusterUpdate { + // The Kubernetes version to change the nodes to (typically an + // upgrade). Use `-` to upgrade to the latest version supported by + // the server. + string desired_node_version = 4; + + // The monitoring service the cluster should use to write metrics. + // Currently available options: + // + // * "monitoring.googleapis.com" - the Google Cloud Monitoring service + // * "none" - no metrics will be exported from the cluster + string desired_monitoring_service = 5; + + // Configurations for the various addons available to run in the cluster. + AddonsConfig desired_addons_config = 6; + + // The node pool to be upgraded. This field is mandatory if + // "desired_node_version", "desired_image_family" or + // "desired_node_pool_autoscaling" is specified and there is more than one + // node pool on the cluster. + string desired_node_pool_id = 7; + + // The desired image type for the node pool. + // NOTE: Set the "desired_node_pool" field as well. + string desired_image_type = 8; + + // Autoscaler configuration for the node pool specified in + // desired_node_pool_id. If there is only one pool in the + // cluster and desired_node_pool_id is not provided then + // the change applies to that single node pool. + NodePoolAutoscaling desired_node_pool_autoscaling = 9; + + // The desired list of Google Compute Engine + // [locations](/compute/docs/zones#available) in which the cluster's nodes + // should be located. Changing the locations a cluster is in will result + // in nodes being either created or removed from the cluster, depending on + // whether locations are being added or removed. + // + // This list must always include the cluster's primary zone. + repeated string desired_locations = 10; + + // Master authorized networks is a Beta feature. + // The desired configuration options for master authorized networks feature. + MasterAuthorizedNetworksConfig desired_master_authorized_networks_config = 12; + + // The Kubernetes version to change the master to. The only valid value is the + // latest supported version. Use "-" to have the server automatically select + // the latest version. + string desired_master_version = 100; +} + +// This operation resource represents operations that may have happened or are +// happening on the cluster. All fields are output only. +message Operation { + // Current status of the operation. + enum Status { + // Not set. + STATUS_UNSPECIFIED = 0; + + // The operation has been created. + PENDING = 1; + + // The operation is currently running. + RUNNING = 2; + + // The operation is done, either cancelled or completed. + DONE = 3; + + // The operation is aborting. + ABORTING = 4; + } + + // Operation type. + enum Type { + // Not set. + TYPE_UNSPECIFIED = 0; + + // Cluster create. + CREATE_CLUSTER = 1; + + // Cluster delete. + DELETE_CLUSTER = 2; + + // A master upgrade. + UPGRADE_MASTER = 3; + + // A node upgrade. + UPGRADE_NODES = 4; + + // Cluster repair. + REPAIR_CLUSTER = 5; + + // Cluster update. + UPDATE_CLUSTER = 6; + + // Node pool create. + CREATE_NODE_POOL = 7; + + // Node pool delete. + DELETE_NODE_POOL = 8; + + // Set node pool management. + SET_NODE_POOL_MANAGEMENT = 9; + + // Automatic node pool repair. + AUTO_REPAIR_NODES = 10; + + // Automatic node upgrade. + AUTO_UPGRADE_NODES = 11; + + // Set labels. + SET_LABELS = 12; + + // Set/generate master auth materials + SET_MASTER_AUTH = 13; + + // Set node pool size. + SET_NODE_POOL_SIZE = 14; + + // Updates network policy for a cluster. + SET_NETWORK_POLICY = 15; + + // Set the maintenance policy. + SET_MAINTENANCE_POLICY = 16; + } + + // The server-assigned ID for the operation. + string name = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the operation + // is taking place. + string zone = 2; + + // The operation type. + Type operation_type = 3; + + // The current status of the operation. + Status status = 4; + + // Detailed operation progress, if available. + string detail = 8; + + // If an error has occurred, a textual description of the error. + string status_message = 5; + + // Server-defined URL for the resource. + string self_link = 6; + + // Server-defined URL for the target of the operation. + string target_link = 7; + + // [Output only] The time the operation started, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string start_time = 10; + + // [Output only] The time the operation completed, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string end_time = 11; +} + +// CreateClusterRequest creates a cluster. +message CreateClusterRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // A [cluster + // resource](/container-engine/reference/rest/v1/projects.zones.clusters) + Cluster cluster = 3; +} + +// GetClusterRequest gets the settings of a cluster. +message GetClusterRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to retrieve. + string cluster_id = 3; +} + +// UpdateClusterRequest updates the settings of a cluster. +message UpdateClusterRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to upgrade. + string cluster_id = 3; + + // A description of the update. + ClusterUpdate update = 4; +} + +// UpdateNodePoolRequests update a node pool's image and/or version. +message UpdateNodePoolRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to upgrade. + string cluster_id = 3; + + // The name of the node pool to upgrade. + string node_pool_id = 4; + + // The Kubernetes version to change the nodes to (typically an + // upgrade). Use `-` to upgrade to the latest version supported by + // the server. + string node_version = 5; + + // The desired image type for the node pool. + string image_type = 6; +} + +// SetNodePoolAutoscalingRequest sets the autoscaler settings of a node pool. +message SetNodePoolAutoscalingRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to upgrade. + string cluster_id = 3; + + // The name of the node pool to upgrade. + string node_pool_id = 4; + + // Autoscaling configuration for the node pool. + NodePoolAutoscaling autoscaling = 5; +} + +// SetLoggingServiceRequest sets the logging service of a cluster. +message SetLoggingServiceRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to upgrade. + string cluster_id = 3; + + // The logging service the cluster should use to write metrics. + // Currently available options: + // + // * "logging.googleapis.com" - the Google Cloud Logging service + // * "none" - no metrics will be exported from the cluster + string logging_service = 4; +} + +// SetMonitoringServiceRequest sets the monitoring service of a cluster. +message SetMonitoringServiceRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to upgrade. + string cluster_id = 3; + + // The monitoring service the cluster should use to write metrics. + // Currently available options: + // + // * "monitoring.googleapis.com" - the Google Cloud Monitoring service + // * "none" - no metrics will be exported from the cluster + string monitoring_service = 4; +} + +// SetAddonsConfigRequest sets the addons associated with the cluster. +message SetAddonsConfigRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to upgrade. + string cluster_id = 3; + + // The desired configurations for the various addons available to run in the + // cluster. + AddonsConfig addons_config = 4; +} + +// SetLocationsRequest sets the locations of the cluster. +message SetLocationsRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to upgrade. + string cluster_id = 3; + + // The desired list of Google Compute Engine + // [locations](/compute/docs/zones#available) in which the cluster's nodes + // should be located. Changing the locations a cluster is in will result + // in nodes being either created or removed from the cluster, depending on + // whether locations are being added or removed. + // + // This list must always include the cluster's primary zone. + repeated string locations = 4; +} + +// UpdateMasterRequest updates the master of the cluster. +message UpdateMasterRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to upgrade. + string cluster_id = 3; + + // The Kubernetes version to change the master to. The only valid value is the + // latest supported version. Use "-" to have the server automatically select + // the latest version. + string master_version = 4; +} + +// SetMasterAuthRequest updates the admin password of a cluster. +message SetMasterAuthRequest { + // Operation type: what type update to perform. + enum Action { + // Operation is unknown and will error out. + UNKNOWN = 0; + + // Set the password to a user generated value. + SET_PASSWORD = 1; + + // Generate a new password and set it to that. + GENERATE_PASSWORD = 2; + + // Set the username. If an empty username is provided, basic authentication + // is disabled for the cluster. If a non-empty username is provided, basic + // authentication is enabled, with either a provided password or a generated + // one. + SET_USERNAME = 3; + } + + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to upgrade. + string cluster_id = 3; + + // The exact form of action to be taken on the master auth. + Action action = 4; + + // A description of the update. + MasterAuth update = 5; +} + +// DeleteClusterRequest deletes a cluster. +message DeleteClusterRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to delete. + string cluster_id = 3; +} + +// ListClustersRequest lists clusters. +message ListClustersRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides, or "-" for all zones. + string zone = 2; +} + +// ListClustersResponse is the result of ListClustersRequest. +message ListClustersResponse { + // A list of clusters in the project in the specified zone, or + // across all ones. + repeated Cluster clusters = 1; + + // If any zones are listed here, the list of clusters returned + // may be missing those zones. + repeated string missing_zones = 2; +} + +// GetOperationRequest gets a single operation. +message GetOperationRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The server-assigned `name` of the operation. + string operation_id = 3; +} + +// ListOperationsRequest lists operations. +message ListOperationsRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine [zone](/compute/docs/zones#available) + // to return operations for, or `-` for all zones. + string zone = 2; +} + +// CancelOperationRequest cancels a single operation. +message CancelOperationRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the operation resides. + string zone = 2; + + // The server-assigned `name` of the operation. + string operation_id = 3; +} + +// ListOperationsResponse is the result of ListOperationsRequest. +message ListOperationsResponse { + // A list of operations in the project in the specified zone. + repeated Operation operations = 1; + + // If any zones are listed here, the list of operations returned + // may be missing the operations from those zones. + repeated string missing_zones = 2; +} + +// Gets the current Container Engine service configuration. +message GetServerConfigRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine [zone](/compute/docs/zones#available) + // to return operations for. + string zone = 2; +} + +// Container Engine service configuration. +message ServerConfig { + // Version of Kubernetes the service deploys by default. + string default_cluster_version = 1; + + // List of valid node upgrade target versions. + repeated string valid_node_versions = 3; + + // Default image type. + string default_image_type = 4; + + // List of valid image types. + repeated string valid_image_types = 5; + + // List of valid master versions. + repeated string valid_master_versions = 6; +} + +// CreateNodePoolRequest creates a node pool for a cluster. +message CreateNodePoolRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster. + string cluster_id = 3; + + // The node pool to create. + NodePool node_pool = 4; +} + +// DeleteNodePoolRequest deletes a node pool for a cluster. +message DeleteNodePoolRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster. + string cluster_id = 3; + + // The name of the node pool to delete. + string node_pool_id = 4; +} + +// ListNodePoolsRequest lists the node pool(s) for a cluster. +message ListNodePoolsRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster. + string cluster_id = 3; +} + +// GetNodePoolRequest retrieves a node pool for a cluster. +message GetNodePoolRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster. + string cluster_id = 3; + + // The name of the node pool. + string node_pool_id = 4; +} + +// NodePool contains the name and configuration for a cluster's node pool. +// Node pools are a set of nodes (i.e. VM's), with a common configuration and +// specification, under the control of the cluster master. They may have a set +// of Kubernetes labels applied to them, which may be used to reference them +// during pod scheduling. They may also be resized up or down, to accommodate +// the workload. +message NodePool { + // The current status of the node pool instance. + enum Status { + // Not set. + STATUS_UNSPECIFIED = 0; + + // The PROVISIONING state indicates the node pool is being created. + PROVISIONING = 1; + + // The RUNNING state indicates the node pool has been created + // and is fully usable. + RUNNING = 2; + + // The RUNNING_WITH_ERROR state indicates the node pool has been created + // and is partially usable. Some error state has occurred and some + // functionality may be impaired. Customer may need to reissue a request + // or trigger a new update. + RUNNING_WITH_ERROR = 3; + + // The RECONCILING state indicates that some work is actively being done on + // the node pool, such as upgrading node software. Details can + // be found in the `statusMessage` field. + RECONCILING = 4; + + // The STOPPING state indicates the node pool is being deleted. + STOPPING = 5; + + // The ERROR state indicates the node pool may be unusable. Details + // can be found in the `statusMessage` field. + ERROR = 6; + } + + // The name of the node pool. + string name = 1; + + // The node configuration of the pool. + NodeConfig config = 2; + + // The initial node count for the pool. You must ensure that your + // Compute Engine resource quota + // is sufficient for this number of instances. You must also have available + // firewall and routes quota. + int32 initial_node_count = 3; + + // [Output only] Server-defined URL for the resource. + string self_link = 100; + + // [Output only] The version of the Kubernetes of this node. + string version = 101; + + // [Output only] The resource URLs of [instance + // groups](/compute/docs/instance-groups/) associated with this + // node pool. + repeated string instance_group_urls = 102; + + // [Output only] The status of the nodes in this pool instance. + Status status = 103; + + // [Output only] Additional information about the current status of this + // node pool instance, if available. + string status_message = 104; + + // Autoscaler configuration for this NodePool. Autoscaler is enabled + // only if a valid configuration is present. + NodePoolAutoscaling autoscaling = 4; + + // NodeManagement configuration for this NodePool. + NodeManagement management = 5; +} + +// NodeManagement defines the set of node management services turned on for the +// node pool. +message NodeManagement { + // A flag that specifies whether node auto-upgrade is enabled for the node + // pool. If enabled, node auto-upgrade helps keep the nodes in your node pool + // up to date with the latest release version of Kubernetes. + bool auto_upgrade = 1; + + // A flag that specifies whether the node auto-repair is enabled for the node + // pool. If enabled, the nodes in this node pool will be monitored and, if + // they fail health checks too many times, an automatic repair action will be + // triggered. + bool auto_repair = 2; + + // Specifies the Auto Upgrade knobs for the node pool. + AutoUpgradeOptions upgrade_options = 10; +} + +// AutoUpgradeOptions defines the set of options for the user to control how +// the Auto Upgrades will proceed. +message AutoUpgradeOptions { + // [Output only] This field is set when upgrades are about to commence + // with the approximate start time for the upgrades, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string auto_upgrade_start_time = 1; + + // [Output only] This field is set when upgrades are about to commence + // with the description of the upgrade. + string description = 2; +} + +// MaintenancePolicy defines the maintenance policy to be used for the cluster. +message MaintenancePolicy { + // Specifies the maintenance window in which maintenance may be performed. + MaintenanceWindow window = 1; +} + +// MaintenanceWindow defines the maintenance window to be used for the cluster. +message MaintenanceWindow { + oneof policy { + // DailyMaintenanceWindow specifies a daily maintenance operation window. + DailyMaintenanceWindow daily_maintenance_window = 2; + } +} + +// Time window specified for daily maintenance operations. +message DailyMaintenanceWindow { + // Time within the maintenance window to start the maintenance operations. + // Time format should be in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) + // format "HH:MM”, where HH : [00-23] and MM : [00-59] GMT. + string start_time = 2; + + // [Output only] Duration of the time window, automatically chosen to be + // smallest possible in the given scenario. + // Duration will be in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) + // format "PTnHnMnS". + string duration = 3; +} + +// SetNodePoolManagementRequest sets the node management properties of a node +// pool. +message SetNodePoolManagementRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to update. + string cluster_id = 3; + + // The name of the node pool to update. + string node_pool_id = 4; + + // NodeManagement configuration for the node pool. + NodeManagement management = 5; +} + +// SetNodePoolSizeRequest sets the size a node +// pool. +message SetNodePoolSizeRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to update. + string cluster_id = 3; + + // The name of the node pool to update. + string node_pool_id = 4; + + // The desired node count for the pool. + int32 node_count = 5; +} + +// RollbackNodePoolUpgradeRequest rollbacks the previously Aborted or Failed +// NodePool upgrade. This will be an no-op if the last upgrade successfully +// completed. +message RollbackNodePoolUpgradeRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to rollback. + string cluster_id = 3; + + // The name of the node pool to rollback. + string node_pool_id = 4; +} + +// ListNodePoolsResponse is the result of ListNodePoolsRequest. +message ListNodePoolsResponse { + // A list of node pools for a cluster. + repeated NodePool node_pools = 1; +} + +// NodePoolAutoscaling contains information required by cluster autoscaler to +// adjust the size of the node pool to the current cluster usage. +message NodePoolAutoscaling { + // Is autoscaling enabled for this node pool. + bool enabled = 1; + + // Minimum number of nodes in the NodePool. Must be >= 1 and <= + // max_node_count. + int32 min_node_count = 2; + + // Maximum number of nodes in the NodePool. Must be >= min_node_count. There + // has to enough quota to scale up the cluster. + int32 max_node_count = 3; +} + +// SetLabelsRequest sets the Google Cloud Platform labels on a Google Container +// Engine cluster, which will in turn set them for Google Compute Engine +// resources used by that cluster +message SetLabelsRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster. + string cluster_id = 3; + + // The labels to set for that cluster. + map resource_labels = 4; + + // The fingerprint of the previous set of labels for this resource, + // used to detect conflicts. The fingerprint is initially generated by + // Container Engine and changes after every request to modify or update + // labels. You must always provide an up-to-date fingerprint hash when + // updating or changing labels. Make a get() request to the + // resource to get the latest fingerprint. + string label_fingerprint = 5; +} + +// SetLegacyAbacRequest enables or disables the ABAC authorization mechanism for +// a cluster. +message SetLegacyAbacRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to update. + string cluster_id = 3; + + // Whether ABAC authorization will be enabled in the cluster. + bool enabled = 4; +} + +// StartIPRotationRequest creates a new IP for the cluster and then performs +// a node upgrade on each node pool to point to the new IP. +message StartIPRotationRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster. + string cluster_id = 3; +} + +// CompleteIPRotationRequest moves the cluster master back into single-IP mode. +message CompleteIPRotationRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster. + string cluster_id = 3; +} + +// AcceleratorConfig represents a Hardware Accelerator request. +message AcceleratorConfig { + // The number of the accelerator cards exposed to an instance. + int64 accelerator_count = 1; + + // The accelerator type resource name. List of supported accelerators + // [here](/compute/docs/gpus/#Introduction) + string accelerator_type = 2; +} + +// SetNetworkPolicyRequest enables/disables network policy for a cluster. +message SetNetworkPolicyRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster. + string cluster_id = 3; + + // Configuration options for the NetworkPolicy feature. + NetworkPolicy network_policy = 4; +} + +// SetMaintenancePolicyRequest sets the maintenance policy for a cluster. +message SetMaintenancePolicyRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to update. + string cluster_id = 3; + + // The maintenance policy to be set for the cluster. An empty field + // clears the existing maintenance policy. + MaintenancePolicy maintenance_policy = 4; +} diff --git a/handwritten/cloud-profiler/google/container/v1alpha1/cluster_service.proto b/handwritten/cloud-profiler/google/container/v1alpha1/cluster_service.proto new file mode 100644 index 00000000000..d9ae4c5cad5 --- /dev/null +++ b/handwritten/cloud-profiler/google/container/v1alpha1/cluster_service.proto @@ -0,0 +1,1932 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.container.v1alpha1; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; + +option go_package = "google.golang.org/genproto/googleapis/container/v1alpha1;container"; +option java_multiple_files = true; +option java_outer_classname = "ClusterServiceProto"; +option java_package = "com.google.container.v1alpha1"; + + +// Google Container Engine Cluster Manager v1alpha1 +service ClusterManager { + // Lists all clusters owned by a project in either the specified zone or all + // zones. + rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { + option (google.api.http) = { get: "/v1alpha1/{parent=projects/*/locations/*}/clusters" }; + } + + // Gets the details of a specific cluster. + rpc GetCluster(GetClusterRequest) returns (Cluster) { + option (google.api.http) = { get: "/v1alpha1/{name=projects/*/locations/*/clusters/*}" }; + } + + // Creates a cluster, consisting of the specified number and type of Google + // Compute Engine instances. + // + // By default, the cluster is created in the project's + // [default network](/compute/docs/networks-and-firewalls#networks). + // + // One firewall is added for the cluster. After cluster creation, + // the cluster creates routes for each node to allow the containers + // on that node to communicate with all other instances in the + // cluster. + // + // Finally, an entry is added to the project's global metadata indicating + // which CIDR range is being used by the cluster. + rpc CreateCluster(CreateClusterRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{parent=projects/*/locations/*}/clusters" body: "*" }; + } + + // Updates the settings of a specific cluster. + rpc UpdateCluster(UpdateClusterRequest) returns (Operation) { + option (google.api.http) = { put: "/v1alpha1/{name=projects/*/locations/*/clusters/*}" body: "*" }; + } + + // Updates the version and/or iamge type of a specific node pool. + rpc UpdateNodePool(UpdateNodePoolRequest) returns (Operation) { + option (google.api.http) = { put: "/v1alpha1/{name=projects/*/locations/*/clusters/*/nodePools/*}" body: "*" }; + } + + // Sets the autoscaling settings of a specific node pool. + rpc SetNodePoolAutoscaling(SetNodePoolAutoscalingRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setAutoscaling" body: "*" }; + } + + // Sets the logging service of a specific cluster. + rpc SetLoggingService(SetLoggingServiceRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*}:setLogging" body: "*" }; + } + + // Sets the monitoring service of a specific cluster. + rpc SetMonitoringService(SetMonitoringServiceRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*}:setMonitoring" body: "*" }; + } + + // Sets the addons of a specific cluster. + rpc SetAddonsConfig(SetAddonsConfigRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*}:setAddons" body: "*" }; + } + + // Sets the locations of a specific cluster. + rpc SetLocations(SetLocationsRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*}:setLocations" body: "*" }; + } + + // Updates the master of a specific cluster. + rpc UpdateMaster(UpdateMasterRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*}:updateMaster" body: "*" }; + } + + // Used to set master auth materials. Currently supports :- + // Changing the admin password of a specific cluster. + // This can be either via password generation or explicitly set. + // Modify basic_auth.csv and reset the K8S API server. + rpc SetMasterAuth(SetMasterAuthRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*}:setMasterAuth" body: "*" }; + } + + // Deletes the cluster, including the Kubernetes endpoint and all worker + // nodes. + // + // Firewalls and routes that were configured during cluster creation + // are also deleted. + // + // Other Google Compute Engine resources that might be in use by the cluster + // (e.g. load balancer resources) will not be deleted if they weren't present + // at the initial create time. + rpc DeleteCluster(DeleteClusterRequest) returns (Operation) { + option (google.api.http) = { delete: "/v1alpha1/{name=projects/*/locations/*/clusters/*}" }; + } + + // Lists all operations in a project in a specific zone or all zones. + rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) { + option (google.api.http) = { get: "/v1alpha1/{parent=projects/*/locations/*}/operations" }; + } + + // Gets the specified operation. + rpc GetOperation(GetOperationRequest) returns (Operation) { + option (google.api.http) = { get: "/v1alpha1/{name=projects/*/locations/*/operations/*}" }; + } + + // Cancels the specified operation. + rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel" body: "*" }; + } + + // Returns configuration info about the Container Engine service. + rpc GetServerConfig(GetServerConfigRequest) returns (ServerConfig) { + option (google.api.http) = { get: "/v1alpha1/{name=projects/*/locations/*}/serverConfig" }; + } + + // Lists the node pools for a cluster. + rpc ListNodePools(ListNodePoolsRequest) returns (ListNodePoolsResponse) { + option (google.api.http) = { get: "/v1alpha1/{parent=projects/*/locations/*/clusters/*}/nodePools" }; + } + + // Retrieves the node pool requested. + rpc GetNodePool(GetNodePoolRequest) returns (NodePool) { + option (google.api.http) = { get: "/v1alpha1/{name=projects/*/locations/*/clusters/*/nodePools/*}" }; + } + + // Creates a node pool for a cluster. + rpc CreateNodePool(CreateNodePoolRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{parent=projects/*/locations/*/clusters/*}/nodePools" body: "*" }; + } + + // Deletes a node pool from a cluster. + rpc DeleteNodePool(DeleteNodePoolRequest) returns (Operation) { + option (google.api.http) = { delete: "/v1alpha1/{name=projects/*/locations/*/clusters/*/nodePools/*}" }; + } + + // Roll back the previously Aborted or Failed NodePool upgrade. + // This will be an no-op if the last upgrade successfully completed. + rpc RollbackNodePoolUpgrade(RollbackNodePoolUpgradeRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*/nodePools/*}:rollback" body: "*" }; + } + + // Sets the NodeManagement options for a node pool. + rpc SetNodePoolManagement(SetNodePoolManagementRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setManagement" body: "*" }; + } + + // Sets labels on a cluster. + rpc SetLabels(SetLabelsRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*}:setResourceLabels" body: "*" }; + } + + // Enables or disables the ABAC authorization mechanism on a cluster. + rpc SetLegacyAbac(SetLegacyAbacRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*}:setLegacyAbac" body: "*" }; + } + + // Start master IP rotation. + rpc StartIPRotation(StartIPRotationRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*}:startIpRotation" body: "*" }; + } + + // Completes master IP rotation. + rpc CompleteIPRotation(CompleteIPRotationRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*}:completeIpRotation" body: "*" }; + } + + // Sets the size of a specific node pool. + rpc SetNodePoolSize(SetNodePoolSizeRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setSize" body: "*" }; + } + + // Enables/Disables Network Policy for a cluster. + rpc SetNetworkPolicy(SetNetworkPolicyRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*}:setNetworkPolicy" body: "*" }; + } + + // Sets the maintenance policy for a cluster. + rpc SetMaintenancePolicy(SetMaintenancePolicyRequest) returns (Operation) { + option (google.api.http) = { post: "/v1alpha1/{name=projects/*/locations/*/clusters/*}:setMaintenancePolicy" body: "*" }; + } +} + +// Parameters that describe the nodes in a cluster. +message NodeConfig { + // The name of a Google Compute Engine [machine + // type](/compute/docs/machine-types) (e.g. + // `n1-standard-1`). + // + // If unspecified, the default machine type is + // `n1-standard-1`. + string machine_type = 1; + + // Size of the disk attached to each node, specified in GB. + // The smallest allowed disk size is 10GB. + // + // If unspecified, the default disk size is 100GB. + int32 disk_size_gb = 2; + + // The set of Google API scopes to be made available on all of the + // node VMs under the "default" service account. + // + // The following scopes are recommended, but not required, and by default are + // not included: + // + // * `https://www.googleapis.com/auth/compute` is required for mounting + // persistent storage on your nodes. + // * `https://www.googleapis.com/auth/devstorage.read_only` is required for + // communicating with **gcr.io** + // (the [Google Container Registry](/container-registry/)). + // + // If unspecified, no scopes are added, unless Cloud Logging or Cloud + // Monitoring are enabled, in which case their required scopes will be added. + repeated string oauth_scopes = 3; + + // The Google Cloud Platform Service Account to be used by the node VMs. If + // no Service Account is specified, the "default" service account is used. + string service_account = 9; + + // The metadata key/value pairs assigned to instances in the cluster. + // + // Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes + // in length. These are reflected as part of a URL in the metadata server. + // Additionally, to avoid ambiguity, keys must not conflict with any other + // metadata keys for the project or be one of the four reserved keys: + // "instance-template", "kube-env", "startup-script", and "user-data" + // + // Values are free-form strings, and only have meaning as interpreted by + // the image running in the instance. The only restriction placed on them is + // that each value's size must be less than or equal to 32 KB. + // + // The total size of all keys and values must be less than 512 KB. + map metadata = 4; + + // The image type to use for this node. Note that for a given image type, + // the latest version of it will be used. + string image_type = 5; + + // The map of Kubernetes labels (key/value pairs) to be applied to each node. + // These will added in addition to any default label(s) that + // Kubernetes may apply to the node. + // In case of conflict in label keys, the applied set may differ depending on + // the Kubernetes version -- it's best to assume the behavior is undefined + // and conflicts should be avoided. + // For more information, including usage and the valid values, see: + // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ + map labels = 6; + + // The number of local SSD disks to be attached to the node. + // + // The limit for this value is dependant upon the maximum number of + // disks available on a machine per zone. See: + // https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits + // for more information. + int32 local_ssd_count = 7; + + // The list of instance tags applied to all nodes. Tags are used to identify + // valid sources or targets for network firewalls and are specified by + // the client during cluster or node pool creation. Each tag within the list + // must comply with RFC1035. + repeated string tags = 8; + + // Whether the nodes are created as preemptible VM instances. See: + // https://cloud.google.com/compute/docs/instances/preemptible for more + // inforamtion about preemptible VM instances. + bool preemptible = 10; + + // A list of hardware accelerators to be attached to each node. + // See https://cloud.google.com/compute/docs/gpus for more information about + // support for GPUs. + repeated AcceleratorConfig accelerators = 11; + + // Minimum CPU platform to be used by this instance. The instance may be + // scheduled on the specified or newer CPU platform. Applicable values are the + // friendly names of CPU platforms, such as + // minCpuPlatform: "Intel Haswell" or + // minCpuPlatform: "Intel Sandy Bridge". For more + // information, read [how to specify min CPU platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform) + string min_cpu_platform = 13; + + // List of kubernetes taints to be applied to each node. + // + // For more information, including usage and the valid values, see: + // https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + repeated NodeTaint taints = 15; +} + +// Kubernetes taint is comprised of three fields: key, value, and effect. Effect +// can only be one of three types: NoSchedule, PreferNoSchedule or NoExecute. +// +// For more information, including usage and the valid values, see: +// https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +message NodeTaint { + // Possible values for Effect in taint. + enum Effect { + // Not set + EFFECT_UNSPECIFIED = 0; + + // NoSchedule + NO_SCHEDULE = 1; + + // PreferNoSchedule + PREFER_NO_SCHEDULE = 2; + + // NoExecute + NO_EXECUTE = 3; + } + + // Key for taint. + string key = 1; + + // Value for taint. + string value = 2; + + // Effect for taint. + Effect effect = 3; +} + +// The authentication information for accessing the master endpoint. +// Authentication can be done using HTTP basic auth or using client +// certificates. +message MasterAuth { + // The username to use for HTTP basic authentication to the master endpoint. + // For clusters v1.6.0 and later, you can disable basic authentication by + // providing an empty username. + string username = 1; + + // The password to use for HTTP basic authentication to the master endpoint. + // Because the master endpoint is open to the Internet, you should create a + // strong password. If a password is provided for cluster creation, username + // must be non-empty. + string password = 2; + + // Configuration for client certificate authentication on the cluster. If no + // configuration is specified, a client certificate is issued. + ClientCertificateConfig client_certificate_config = 3; + + // [Output only] Base64-encoded public certificate that is the root of + // trust for the cluster. + string cluster_ca_certificate = 100; + + // [Output only] Base64-encoded public certificate used by clients to + // authenticate to the cluster endpoint. + string client_certificate = 101; + + // [Output only] Base64-encoded private key used by clients to authenticate + // to the cluster endpoint. + string client_key = 102; +} + +// Configuration for client certificates on the cluster. +message ClientCertificateConfig { + // Issue a client certificate. + bool issue_client_certificate = 1; +} + +// Configuration for the addons that can be automatically spun up in the +// cluster, enabling additional functionality. +message AddonsConfig { + // Configuration for the HTTP (L7) load balancing controller addon, which + // makes it easy to set up HTTP load balancers for services in a cluster. + HttpLoadBalancing http_load_balancing = 1; + + // Configuration for the horizontal pod autoscaling feature, which + // increases or decreases the number of replica pods a replication controller + // has based on the resource usage of the existing pods. + HorizontalPodAutoscaling horizontal_pod_autoscaling = 2; + + // Configuration for the Kubernetes Dashboard. + KubernetesDashboard kubernetes_dashboard = 3; + + // Configuration for NetworkPolicy. This only tracks whether the addon + // is enabled or not on the Master, it does not track whether network policy + // is enabled for the nodes. + NetworkPolicyConfig network_policy_config = 4; +} + +// Configuration options for the HTTP (L7) load balancing controller addon, +// which makes it easy to set up HTTP load balancers for services in a cluster. +message HttpLoadBalancing { + // Whether the HTTP Load Balancing controller is enabled in the cluster. + // When enabled, it runs a small pod in the cluster that manages the load + // balancers. + bool disabled = 1; +} + +// Configuration options for the horizontal pod autoscaling feature, which +// increases or decreases the number of replica pods a replication controller +// has based on the resource usage of the existing pods. +message HorizontalPodAutoscaling { + // Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. + // When enabled, it ensures that a Heapster pod is running in the cluster, + // which is also used by the Cloud Monitoring service. + bool disabled = 1; +} + +// Configuration for the Kubernetes Dashboard. +message KubernetesDashboard { + // Whether the Kubernetes Dashboard is enabled for this cluster. + bool disabled = 1; +} + +// Configuration for NetworkPolicy. This only tracks whether the addon +// is enabled or not on the Master, it does not track whether network policy +// is enabled for the nodes. +message NetworkPolicyConfig { + // Whether NetworkPolicy is enabled for this cluster. + bool disabled = 1; +} + +// Configuration options for the master authorized networks feature. Enabled +// master authorized networks will disallow all external traffic to access +// Kubernetes master through HTTPS except traffic from the given CIDR blocks, +// Google Compute Engine Public IPs and Google Prod IPs. +message MasterAuthorizedNetworksConfig { + // CidrBlock contains an optional name and one CIDR block. + message CidrBlock { + // display_name is an optional field for users to identify CIDR blocks. + string display_name = 1; + + // cidr_block must be specified in CIDR notation. + string cidr_block = 2; + } + + // Whether or not master authorized networks is enabled. + bool enabled = 1; + + // cidr_blocks define up to 10 external networks that could access + // Kubernetes master through HTTPS. + repeated CidrBlock cidr_blocks = 2; +} + +// Configuration options for the NetworkPolicy feature. +// https://kubernetes.io/docs/concepts/services-networking/networkpolicies/ +message NetworkPolicy { + // Allowed Network Policy providers. + enum Provider { + // Not set + PROVIDER_UNSPECIFIED = 0; + + // Tigera (Calico Felix). + CALICO = 1; + } + + // The selected network policy provider. + Provider provider = 1; + + // Whether network policy is enabled on the cluster. + bool enabled = 2; +} + +// Configuration for controlling how IPs are allocated in the cluster. +message IPAllocationPolicy { + // Whether alias IPs will be used for pod IPs in the cluster. + bool use_ip_aliases = 1; + + // Whether a new subnetwork will be created automatically for the cluster. + // + // This field is only applicable when `use_ip_aliases` is true. + bool create_subnetwork = 2; + + // A custom subnetwork name to be used if `create_subnetwork` is true. If + // this field is empty, then an automatic name will be chosen for the new + // subnetwork. + string subnetwork_name = 3; + + // This field is deprecated, use cluster_ipv4_cidr_block. + string cluster_ipv4_cidr = 4; + + // This field is deprecated, use node_ipv4_cidr_block. + string node_ipv4_cidr = 5; + + // This field is deprecated, use services_ipv4_cidr_block. + string services_ipv4_cidr = 6; + + // The name of the secondary range to be used for the cluster CIDR + // block. The secondary range will be used for pod IP + // addresses. This must be an existing secondary range associated + // with the cluster subnetwork. + // + // This field is only applicable if use_ip_aliases is true and + // create_subnetwork is false. + string cluster_secondary_range_name = 7; + + // The name of the secondary range to be used as for the services + // CIDR block. The secondary range will be used for service + // ClusterIPs. This must be an existing secondary range associated + // with the cluster subnetwork. + // + // This field is only applicable with use_ip_aliases is true and + // create_subnetwork is false. + string services_secondary_range_name = 8; + + // The IP address range for the cluster pod IPs. If this field is set, then + // `cluster.cluster_ipv4_cidr` must be left blank. + // + // This field is only applicable when `use_ip_aliases` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string cluster_ipv4_cidr_block = 9; + + // The IP address range of the instance IPs in this cluster. + // + // This is applicable only if `create_subnetwork` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string node_ipv4_cidr_block = 10; + + // The IP address range of the services IPs in this cluster. If blank, a range + // will be automatically chosen with the default size. + // + // This field is only applicable when `use_ip_aliases` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string services_ipv4_cidr_block = 11; +} + +// Configuration for the PodSecurityPolicy feature. +message PodSecurityPolicyConfig { + // Enable the PodSecurityPolicy controller for this cluster. If enabled, pods + // must be valid under a PodSecurityPolicy to be created. + bool enabled = 1; +} + +// A Google Container Engine cluster. +message Cluster { + // The current status of the cluster. + enum Status { + // Not set. + STATUS_UNSPECIFIED = 0; + + // The PROVISIONING state indicates the cluster is being created. + PROVISIONING = 1; + + // The RUNNING state indicates the cluster has been created and is fully + // usable. + RUNNING = 2; + + // The RECONCILING state indicates that some work is actively being done on + // the cluster, such as upgrading the master or node software. Details can + // be found in the `statusMessage` field. + RECONCILING = 3; + + // The STOPPING state indicates the cluster is being deleted. + STOPPING = 4; + + // The ERROR state indicates the cluster may be unusable. Details + // can be found in the `statusMessage` field. + ERROR = 5; + } + + // The name of this cluster. The name must be unique within this project + // and zone, and can be up to 40 characters with the following restrictions: + // + // * Lowercase letters, numbers, and hyphens only. + // * Must start with a letter. + // * Must end with a number or a letter. + string name = 1; + + // An optional description of this cluster. + string description = 2; + + // The number of nodes to create in this cluster. You must ensure that your + // Compute Engine resource quota + // is sufficient for this number of instances. You must also have available + // firewall and routes quota. + // For requests, this field should only be used in lieu of a + // "node_pool" object, since this configuration (along with the + // "node_config") will be used to create a "NodePool" object with an + // auto-generated name. Do not use this and a node_pool at the same time. + int32 initial_node_count = 3; + + // Parameters used in creating the cluster's nodes. + // See `nodeConfig` for the description of its properties. + // For requests, this field should only be used in lieu of a + // "node_pool" object, since this configuration (along with the + // "initial_node_count") will be used to create a "NodePool" object with an + // auto-generated name. Do not use this and a node_pool at the same time. + // For responses, this field will be populated with the node configuration of + // the first node pool. + // + // If unspecified, the defaults are used. + NodeConfig node_config = 4; + + // The authentication information for accessing the master endpoint. + MasterAuth master_auth = 5; + + // The logging service the cluster should use to write logs. + // Currently available options: + // + // * `logging.googleapis.com` - the Google Cloud Logging service. + // * `none` - no logs will be exported from the cluster. + // * if left as an empty string,`logging.googleapis.com` will be used. + string logging_service = 6; + + // The monitoring service the cluster should use to write metrics. + // Currently available options: + // + // * `monitoring.googleapis.com` - the Google Cloud Monitoring service. + // * `none` - no metrics will be exported from the cluster. + // * if left as an empty string, `monitoring.googleapis.com` will be used. + string monitoring_service = 7; + + // The name of the Google Compute Engine + // [network](/compute/docs/networks-and-firewalls#networks) to which the + // cluster is connected. If left unspecified, the `default` network + // will be used. + string network = 8; + + // The IP address range of the container pods in this cluster, in + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`). Leave blank to have + // one automatically chosen or specify a `/14` block in `10.0.0.0/8`. + string cluster_ipv4_cidr = 9; + + // Configurations for the various addons available to run in the cluster. + AddonsConfig addons_config = 10; + + // The name of the Google Compute Engine + // [subnetwork](/compute/docs/subnetworks) to which the + // cluster is connected. + string subnetwork = 11; + + // The node pools associated with this cluster. + // This field should not be set if "node_config" or "initial_node_count" are + // specified. + repeated NodePool node_pools = 12; + + // The list of Google Compute Engine + // [locations](/compute/docs/zones#available) in which the cluster's nodes + // should be located. + repeated string locations = 13; + + // Kubernetes alpha features are enabled on this cluster. This includes alpha + // API groups (e.g. v1alpha1) and features that may not be production ready in + // the kubernetes version of the master and nodes. + // The cluster has no SLA for uptime and master/node upgrades are disabled. + // Alpha enabled clusters are automatically deleted thirty days after + // creation. + bool enable_kubernetes_alpha = 14; + + // Configuration options for the NetworkPolicy feature. + NetworkPolicy network_policy = 19; + + // Configuration for cluster IP allocation. + IPAllocationPolicy ip_allocation_policy = 20; + + // The configuration options for master authorized networks feature. + MasterAuthorizedNetworksConfig master_authorized_networks_config = 22; + + // Configure the maintenance policy for this cluster. + MaintenancePolicy maintenance_policy = 23; + + // Configuration for the PodSecurityPolicy feature. + PodSecurityPolicyConfig pod_security_policy_config = 25; + + // [Output only] Server-defined URL for the resource. + string self_link = 100; + + // [Output only] The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use location instead. + string zone = 101; + + // [Output only] The IP address of this cluster's master endpoint. + // The endpoint can be accessed from the internet at + // `https://username:password@endpoint/`. + // + // See the `masterAuth` property of this resource for username and + // password information. + string endpoint = 102; + + // The initial Kubernetes version for this cluster. Valid versions are those + // found in validMasterVersions returned by getServerConfig. The version can + // be upgraded over time; such upgrades are reflected in + // currentMasterVersion and currentNodeVersion. + string initial_cluster_version = 103; + + // [Output only] The current software version of the master endpoint. + string current_master_version = 104; + + // [Output only] The current version of the node software components. + // If they are currently at multiple versions because they're in the process + // of being upgraded, this reflects the minimum version of all nodes. + string current_node_version = 105; + + // [Output only] The time the cluster was created, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string create_time = 106; + + // [Output only] The current status of this cluster. + Status status = 107; + + // [Output only] Additional information about the current status of this + // cluster, if available. + string status_message = 108; + + // [Output only] The size of the address space on each node for hosting + // containers. This is provisioned from within the `container_ipv4_cidr` + // range. + int32 node_ipv4_cidr_size = 109; + + // [Output only] The IP address range of the Kubernetes services in + // this cluster, in + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `1.2.3.4/29`). Service addresses are + // typically put in the last `/16` from the container CIDR. + string services_ipv4_cidr = 110; + + // [Output only] The resource URLs of [instance + // groups](/compute/docs/instance-groups/) associated with this + // cluster. + repeated string instance_group_urls = 111; + + // [Output only] The number of nodes currently in the cluster. + int32 current_node_count = 112; + + // [Output only] The time the cluster will be automatically + // deleted in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string expire_time = 113; + + // [Output only] The name of the Google Compute Engine + // [zone](/compute/docs/regions-zones/regions-zones#available) or + // [region](/compute/docs/regions-zones/regions-zones#available) in which + // the cluster resides. + string location = 114; +} + +// ClusterUpdate describes an update to the cluster. Exactly one update can +// be applied to a cluster with each request, so at most one field can be +// provided. +message ClusterUpdate { + // The Kubernetes version to change the nodes to (typically an + // upgrade). Use `-` to upgrade to the latest version supported by + // the server. + string desired_node_version = 4; + + // The monitoring service the cluster should use to write metrics. + // Currently available options: + // + // * "monitoring.googleapis.com" - the Google Cloud Monitoring service + // * "none" - no metrics will be exported from the cluster + string desired_monitoring_service = 5; + + // Configurations for the various addons available to run in the cluster. + AddonsConfig desired_addons_config = 6; + + // The node pool to be upgraded. This field is mandatory if + // "desired_node_version", "desired_image_family" or + // "desired_node_pool_autoscaling" is specified and there is more than one + // node pool on the cluster. + string desired_node_pool_id = 7; + + // The desired image type for the node pool. + // NOTE: Set the "desired_node_pool" field as well. + string desired_image_type = 8; + + // Autoscaler configuration for the node pool specified in + // desired_node_pool_id. If there is only one pool in the + // cluster and desired_node_pool_id is not provided then + // the change applies to that single node pool. + NodePoolAutoscaling desired_node_pool_autoscaling = 9; + + // The desired list of Google Compute Engine + // [locations](/compute/docs/zones#available) in which the cluster's nodes + // should be located. Changing the locations a cluster is in will result + // in nodes being either created or removed from the cluster, depending on + // whether locations are being added or removed. + // + // This list must always include the cluster's primary zone. + repeated string desired_locations = 10; + + // The desired configuration options for master authorized networks feature. + MasterAuthorizedNetworksConfig desired_master_authorized_networks_config = 12; + + // The desired configuration options for the PodSecurityPolicy feature. + PodSecurityPolicyConfig desired_pod_security_policy_config = 14; + + // The Kubernetes version to change the master to. The only valid value is the + // latest supported version. Use "-" to have the server automatically select + // the latest version. + string desired_master_version = 100; +} + +// This operation resource represents operations that may have happened or are +// happening on the cluster. All fields are output only. +message Operation { + // Current status of the operation. + enum Status { + // Not set. + STATUS_UNSPECIFIED = 0; + + // The operation has been created. + PENDING = 1; + + // The operation is currently running. + RUNNING = 2; + + // The operation is done, either cancelled or completed. + DONE = 3; + + // The operation is aborting. + ABORTING = 4; + } + + // Operation type. + enum Type { + // Not set. + TYPE_UNSPECIFIED = 0; + + // Cluster create. + CREATE_CLUSTER = 1; + + // Cluster delete. + DELETE_CLUSTER = 2; + + // A master upgrade. + UPGRADE_MASTER = 3; + + // A node upgrade. + UPGRADE_NODES = 4; + + // Cluster repair. + REPAIR_CLUSTER = 5; + + // Cluster update. + UPDATE_CLUSTER = 6; + + // Node pool create. + CREATE_NODE_POOL = 7; + + // Node pool delete. + DELETE_NODE_POOL = 8; + + // Set node pool management. + SET_NODE_POOL_MANAGEMENT = 9; + + // Automatic node pool repair. + AUTO_REPAIR_NODES = 10; + + // Automatic node upgrade. + AUTO_UPGRADE_NODES = 11; + + // Set labels. + SET_LABELS = 12; + + // Set/generate master auth materials + SET_MASTER_AUTH = 13; + + // Set node pool size. + SET_NODE_POOL_SIZE = 14; + + // Updates network policy for a cluster. + SET_NETWORK_POLICY = 15; + + // Set the maintenance policy. + SET_MAINTENANCE_POLICY = 16; + } + + // The server-assigned ID for the operation. + string name = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the operation + // is taking place. + // This field is deprecated, use location instead. + string zone = 2; + + // The operation type. + Type operation_type = 3; + + // The current status of the operation. + Status status = 4; + + // Detailed operation progress, if available. + string detail = 8; + + // If an error has occurred, a textual description of the error. + string status_message = 5; + + // Server-defined URL for the resource. + string self_link = 6; + + // Server-defined URL for the target of the operation. + string target_link = 7; + + // [Output only] The name of the Google Compute Engine + // [zone](/compute/docs/regions-zones/regions-zones#available) or + // [region](/compute/docs/regions-zones/regions-zones#available) in which + // the cluster resides. + string location = 9; + + // [Output only] The time the operation started, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string start_time = 10; + + // [Output only] The time the operation completed, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string end_time = 11; +} + +// CreateClusterRequest creates a cluster. +message CreateClusterRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use parent instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use parent instead. + string zone = 2; + + // A [cluster + // resource](/container-engine/reference/rest/v1alpha1/projects.zones.clusters) + Cluster cluster = 3; + + // The parent (project and location) where the cluster will be created. + // Specified in the format 'projects/*/locations/*'. + string parent = 5; +} + +// GetClusterRequest gets the settings of a cluster. +message GetClusterRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to retrieve. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name (project, location, cluster) of the cluster to retrieve. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 5; +} + +// UpdateClusterRequest updates the settings of a cluster. +message UpdateClusterRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to upgrade. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // A description of the update. + ClusterUpdate update = 4; + + // The name (project, location, cluster) of the cluster to update. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 5; +} + +// SetNodePoolVersionRequest updates the version of a node pool. +message UpdateNodePoolRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to upgrade. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name of the node pool to upgrade. + // This field is deprecated, use name instead. + string node_pool_id = 4; + + // The Kubernetes version to change the nodes to (typically an + // upgrade). Use `-` to upgrade to the latest version supported by + // the server. + string node_version = 5; + + // The desired image type for the node pool. + string image_type = 6; + + // The name (project, location, cluster, node pool) of the node pool to update. + // Specified in the format 'projects/*/locations/*/clusters/*/nodePools/*'. + string name = 8; +} + +// SetNodePoolAutoscalingRequest sets the autoscaler settings of a node pool. +message SetNodePoolAutoscalingRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to upgrade. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name of the node pool to upgrade. + // This field is deprecated, use name instead. + string node_pool_id = 4; + + // Autoscaling configuration for the node pool. + NodePoolAutoscaling autoscaling = 5; + + // The name (project, location, cluster, node pool) of the node pool to set + // autoscaler settings. Specified in the format + // 'projects/*/locations/*/clusters/*/nodePools/*'. + string name = 6; +} + +// SetLoggingServiceRequest sets the logging service of a cluster. +message SetLoggingServiceRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to upgrade. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The logging service the cluster should use to write metrics. + // Currently available options: + // + // * "logging.googleapis.com" - the Google Cloud Logging service + // * "none" - no metrics will be exported from the cluster + string logging_service = 4; + + // The name (project, location, cluster) of the cluster to set logging. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 5; +} + +// SetMonitoringServiceRequest sets the monitoring service of a cluster. +message SetMonitoringServiceRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to upgrade. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The monitoring service the cluster should use to write metrics. + // Currently available options: + // + // * "monitoring.googleapis.com" - the Google Cloud Monitoring service + // * "none" - no metrics will be exported from the cluster + string monitoring_service = 4; + + // The name (project, location, cluster) of the cluster to set monitoring. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 6; +} + +// SetAddonsRequest sets the addons associated with the cluster. +message SetAddonsConfigRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to upgrade. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The desired configurations for the various addons available to run in the + // cluster. + AddonsConfig addons_config = 4; + + // The name (project, location, cluster) of the cluster to set addons. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 6; +} + +// SetLocationsRequest sets the locations of the cluster. +message SetLocationsRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to upgrade. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The desired list of Google Compute Engine + // [locations](/compute/docs/zones#available) in which the cluster's nodes + // should be located. Changing the locations a cluster is in will result + // in nodes being either created or removed from the cluster, depending on + // whether locations are being added or removed. + // + // This list must always include the cluster's primary zone. + repeated string locations = 4; + + // The name (project, location, cluster) of the cluster to set locations. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 6; +} + +// UpdateMasterRequest updates the master of the cluster. +message UpdateMasterRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to upgrade. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The Kubernetes version to change the master to. The only valid value is the + // latest supported version. Use "-" to have the server automatically select + // the latest version. + string master_version = 4; + + // The name (project, location, cluster) of the cluster to update. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 7; +} + +// SetMasterAuthRequest updates the admin password of a cluster. +message SetMasterAuthRequest { + // Operation type: what type update to perform. + enum Action { + // Operation is unknown and will error out. + UNKNOWN = 0; + + // Set the password to a user generated value. + SET_PASSWORD = 1; + + // Generate a new password and set it to that. + GENERATE_PASSWORD = 2; + + // Set the username. If an empty username is provided, basic authentication + // is disabled for the cluster. If a non-empty username is provided, basic + // authentication is enabled, with either a provided password or a generated + // one. + SET_USERNAME = 3; + } + + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to upgrade. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The exact form of action to be taken on the master auth. + Action action = 4; + + // A description of the update. + MasterAuth update = 5; + + // The name (project, location, cluster) of the cluster to set auth. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 7; +} + +// DeleteClusterRequest deletes a cluster. +message DeleteClusterRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to delete. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name (project, location, cluster) of the cluster to delete. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 4; +} + +// ListClustersRequest lists clusters. +message ListClustersRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use parent instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides, or "-" for all zones. + // This field is deprecated, use parent instead. + string zone = 2; + + // The parent (project and location) where the clusters will be listed. + // Specified in the format 'projects/*/locations/*'. + // Location "-" matches all zones and all regions. + string parent = 4; +} + +// ListClustersResponse is the result of ListClustersRequest. +message ListClustersResponse { + // A list of clusters in the project in the specified zone, or + // across all ones. + repeated Cluster clusters = 1; + + // If any zones are listed here, the list of clusters returned + // may be missing those zones. + repeated string missing_zones = 2; +} + +// GetOperationRequest gets a single operation. +message GetOperationRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The server-assigned `name` of the operation. + // This field is deprecated, use name instead. + string operation_id = 3; + + // The name (project, location, operation id) of the operation to get. + // Specified in the format 'projects/*/locations/*/operations/*'. + string name = 5; +} + +// ListOperationsRequest lists operations. +message ListOperationsRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use parent instead. + string project_id = 1; + + // The name of the Google Compute Engine [zone](/compute/docs/zones#available) + // to return operations for, or `-` for all zones. + // This field is deprecated, use parent instead. + string zone = 2; + + // The parent (project and location) where the operations will be listed. + // Specified in the format 'projects/*/locations/*'. + // Location "-" matches all zones and all regions. + string parent = 4; +} + +// CancelOperationRequest cancels a single operation. +message CancelOperationRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the operation resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The server-assigned `name` of the operation. + // This field is deprecated, use name instead. + string operation_id = 3; + + // The name (project, location, operation id) of the operation to cancel. + // Specified in the format 'projects/*/locations/*/operations/*'. + string name = 4; +} + +// ListOperationsResponse is the result of ListOperationsRequest. +message ListOperationsResponse { + // A list of operations in the project in the specified zone. + repeated Operation operations = 1; + + // If any zones are listed here, the list of operations returned + // may be missing the operations from those zones. + repeated string missing_zones = 2; +} + +// Gets the current Container Engine service configuration. +message GetServerConfigRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine [zone](/compute/docs/zones#available) + // to return operations for. + // This field is deprecated, use name instead. + string zone = 2; + + // The name (project and location) of the server config to get + // Specified in the format 'projects/*/locations/*'. + string name = 4; +} + +// Container Engine service configuration. +message ServerConfig { + // Version of Kubernetes the service deploys by default. + string default_cluster_version = 1; + + // List of valid node upgrade target versions. + repeated string valid_node_versions = 3; + + // Default image type. + string default_image_type = 4; + + // List of valid image types. + repeated string valid_image_types = 5; + + // List of valid master versions. + repeated string valid_master_versions = 6; +} + +// CreateNodePoolRequest creates a node pool for a cluster. +message CreateNodePoolRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use parent instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use parent instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use parent instead. + string cluster_id = 3; + + // The node pool to create. + NodePool node_pool = 4; + + // The parent (project, location, cluster id) where the node pool will be created. + // Specified in the format 'projects/*/locations/*/clusters/*/nodePools/*'. + string parent = 6; +} + +// DeleteNodePoolRequest deletes a node pool for a cluster. +message DeleteNodePoolRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name of the node pool to delete. + // This field is deprecated, use name instead. + string node_pool_id = 4; + + // The name (project, location, cluster, node pool id) of the node pool to delete. + // Specified in the format 'projects/*/locations/*/clusters/*/nodePools/*'. + string name = 6; +} + +// ListNodePoolsRequest lists the node pool(s) for a cluster. +message ListNodePoolsRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use parent instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use parent instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use parent instead. + string cluster_id = 3; + + // The parent (project, location, cluster id) where the node pools will be listed. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string parent = 5; +} + +// GetNodePoolRequest retrieves a node pool for a cluster. +message GetNodePoolRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name of the node pool. + // This field is deprecated, use name instead. + string node_pool_id = 4; + + // The name (project, location, cluster, node pool id) of the node pool to get. + // Specified in the format 'projects/*/locations/*/clusters/*/nodePools/*'. + string name = 6; +} + +// NodePool contains the name and configuration for a cluster's node pool. +// Node pools are a set of nodes (i.e. VM's), with a common configuration and +// specification, under the control of the cluster master. They may have a set +// of Kubernetes labels applied to them, which may be used to reference them +// during pod scheduling. They may also be resized up or down, to accommodate +// the workload. +message NodePool { + // The current status of the node pool instance. + enum Status { + // Not set. + STATUS_UNSPECIFIED = 0; + + // The PROVISIONING state indicates the node pool is being created. + PROVISIONING = 1; + + // The RUNNING state indicates the node pool has been created + // and is fully usable. + RUNNING = 2; + + // The RUNNING_WITH_ERROR state indicates the node pool has been created + // and is partially usable. Some error state has occurred and some + // functionality may be impaired. Customer may need to reissue a request + // or trigger a new update. + RUNNING_WITH_ERROR = 3; + + // The RECONCILING state indicates that some work is actively being done on + // the node pool, such as upgrading node software. Details can + // be found in the `statusMessage` field. + RECONCILING = 4; + + // The STOPPING state indicates the node pool is being deleted. + STOPPING = 5; + + // The ERROR state indicates the node pool may be unusable. Details + // can be found in the `statusMessage` field. + ERROR = 6; + } + + // The name of the node pool. + string name = 1; + + // The node configuration of the pool. + NodeConfig config = 2; + + // The initial node count for the pool. You must ensure that your + // Compute Engine resource quota + // is sufficient for this number of instances. You must also have available + // firewall and routes quota. + int32 initial_node_count = 3; + + // Autoscaler configuration for this NodePool. Autoscaler is enabled + // only if a valid configuration is present. + NodePoolAutoscaling autoscaling = 4; + + // NodeManagement configuration for this NodePool. + NodeManagement management = 5; + + // [Output only] Server-defined URL for the resource. + string self_link = 100; + + // [Output only] The version of the Kubernetes of this node. + string version = 101; + + // [Output only] The resource URLs of [instance + // groups](/compute/docs/instance-groups/) associated with this + // node pool. + repeated string instance_group_urls = 102; + + // [Output only] The status of the nodes in this pool instance. + Status status = 103; + + // [Output only] Additional information about the current status of this + // node pool instance, if available. + string status_message = 104; +} + +// NodeManagement defines the set of node management services turned on for the +// node pool. +message NodeManagement { + // Whether the nodes will be automatically upgraded. + bool auto_upgrade = 1; + + // Whether the nodes will be automatically repaired. + bool auto_repair = 2; + + // Specifies the Auto Upgrade knobs for the node pool. + AutoUpgradeOptions upgrade_options = 10; +} + +// AutoUpgradeOptions defines the set of options for the user to control how +// the Auto Upgrades will proceed. +message AutoUpgradeOptions { + // [Output only] This field is set when upgrades are about to commence + // with the approximate start time for the upgrades, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string auto_upgrade_start_time = 1; + + // [Output only] This field is set when upgrades are about to commence + // with the description of the upgrade. + string description = 2; +} + +// MaintenancePolicy defines the maintenance policy to be used for the cluster. +message MaintenancePolicy { + // Specifies the maintenance window in which maintenance may be performed. + MaintenanceWindow window = 1; +} + +// MaintenanceWindow defines the maintenance window to be used for the cluster. +message MaintenanceWindow { + // Unimplemented, reserved for future use. + // HourlyMaintenanceWindow hourly_maintenance_window = 1; + oneof policy { + // DailyMaintenanceWindow specifies a daily maintenance operation window. + DailyMaintenanceWindow daily_maintenance_window = 2; + } +} + +// Time window specified for daily maintenance operations. +message DailyMaintenanceWindow { + // Time within the maintenance window to start the maintenance operations. + // It must be in format "HH:MM”, where HH : [00-23] and MM : [00-59] GMT. + string start_time = 2; + + // [Output only] Duration of the time window, automatically chosen to be + // smallest possible in the given scenario. + string duration = 3; +} + +// SetNodePoolManagementRequest sets the node management properties of a node +// pool. +message SetNodePoolManagementRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to update. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name of the node pool to update. + // This field is deprecated, use name instead. + string node_pool_id = 4; + + // NodeManagement configuration for the node pool. + NodeManagement management = 5; + + // The name (project, location, cluster, node pool id) of the node pool to set + // management properties. Specified in the format + // 'projects/*/locations/*/clusters/*/nodePools/*'. + string name = 7; +} + +// SetNodePoolSizeRequest sets the size a node +// pool. +message SetNodePoolSizeRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to update. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name of the node pool to update. + // This field is deprecated, use name instead. + string node_pool_id = 4; + + // The desired node count for the pool. + int32 node_count = 5; + + // The name (project, location, cluster, node pool id) of the node pool to set + // size. + // Specified in the format 'projects/*/locations/*/clusters/*/nodePools/*'. + string name = 7; +} + +// RollbackNodePoolUpgradeRequest rollbacks the previously Aborted or Failed +// NodePool upgrade. This will be an no-op if the last upgrade successfully +// completed. +message RollbackNodePoolUpgradeRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to rollback. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name of the node pool to rollback. + // This field is deprecated, use name instead. + string node_pool_id = 4; + + // The name (project, location, cluster, node pool id) of the node poll to + // rollback upgrade. + // Specified in the format 'projects/*/locations/*/clusters/*/nodePools/*'. + string name = 6; +} + +// ListNodePoolsResponse is the result of ListNodePoolsRequest. +message ListNodePoolsResponse { + // A list of node pools for a cluster. + repeated NodePool node_pools = 1; +} + +// NodePoolAutoscaling contains information required by cluster autoscaler to +// adjust the size of the node pool to the current cluster usage. +message NodePoolAutoscaling { + // Is autoscaling enabled for this node pool. + bool enabled = 1; + + // Minimum number of nodes in the NodePool. Must be >= 1 and <= + // max_node_count. + int32 min_node_count = 2; + + // Maximum number of nodes in the NodePool. Must be >= min_node_count. There + // has to enough quota to scale up the cluster. + int32 max_node_count = 3; +} + +// SetLabelsRequest sets the Google Cloud Platform labels on a Google Container +// Engine cluster, which will in turn set them for Google Compute Engine +// resources used by that cluster +message SetLabelsRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The labels to set for that cluster. + map resource_labels = 4; + + // The fingerprint of the previous set of labels for this resource, + // used to detect conflicts. The fingerprint is initially generated by + // Container Engine and changes after every request to modify or update + // labels. You must always provide an up-to-date fingerprint hash when + // updating or changing labels. Make a get() request to the + // resource to get the latest fingerprint. + string label_fingerprint = 5; + + // The name (project, location, cluster id) of the cluster to set labels. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 7; +} + +// SetLegacyAbacRequest enables or disables the ABAC authorization mechanism for +// a cluster. +message SetLegacyAbacRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to update. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // Whether ABAC authorization will be enabled in the cluster. + bool enabled = 4; + + // The name (project, location, cluster id) of the cluster to set legacy abac. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 6; +} + +// StartIPRotationRequest creates a new IP for the cluster and then performs +// a node upgrade on each node pool to point to the new IP. +message StartIPRotationRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name (project, location, cluster id) of the cluster to start IP rotation. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 6; +} + +// CompleteIPRotationRequest moves the cluster master back into single-IP mode. +message CompleteIPRotationRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name (project, location, cluster id) of the cluster to complete IP rotation. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 7; +} + +// AcceleratorConfig represents a Hardware Accelerator request. +message AcceleratorConfig { + // The number of the accelerator cards exposed to an instance. + int64 accelerator_count = 1; + + // The accelerator type resource name. List of supported accelerators + // [here](/compute/docs/gpus/#Introduction) + string accelerator_type = 2; +} + +// SetNetworkPolicyRequest enables/disables network policy for a cluster. +message SetNetworkPolicyRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // Configuration options for the NetworkPolicy feature. + NetworkPolicy network_policy = 4; + + // The name (project, location, cluster id) of the cluster to set networking + // policy. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 6; +} + +// SetMaintenancePolicyRequest sets the maintenance policy for a cluster. +message SetMaintenancePolicyRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to update. + string cluster_id = 3; + + // The maintenance policy to be set for the cluster. An empty field + // clears the existing maintenance policy. + MaintenancePolicy maintenance_policy = 4; + + // The name (project, location, cluster id) of the cluster to set maintenance + // policy. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 5; +} diff --git a/handwritten/cloud-profiler/google/container/v1beta1/cluster_service.proto b/handwritten/cloud-profiler/google/container/v1beta1/cluster_service.proto new file mode 100644 index 00000000000..a00f889d7b1 --- /dev/null +++ b/handwritten/cloud-profiler/google/container/v1beta1/cluster_service.proto @@ -0,0 +1,1657 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.container.v1beta1; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; + +option go_package = "google.golang.org/genproto/googleapis/container/v1beta1;container"; +option java_multiple_files = true; +option java_outer_classname = "ClusterServiceProto"; +option java_package = "com.google.container.v1beta1"; + + +// Google Container Engine Cluster Manager v1beta1 +service ClusterManager { + // Lists all clusters owned by a project in either the specified zone or all + // zones. + rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { + option (google.api.http) = { get: "/v1beta1/{parent=projects/*/locations/*}/clusters" }; + } + + // Gets the details of a specific cluster. + rpc GetCluster(GetClusterRequest) returns (Cluster) { + option (google.api.http) = { get: "/v1beta1/{name=projects/*/locations/*/clusters/*}" }; + } + + // Creates a cluster, consisting of the specified number and type of Google + // Compute Engine instances. + // + // By default, the cluster is created in the project's + // [default network](/compute/docs/networks-and-firewalls#networks). + // + // One firewall is added for the cluster. After cluster creation, + // the cluster creates routes for each node to allow the containers + // on that node to communicate with all other instances in the + // cluster. + // + // Finally, an entry is added to the project's global metadata indicating + // which CIDR range is being used by the cluster. + rpc CreateCluster(CreateClusterRequest) returns (Operation) { + option (google.api.http) = { post: "/v1beta1/{parent=projects/*/locations/*}/clusters" body: "*" }; + } + + // Updates the settings of a specific cluster. + rpc UpdateCluster(UpdateClusterRequest) returns (Operation) { + option (google.api.http) = { put: "/v1beta1/{name=projects/*/locations/*/clusters/*}" body: "*" }; + } + + // Used to set master auth materials. Currently supports :- + // Changing the admin password of a specific cluster. + // This can be either via password generation or explicitly set. + // Modify basic_auth.csv and reset the K8S API server. + rpc SetMasterAuth(SetMasterAuthRequest) returns (Operation) { + option (google.api.http) = { post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setMasterAuth" body: "*" }; + } + + // Deletes the cluster, including the Kubernetes endpoint and all worker + // nodes. + // + // Firewalls and routes that were configured during cluster creation + // are also deleted. + // + // Other Google Compute Engine resources that might be in use by the cluster + // (e.g. load balancer resources) will not be deleted if they weren't present + // at the initial create time. + rpc DeleteCluster(DeleteClusterRequest) returns (Operation) { + option (google.api.http) = { delete: "/v1beta1/{name=projects/*/locations/*/clusters/*}" }; + } + + // Lists all operations in a project in a specific zone or all zones. + rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) { + option (google.api.http) = { get: "/v1beta1/{parent=projects/*/locations/*}/operations" }; + } + + // Gets the specified operation. + rpc GetOperation(GetOperationRequest) returns (Operation) { + option (google.api.http) = { get: "/v1beta1/{name=projects/*/locations/*/operations/*}" }; + } + + // Cancels the specified operation. + rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1beta1/{name=projects/*/locations/*/operations/*}:cancel" body: "*" }; + } + + // Returns configuration info about the Container Engine service. + rpc GetServerConfig(GetServerConfigRequest) returns (ServerConfig) { + option (google.api.http) = { get: "/v1beta1/{name=projects/*/locations/*}/serverConfig" }; + } + + // Lists the node pools for a cluster. + rpc ListNodePools(ListNodePoolsRequest) returns (ListNodePoolsResponse) { + option (google.api.http) = { get: "/v1beta1/{parent=projects/*/locations/*/clusters/*}/nodePools" }; + } + + // Retrieves the node pool requested. + rpc GetNodePool(GetNodePoolRequest) returns (NodePool) { + option (google.api.http) = { get: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}" }; + } + + // Creates a node pool for a cluster. + rpc CreateNodePool(CreateNodePoolRequest) returns (Operation) { + option (google.api.http) = { post: "/v1beta1/{parent=projects/*/locations/*/clusters/*}/nodePools" body: "*" }; + } + + // Deletes a node pool from a cluster. + rpc DeleteNodePool(DeleteNodePoolRequest) returns (Operation) { + option (google.api.http) = { delete: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}" }; + } + + // Roll back the previously Aborted or Failed NodePool upgrade. + // This will be an no-op if the last upgrade successfully completed. + rpc RollbackNodePoolUpgrade(RollbackNodePoolUpgradeRequest) returns (Operation) { + option (google.api.http) = { post: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}:rollback" body: "*" }; + } + + // Sets the NodeManagement options for a node pool. + rpc SetNodePoolManagement(SetNodePoolManagementRequest) returns (Operation) { + option (google.api.http) = { post: "/v1beta1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setManagement" body: "*" }; + } + + // Sets labels on a cluster. + rpc SetLabels(SetLabelsRequest) returns (Operation) { + option (google.api.http) = { post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setResourceLabels" body: "*" }; + } + + // Enables or disables the ABAC authorization mechanism on a cluster. + rpc SetLegacyAbac(SetLegacyAbacRequest) returns (Operation) { + option (google.api.http) = { post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setLegacyAbac" body: "*" }; + } + + // Start master IP rotation. + rpc StartIPRotation(StartIPRotationRequest) returns (Operation) { + option (google.api.http) = { post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:startIpRotation" body: "*" }; + } + + // Completes master IP rotation. + rpc CompleteIPRotation(CompleteIPRotationRequest) returns (Operation) { + option (google.api.http) = { post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:completeIpRotation" body: "*" }; + } + + // Enables/Disables Network Policy for a cluster. + rpc SetNetworkPolicy(SetNetworkPolicyRequest) returns (Operation) { + option (google.api.http) = { post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setNetworkPolicy" body: "*" }; + } + + // Sets the maintenance policy for a cluster. + rpc SetMaintenancePolicy(SetMaintenancePolicyRequest) returns (Operation) { + option (google.api.http) = { post: "/v1beta1/{name=projects/*/locations/*/clusters/*}:setMaintenancePolicy" body: "*" }; + } +} + +// Parameters that describe the nodes in a cluster. +message NodeConfig { + // The name of a Google Compute Engine [machine + // type](/compute/docs/machine-types) (e.g. + // `n1-standard-1`). + // + // If unspecified, the default machine type is + // `n1-standard-1`. + string machine_type = 1; + + // Size of the disk attached to each node, specified in GB. + // The smallest allowed disk size is 10GB. + // + // If unspecified, the default disk size is 100GB. + int32 disk_size_gb = 2; + + // The set of Google API scopes to be made available on all of the + // node VMs under the "default" service account. + // + // The following scopes are recommended, but not required, and by default are + // not included: + // + // * `https://www.googleapis.com/auth/compute` is required for mounting + // persistent storage on your nodes. + // * `https://www.googleapis.com/auth/devstorage.read_only` is required for + // communicating with **gcr.io** + // (the [Google Container Registry](/container-registry/)). + // + // If unspecified, no scopes are added, unless Cloud Logging or Cloud + // Monitoring are enabled, in which case their required scopes will be added. + repeated string oauth_scopes = 3; + + // The Google Cloud Platform Service Account to be used by the node VMs. If + // no Service Account is specified, the "default" service account is used. + string service_account = 9; + + // The metadata key/value pairs assigned to instances in the cluster. + // + // Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes + // in length. These are reflected as part of a URL in the metadata server. + // Additionally, to avoid ambiguity, keys must not conflict with any other + // metadata keys for the project or be one of the four reserved keys: + // "instance-template", "kube-env", "startup-script", and "user-data" + // + // Values are free-form strings, and only have meaning as interpreted by + // the image running in the instance. The only restriction placed on them is + // that each value's size must be less than or equal to 32 KB. + // + // The total size of all keys and values must be less than 512 KB. + map metadata = 4; + + // The image type to use for this node. Note that for a given image type, + // the latest version of it will be used. + string image_type = 5; + + // The map of Kubernetes labels (key/value pairs) to be applied to each node. + // These will added in addition to any default label(s) that + // Kubernetes may apply to the node. + // In case of conflict in label keys, the applied set may differ depending on + // the Kubernetes version -- it's best to assume the behavior is undefined + // and conflicts should be avoided. + // For more information, including usage and the valid values, see: + // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ + map labels = 6; + + // The number of local SSD disks to be attached to the node. + // + // The limit for this value is dependant upon the maximum number of + // disks available on a machine per zone. See: + // https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits + // for more information. + int32 local_ssd_count = 7; + + // The list of instance tags applied to all nodes. Tags are used to identify + // valid sources or targets for network firewalls and are specified by + // the client during cluster or node pool creation. Each tag within the list + // must comply with RFC1035. + repeated string tags = 8; + + // Whether the nodes are created as preemptible VM instances. See: + // https://cloud.google.com/compute/docs/instances/preemptible for more + // inforamtion about preemptible VM instances. + bool preemptible = 10; + + // A list of hardware accelerators to be attached to each node. + // See https://cloud.google.com/compute/docs/gpus for more information about + // support for GPUs. + repeated AcceleratorConfig accelerators = 11; + + // Minimum CPU platform to be used by this instance. The instance may be + // scheduled on the specified or newer CPU platform. Applicable values are the + // friendly names of CPU platforms, such as + // minCpuPlatform: "Intel Haswell" or + // minCpuPlatform: "Intel Sandy Bridge". For more + // information, read [how to specify min CPU platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform) + string min_cpu_platform = 13; + + // List of kubernetes taints to be applied to each node. + // + // For more information, including usage and the valid values, see: + // https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + repeated NodeTaint taints = 15; +} + +// Kubernetes taint is comprised of three fields: key, value, and effect. Effect +// can only be one of three types: NoSchedule, PreferNoSchedule or NoExecute. +// +// For more information, including usage and the valid values, see: +// https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +message NodeTaint { + // Possible values for Effect in taint. + enum Effect { + // Not set + EFFECT_UNSPECIFIED = 0; + + // NoSchedule + NO_SCHEDULE = 1; + + // PreferNoSchedule + PREFER_NO_SCHEDULE = 2; + + // NoExecute + NO_EXECUTE = 3; + } + + // Key for taint. + string key = 1; + + // Value for taint. + string value = 2; + + // Effect for taint. + Effect effect = 3; +} + +// The authentication information for accessing the master endpoint. +// Authentication can be done using HTTP basic auth or using client +// certificates. +message MasterAuth { + // The username to use for HTTP basic authentication to the master endpoint. + // For clusters v1.6.0 and later, you can disable basic authentication by + // providing an empty username. + string username = 1; + + // The password to use for HTTP basic authentication to the master endpoint. + // Because the master endpoint is open to the Internet, you should create a + // strong password. If a password is provided for cluster creation, username + // must be non-empty. + string password = 2; + + // Configuration for client certificate authentication on the cluster. If no + // configuration is specified, a client certificate is issued. + ClientCertificateConfig client_certificate_config = 3; + + // [Output only] Base64-encoded public certificate that is the root of + // trust for the cluster. + string cluster_ca_certificate = 100; + + // [Output only] Base64-encoded public certificate used by clients to + // authenticate to the cluster endpoint. + string client_certificate = 101; + + // [Output only] Base64-encoded private key used by clients to authenticate + // to the cluster endpoint. + string client_key = 102; +} + +// Configuration for client certificates on the cluster. +message ClientCertificateConfig { + // Issue a client certificate. + bool issue_client_certificate = 1; +} + +// Configuration for the addons that can be automatically spun up in the +// cluster, enabling additional functionality. +message AddonsConfig { + // Configuration for the HTTP (L7) load balancing controller addon, which + // makes it easy to set up HTTP load balancers for services in a cluster. + HttpLoadBalancing http_load_balancing = 1; + + // Configuration for the horizontal pod autoscaling feature, which + // increases or decreases the number of replica pods a replication controller + // has based on the resource usage of the existing pods. + HorizontalPodAutoscaling horizontal_pod_autoscaling = 2; + + // Configuration for the Kubernetes Dashboard. + KubernetesDashboard kubernetes_dashboard = 3; + + // Configuration for NetworkPolicy. This only tracks whether the addon + // is enabled or not on the Master, it does not track whether network policy + // is enabled for the nodes. + NetworkPolicyConfig network_policy_config = 4; +} + +// Configuration options for the HTTP (L7) load balancing controller addon, +// which makes it easy to set up HTTP load balancers for services in a cluster. +message HttpLoadBalancing { + // Whether the HTTP Load Balancing controller is enabled in the cluster. + // When enabled, it runs a small pod in the cluster that manages the load + // balancers. + bool disabled = 1; +} + +// Configuration options for the horizontal pod autoscaling feature, which +// increases or decreases the number of replica pods a replication controller +// has based on the resource usage of the existing pods. +message HorizontalPodAutoscaling { + // Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. + // When enabled, it ensures that a Heapster pod is running in the cluster, + // which is also used by the Cloud Monitoring service. + bool disabled = 1; +} + +// Configuration for the Kubernetes Dashboard. +message KubernetesDashboard { + // Whether the Kubernetes Dashboard is enabled for this cluster. + bool disabled = 1; +} + +// Configuration for NetworkPolicy. This only tracks whether the addon +// is enabled or not on the Master, it does not track whether network policy +// is enabled for the nodes. +message NetworkPolicyConfig { + // Whether NetworkPolicy is enabled for this cluster. + bool disabled = 1; +} + +// Configuration options for the master authorized networks feature. Enabled +// master authorized networks will disallow all external traffic to access +// Kubernetes master through HTTPS except traffic from the given CIDR blocks, +// Google Compute Engine Public IPs and Google Prod IPs. +message MasterAuthorizedNetworksConfig { + // CidrBlock contains an optional name and one CIDR block. + message CidrBlock { + // display_name is an optional field for users to identify CIDR blocks. + string display_name = 1; + + // cidr_block must be specified in CIDR notation. + string cidr_block = 2; + } + + // Whether or not master authorized networks is enabled. + bool enabled = 1; + + // cidr_blocks define up to 10 external networks that could access + // Kubernetes master through HTTPS. + repeated CidrBlock cidr_blocks = 2; +} + +// Configuration options for the NetworkPolicy feature. +// https://kubernetes.io/docs/concepts/services-networking/networkpolicies/ +message NetworkPolicy { + // Allowed Network Policy providers. + enum Provider { + // Not set + PROVIDER_UNSPECIFIED = 0; + + // Tigera (Calico Felix). + CALICO = 1; + } + + // The selected network policy provider. + Provider provider = 1; + + // Whether network policy is enabled on the cluster. + bool enabled = 2; +} + +// Configuration for controlling how IPs are allocated in the cluster. +message IPAllocationPolicy { + // Whether alias IPs will be used for pod IPs in the cluster. + bool use_ip_aliases = 1; + + // Whether a new subnetwork will be created automatically for the cluster. + // + // This field is only applicable when `use_ip_aliases` is true. + bool create_subnetwork = 2; + + // A custom subnetwork name to be used if `create_subnetwork` is true. If + // this field is empty, then an automatic name will be chosen for the new + // subnetwork. + string subnetwork_name = 3; + + // This field is deprecated, use cluster_ipv4_cidr_block. + string cluster_ipv4_cidr = 4; + + // This field is deprecated, use node_ipv4_cidr_block. + string node_ipv4_cidr = 5; + + // This field is deprecated, use services_ipv4_cidr_block. + string services_ipv4_cidr = 6; + + // The name of the secondary range to be used for the cluster CIDR + // block. The secondary range will be used for pod IP + // addresses. This must be an existing secondary range associated + // with the cluster subnetwork. + // + // This field is only applicable with use_ip_aliases and + // create_subnetwork is false. + string cluster_secondary_range_name = 7; + + // The name of the secondary range to be used as for the services + // CIDR block. The secondary range will be used for service + // ClusterIPs. This must be an existing secondary range associated + // with the cluster subnetwork. + // + // This field is only applicable with use_ip_aliases and + // create_subnetwork is false. + string services_secondary_range_name = 8; + + // The IP address range for the cluster pod IPs. If this field is set, then + // `cluster.cluster_ipv4_cidr` must be left blank. + // + // This field is only applicable when `use_ip_aliases` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string cluster_ipv4_cidr_block = 9; + + // The IP address range of the instance IPs in this cluster. + // + // This is applicable only if `create_subnetwork` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string node_ipv4_cidr_block = 10; + + // The IP address range of the services IPs in this cluster. If blank, a range + // will be automatically chosen with the default size. + // + // This field is only applicable when `use_ip_aliases` is true. + // + // Set to blank to have a range chosen with the default size. + // + // Set to /netmask (e.g. `/14`) to have a range chosen with a specific + // netmask. + // + // Set to a + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + // `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + // to use. + string services_ipv4_cidr_block = 11; +} + +// Configuration for the PodSecurityPolicy feature. +message PodSecurityPolicyConfig { + // Enable the PodSecurityPolicy controller for this cluster. If enabled, pods + // must be valid under a PodSecurityPolicy to be created. + bool enabled = 1; +} + +// A Google Container Engine cluster. +message Cluster { + // The current status of the cluster. + enum Status { + // Not set. + STATUS_UNSPECIFIED = 0; + + // The PROVISIONING state indicates the cluster is being created. + PROVISIONING = 1; + + // The RUNNING state indicates the cluster has been created and is fully + // usable. + RUNNING = 2; + + // The RECONCILING state indicates that some work is actively being done on + // the cluster, such as upgrading the master or node software. Details can + // be found in the `statusMessage` field. + RECONCILING = 3; + + // The STOPPING state indicates the cluster is being deleted. + STOPPING = 4; + + // The ERROR state indicates the cluster may be unusable. Details + // can be found in the `statusMessage` field. + ERROR = 5; + } + + // The name of this cluster. The name must be unique within this project + // and zone, and can be up to 40 characters with the following restrictions: + // + // * Lowercase letters, numbers, and hyphens only. + // * Must start with a letter. + // * Must end with a number or a letter. + string name = 1; + + // An optional description of this cluster. + string description = 2; + + // The number of nodes to create in this cluster. You must ensure that your + // Compute Engine resource quota + // is sufficient for this number of instances. You must also have available + // firewall and routes quota. + // For requests, this field should only be used in lieu of a + // "node_pool" object, since this configuration (along with the + // "node_config") will be used to create a "NodePool" object with an + // auto-generated name. Do not use this and a node_pool at the same time. + int32 initial_node_count = 3; + + // Parameters used in creating the cluster's nodes. + // See `nodeConfig` for the description of its properties. + // For requests, this field should only be used in lieu of a + // "node_pool" object, since this configuration (along with the + // "initial_node_count") will be used to create a "NodePool" object with an + // auto-generated name. Do not use this and a node_pool at the same time. + // For responses, this field will be populated with the node configuration of + // the first node pool. + // + // If unspecified, the defaults are used. + NodeConfig node_config = 4; + + // The authentication information for accessing the master endpoint. + MasterAuth master_auth = 5; + + // The logging service the cluster should use to write logs. + // Currently available options: + // + // * `logging.googleapis.com` - the Google Cloud Logging service. + // * `none` - no logs will be exported from the cluster. + // * if left as an empty string,`logging.googleapis.com` will be used. + string logging_service = 6; + + // The monitoring service the cluster should use to write metrics. + // Currently available options: + // + // * `monitoring.googleapis.com` - the Google Cloud Monitoring service. + // * `none` - no metrics will be exported from the cluster. + // * if left as an empty string, `monitoring.googleapis.com` will be used. + string monitoring_service = 7; + + // The name of the Google Compute Engine + // [network](/compute/docs/networks-and-firewalls#networks) to which the + // cluster is connected. If left unspecified, the `default` network + // will be used. + string network = 8; + + // The IP address range of the container pods in this cluster, in + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `10.96.0.0/14`). Leave blank to have + // one automatically chosen or specify a `/14` block in `10.0.0.0/8`. + string cluster_ipv4_cidr = 9; + + // Configurations for the various addons available to run in the cluster. + AddonsConfig addons_config = 10; + + // The name of the Google Compute Engine + // [subnetwork](/compute/docs/subnetworks) to which the + // cluster is connected. + string subnetwork = 11; + + // The node pools associated with this cluster. + // This field should not be set if "node_config" or "initial_node_count" are + // specified. + repeated NodePool node_pools = 12; + + // The list of Google Compute Engine + // [locations](/compute/docs/zones#available) in which the cluster's nodes + // should be located. + repeated string locations = 13; + + // Kubernetes alpha features are enabled on this cluster. This includes alpha + // API groups (e.g. v1beta1) and features that may not be production ready in + // the kubernetes version of the master and nodes. + // The cluster has no SLA for uptime and master/node upgrades are disabled. + // Alpha enabled clusters are automatically deleted thirty days after + // creation. + bool enable_kubernetes_alpha = 14; + + // Configuration options for the NetworkPolicy feature. + NetworkPolicy network_policy = 19; + + // Configuration for cluster IP allocation. + IPAllocationPolicy ip_allocation_policy = 20; + + // The configuration options for master authorized networks feature. + MasterAuthorizedNetworksConfig master_authorized_networks_config = 22; + + // Configure the maintenance policy for this cluster. + MaintenancePolicy maintenance_policy = 23; + + // Configuration for the PodSecurityPolicy feature. + PodSecurityPolicyConfig pod_security_policy_config = 25; + + // [Output only] Server-defined URL for the resource. + string self_link = 100; + + // [Output only] The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use location instead. + string zone = 101; + + // [Output only] The IP address of this cluster's master endpoint. + // The endpoint can be accessed from the internet at + // `https://username:password@endpoint/`. + // + // See the `masterAuth` property of this resource for username and + // password information. + string endpoint = 102; + + // The initial Kubernetes version for this cluster. Valid versions are those + // found in validMasterVersions returned by getServerConfig. The version can + // be upgraded over time; such upgrades are reflected in + // currentMasterVersion and currentNodeVersion. + string initial_cluster_version = 103; + + // [Output only] The current software version of the master endpoint. + string current_master_version = 104; + + // [Output only] The current version of the node software components. + // If they are currently at multiple versions because they're in the process + // of being upgraded, this reflects the minimum version of all nodes. + string current_node_version = 105; + + // [Output only] The time the cluster was created, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string create_time = 106; + + // [Output only] The current status of this cluster. + Status status = 107; + + // [Output only] Additional information about the current status of this + // cluster, if available. + string status_message = 108; + + // [Output only] The size of the address space on each node for hosting + // containers. This is provisioned from within the `container_ipv4_cidr` + // range. + int32 node_ipv4_cidr_size = 109; + + // [Output only] The IP address range of the Kubernetes services in + // this cluster, in + // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + // notation (e.g. `1.2.3.4/29`). Service addresses are + // typically put in the last `/16` from the container CIDR. + string services_ipv4_cidr = 110; + + // [Output only] The resource URLs of [instance + // groups](/compute/docs/instance-groups/) associated with this + // cluster. + repeated string instance_group_urls = 111; + + // [Output only] The number of nodes currently in the cluster. + int32 current_node_count = 112; + + // [Output only] The time the cluster will be automatically + // deleted in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string expire_time = 113; + + // [Output only] The name of the Google Compute Engine + // [zone](/compute/docs/regions-zones/regions-zones#available) or + // [region](/compute/docs/regions-zones/regions-zones#available) in which + // the cluster resides. + string location = 114; +} + +// ClusterUpdate describes an update to the cluster. Exactly one update can +// be applied to a cluster with each request, so at most one field can be +// provided. +message ClusterUpdate { + // The Kubernetes version to change the nodes to (typically an + // upgrade). Use `-` to upgrade to the latest version supported by + // the server. + string desired_node_version = 4; + + // The monitoring service the cluster should use to write metrics. + // Currently available options: + // + // * "monitoring.googleapis.com" - the Google Cloud Monitoring service + // * "none" - no metrics will be exported from the cluster + string desired_monitoring_service = 5; + + // Configurations for the various addons available to run in the cluster. + AddonsConfig desired_addons_config = 6; + + // The node pool to be upgraded. This field is mandatory if + // "desired_node_version", "desired_image_family" or + // "desired_node_pool_autoscaling" is specified and there is more than one + // node pool on the cluster. + string desired_node_pool_id = 7; + + // The desired image type for the node pool. + // NOTE: Set the "desired_node_pool" field as well. + string desired_image_type = 8; + + // Autoscaler configuration for the node pool specified in + // desired_node_pool_id. If there is only one pool in the + // cluster and desired_node_pool_id is not provided then + // the change applies to that single node pool. + NodePoolAutoscaling desired_node_pool_autoscaling = 9; + + // The desired list of Google Compute Engine + // [locations](/compute/docs/zones#available) in which the cluster's nodes + // should be located. Changing the locations a cluster is in will result + // in nodes being either created or removed from the cluster, depending on + // whether locations are being added or removed. + // + // This list must always include the cluster's primary zone. + repeated string desired_locations = 10; + + // The desired configuration options for master authorized networks feature. + MasterAuthorizedNetworksConfig desired_master_authorized_networks_config = 12; + + // The desired configuration options for the PodSecurityPolicy feature. + PodSecurityPolicyConfig desired_pod_security_policy_config = 14; + + // The Kubernetes version to change the master to. The only valid value is the + // latest supported version. Use "-" to have the server automatically select + // the latest version. + string desired_master_version = 100; +} + +// This operation resource represents operations that may have happened or are +// happening on the cluster. All fields are output only. +message Operation { + // Current status of the operation. + enum Status { + // Not set. + STATUS_UNSPECIFIED = 0; + + // The operation has been created. + PENDING = 1; + + // The operation is currently running. + RUNNING = 2; + + // The operation is done, either cancelled or completed. + DONE = 3; + + // The operation is aborting. + ABORTING = 4; + } + + // Operation type. + enum Type { + // Not set. + TYPE_UNSPECIFIED = 0; + + // Cluster create. + CREATE_CLUSTER = 1; + + // Cluster delete. + DELETE_CLUSTER = 2; + + // A master upgrade. + UPGRADE_MASTER = 3; + + // A node upgrade. + UPGRADE_NODES = 4; + + // Cluster repair. + REPAIR_CLUSTER = 5; + + // Cluster update. + UPDATE_CLUSTER = 6; + + // Node pool create. + CREATE_NODE_POOL = 7; + + // Node pool delete. + DELETE_NODE_POOL = 8; + + // Set node pool management. + SET_NODE_POOL_MANAGEMENT = 9; + + // Automatic node pool repair. + AUTO_REPAIR_NODES = 10; + + // Automatic node upgrade. + AUTO_UPGRADE_NODES = 11; + + // Set labels. + SET_LABELS = 12; + + // Set/generate master auth materials + SET_MASTER_AUTH = 13; + + // Set node pool size. + SET_NODE_POOL_SIZE = 14; + + // Updates network policy for a cluster. + SET_NETWORK_POLICY = 15; + + // Set the maintenance policy. + SET_MAINTENANCE_POLICY = 16; + } + + // The server-assigned ID for the operation. + string name = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the operation + // is taking place. + // This field is deprecated, use location instead. + string zone = 2; + + // The operation type. + Type operation_type = 3; + + // The current status of the operation. + Status status = 4; + + // Detailed operation progress, if available. + string detail = 8; + + // If an error has occurred, a textual description of the error. + string status_message = 5; + + // Server-defined URL for the resource. + string self_link = 6; + + // Server-defined URL for the target of the operation. + string target_link = 7; + + // [Output only] The name of the Google Compute Engine + // [zone](/compute/docs/regions-zones/regions-zones#available) or + // [region](/compute/docs/regions-zones/regions-zones#available) in which + // the cluster resides. + string location = 9; + + // [Output only] The time the operation started, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string start_time = 10; + + // [Output only] The time the operation completed, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string end_time = 11; +} + +// CreateClusterRequest creates a cluster. +message CreateClusterRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use parent instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use parent instead. + string zone = 2; + + // A [cluster + // resource](/container-engine/reference/rest/v1beta1/projects.zones.clusters) + Cluster cluster = 3; + + // The parent (project and location) where the cluster will be created. + // Specified in the format 'projects/*/locations/*'. + string parent = 5; +} + +// GetClusterRequest gets the settings of a cluster. +message GetClusterRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to retrieve. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name (project, location, cluster) of the cluster to retrieve. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 5; +} + +// UpdateClusterRequest updates the settings of a cluster. +message UpdateClusterRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to upgrade. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // A description of the update. + ClusterUpdate update = 4; + + // The name (project, location, cluster) of the cluster to update. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 5; +} + +// SetMasterAuthRequest updates the admin password of a cluster. +message SetMasterAuthRequest { + // Operation type: what type update to perform. + enum Action { + // Operation is unknown and will error out. + UNKNOWN = 0; + + // Set the password to a user generated value. + SET_PASSWORD = 1; + + // Generate a new password and set it to that. + GENERATE_PASSWORD = 2; + + // Set the username. If an empty username is provided, basic authentication + // is disabled for the cluster. If a non-empty username is provided, basic + // authentication is enabled, with either a provided password or a generated + // one. + SET_USERNAME = 3; + } + + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to upgrade. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The exact form of action to be taken on the master auth. + Action action = 4; + + // A description of the update. + MasterAuth update = 5; + + // The name (project, location, cluster) of the cluster to set auth. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 7; +} + +// DeleteClusterRequest deletes a cluster. +message DeleteClusterRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to delete. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name (project, location, cluster) of the cluster to delete. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 4; +} + +// ListClustersRequest lists clusters. +message ListClustersRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use parent instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides, or "-" for all zones. + // This field is deprecated, use parent instead. + string zone = 2; + + // The parent (project and location) where the clusters will be listed. + // Specified in the format 'projects/*/locations/*'. + // Location "-" matches all zones and all regions. + string parent = 4; +} + +// ListClustersResponse is the result of ListClustersRequest. +message ListClustersResponse { + // A list of clusters in the project in the specified zone, or + // across all ones. + repeated Cluster clusters = 1; + + // If any zones are listed here, the list of clusters returned + // may be missing those zones. + repeated string missing_zones = 2; +} + +// GetOperationRequest gets a single operation. +message GetOperationRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The server-assigned `name` of the operation. + // This field is deprecated, use name instead. + string operation_id = 3; + + // The name (project, location, operation id) of the operation to get. + // Specified in the format 'projects/*/locations/*/operations/*'. + string name = 5; +} + +// ListOperationsRequest lists operations. +message ListOperationsRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use parent instead. + string project_id = 1; + + // The name of the Google Compute Engine [zone](/compute/docs/zones#available) + // to return operations for, or `-` for all zones. + // This field is deprecated, use parent instead. + string zone = 2; + + // The parent (project and location) where the operations will be listed. + // Specified in the format 'projects/*/locations/*'. + // Location "-" matches all zones and all regions. + string parent = 4; +} + +// CancelOperationRequest cancels a single operation. +message CancelOperationRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the operation resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The server-assigned `name` of the operation. + // This field is deprecated, use name instead. + string operation_id = 3; + + // The name (project, location, operation id) of the operation to cancel. + // Specified in the format 'projects/*/locations/*/operations/*'. + string name = 4; +} + +// ListOperationsResponse is the result of ListOperationsRequest. +message ListOperationsResponse { + // A list of operations in the project in the specified zone. + repeated Operation operations = 1; + + // If any zones are listed here, the list of operations returned + // may be missing the operations from those zones. + repeated string missing_zones = 2; +} + +// Gets the current Container Engine service configuration. +message GetServerConfigRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine [zone](/compute/docs/zones#available) + // to return operations for. + // This field is deprecated, use name instead. + string zone = 2; + + // The name (project and location) of the server config to get + // Specified in the format 'projects/*/locations/*'. + string name = 4; +} + +// Container Engine service configuration. +message ServerConfig { + // Version of Kubernetes the service deploys by default. + string default_cluster_version = 1; + + // List of valid node upgrade target versions. + repeated string valid_node_versions = 3; + + // Default image type. + string default_image_type = 4; + + // List of valid image types. + repeated string valid_image_types = 5; + + // List of valid master versions. + repeated string valid_master_versions = 6; +} + +// CreateNodePoolRequest creates a node pool for a cluster. +message CreateNodePoolRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use parent instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use parent instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use parent instead. + string cluster_id = 3; + + // The node pool to create. + NodePool node_pool = 4; + + // The parent (project, location, cluster id) where the node pool will be created. + // Specified in the format 'projects/*/locations/*/clusters/*/nodePools/*'. + string parent = 6; +} + +// DeleteNodePoolRequest deletes a node pool for a cluster. +message DeleteNodePoolRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name of the node pool to delete. + // This field is deprecated, use name instead. + string node_pool_id = 4; + + // The name (project, location, cluster, node pool id) of the node pool to delete. + // Specified in the format 'projects/*/locations/*/clusters/*/nodePools/*'. + string name = 6; +} + +// ListNodePoolsRequest lists the node pool(s) for a cluster. +message ListNodePoolsRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use parent instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use parent instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use parent instead. + string cluster_id = 3; + + // The parent (project, location, cluster id) where the node pools will be listed. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string parent = 5; +} + +// GetNodePoolRequest retrieves a node pool for a cluster. +message GetNodePoolRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name of the node pool. + // This field is deprecated, use name instead. + string node_pool_id = 4; + + // The name (project, location, cluster, node pool id) of the node pool to get. + // Specified in the format 'projects/*/locations/*/clusters/*/nodePools/*'. + string name = 6; +} + +// NodePool contains the name and configuration for a cluster's node pool. +// Node pools are a set of nodes (i.e. VM's), with a common configuration and +// specification, under the control of the cluster master. They may have a set +// of Kubernetes labels applied to them, which may be used to reference them +// during pod scheduling. They may also be resized up or down, to accommodate +// the workload. +message NodePool { + // The current status of the node pool instance. + enum Status { + // Not set. + STATUS_UNSPECIFIED = 0; + + // The PROVISIONING state indicates the node pool is being created. + PROVISIONING = 1; + + // The RUNNING state indicates the node pool has been created + // and is fully usable. + RUNNING = 2; + + // The RUNNING_WITH_ERROR state indicates the node pool has been created + // and is partially usable. Some error state has occurred and some + // functionality may be impaired. Customer may need to reissue a request + // or trigger a new update. + RUNNING_WITH_ERROR = 3; + + // The RECONCILING state indicates that some work is actively being done on + // the node pool, such as upgrading node software. Details can + // be found in the `statusMessage` field. + RECONCILING = 4; + + // The STOPPING state indicates the node pool is being deleted. + STOPPING = 5; + + // The ERROR state indicates the node pool may be unusable. Details + // can be found in the `statusMessage` field. + ERROR = 6; + } + + // The name of the node pool. + string name = 1; + + // The node configuration of the pool. + NodeConfig config = 2; + + // The initial node count for the pool. You must ensure that your + // Compute Engine resource quota + // is sufficient for this number of instances. You must also have available + // firewall and routes quota. + int32 initial_node_count = 3; + + // [Output only] Server-defined URL for the resource. + string self_link = 100; + + // [Output only] The version of the Kubernetes of this node. + string version = 101; + + // [Output only] The resource URLs of [instance + // groups](/compute/docs/instance-groups/) associated with this + // node pool. + repeated string instance_group_urls = 102; + + // [Output only] The status of the nodes in this pool instance. + Status status = 103; + + // [Output only] Additional information about the current status of this + // node pool instance, if available. + string status_message = 104; + + // Autoscaler configuration for this NodePool. Autoscaler is enabled + // only if a valid configuration is present. + NodePoolAutoscaling autoscaling = 4; + + // NodeManagement configuration for this NodePool. + NodeManagement management = 5; +} + +// NodeManagement defines the set of node management services turned on for the +// node pool. +message NodeManagement { + // Whether the nodes will be automatically upgraded. + bool auto_upgrade = 1; + + // Whether the nodes will be automatically repaired. + bool auto_repair = 2; + + // Specifies the Auto Upgrade knobs for the node pool. + AutoUpgradeOptions upgrade_options = 10; +} + +// AutoUpgradeOptions defines the set of options for the user to control how +// the Auto Upgrades will proceed. +message AutoUpgradeOptions { + // [Output only] This field is set when upgrades are about to commence + // with the approximate start time for the upgrades, in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + string auto_upgrade_start_time = 1; + + // [Output only] This field is set when upgrades are about to commence + // with the description of the upgrade. + string description = 2; +} + +// MaintenancePolicy defines the maintenance policy to be used for the cluster. +message MaintenancePolicy { + // Specifies the maintenance window in which maintenance may be performed. + MaintenanceWindow window = 1; +} + +// MaintenanceWindow defines the maintenance window to be used for the cluster. +message MaintenanceWindow { + // Unimplemented, reserved for future use. + // HourlyMaintenanceWindow hourly_maintenance_window = 1; + oneof policy { + // DailyMaintenanceWindow specifies a daily maintenance operation window. + DailyMaintenanceWindow daily_maintenance_window = 2; + } +} + +// Time window specified for daily maintenance operations. +message DailyMaintenanceWindow { + // Time within the maintenance window to start the maintenance operations. + // It must be in format "HH:MM”, where HH : [00-23] and MM : [00-59] GMT. + string start_time = 2; + + // [Output only] Duration of the time window, automatically chosen to be + // smallest possible in the given scenario. + string duration = 3; +} + +// SetNodePoolManagementRequest sets the node management properties of a node +// pool. +message SetNodePoolManagementRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to update. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name of the node pool to update. + // This field is deprecated, use name instead. + string node_pool_id = 4; + + // NodeManagement configuration for the node pool. + NodeManagement management = 5; + + // The name (project, location, cluster, node pool id) of the node pool to set + // management properties. Specified in the format + // 'projects/*/locations/*/clusters/*/nodePools/*'. + string name = 7; +} + +// RollbackNodePoolUpgradeRequest rollbacks the previously Aborted or Failed +// NodePool upgrade. This will be an no-op if the last upgrade successfully +// completed. +message RollbackNodePoolUpgradeRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to rollback. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name of the node pool to rollback. + // This field is deprecated, use name instead. + string node_pool_id = 4; + + // The name (project, location, cluster, node pool id) of the node poll to + // rollback upgrade. + // Specified in the format 'projects/*/locations/*/clusters/*/nodePools/*'. + string name = 6; +} + +// ListNodePoolsResponse is the result of ListNodePoolsRequest. +message ListNodePoolsResponse { + // A list of node pools for a cluster. + repeated NodePool node_pools = 1; +} + +// NodePoolAutoscaling contains information required by cluster autoscaler to +// adjust the size of the node pool to the current cluster usage. +message NodePoolAutoscaling { + // Is autoscaling enabled for this node pool. + bool enabled = 1; + + // Minimum number of nodes in the NodePool. Must be >= 1 and <= + // max_node_count. + int32 min_node_count = 2; + + // Maximum number of nodes in the NodePool. Must be >= min_node_count. There + // has to enough quota to scale up the cluster. + int32 max_node_count = 3; +} + +// SetLabelsRequest sets the Google Cloud Platform labels on a Google Container +// Engine cluster, which will in turn set them for Google Compute Engine +// resources used by that cluster +message SetLabelsRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The labels to set for that cluster. + map resource_labels = 4; + + // The fingerprint of the previous set of labels for this resource, + // used to detect conflicts. The fingerprint is initially generated by + // Container Engine and changes after every request to modify or update + // labels. You must always provide an up-to-date fingerprint hash when + // updating or changing labels. Make a get() request to the + // resource to get the latest fingerprint. + string label_fingerprint = 5; + + // The name (project, location, cluster id) of the cluster to set labels. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 7; +} + +// SetLegacyAbacRequest enables or disables the ABAC authorization mechanism for +// a cluster. +message SetLegacyAbacRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster to update. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // Whether ABAC authorization will be enabled in the cluster. + bool enabled = 4; + + // The name (project, location, cluster id) of the cluster to set legacy abac. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 6; +} + +// StartIPRotationRequest creates a new IP for the cluster and then performs +// a node upgrade on each node pool to point to the new IP. +message StartIPRotationRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name (project, location, cluster id) of the cluster to start IP rotation. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 6; +} + +// CompleteIPRotationRequest moves the cluster master back into single-IP mode. +message CompleteIPRotationRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // The name (project, location, cluster id) of the cluster to complete IP rotation. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 7; +} + +// AcceleratorConfig represents a Hardware Accelerator request. +message AcceleratorConfig { + // The number of the accelerator cards exposed to an instance. + int64 accelerator_count = 1; + + // The accelerator type resource name. List of supported accelerators + // [here](/compute/docs/gpus/#Introduction) + string accelerator_type = 2; +} + +// SetNetworkPolicyRequest enables/disables network policy for a cluster. +message SetNetworkPolicyRequest { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + // This field is deprecated, use name instead. + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + // This field is deprecated, use name instead. + string zone = 2; + + // The name of the cluster. + // This field is deprecated, use name instead. + string cluster_id = 3; + + // Configuration options for the NetworkPolicy feature. + NetworkPolicy network_policy = 4; + + // The name (project, location, cluster id) of the cluster to set networking policy. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 6; +} + +// SetMaintenancePolicyRequest sets the maintenance policy for a cluster. +message SetMaintenancePolicyRequest { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + string project_id = 1; + + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + string zone = 2; + + // The name of the cluster to update. + string cluster_id = 3; + + // The maintenance policy to be set for the cluster. An empty field + // clears the existing maintenance policy. + MaintenancePolicy maintenance_policy = 4; + + // The name (project, location, cluster id) of the cluster to set maintenance + // policy. + // Specified in the format 'projects/*/locations/*/clusters/*'. + string name = 5; +} diff --git a/handwritten/cloud-profiler/google/datastore/README.md b/handwritten/cloud-profiler/google/datastore/README.md new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/handwritten/cloud-profiler/google/datastore/README.md @@ -0,0 +1 @@ + diff --git a/handwritten/cloud-profiler/google/datastore/admin/v1beta1/datastore_admin.proto b/handwritten/cloud-profiler/google/datastore/admin/v1beta1/datastore_admin.proto new file mode 100644 index 00000000000..31ef567816d --- /dev/null +++ b/handwritten/cloud-profiler/google/datastore/admin/v1beta1/datastore_admin.proto @@ -0,0 +1,323 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.datastore.admin.v1beta1; + +import "google/api/annotations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Datastore.Admin.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/datastore/admin/v1beta1;admin"; +option java_multiple_files = true; +option java_outer_classname = "DatastoreAdminProto"; +option java_package = "com.google.datastore.admin.v1beta1"; + + +// Google Cloud Datastore Admin API +// +// The Datastore Admin API provides several admin services for Cloud Datastore. +// +// ----------------------------------------------------------------------------- +// ## Concepts +// +// Project, namespace, kind, and entity as defined in the Google Cloud Datastore +// API. +// +// Operation: An Operation represents work being performed in the background. +// +// EntityFilter: Allows specifying a subset of entities in a project. This is +// specified as a combination of kinds and namespaces (either or both of which +// may be all). +// +// ----------------------------------------------------------------------------- +// ## Services +// +// # Export/Import +// +// The Export/Import service provides the ability to copy all or a subset of +// entities to/from Google Cloud Storage. +// +// Exported data may be imported into Cloud Datastore for any Google Cloud +// Platform project. It is not restricted to the export source project. It is +// possible to export from one project and then import into another. +// +// Exported data can also be loaded into Google BigQuery for analysis. +// +// Exports and imports are performed asynchronously. An Operation resource is +// created for each export/import. The state (including any errors encountered) +// of the export/import may be queried via the Operation resource. +// +// # Operation +// +// The Operations collection provides a record of actions performed for the +// specified project (including any operations in progress). Operations are not +// created directly but through calls on other collections or resources. +// +// An operation that is not yet done may be cancelled. The request to cancel is +// asynchronous and the operation may continue to run for some time after the +// request to cancel is made. +// +// An operation that is done may be deleted so that it is no longer listed as +// part of the Operation collection. +// +// ListOperations returns all pending operations, but not completed operations. +// +// Operations are created by service DatastoreAdmin, +// but are accessed via service google.longrunning.Operations. +service DatastoreAdmin { + // Exports a copy of all or a subset of entities from Google Cloud Datastore + // to another storage system, such as Google Cloud Storage. Recent updates to + // entities may not be reflected in the export. The export occurs in the + // background and its progress can be monitored and managed via the + // Operation resource that is created. The output of an export may only be + // used once the associated operation is done. If an export operation is + // cancelled before completion it may leave partial data behind in Google + // Cloud Storage. + rpc ExportEntities(ExportEntitiesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1beta1/projects/{project_id}:export" body: "*" }; + } + + // Imports entities into Google Cloud Datastore. Existing entities with the + // same key are overwritten. The import occurs in the background and its + // progress can be monitored and managed via the Operation resource that is + // created. If an ImportEntities operation is cancelled, it is possible + // that a subset of the data has already been imported to Cloud Datastore. + rpc ImportEntities(ImportEntitiesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1beta1/projects/{project_id}:import" body: "*" }; + } +} + +// Metadata common to all Datastore Admin operations. +message CommonMetadata { + // The various possible states for an ongoing Operation. + enum State { + // Unspecified. + STATE_UNSPECIFIED = 0; + + // Request is being prepared for processing. + INITIALIZING = 1; + + // Request is actively being processed. + PROCESSING = 2; + + // Request is in the process of being cancelled after user called + // google.longrunning.Operations.CancelOperation on the operation. + CANCELLING = 3; + + // Request has been processed and is in its finalization stage. + FINALIZING = 4; + + // Request has completed successfully. + SUCCESSFUL = 5; + + // Request has finished being processed, but encountered an error. + FAILED = 6; + + // Request has finished being cancelled after user called + // google.longrunning.Operations.CancelOperation. + CANCELLED = 7; + } + + // The time that work began on the operation. + google.protobuf.Timestamp start_time = 1; + + // The time the operation ended, either successfully or otherwise. + google.protobuf.Timestamp end_time = 2; + + // The type of the operation. Can be used as a filter in + // ListOperationsRequest. + OperationType operation_type = 3; + + // The client-assigned labels which were provided when the operation was + // created. May also include additional labels. + map labels = 4; + + // The current state of the Operation. + State state = 5; +} + +// Measures the progress of a particular metric. +message Progress { + // The amount of work that has been completed. Note that this may be greater + // than work_estimated. + int64 work_completed = 1; + + // An estimate of how much work needs to be performed. May be zero if the + // work estimate is unavailable. + int64 work_estimated = 2; +} + +// The request for +// [google.datastore.admin.v1beta1.DatastoreAdmin.ExportEntities][google.datastore.admin.v1beta1.DatastoreAdmin.ExportEntities]. +message ExportEntitiesRequest { + // Project ID against which to make the request. + string project_id = 1; + + // Client-assigned labels. + map labels = 2; + + // Description of what data from the project is included in the export. + EntityFilter entity_filter = 3; + + // Location for the export metadata and data files. + // + // The full resource URL of the external storage location. Currently, only + // Google Cloud Storage is supported. So output_url_prefix should be of the + // form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the + // name of the Cloud Storage bucket and `NAMESPACE_PATH` is an optional Cloud + // Storage namespace path (this is not a Cloud Datastore namespace). For more + // information about Cloud Storage namespace paths, see + // [Object name + // considerations](https://cloud.google.com/storage/docs/naming#object-considerations). + // + // The resulting files will be nested deeper than the specified URL prefix. + // The final output URL will be provided in the + // [google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url][google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url] + // field. That value should be used for subsequent ImportEntities operations. + // + // By nesting the data files deeper, the same Cloud Storage bucket can be used + // in multiple ExportEntities operations without conflict. + string output_url_prefix = 4; +} + +// The request for +// [google.datastore.admin.v1beta1.DatastoreAdmin.ImportEntities][google.datastore.admin.v1beta1.DatastoreAdmin.ImportEntities]. +message ImportEntitiesRequest { + // Project ID against which to make the request. + string project_id = 1; + + // Client-assigned labels. + map labels = 2; + + // The full resource URL of the external storage location. Currently, only + // Google Cloud Storage is supported. So input_url should be of the form: + // `gs://BUCKET_NAME[/NAMESPACE_PATH]/OVERALL_EXPORT_METADATA_FILE`, where + // `BUCKET_NAME` is the name of the Cloud Storage bucket, `NAMESPACE_PATH` is + // an optional Cloud Storage namespace path (this is not a Cloud Datastore + // namespace), and `OVERALL_EXPORT_METADATA_FILE` is the metadata file written + // by the ExportEntities operation. For more information about Cloud Storage + // namespace paths, see + // [Object name + // considerations](https://cloud.google.com/storage/docs/naming#object-considerations). + // + // For more information, see + // [google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url][google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url]. + string input_url = 3; + + // Optionally specify which kinds/namespaces are to be imported. If provided, + // the list must be a subset of the EntityFilter used in creating the export, + // otherwise a FAILED_PRECONDITION error will be returned. If no filter is + // specified then all entities from the export are imported. + EntityFilter entity_filter = 4; +} + +// The response for +// [google.datastore.admin.v1beta1.DatastoreAdmin.ExportEntities][google.datastore.admin.v1beta1.DatastoreAdmin.ExportEntities]. +message ExportEntitiesResponse { + // Location of the output metadata file. This can be used to begin an import + // into Cloud Datastore (this project or another project). See + // [google.datastore.admin.v1beta1.ImportEntitiesRequest.input_url][google.datastore.admin.v1beta1.ImportEntitiesRequest.input_url]. + // Only present if the operation completed successfully. + string output_url = 1; +} + +// Metadata for ExportEntities operations. +message ExportEntitiesMetadata { + // Metadata common to all Datastore Admin operations. + CommonMetadata common = 1; + + // An estimate of the number of entities processed. + Progress progress_entities = 2; + + // An estimate of the number of bytes processed. + Progress progress_bytes = 3; + + // Description of which entities are being exported. + EntityFilter entity_filter = 4; + + // Location for the export metadata and data files. This will be the same + // value as the + // [google.datastore.admin.v1beta1.ExportEntitiesRequest.output_url_prefix][google.datastore.admin.v1beta1.ExportEntitiesRequest.output_url_prefix] + // field. The final output location is provided in + // [google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url][google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url]. + string output_url_prefix = 5; +} + +// Metadata for ImportEntities operations. +message ImportEntitiesMetadata { + // Metadata common to all Datastore Admin operations. + CommonMetadata common = 1; + + // An estimate of the number of entities processed. + Progress progress_entities = 2; + + // An estimate of the number of bytes processed. + Progress progress_bytes = 3; + + // Description of which entities are being imported. + EntityFilter entity_filter = 4; + + // The location of the import metadata file. This will be the same value as + // the [google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url][google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url] + // field. + string input_url = 5; +} + +// Identifies a subset of entities in a project. This is specified as +// combinations of kinds and namespaces (either or both of which may be all, as +// described in the following examples). +// Example usage: +// +// Entire project: +// kinds=[], namespace_ids=[] +// +// Kinds Foo and Bar in all namespaces: +// kinds=['Foo', 'Bar'], namespace_ids=[] +// +// Kinds Foo and Bar only in the default namespace: +// kinds=['Foo', 'Bar'], namespace_ids=[''] +// +// Kinds Foo and Bar in both the default and Baz namespaces: +// kinds=['Foo', 'Bar'], namespace_ids=['', 'Baz'] +// +// The entire Baz namespace: +// kinds=[], namespace_ids=['Baz'] +message EntityFilter { + // If empty, then this represents all kinds. + repeated string kinds = 1; + + // An empty list represents all namespaces. This is the preferred + // usage for projects that don't use namespaces. + // + // An empty string element represents the default namespace. This should be + // used if the project has data in non-default namespaces, but doesn't want to + // include them. + // Each namespace in this list must be unique. + repeated string namespace_ids = 2; +} + +// Operation types. +enum OperationType { + // Unspecified. + OPERATION_TYPE_UNSPECIFIED = 0; + + // ExportEntities. + EXPORT_ENTITIES = 1; + + // ImportEntities. + IMPORT_ENTITIES = 2; +} diff --git a/handwritten/cloud-profiler/google/datastore/artman_datastore.yaml b/handwritten/cloud-profiler/google/datastore/artman_datastore.yaml new file mode 100644 index 00000000000..137745260c4 --- /dev/null +++ b/handwritten/cloud-profiler/google/datastore/artman_datastore.yaml @@ -0,0 +1,109 @@ +common: + api_name: datastore + api_version: v1 + organization_name: google-cloud + service_yaml: datastore.yaml + gapic_yaml: v1/datastore_gapic.yaml + src_proto_paths: + - v1 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-datastore + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/google-cloud-datastore-v1 +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + release_level: BETA + package_version: + grpc_dep_lower_bound: 0.90.4 + grpc_dep_upper_bound: 0.91dev + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-datastore-v1 + - name: grpc + dest: generated/python/proto-google-cloud-datastore-v1 + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: google/cloud/datastore_v1 + dest: datastore/google/cloud/datastore_v1 + - src: tests/unit/gapic/v1 + dest: datastore/tests/gapic + - name: grpc + src: google/cloud/proto + dest: datastore/google/cloud/proto +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-datastore-v1 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-datastore + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/datastore/v1 + dest: google-cloud-datastore/lib/google/cloud/datastore/v1 +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-datastore-v1/vendor + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: datastore/apiv1 +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + publish_targets: + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v1 + dest: packages/datastore/src/v1 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/datastore +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/datastore/datastore.yaml b/handwritten/cloud-profiler/google/datastore/datastore.yaml new file mode 100644 index 00000000000..26822278fb2 --- /dev/null +++ b/handwritten/cloud-profiler/google/datastore/datastore.yaml @@ -0,0 +1,20 @@ +type: google.api.Service +config_version: 3 +name: datastore.googleapis.com +title: Google Cloud Datastore API + +apis: +- name: google.datastore.v1.Datastore + +documentation: + summary: |- + Accesses the schemaless NoSQL database to provide fully managed, robust, + scalable storage for your application. + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/datastore diff --git a/handwritten/cloud-profiler/google/datastore/v1/datastore.proto b/handwritten/cloud-profiler/google/datastore/v1/datastore.proto new file mode 100644 index 00000000000..245edb68965 --- /dev/null +++ b/handwritten/cloud-profiler/google/datastore/v1/datastore.proto @@ -0,0 +1,373 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.datastore.v1; + +import "google/api/annotations.proto"; +import "google/datastore/v1/entity.proto"; +import "google/datastore/v1/query.proto"; + +option csharp_namespace = "Google.Cloud.Datastore.V1"; +option go_package = "google.golang.org/genproto/googleapis/datastore/v1;datastore"; +option java_multiple_files = true; +option java_outer_classname = "DatastoreProto"; +option java_package = "com.google.datastore.v1"; + + +// Each RPC normalizes the partition IDs of the keys in its input entities, +// and always returns entities with keys with normalized partition IDs. +// This applies to all keys and entities, including those in values, except keys +// with both an empty path and an empty or unset partition ID. Normalization of +// input keys sets the project ID (if not already set) to the project ID from +// the request. +// +service Datastore { + // Looks up entities by key. + rpc Lookup(LookupRequest) returns (LookupResponse) { + option (google.api.http) = { post: "/v1/projects/{project_id}:lookup" body: "*" }; + } + + // Queries for entities. + rpc RunQuery(RunQueryRequest) returns (RunQueryResponse) { + option (google.api.http) = { post: "/v1/projects/{project_id}:runQuery" body: "*" }; + } + + // Begins a new transaction. + rpc BeginTransaction(BeginTransactionRequest) returns (BeginTransactionResponse) { + option (google.api.http) = { post: "/v1/projects/{project_id}:beginTransaction" body: "*" }; + } + + // Commits a transaction, optionally creating, deleting or modifying some + // entities. + rpc Commit(CommitRequest) returns (CommitResponse) { + option (google.api.http) = { post: "/v1/projects/{project_id}:commit" body: "*" }; + } + + // Rolls back a transaction. + rpc Rollback(RollbackRequest) returns (RollbackResponse) { + option (google.api.http) = { post: "/v1/projects/{project_id}:rollback" body: "*" }; + } + + // Allocates IDs for the given keys, which is useful for referencing an entity + // before it is inserted. + rpc AllocateIds(AllocateIdsRequest) returns (AllocateIdsResponse) { + option (google.api.http) = { post: "/v1/projects/{project_id}:allocateIds" body: "*" }; + } + + // Prevents the supplied keys' IDs from being auto-allocated by Cloud + // Datastore. + rpc ReserveIds(ReserveIdsRequest) returns (ReserveIdsResponse) { + option (google.api.http) = { post: "/v1/projects/{project_id}:reserveIds" body: "*" }; + } +} + +// The request for [Datastore.Lookup][google.datastore.v1.Datastore.Lookup]. +message LookupRequest { + // The ID of the project against which to make the request. + string project_id = 8; + + // The options for this lookup request. + ReadOptions read_options = 1; + + // Keys of entities to look up. + repeated Key keys = 3; +} + +// The response for [Datastore.Lookup][google.datastore.v1.Datastore.Lookup]. +message LookupResponse { + // Entities found as `ResultType.FULL` entities. The order of results in this + // field is undefined and has no relation to the order of the keys in the + // input. + repeated EntityResult found = 1; + + // Entities not found as `ResultType.KEY_ONLY` entities. The order of results + // in this field is undefined and has no relation to the order of the keys + // in the input. + repeated EntityResult missing = 2; + + // A list of keys that were not looked up due to resource constraints. The + // order of results in this field is undefined and has no relation to the + // order of the keys in the input. + repeated Key deferred = 3; +} + +// The request for [Datastore.RunQuery][google.datastore.v1.Datastore.RunQuery]. +message RunQueryRequest { + // The ID of the project against which to make the request. + string project_id = 8; + + // Entities are partitioned into subsets, identified by a partition ID. + // Queries are scoped to a single partition. + // This partition ID is normalized with the standard default context + // partition ID. + PartitionId partition_id = 2; + + // The options for this query. + ReadOptions read_options = 1; + + // The type of query. + oneof query_type { + // The query to run. + Query query = 3; + + // The GQL query to run. + GqlQuery gql_query = 7; + } +} + +// The response for [Datastore.RunQuery][google.datastore.v1.Datastore.RunQuery]. +message RunQueryResponse { + // A batch of query results (always present). + QueryResultBatch batch = 1; + + // The parsed form of the `GqlQuery` from the request, if it was set. + Query query = 2; +} + +// The request for [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction]. +message BeginTransactionRequest { + // The ID of the project against which to make the request. + string project_id = 8; + + // Options for a new transaction. + TransactionOptions transaction_options = 10; +} + +// The response for [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction]. +message BeginTransactionResponse { + // The transaction identifier (always present). + bytes transaction = 1; +} + +// The request for [Datastore.Rollback][google.datastore.v1.Datastore.Rollback]. +message RollbackRequest { + // The ID of the project against which to make the request. + string project_id = 8; + + // The transaction identifier, returned by a call to + // [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction]. + bytes transaction = 1; +} + +// The response for [Datastore.Rollback][google.datastore.v1.Datastore.Rollback]. +// (an empty message). +message RollbackResponse { + +} + +// The request for [Datastore.Commit][google.datastore.v1.Datastore.Commit]. +message CommitRequest { + // The modes available for commits. + enum Mode { + // Unspecified. This value must not be used. + MODE_UNSPECIFIED = 0; + + // Transactional: The mutations are either all applied, or none are applied. + // Learn about transactions [here](https://cloud.google.com/datastore/docs/concepts/transactions). + TRANSACTIONAL = 1; + + // Non-transactional: The mutations may not apply as all or none. + NON_TRANSACTIONAL = 2; + } + + // The ID of the project against which to make the request. + string project_id = 8; + + // The type of commit to perform. Defaults to `TRANSACTIONAL`. + Mode mode = 5; + + // Must be set when mode is `TRANSACTIONAL`. + oneof transaction_selector { + // The identifier of the transaction associated with the commit. A + // transaction identifier is returned by a call to + // [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction]. + bytes transaction = 1; + } + + // The mutations to perform. + // + // When mode is `TRANSACTIONAL`, mutations affecting a single entity are + // applied in order. The following sequences of mutations affecting a single + // entity are not permitted in a single `Commit` request: + // + // - `insert` followed by `insert` + // - `update` followed by `insert` + // - `upsert` followed by `insert` + // - `delete` followed by `update` + // + // When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single + // entity. + repeated Mutation mutations = 6; +} + +// The response for [Datastore.Commit][google.datastore.v1.Datastore.Commit]. +message CommitResponse { + // The result of performing the mutations. + // The i-th mutation result corresponds to the i-th mutation in the request. + repeated MutationResult mutation_results = 3; + + // The number of index entries updated during the commit, or zero if none were + // updated. + int32 index_updates = 4; +} + +// The request for [Datastore.AllocateIds][google.datastore.v1.Datastore.AllocateIds]. +message AllocateIdsRequest { + // The ID of the project against which to make the request. + string project_id = 8; + + // A list of keys with incomplete key paths for which to allocate IDs. + // No key may be reserved/read-only. + repeated Key keys = 1; +} + +// The response for [Datastore.AllocateIds][google.datastore.v1.Datastore.AllocateIds]. +message AllocateIdsResponse { + // The keys specified in the request (in the same order), each with + // its key path completed with a newly allocated ID. + repeated Key keys = 1; +} + +// The request for [Datastore.ReserveIds][google.datastore.v1.Datastore.ReserveIds]. +message ReserveIdsRequest { + // The ID of the project against which to make the request. + string project_id = 8; + + // If not empty, the ID of the database against which to make the request. + string database_id = 9; + + // A list of keys with complete key paths whose numeric IDs should not be + // auto-allocated. + repeated Key keys = 1; +} + +// The response for [Datastore.ReserveIds][google.datastore.v1.Datastore.ReserveIds]. +message ReserveIdsResponse { + +} + +// A mutation to apply to an entity. +message Mutation { + // The mutation operation. + // + // For `insert`, `update`, and `upsert`: + // - The entity's key must not be reserved/read-only. + // - No property in the entity may have a reserved name, + // not even a property in an entity in a value. + // - No value in the entity may have meaning 18, + // not even a value in an entity in another value. + oneof operation { + // The entity to insert. The entity must not already exist. + // The entity key's final path element may be incomplete. + Entity insert = 4; + + // The entity to update. The entity must already exist. + // Must have a complete key path. + Entity update = 5; + + // The entity to upsert. The entity may or may not already exist. + // The entity key's final path element may be incomplete. + Entity upsert = 6; + + // The key of the entity to delete. The entity may or may not already exist. + // Must have a complete key path and must not be reserved/read-only. + Key delete = 7; + } + + // When set, the server will detect whether or not this mutation conflicts + // with the current version of the entity on the server. Conflicting mutations + // are not applied, and are marked as such in MutationResult. + oneof conflict_detection_strategy { + // The version of the entity that this mutation is being applied to. If this + // does not match the current version on the server, the mutation conflicts. + int64 base_version = 8; + } +} + +// The result of applying a mutation. +message MutationResult { + // The automatically allocated key. + // Set only when the mutation allocated a key. + Key key = 3; + + // The version of the entity on the server after processing the mutation. If + // the mutation doesn't change anything on the server, then the version will + // be the version of the current entity or, if no entity is present, a version + // that is strictly greater than the version of any previous entity and less + // than the version of any possible future entity. + int64 version = 4; + + // Whether a conflict was detected for this mutation. Always false when a + // conflict detection strategy field is not set in the mutation. + bool conflict_detected = 5; +} + +// The options shared by read requests. +message ReadOptions { + // The possible values for read consistencies. + enum ReadConsistency { + // Unspecified. This value must not be used. + READ_CONSISTENCY_UNSPECIFIED = 0; + + // Strong consistency. + STRONG = 1; + + // Eventual consistency. + EVENTUAL = 2; + } + + // If not specified, lookups and ancestor queries default to + // `read_consistency`=`STRONG`, global queries default to + // `read_consistency`=`EVENTUAL`. + oneof consistency_type { + // The non-transactional read consistency to use. + // Cannot be set to `STRONG` for global queries. + ReadConsistency read_consistency = 1; + + // The identifier of the transaction in which to read. A + // transaction identifier is returned by a call to + // [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction]. + bytes transaction = 2; + } +} + +// Options for beginning a new transaction. +// +// Transactions can be created explicitly with calls to +// [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction] or implicitly by setting +// [ReadOptions.new_transaction][google.datastore.v1.ReadOptions.new_transaction] in read requests. +message TransactionOptions { + // Options specific to read / write transactions. + message ReadWrite { + // The transaction identifier of the transaction being retried. + bytes previous_transaction = 1; + } + + // Options specific to read-only transactions. + message ReadOnly { + + } + + // The `mode` of the transaction, indicating whether write operations are + // supported. + oneof mode { + // The transaction should allow both reads and writes. + ReadWrite read_write = 1; + + // The transaction should only allow reads. + ReadOnly read_only = 2; + } +} diff --git a/handwritten/cloud-profiler/google/datastore/v1/datastore_gapic.yaml b/handwritten/cloud-profiler/google/datastore/v1/datastore_gapic.yaml new file mode 100644 index 00000000000..c6e24cdd539 --- /dev/null +++ b/handwritten/cloud-profiler/google/datastore/v1/datastore_gapic.yaml @@ -0,0 +1,135 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.datastore.v1 + python: + package_name: google.cloud.datastore_v1.gapic + go: + package_name: cloud.google.com/go/datastore/apiv1 + csharp: + package_name: Google.Cloud.Datastore.V1 + release_level: GA + ruby: + package_name: Google::Cloud::Datastore::V1 + php: + package_name: Google\Cloud\Datastore\V1 + nodejs: + package_name: datastore.v1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.datastore.v1.Datastore + collections: [] + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 60000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 60000 + total_timeout_millis: 600000 + methods: + - name: Lookup + flattening: + groups: + - parameters: + - project_id + - read_options + - keys + required_fields: + - project_id + - keys + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: RunQuery + # TODO: Add flattening with oneof when oneofs implemented + required_fields: + - project_id + - partition_id + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: BeginTransaction + flattening: + groups: + - parameters: + - project_id + required_fields: + - project_id + request_object_method: false + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: Commit + flattening: + groups: + - parameters: + - project_id + - mode + - transaction + - mutations + - parameters: + - project_id + - mode + - mutations + required_fields: + - project_id + - mode + - mutations + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: Rollback + flattening: + groups: + - parameters: + - project_id + - transaction + required_fields: + - project_id + - transaction + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: AllocateIds + flattening: + groups: + - parameters: + - project_id + - keys + required_fields: + - project_id + - keys + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: ReserveIds + flattening: + groups: + - parameters: + - project_id + - keys + required_fields: + - project_id + - keys + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 diff --git a/handwritten/cloud-profiler/google/datastore/v1/entity.proto b/handwritten/cloud-profiler/google/datastore/v1/entity.proto new file mode 100644 index 00000000000..de38b0763ed --- /dev/null +++ b/handwritten/cloud-profiler/google/datastore/v1/entity.proto @@ -0,0 +1,203 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.datastore.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/latlng.proto"; + +option csharp_namespace = "Google.Cloud.Datastore.V1"; +option go_package = "google.golang.org/genproto/googleapis/datastore/v1;datastore"; +option java_multiple_files = true; +option java_outer_classname = "EntityProto"; +option java_package = "com.google.datastore.v1"; + + +// A partition ID identifies a grouping of entities. The grouping is always +// by project and namespace, however the namespace ID may be empty. +// +// A partition ID contains several dimensions: +// project ID and namespace ID. +// +// Partition dimensions: +// +// - May be `""`. +// - Must be valid UTF-8 bytes. +// - Must have values that match regex `[A-Za-z\d\.\-_]{1,100}` +// If the value of any dimension matches regex `__.*__`, the partition is +// reserved/read-only. +// A reserved/read-only partition ID is forbidden in certain documented +// contexts. +// +// Foreign partition IDs (in which the project ID does +// not match the context project ID ) are discouraged. +// Reads and writes of foreign partition IDs may fail if the project is not in an active state. +message PartitionId { + // The ID of the project to which the entities belong. + string project_id = 2; + + // If not empty, the ID of the namespace to which the entities belong. + string namespace_id = 4; +} + +// A unique identifier for an entity. +// If a key's partition ID or any of its path kinds or names are +// reserved/read-only, the key is reserved/read-only. +// A reserved/read-only key is forbidden in certain documented contexts. +message Key { + // A (kind, ID/name) pair used to construct a key path. + // + // If either name or ID is set, the element is complete. + // If neither is set, the element is incomplete. + message PathElement { + // The kind of the entity. + // A kind matching regex `__.*__` is reserved/read-only. + // A kind must not contain more than 1500 bytes when UTF-8 encoded. + // Cannot be `""`. + string kind = 1; + + // The type of ID. + oneof id_type { + // The auto-allocated ID of the entity. + // Never equal to zero. Values less than zero are discouraged and may not + // be supported in the future. + int64 id = 2; + + // The name of the entity. + // A name matching regex `__.*__` is reserved/read-only. + // A name must not be more than 1500 bytes when UTF-8 encoded. + // Cannot be `""`. + string name = 3; + } + } + + // Entities are partitioned into subsets, currently identified by a project + // ID and namespace ID. + // Queries are scoped to a single partition. + PartitionId partition_id = 1; + + // The entity path. + // An entity path consists of one or more elements composed of a kind and a + // string or numerical identifier, which identify entities. The first + // element identifies a _root entity_, the second element identifies + // a _child_ of the root entity, the third element identifies a child of the + // second entity, and so forth. The entities identified by all prefixes of + // the path are called the element's _ancestors_. + // + // An entity path is always fully complete: *all* of the entity's ancestors + // are required to be in the path along with the entity identifier itself. + // The only exception is that in some documented cases, the identifier in the + // last path element (for the entity) itself may be omitted. For example, + // the last path element of the key of `Mutation.insert` may have no + // identifier. + // + // A path can never be empty, and a path can have at most 100 elements. + repeated PathElement path = 2; +} + +// An array value. +message ArrayValue { + // Values in the array. + // The order of this array may not be preserved if it contains a mix of + // indexed and unindexed values. + repeated Value values = 1; +} + +// A message that can hold any of the supported value types and associated +// metadata. +message Value { + // Must have a value set. + oneof value_type { + // A null value. + google.protobuf.NullValue null_value = 11; + + // A boolean value. + bool boolean_value = 1; + + // An integer value. + int64 integer_value = 2; + + // A double value. + double double_value = 3; + + // A timestamp value. + // When stored in the Datastore, precise only to microseconds; + // any additional precision is rounded down. + google.protobuf.Timestamp timestamp_value = 10; + + // A key value. + Key key_value = 5; + + // A UTF-8 encoded string value. + // When `exclude_from_indexes` is false (it is indexed) , may have at most 1500 bytes. + // Otherwise, may be set to at least 1,000,000 bytes. + string string_value = 17; + + // A blob value. + // May have at most 1,000,000 bytes. + // When `exclude_from_indexes` is false, may have at most 1500 bytes. + // In JSON requests, must be base64-encoded. + bytes blob_value = 18; + + // A geo point value representing a point on the surface of Earth. + google.type.LatLng geo_point_value = 8; + + // An entity value. + // + // - May have no key. + // - May have a key with an incomplete key path. + // - May have a reserved/read-only key. + Entity entity_value = 6; + + // An array value. + // Cannot contain another array value. + // A `Value` instance that sets field `array_value` must not set fields + // `meaning` or `exclude_from_indexes`. + ArrayValue array_value = 9; + } + + // The `meaning` field should only be populated for backwards compatibility. + int32 meaning = 14; + + // If the value should be excluded from all indexes including those defined + // explicitly. + bool exclude_from_indexes = 19; +} + +// A Datastore data object. +// +// An entity is limited to 1 megabyte when stored. That _roughly_ +// corresponds to a limit of 1 megabyte for the serialized form of this +// message. +message Entity { + // The entity's key. + // + // An entity must have a key, unless otherwise documented (for example, + // an entity in `Value.entity_value` may have no key). + // An entity's kind is its key path's last element's kind, + // or null if it has no key. + Key key = 1; + + // The entity's properties. + // The map's keys are property names. + // A property name matching regex `__.*__` is reserved. + // A reserved property name is forbidden in certain documented contexts. + // The name must not contain more than 500 characters. + // The name cannot be `""`. + map properties = 3; +} diff --git a/handwritten/cloud-profiler/google/datastore/v1/query.proto b/handwritten/cloud-profiler/google/datastore/v1/query.proto new file mode 100644 index 00000000000..f74a9946849 --- /dev/null +++ b/handwritten/cloud-profiler/google/datastore/v1/query.proto @@ -0,0 +1,309 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.datastore.v1; + +import "google/api/annotations.proto"; +import "google/datastore/v1/entity.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/latlng.proto"; + +option csharp_namespace = "Google.Cloud.Datastore.V1"; +option go_package = "google.golang.org/genproto/googleapis/datastore/v1;datastore"; +option java_multiple_files = true; +option java_outer_classname = "QueryProto"; +option java_package = "com.google.datastore.v1"; + + +// The result of fetching an entity from Datastore. +message EntityResult { + // Specifies what data the 'entity' field contains. + // A `ResultType` is either implied (for example, in `LookupResponse.missing` + // from `datastore.proto`, it is always `KEY_ONLY`) or specified by context + // (for example, in message `QueryResultBatch`, field `entity_result_type` + // specifies a `ResultType` for all the values in field `entity_results`). + enum ResultType { + // Unspecified. This value is never used. + RESULT_TYPE_UNSPECIFIED = 0; + + // The key and properties. + FULL = 1; + + // A projected subset of properties. The entity may have no key. + PROJECTION = 2; + + // Only the key. + KEY_ONLY = 3; + } + + // The resulting entity. + Entity entity = 1; + + // The version of the entity, a strictly positive number that monotonically + // increases with changes to the entity. + // + // This field is set for [`FULL`][google.datastore.v1.EntityResult.ResultType.FULL] entity + // results. + // + // For [missing][google.datastore.v1.LookupResponse.missing] entities in `LookupResponse`, this + // is the version of the snapshot that was used to look up the entity, and it + // is always set except for eventually consistent reads. + int64 version = 4; + + // A cursor that points to the position after the result entity. + // Set only when the `EntityResult` is part of a `QueryResultBatch` message. + bytes cursor = 3; +} + +// A query for entities. +message Query { + // The projection to return. Defaults to returning all properties. + repeated Projection projection = 2; + + // The kinds to query (if empty, returns entities of all kinds). + // Currently at most 1 kind may be specified. + repeated KindExpression kind = 3; + + // The filter to apply. + Filter filter = 4; + + // The order to apply to the query results (if empty, order is unspecified). + repeated PropertyOrder order = 5; + + // The properties to make distinct. The query results will contain the first + // result for each distinct combination of values for the given properties + // (if empty, all results are returned). + repeated PropertyReference distinct_on = 6; + + // A starting point for the query results. Query cursors are + // returned in query result batches and + // [can only be used to continue the same query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets). + bytes start_cursor = 7; + + // An ending point for the query results. Query cursors are + // returned in query result batches and + // [can only be used to limit the same query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets). + bytes end_cursor = 8; + + // The number of results to skip. Applies before limit, but after all other + // constraints. Optional. Must be >= 0 if specified. + int32 offset = 10; + + // The maximum number of results to return. Applies after all other + // constraints. Optional. + // Unspecified is interpreted as no limit. + // Must be >= 0 if specified. + google.protobuf.Int32Value limit = 12; +} + +// A representation of a kind. +message KindExpression { + // The name of the kind. + string name = 1; +} + +// A reference to a property relative to the kind expressions. +message PropertyReference { + // The name of the property. + // If name includes "."s, it may be interpreted as a property name path. + string name = 2; +} + +// A representation of a property in a projection. +message Projection { + // The property to project. + PropertyReference property = 1; +} + +// The desired order for a specific property. +message PropertyOrder { + // The sort direction. + enum Direction { + // Unspecified. This value must not be used. + DIRECTION_UNSPECIFIED = 0; + + // Ascending. + ASCENDING = 1; + + // Descending. + DESCENDING = 2; + } + + // The property to order by. + PropertyReference property = 1; + + // The direction to order by. Defaults to `ASCENDING`. + Direction direction = 2; +} + +// A holder for any type of filter. +message Filter { + // The type of filter. + oneof filter_type { + // A composite filter. + CompositeFilter composite_filter = 1; + + // A filter on a property. + PropertyFilter property_filter = 2; + } +} + +// A filter that merges multiple other filters using the given operator. +message CompositeFilter { + // A composite filter operator. + enum Operator { + // Unspecified. This value must not be used. + OPERATOR_UNSPECIFIED = 0; + + // The results are required to satisfy each of the combined filters. + AND = 1; + } + + // The operator for combining multiple filters. + Operator op = 1; + + // The list of filters to combine. + // Must contain at least one filter. + repeated Filter filters = 2; +} + +// A filter on a specific property. +message PropertyFilter { + // A property filter operator. + enum Operator { + // Unspecified. This value must not be used. + OPERATOR_UNSPECIFIED = 0; + + // Less than. + LESS_THAN = 1; + + // Less than or equal. + LESS_THAN_OR_EQUAL = 2; + + // Greater than. + GREATER_THAN = 3; + + // Greater than or equal. + GREATER_THAN_OR_EQUAL = 4; + + // Equal. + EQUAL = 5; + + // Has ancestor. + HAS_ANCESTOR = 11; + } + + // The property to filter by. + PropertyReference property = 1; + + // The operator to filter by. + Operator op = 2; + + // The value to compare the property to. + Value value = 3; +} + +// A [GQL query](https://cloud.google.com/datastore/docs/apis/gql/gql_reference). +message GqlQuery { + // A string of the format described + // [here](https://cloud.google.com/datastore/docs/apis/gql/gql_reference). + string query_string = 1; + + // When false, the query string must not contain any literals and instead must + // bind all values. For example, + // `SELECT * FROM Kind WHERE a = 'string literal'` is not allowed, while + // `SELECT * FROM Kind WHERE a = @value` is. + bool allow_literals = 2; + + // For each non-reserved named binding site in the query string, there must be + // a named parameter with that name, but not necessarily the inverse. + // + // Key must match regex `[A-Za-z_$][A-Za-z_$0-9]*`, must not match regex + // `__.*__`, and must not be `""`. + map named_bindings = 5; + + // Numbered binding site @1 references the first numbered parameter, + // effectively using 1-based indexing, rather than the usual 0. + // + // For each binding site numbered i in `query_string`, there must be an i-th + // numbered parameter. The inverse must also be true. + repeated GqlQueryParameter positional_bindings = 4; +} + +// A binding parameter for a GQL query. +message GqlQueryParameter { + // The type of parameter. + oneof parameter_type { + // A value parameter. + Value value = 2; + + // A query cursor. Query cursors are returned in query + // result batches. + bytes cursor = 3; + } +} + +// A batch of results produced by a query. +message QueryResultBatch { + // The possible values for the `more_results` field. + enum MoreResultsType { + // Unspecified. This value is never used. + MORE_RESULTS_TYPE_UNSPECIFIED = 0; + + // There may be additional batches to fetch from this query. + NOT_FINISHED = 1; + + // The query is finished, but there may be more results after the limit. + MORE_RESULTS_AFTER_LIMIT = 2; + + // The query is finished, but there may be more results after the end + // cursor. + MORE_RESULTS_AFTER_CURSOR = 4; + + // The query is finished, and there are no more results. + NO_MORE_RESULTS = 3; + } + + // The number of results skipped, typically because of an offset. + int32 skipped_results = 6; + + // A cursor that points to the position after the last skipped result. + // Will be set when `skipped_results` != 0. + bytes skipped_cursor = 3; + + // The result type for every entity in `entity_results`. + EntityResult.ResultType entity_result_type = 1; + + // The results for this batch. + repeated EntityResult entity_results = 2; + + // A cursor that points to the position after the last result in the batch. + bytes end_cursor = 4; + + // The state of the query after the current batch. + MoreResultsType more_results = 5; + + // The version number of the snapshot this batch was returned from. + // This applies to the range of results from the query's `start_cursor` (or + // the beginning of the query if no cursor was given) to this batch's + // `end_cursor` (not the query's `end_cursor`). + // + // In a single transaction, subsequent query result batches for the same query + // can have a greater snapshot version number. Each batch's snapshot version + // is valid for all preceding batches. + // The value will be zero for eventually consistent queries. + int64 snapshot_version = 7; +} diff --git a/handwritten/cloud-profiler/google/datastore/v1beta3/datastore.proto b/handwritten/cloud-profiler/google/datastore/v1beta3/datastore.proto new file mode 100644 index 00000000000..140188fc3ac --- /dev/null +++ b/handwritten/cloud-profiler/google/datastore/v1beta3/datastore.proto @@ -0,0 +1,373 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.datastore.v1beta3; + +import "google/api/annotations.proto"; +import "google/datastore/v1beta3/entity.proto"; +import "google/datastore/v1beta3/query.proto"; + +option csharp_namespace = "Google.Cloud.Datastore.V1Beta3"; +option go_package = "google.golang.org/genproto/googleapis/datastore/v1beta3;datastore"; +option java_multiple_files = true; +option java_outer_classname = "DatastoreProto"; +option java_package = "com.google.datastore.v1beta3"; + + +// Each RPC normalizes the partition IDs of the keys in its input entities, +// and always returns entities with keys with normalized partition IDs. +// This applies to all keys and entities, including those in values, except keys +// with both an empty path and an empty or unset partition ID. Normalization of +// input keys sets the project ID (if not already set) to the project ID from +// the request. +// +service Datastore { + // Looks up entities by key. + rpc Lookup(LookupRequest) returns (LookupResponse) { + option (google.api.http) = { post: "/v1beta3/projects/{project_id}:lookup" body: "*" }; + } + + // Queries for entities. + rpc RunQuery(RunQueryRequest) returns (RunQueryResponse) { + option (google.api.http) = { post: "/v1beta3/projects/{project_id}:runQuery" body: "*" }; + } + + // Begins a new transaction. + rpc BeginTransaction(BeginTransactionRequest) returns (BeginTransactionResponse) { + option (google.api.http) = { post: "/v1beta3/projects/{project_id}:beginTransaction" body: "*" }; + } + + // Commits a transaction, optionally creating, deleting or modifying some + // entities. + rpc Commit(CommitRequest) returns (CommitResponse) { + option (google.api.http) = { post: "/v1beta3/projects/{project_id}:commit" body: "*" }; + } + + // Rolls back a transaction. + rpc Rollback(RollbackRequest) returns (RollbackResponse) { + option (google.api.http) = { post: "/v1beta3/projects/{project_id}:rollback" body: "*" }; + } + + // Allocates IDs for the given keys, which is useful for referencing an entity + // before it is inserted. + rpc AllocateIds(AllocateIdsRequest) returns (AllocateIdsResponse) { + option (google.api.http) = { post: "/v1beta3/projects/{project_id}:allocateIds" body: "*" }; + } + + // Prevents the supplied keys' IDs from being auto-allocated by Cloud + // Datastore. + rpc ReserveIds(ReserveIdsRequest) returns (ReserveIdsResponse) { + option (google.api.http) = { post: "/v1beta3/projects/{project_id}:reserveIds" body: "*" }; + } +} + +// The request for [Datastore.Lookup][google.datastore.v1beta3.Datastore.Lookup]. +message LookupRequest { + // The ID of the project against which to make the request. + string project_id = 8; + + // The options for this lookup request. + ReadOptions read_options = 1; + + // Keys of entities to look up. + repeated Key keys = 3; +} + +// The response for [Datastore.Lookup][google.datastore.v1beta3.Datastore.Lookup]. +message LookupResponse { + // Entities found as `ResultType.FULL` entities. The order of results in this + // field is undefined and has no relation to the order of the keys in the + // input. + repeated EntityResult found = 1; + + // Entities not found as `ResultType.KEY_ONLY` entities. The order of results + // in this field is undefined and has no relation to the order of the keys + // in the input. + repeated EntityResult missing = 2; + + // A list of keys that were not looked up due to resource constraints. The + // order of results in this field is undefined and has no relation to the + // order of the keys in the input. + repeated Key deferred = 3; +} + +// The request for [Datastore.RunQuery][google.datastore.v1beta3.Datastore.RunQuery]. +message RunQueryRequest { + // The ID of the project against which to make the request. + string project_id = 8; + + // Entities are partitioned into subsets, identified by a partition ID. + // Queries are scoped to a single partition. + // This partition ID is normalized with the standard default context + // partition ID. + PartitionId partition_id = 2; + + // The options for this query. + ReadOptions read_options = 1; + + // The type of query. + oneof query_type { + // The query to run. + Query query = 3; + + // The GQL query to run. + GqlQuery gql_query = 7; + } +} + +// The response for [Datastore.RunQuery][google.datastore.v1beta3.Datastore.RunQuery]. +message RunQueryResponse { + // A batch of query results (always present). + QueryResultBatch batch = 1; + + // The parsed form of the `GqlQuery` from the request, if it was set. + Query query = 2; +} + +// The request for [Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction]. +message BeginTransactionRequest { + // The ID of the project against which to make the request. + string project_id = 8; + + // Options for a new transaction. + TransactionOptions transaction_options = 10; +} + +// The response for [Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction]. +message BeginTransactionResponse { + // The transaction identifier (always present). + bytes transaction = 1; +} + +// The request for [Datastore.Rollback][google.datastore.v1beta3.Datastore.Rollback]. +message RollbackRequest { + // The ID of the project against which to make the request. + string project_id = 8; + + // The transaction identifier, returned by a call to + // [Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction]. + bytes transaction = 1; +} + +// The response for [Datastore.Rollback][google.datastore.v1beta3.Datastore.Rollback]. +// (an empty message). +message RollbackResponse { + +} + +// The request for [Datastore.Commit][google.datastore.v1beta3.Datastore.Commit]. +message CommitRequest { + // The modes available for commits. + enum Mode { + // Unspecified. This value must not be used. + MODE_UNSPECIFIED = 0; + + // Transactional: The mutations are either all applied, or none are applied. + // Learn about transactions [here](https://cloud.google.com/datastore/docs/concepts/transactions). + TRANSACTIONAL = 1; + + // Non-transactional: The mutations may not apply as all or none. + NON_TRANSACTIONAL = 2; + } + + // The ID of the project against which to make the request. + string project_id = 8; + + // The type of commit to perform. Defaults to `TRANSACTIONAL`. + Mode mode = 5; + + // Must be set when mode is `TRANSACTIONAL`. + oneof transaction_selector { + // The identifier of the transaction associated with the commit. A + // transaction identifier is returned by a call to + // [Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction]. + bytes transaction = 1; + } + + // The mutations to perform. + // + // When mode is `TRANSACTIONAL`, mutations affecting a single entity are + // applied in order. The following sequences of mutations affecting a single + // entity are not permitted in a single `Commit` request: + // + // - `insert` followed by `insert` + // - `update` followed by `insert` + // - `upsert` followed by `insert` + // - `delete` followed by `update` + // + // When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single + // entity. + repeated Mutation mutations = 6; +} + +// The response for [Datastore.Commit][google.datastore.v1beta3.Datastore.Commit]. +message CommitResponse { + // The result of performing the mutations. + // The i-th mutation result corresponds to the i-th mutation in the request. + repeated MutationResult mutation_results = 3; + + // The number of index entries updated during the commit, or zero if none were + // updated. + int32 index_updates = 4; +} + +// The request for [Datastore.AllocateIds][google.datastore.v1beta3.Datastore.AllocateIds]. +message AllocateIdsRequest { + // The ID of the project against which to make the request. + string project_id = 8; + + // A list of keys with incomplete key paths for which to allocate IDs. + // No key may be reserved/read-only. + repeated Key keys = 1; +} + +// The response for [Datastore.AllocateIds][google.datastore.v1beta3.Datastore.AllocateIds]. +message AllocateIdsResponse { + // The keys specified in the request (in the same order), each with + // its key path completed with a newly allocated ID. + repeated Key keys = 1; +} + +// The request for [Datastore.ReserveIds][google.datastore.v1beta3.Datastore.ReserveIds]. +message ReserveIdsRequest { + // The ID of the project against which to make the request. + string project_id = 8; + + // If not empty, the ID of the database against which to make the request. + string database_id = 9; + + // A list of keys with complete key paths whose numeric IDs should not be + // auto-allocated. + repeated Key keys = 1; +} + +// The response for [Datastore.ReserveIds][google.datastore.v1beta3.Datastore.ReserveIds]. +message ReserveIdsResponse { + +} + +// A mutation to apply to an entity. +message Mutation { + // The mutation operation. + // + // For `insert`, `update`, and `upsert`: + // - The entity's key must not be reserved/read-only. + // - No property in the entity may have a reserved name, + // not even a property in an entity in a value. + // - No value in the entity may have meaning 18, + // not even a value in an entity in another value. + oneof operation { + // The entity to insert. The entity must not already exist. + // The entity key's final path element may be incomplete. + Entity insert = 4; + + // The entity to update. The entity must already exist. + // Must have a complete key path. + Entity update = 5; + + // The entity to upsert. The entity may or may not already exist. + // The entity key's final path element may be incomplete. + Entity upsert = 6; + + // The key of the entity to delete. The entity may or may not already exist. + // Must have a complete key path and must not be reserved/read-only. + Key delete = 7; + } + + // When set, the server will detect whether or not this mutation conflicts + // with the current version of the entity on the server. Conflicting mutations + // are not applied, and are marked as such in MutationResult. + oneof conflict_detection_strategy { + // The version of the entity that this mutation is being applied to. If this + // does not match the current version on the server, the mutation conflicts. + int64 base_version = 8; + } +} + +// The result of applying a mutation. +message MutationResult { + // The automatically allocated key. + // Set only when the mutation allocated a key. + Key key = 3; + + // The version of the entity on the server after processing the mutation. If + // the mutation doesn't change anything on the server, then the version will + // be the version of the current entity or, if no entity is present, a version + // that is strictly greater than the version of any previous entity and less + // than the version of any possible future entity. + int64 version = 4; + + // Whether a conflict was detected for this mutation. Always false when a + // conflict detection strategy field is not set in the mutation. + bool conflict_detected = 5; +} + +// The options shared by read requests. +message ReadOptions { + // The possible values for read consistencies. + enum ReadConsistency { + // Unspecified. This value must not be used. + READ_CONSISTENCY_UNSPECIFIED = 0; + + // Strong consistency. + STRONG = 1; + + // Eventual consistency. + EVENTUAL = 2; + } + + // If not specified, lookups and ancestor queries default to + // `read_consistency`=`STRONG`, global queries default to + // `read_consistency`=`EVENTUAL`. + oneof consistency_type { + // The non-transactional read consistency to use. + // Cannot be set to `STRONG` for global queries. + ReadConsistency read_consistency = 1; + + // The identifier of the transaction in which to read. A + // transaction identifier is returned by a call to + // [Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction]. + bytes transaction = 2; + } +} + +// Options for beginning a new transaction. +// +// Transactions can be created explicitly with calls to +// [Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction] or implicitly by setting +// [ReadOptions.new_transaction][google.datastore.v1beta3.ReadOptions.new_transaction] in read requests. +message TransactionOptions { + // Options specific to read / write transactions. + message ReadWrite { + // The transaction identifier of the transaction being retried. + bytes previous_transaction = 1; + } + + // Options specific to read-only transactions. + message ReadOnly { + + } + + // The `mode` of the transaction, indicating whether write operations are + // supported. + oneof mode { + // The transaction should allow both reads and writes. + ReadWrite read_write = 1; + + // The transaction should only allow reads. + ReadOnly read_only = 2; + } +} diff --git a/handwritten/cloud-profiler/google/datastore/v1beta3/entity.proto b/handwritten/cloud-profiler/google/datastore/v1beta3/entity.proto new file mode 100644 index 00000000000..81e5e4dd303 --- /dev/null +++ b/handwritten/cloud-profiler/google/datastore/v1beta3/entity.proto @@ -0,0 +1,203 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.datastore.v1beta3; + +import "google/api/annotations.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/latlng.proto"; + +option csharp_namespace = "Google.Cloud.Datastore.V1Beta3"; +option go_package = "google.golang.org/genproto/googleapis/datastore/v1beta3;datastore"; +option java_multiple_files = true; +option java_outer_classname = "EntityProto"; +option java_package = "com.google.datastore.v1beta3"; + + +// A partition ID identifies a grouping of entities. The grouping is always +// by project and namespace, however the namespace ID may be empty. +// +// A partition ID contains several dimensions: +// project ID and namespace ID. +// +// Partition dimensions: +// +// - May be `""`. +// - Must be valid UTF-8 bytes. +// - Must have values that match regex `[A-Za-z\d\.\-_]{1,100}` +// If the value of any dimension matches regex `__.*__`, the partition is +// reserved/read-only. +// A reserved/read-only partition ID is forbidden in certain documented +// contexts. +// +// Foreign partition IDs (in which the project ID does +// not match the context project ID ) are discouraged. +// Reads and writes of foreign partition IDs may fail if the project is not in an active state. +message PartitionId { + // The ID of the project to which the entities belong. + string project_id = 2; + + // If not empty, the ID of the namespace to which the entities belong. + string namespace_id = 4; +} + +// A unique identifier for an entity. +// If a key's partition ID or any of its path kinds or names are +// reserved/read-only, the key is reserved/read-only. +// A reserved/read-only key is forbidden in certain documented contexts. +message Key { + // A (kind, ID/name) pair used to construct a key path. + // + // If either name or ID is set, the element is complete. + // If neither is set, the element is incomplete. + message PathElement { + // The kind of the entity. + // A kind matching regex `__.*__` is reserved/read-only. + // A kind must not contain more than 1500 bytes when UTF-8 encoded. + // Cannot be `""`. + string kind = 1; + + // The type of ID. + oneof id_type { + // The auto-allocated ID of the entity. + // Never equal to zero. Values less than zero are discouraged and may not + // be supported in the future. + int64 id = 2; + + // The name of the entity. + // A name matching regex `__.*__` is reserved/read-only. + // A name must not be more than 1500 bytes when UTF-8 encoded. + // Cannot be `""`. + string name = 3; + } + } + + // Entities are partitioned into subsets, currently identified by a project + // ID and namespace ID. + // Queries are scoped to a single partition. + PartitionId partition_id = 1; + + // The entity path. + // An entity path consists of one or more elements composed of a kind and a + // string or numerical identifier, which identify entities. The first + // element identifies a _root entity_, the second element identifies + // a _child_ of the root entity, the third element identifies a child of the + // second entity, and so forth. The entities identified by all prefixes of + // the path are called the element's _ancestors_. + // + // An entity path is always fully complete: *all* of the entity's ancestors + // are required to be in the path along with the entity identifier itself. + // The only exception is that in some documented cases, the identifier in the + // last path element (for the entity) itself may be omitted. For example, + // the last path element of the key of `Mutation.insert` may have no + // identifier. + // + // A path can never be empty, and a path can have at most 100 elements. + repeated PathElement path = 2; +} + +// An array value. +message ArrayValue { + // Values in the array. + // The order of this array may not be preserved if it contains a mix of + // indexed and unindexed values. + repeated Value values = 1; +} + +// A message that can hold any of the supported value types and associated +// metadata. +message Value { + // Must have a value set. + oneof value_type { + // A null value. + google.protobuf.NullValue null_value = 11; + + // A boolean value. + bool boolean_value = 1; + + // An integer value. + int64 integer_value = 2; + + // A double value. + double double_value = 3; + + // A timestamp value. + // When stored in the Datastore, precise only to microseconds; + // any additional precision is rounded down. + google.protobuf.Timestamp timestamp_value = 10; + + // A key value. + Key key_value = 5; + + // A UTF-8 encoded string value. + // When `exclude_from_indexes` is false (it is indexed) , may have at most 1500 bytes. + // Otherwise, may be set to at least 1,000,000 bytes. + string string_value = 17; + + // A blob value. + // May have at most 1,000,000 bytes. + // When `exclude_from_indexes` is false, may have at most 1500 bytes. + // In JSON requests, must be base64-encoded. + bytes blob_value = 18; + + // A geo point value representing a point on the surface of Earth. + google.type.LatLng geo_point_value = 8; + + // An entity value. + // + // - May have no key. + // - May have a key with an incomplete key path. + // - May have a reserved/read-only key. + Entity entity_value = 6; + + // An array value. + // Cannot contain another array value. + // A `Value` instance that sets field `array_value` must not set fields + // `meaning` or `exclude_from_indexes`. + ArrayValue array_value = 9; + } + + // The `meaning` field should only be populated for backwards compatibility. + int32 meaning = 14; + + // If the value should be excluded from all indexes including those defined + // explicitly. + bool exclude_from_indexes = 19; +} + +// A Datastore data object. +// +// An entity is limited to 1 megabyte when stored. That _roughly_ +// corresponds to a limit of 1 megabyte for the serialized form of this +// message. +message Entity { + // The entity's key. + // + // An entity must have a key, unless otherwise documented (for example, + // an entity in `Value.entity_value` may have no key). + // An entity's kind is its key path's last element's kind, + // or null if it has no key. + Key key = 1; + + // The entity's properties. + // The map's keys are property names. + // A property name matching regex `__.*__` is reserved. + // A reserved property name is forbidden in certain documented contexts. + // The name must not contain more than 500 characters. + // The name cannot be `""`. + map properties = 3; +} diff --git a/handwritten/cloud-profiler/google/datastore/v1beta3/query.proto b/handwritten/cloud-profiler/google/datastore/v1beta3/query.proto new file mode 100644 index 00000000000..03f7986f656 --- /dev/null +++ b/handwritten/cloud-profiler/google/datastore/v1beta3/query.proto @@ -0,0 +1,309 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.datastore.v1beta3; + +import "google/api/annotations.proto"; +import "google/datastore/v1beta3/entity.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/latlng.proto"; + +option csharp_namespace = "Google.Cloud.Datastore.V1Beta3"; +option go_package = "google.golang.org/genproto/googleapis/datastore/v1beta3;datastore"; +option java_multiple_files = true; +option java_outer_classname = "QueryProto"; +option java_package = "com.google.datastore.v1beta3"; + + +// The result of fetching an entity from Datastore. +message EntityResult { + // Specifies what data the 'entity' field contains. + // A `ResultType` is either implied (for example, in `LookupResponse.missing` + // from `datastore.proto`, it is always `KEY_ONLY`) or specified by context + // (for example, in message `QueryResultBatch`, field `entity_result_type` + // specifies a `ResultType` for all the values in field `entity_results`). + enum ResultType { + // Unspecified. This value is never used. + RESULT_TYPE_UNSPECIFIED = 0; + + // The key and properties. + FULL = 1; + + // A projected subset of properties. The entity may have no key. + PROJECTION = 2; + + // Only the key. + KEY_ONLY = 3; + } + + // The resulting entity. + Entity entity = 1; + + // The version of the entity, a strictly positive number that monotonically + // increases with changes to the entity. + // + // This field is set for [`FULL`][google.datastore.v1beta3.EntityResult.ResultType.FULL] entity + // results. + // + // For [missing][google.datastore.v1beta3.LookupResponse.missing] entities in `LookupResponse`, this + // is the version of the snapshot that was used to look up the entity, and it + // is always set except for eventually consistent reads. + int64 version = 4; + + // A cursor that points to the position after the result entity. + // Set only when the `EntityResult` is part of a `QueryResultBatch` message. + bytes cursor = 3; +} + +// A query for entities. +message Query { + // The projection to return. Defaults to returning all properties. + repeated Projection projection = 2; + + // The kinds to query (if empty, returns entities of all kinds). + // Currently at most 1 kind may be specified. + repeated KindExpression kind = 3; + + // The filter to apply. + Filter filter = 4; + + // The order to apply to the query results (if empty, order is unspecified). + repeated PropertyOrder order = 5; + + // The properties to make distinct. The query results will contain the first + // result for each distinct combination of values for the given properties + // (if empty, all results are returned). + repeated PropertyReference distinct_on = 6; + + // A starting point for the query results. Query cursors are + // returned in query result batches and + // [can only be used to continue the same query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets). + bytes start_cursor = 7; + + // An ending point for the query results. Query cursors are + // returned in query result batches and + // [can only be used to limit the same query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets). + bytes end_cursor = 8; + + // The number of results to skip. Applies before limit, but after all other + // constraints. Optional. Must be >= 0 if specified. + int32 offset = 10; + + // The maximum number of results to return. Applies after all other + // constraints. Optional. + // Unspecified is interpreted as no limit. + // Must be >= 0 if specified. + google.protobuf.Int32Value limit = 12; +} + +// A representation of a kind. +message KindExpression { + // The name of the kind. + string name = 1; +} + +// A reference to a property relative to the kind expressions. +message PropertyReference { + // The name of the property. + // If name includes "."s, it may be interpreted as a property name path. + string name = 2; +} + +// A representation of a property in a projection. +message Projection { + // The property to project. + PropertyReference property = 1; +} + +// The desired order for a specific property. +message PropertyOrder { + // The sort direction. + enum Direction { + // Unspecified. This value must not be used. + DIRECTION_UNSPECIFIED = 0; + + // Ascending. + ASCENDING = 1; + + // Descending. + DESCENDING = 2; + } + + // The property to order by. + PropertyReference property = 1; + + // The direction to order by. Defaults to `ASCENDING`. + Direction direction = 2; +} + +// A holder for any type of filter. +message Filter { + // The type of filter. + oneof filter_type { + // A composite filter. + CompositeFilter composite_filter = 1; + + // A filter on a property. + PropertyFilter property_filter = 2; + } +} + +// A filter that merges multiple other filters using the given operator. +message CompositeFilter { + // A composite filter operator. + enum Operator { + // Unspecified. This value must not be used. + OPERATOR_UNSPECIFIED = 0; + + // The results are required to satisfy each of the combined filters. + AND = 1; + } + + // The operator for combining multiple filters. + Operator op = 1; + + // The list of filters to combine. + // Must contain at least one filter. + repeated Filter filters = 2; +} + +// A filter on a specific property. +message PropertyFilter { + // A property filter operator. + enum Operator { + // Unspecified. This value must not be used. + OPERATOR_UNSPECIFIED = 0; + + // Less than. + LESS_THAN = 1; + + // Less than or equal. + LESS_THAN_OR_EQUAL = 2; + + // Greater than. + GREATER_THAN = 3; + + // Greater than or equal. + GREATER_THAN_OR_EQUAL = 4; + + // Equal. + EQUAL = 5; + + // Has ancestor. + HAS_ANCESTOR = 11; + } + + // The property to filter by. + PropertyReference property = 1; + + // The operator to filter by. + Operator op = 2; + + // The value to compare the property to. + Value value = 3; +} + +// A [GQL query](https://cloud.google.com/datastore/docs/apis/gql/gql_reference). +message GqlQuery { + // A string of the format described + // [here](https://cloud.google.com/datastore/docs/apis/gql/gql_reference). + string query_string = 1; + + // When false, the query string must not contain any literals and instead must + // bind all values. For example, + // `SELECT * FROM Kind WHERE a = 'string literal'` is not allowed, while + // `SELECT * FROM Kind WHERE a = @value` is. + bool allow_literals = 2; + + // For each non-reserved named binding site in the query string, there must be + // a named parameter with that name, but not necessarily the inverse. + // + // Key must match regex `[A-Za-z_$][A-Za-z_$0-9]*`, must not match regex + // `__.*__`, and must not be `""`. + map named_bindings = 5; + + // Numbered binding site @1 references the first numbered parameter, + // effectively using 1-based indexing, rather than the usual 0. + // + // For each binding site numbered i in `query_string`, there must be an i-th + // numbered parameter. The inverse must also be true. + repeated GqlQueryParameter positional_bindings = 4; +} + +// A binding parameter for a GQL query. +message GqlQueryParameter { + // The type of parameter. + oneof parameter_type { + // A value parameter. + Value value = 2; + + // A query cursor. Query cursors are returned in query + // result batches. + bytes cursor = 3; + } +} + +// A batch of results produced by a query. +message QueryResultBatch { + // The possible values for the `more_results` field. + enum MoreResultsType { + // Unspecified. This value is never used. + MORE_RESULTS_TYPE_UNSPECIFIED = 0; + + // There may be additional batches to fetch from this query. + NOT_FINISHED = 1; + + // The query is finished, but there may be more results after the limit. + MORE_RESULTS_AFTER_LIMIT = 2; + + // The query is finished, but there may be more results after the end + // cursor. + MORE_RESULTS_AFTER_CURSOR = 4; + + // The query is finished, and there are no more results. + NO_MORE_RESULTS = 3; + } + + // The number of results skipped, typically because of an offset. + int32 skipped_results = 6; + + // A cursor that points to the position after the last skipped result. + // Will be set when `skipped_results` != 0. + bytes skipped_cursor = 3; + + // The result type for every entity in `entity_results`. + EntityResult.ResultType entity_result_type = 1; + + // The results for this batch. + repeated EntityResult entity_results = 2; + + // A cursor that points to the position after the last result in the batch. + bytes end_cursor = 4; + + // The state of the query after the current batch. + MoreResultsType more_results = 5; + + // The version number of the snapshot this batch was returned from. + // This applies to the range of results from the query's `start_cursor` (or + // the beginning of the query if no cursor was given) to this batch's + // `end_cursor` (not the query's `end_cursor`). + // + // In a single transaction, subsequent query result batches for the same query + // can have a greater snapshot version number. Each batch's snapshot version + // is valid for all preceding batches. + // The value will be zero for eventually consistent queries. + int64 snapshot_version = 7; +} diff --git a/handwritten/cloud-profiler/google/devtools/artman_clouddebugger.yaml b/handwritten/cloud-profiler/google/devtools/artman_clouddebugger.yaml new file mode 100644 index 00000000000..3a301590ce0 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/artman_clouddebugger.yaml @@ -0,0 +1,95 @@ +common: + api_name: debugger + api_version: v2 + organization_name: google-cloud + service_yaml: clouddebugger/clouddebugger.yaml + gapic_yaml: clouddebugger/v2/clouddebugger_gapic.yaml + src_proto_paths: + - clouddebugger/v2 + - source/v1 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-debugger + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/google-cloud-debugger-v2 +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-debugger-v2 + - name: grpc + dest: generated/python/proto-google-cloud-debugger-v2 +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-debugger-v2 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/debugger/v2 + dest: google-cloud-debugger/lib/google/cloud/debugger/v2 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-debugger +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: debugger/apiv2 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-devtools-clouddebugger-v2/vendor +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + publish_targets: + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v2 + dest: packages/debugger/src/v2 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/debugger +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/devtools/build/v1/build_events.proto b/handwritten/cloud-profiler/google/devtools/build/v1/build_events.proto new file mode 100644 index 00000000000..c3a1faed8e4 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/build/v1/build_events.proto @@ -0,0 +1,186 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.build.v1; + +import "google/api/annotations.proto"; +import "google/devtools/build/v1/build_status.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/devtools/build/v1;build"; +option java_multiple_files = true; +option java_outer_classname = "BuildEventProto"; +option java_package = "com.google.devtools.build.v1"; + + +// An event representing some state change that occured in the build. This +// message does not include field for uniquely identifying an event. +message BuildEvent { + // Notification that the build system has attempted to run the build tool. + message InvocationAttemptStarted { + // The number of the invocation attempt, starting at 1 and increasing by 1 + // for each new attempt. Can be used to determine if there is a later + // invocation attempt replacing the current one a client is processing. + int64 attempt_number = 1; + } + + // Notification that an invocation attempt has finished. + message InvocationAttemptFinished { + // The exit code of the build tool. + google.protobuf.Int32Value exit_code = 2; + + // Final status of the invocation. + BuildStatus invocation_status = 3; + } + + // Notification that the build request is enqueued. It could happen when + // a new build request is inserted into the build queue, or when a + // build request is put back into the build queue due to a previous build + // failure. + message BuildEnqueued { + + } + + // Notification that the build request has finished, and no further + // invocations will occur. Note that this applies to the entire Build. + // Individual invocations trigger InvocationFinished when they finish. + message BuildFinished { + // Final status of the build. + BuildStatus status = 1; + } + + // Textual output written to standard output or standard error. + message ConsoleOutput { + // The output stream type. + ConsoleOutputStream type = 1; + + // The output stream content. + oneof output { + // Regular UTF-8 output; normal text. + string text_output = 2; + + // Used if the output is not UTF-8 text (for example, a binary proto). + bytes binary_output = 3; + } + } + + // Notification of the end of a build event stream published by a build + // component other than CONTROLLER (See StreamId.BuildComponents). + message BuildComponentStreamFinished { + // How did the event stream finish. + enum FinishType { + // Unknown or unspecified; callers should never set this value. + FINISH_TYPE_UNSPECIFIED = 0; + + // Set by the event publisher to indicate a build event stream is + // finished. + FINISHED = 1; + + // Set by the WatchBuild RPC server when the publisher of a build event + // stream stops publishing events without publishing a + // BuildComponentStreamFinished event whose type equals FINISHED. + EXPIRED = 2; + } + + // How the event stream finished. + FinishType type = 1; + } + + // The timestamp of this event. + google.protobuf.Timestamp event_time = 1; + + // ////////////////////////////////////////////////////////////////////////// + // Events that indicate a state change of a build request in the build + // queue. + oneof event { + // An invocation attempt has started. + InvocationAttemptStarted invocation_attempt_started = 51; + + // An invocation attempt has finished. + InvocationAttemptFinished invocation_attempt_finished = 52; + + // The build is enqueued (just inserted to the build queue or put back + // into the build queue due to a previous build failure). + BuildEnqueued build_enqueued = 53; + + // The build has finished. Set when the build is terminated. + BuildFinished build_finished = 55; + + // An event containing printed text. + ConsoleOutput console_output = 56; + + // Indicates the end of a build event stream (with the same StreamId) from + // a build component executing the requested build task. + // *** This field does not indicate the WatchBuild RPC is finished. *** + BuildComponentStreamFinished component_stream_finished = 59; + + // Structured build event generated by Bazel about its execution progress. + google.protobuf.Any bazel_event = 60; + + // An event that contains supplemental tool-specific information about + // build execution. + google.protobuf.Any build_execution_event = 61; + + // An event that contains supplemental tool-specific information about + // source fetching. + google.protobuf.Any source_fetch_event = 62; + } +} + +// Unique identifier for a build event stream. +message StreamId { + // Which build component generates this event stream. Each build component + // may generate one event stream. + enum BuildComponent { + // Unknown or unspecified; callers should never set this value. + UNKNOWN_COMPONENT = 0; + + // A component that coordinates builds. + CONTROLLER = 1; + + // A component that runs executables needed to complete a build. + WORKER = 2; + + // A component that builds something. + TOOL = 3; + } + + // The id of a Build message. + string build_id = 1; + + // The unique invocation ID within this build. + // It should be the same as {invocation} (below) during the migration. + string invocation_id = 6; + + // The component that emitted this event. + BuildComponent component = 3; +} + +// The type of console output stream. +enum ConsoleOutputStream { + // Unspecified or unknown. + UNKNOWN = 0; + + // Normal output stream. + STDOUT = 1; + + // Error output stream. + STDERR = 2; +} diff --git a/handwritten/cloud-profiler/google/devtools/build/v1/build_status.proto b/handwritten/cloud-profiler/google/devtools/build/v1/build_status.proto new file mode 100644 index 00000000000..f88296c9cd9 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/build/v1/build_status.proto @@ -0,0 +1,66 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.build.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/any.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/devtools/build/v1;build"; +option java_multiple_files = true; +option java_outer_classname = "BuildStatusProto"; +option java_package = "com.google.devtools.build.v1"; + + +// Status used for both invocation attempt and overall build completion. +message BuildStatus { + // The end result of the Build. + enum Result { + // Unspecified or unknown. + UNKNOWN_STATUS = 0; + + // Build was successful and tests (if requested) all pass. + COMMAND_SUCCEEDED = 1; + + // Build error and/or test failure. + COMMAND_FAILED = 2; + + // Unable to obtain a result due to input provided by the user. + USER_ERROR = 3; + + // Unable to obtain a result due to a failure within the build system. + SYSTEM_ERROR = 4; + + // Build required too many resources, such as build tool RAM. + RESOURCE_EXHAUSTED = 5; + + // An invocation attempt time exceeded its deadline. + INVOCATION_DEADLINE_EXCEEDED = 6; + + // Build request time exceeded the request_deadline + REQUEST_DEADLINE_EXCEEDED = 8; + + // The build was cancelled by a call to CancelBuild. + CANCELLED = 7; + } + + // The end result. + Result result = 1; + + // Fine-grained diagnostic information to complement the status. + google.protobuf.Any details = 2; +} diff --git a/handwritten/cloud-profiler/google/devtools/build/v1/publish_build_event.proto b/handwritten/cloud-profiler/google/devtools/build/v1/publish_build_event.proto new file mode 100644 index 00000000000..7d7b1cd24c5 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/build/v1/publish_build_event.proto @@ -0,0 +1,160 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.build.v1; + +import "google/api/annotations.proto"; +import "google/devtools/build/v1/build_events.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/devtools/build/v1;build"; +option java_multiple_files = true; +option java_outer_classname = "BackendProto"; +option java_package = "com.google.devtools.build.v1"; + + +// A service for publishing BuildEvents. BuildEvents are generated by Build +// Systems to record actions taken during a Build. Events occur in streams, +// are identified by a StreamId, and ordered by sequence number in a stream. +// +// A Build may contain several streams of BuildEvents, depending on the systems +// that are involved in the Build. Some BuildEvents are used to declare the +// beginning and end of major portions of a Build; these are called +// LifecycleEvents, and are used (for example) to indicate the beginning or end +// of a Build, and the beginning or end of an Invocation attempt (there can be +// more than 1 Invocation in a Build if, for example, a failure occurs somewhere +// and it needs to be retried). +// +// Other, build-tool events represent actions taken by the Build tool, such as +// target objects produced via compilation, tests run, et cetera. There could be +// more than one build tool stream for an invocation attempt of a build. +service PublishBuildEvent { + // Publish a build event stating the new state of a build (typically from the + // build queue). If the event is a BuildEnqueued event, also register the new + // build request ID and its build type to BES. + // + // The backend will persist the event and deliver it to registered frontend + // jobs immediately without batching. + // + // The commit status of the request is reported by the RPC's util_status() + // function. The error code is the canoncial error code defined in + // //util/task/codes.proto. + rpc PublishLifecycleEvent(PublishLifecycleEventRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1/lifecycleEvents:publish" body: "*" }; + } + + // Publish build tool events belonging to the same stream to a backend job + // using bidirectional streaming. + rpc PublishBuildToolEventStream(stream OrderedBuildEvent) returns (stream PublishBuildToolEventStreamResponse) { + option (google.api.http) = { post: "/v1/events:publish" body: "*" }; + } +} + +// Publishes 'lifecycle events' that update the high-level state of a build: +// - BuildEnqueued: When a build is scheduled. +// - InvocationAttemptStarted: When work for a build starts; there can be +// multiple invocations for a build (e.g. retries). +// - InvocationAttemptCompleted: When work for a build finishes. +// - BuildFinished: When a build is finished. +message PublishLifecycleEventRequest { + // The service level of the build request. Backends only uses this value when + // the BuildEnqueued event is published to determine what level of service + // this build should receive. + enum ServiceLevel { + // Non-interactive builds can tolerate longer event latencies. This is the + // default ServiceLevel if callers do not specify one. + NONINTERACTIVE = 0; + + // The events of an interactive build should be delivered with low latency. + INTERACTIVE = 1; + } + + // The interactivity of this build. + ServiceLevel service_level = 1; + + // The lifecycle build event. If this is a build tool event, the RPC will fail + // with INVALID_REQUEST. + OrderedBuildEvent build_event = 2; + + // If the next event for this build or invocation (depending on the event + // type) hasn't been published after this duration from when {build_event} + // is written to BES, consider this stream expired. If this field is not set, + // BES backend will use its own default value. + google.protobuf.Duration stream_timeout = 3; + + // Additional information about a build request. These are define by the event + // publishers, and the Build Event Service does not validate or interpret + // them. They are used while notifying internal systems of new builds and + // invocations if the OrderedBuildEvent.event type is + // BuildEnqueued/InvocationAttemptStarted. + repeated string notification_keywords = 4; + + // This field identifies which project (if any) the build is associated with. + string project_id = 6; +} + +// States which event has been committed. Any failure to commit will cause +// RPC errors, hence not recorded by this proto. +message PublishBuildToolEventStreamResponse { + // The stream that contains this event. + StreamId stream_id = 1; + + // The sequence number of this event that has been committed. + int64 sequence_number = 2; +} + +// Build event with contextual information about the stream it belongs to and +// its position in that stream. +message OrderedBuildEvent { + // Which build event stream this event belongs to. + StreamId stream_id = 1; + + // The position of this event in the stream. The sequence numbers for a build + // event stream should be a sequence of consecutive natural numbers starting + // from one. (1, 2, 3, ...) + int64 sequence_number = 2; + + // The actual event. + BuildEvent event = 3; +} + +message PublishBuildToolEventStreamRequest { + // The fist 3 fields are identical to OrderedBuildEvent so we can have wire- + // compatibility when migrating BES publishers. + + // Which build event stream this event belongs to. + google.devtools.build.v1.StreamId stream_id = 1 [deprecated = true]; + + // The position of this event in the stream. The sequence numbers for a build + // event stream should be a sequence of consecutive natural numbers starting + // from one. (1, 2, 3, ...) + int64 sequence_number = 2 [deprecated = true]; + + // The actual event. + google.devtools.build.v1.BuildEvent event = 3 [deprecated = true]; + + // The build event with position info. + // New publishing clients should use this field rather than the 3 above. + OrderedBuildEvent ordered_build_event = 4; + + // The keywords to be attached to the notification which notifies the start + // of a new build event stream. BES only reads this field when sequence_number + // or ordered_build_event.sequence_number is 1 in this message. If this field + // is empty, BES will not publish notification messages for this stream. + repeated string notification_keywords = 5; +} diff --git a/handwritten/cloud-profiler/google/devtools/cloudbuild/README.md b/handwritten/cloud-profiler/google/devtools/cloudbuild/README.md new file mode 100644 index 00000000000..12ffda1a204 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudbuild/README.md @@ -0,0 +1 @@ +The Google Cloud Container Builder API lets you to build an application or part of an application from source code stored in Google Cloud Storage or a Google Cloud Source Repository and package it into container images. The container images are then stored in Google Container Registry. You can optionally copy the images to another container registry as required. diff --git a/handwritten/cloud-profiler/google/devtools/cloudbuild/cloudbuild.yaml b/handwritten/cloud-profiler/google/devtools/cloudbuild/cloudbuild.yaml new file mode 100644 index 00000000000..2ce520a4d00 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudbuild/cloudbuild.yaml @@ -0,0 +1,26 @@ +type: google.api.Service +config_version: 3 +name: cloudbuild.googleapis.com +title: Google Cloud Container Builder API + +apis: +- name: google.devtools.cloudbuild.v1.CloudBuild + +types: +- name: google.devtools.cloudbuild.v1.BuildOperationMetadata + +documentation: + summary: Builds container images in the cloud. + overview: |- + The Google Cloud Container Builder API lets you to build an application or + part of an application from source code stored in Google Cloud Storage or a + Google Cloud Source Repository and package it into container images. The + container images are then stored in Google Container Registry. You can + optionally copy the images to another container registry as required. + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/devtools/cloudbuild/v1/cloudbuild.proto b/handwritten/cloud-profiler/google/devtools/cloudbuild/v1/cloudbuild.proto new file mode 100644 index 00000000000..4d9f2961668 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudbuild/v1/cloudbuild.proto @@ -0,0 +1,643 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.cloudbuild.v1; + +import "google/api/annotations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1;cloudbuild"; +option java_multiple_files = true; +option java_package = "com.google.cloudbuild.v1"; +option objc_class_prefix = "GCB"; + + +// Manages container image build requests in the cloud. +// +// The main concept used by this API is a Build, which describes the location of +// the source to build, how to build the source into a container image, and what +// tag to apply to the built image when it is pushed to Google Container +// Registry. +// +// A user can list previously-requested builds or get builds by their ID to +// determine the status of the build. +service CloudBuild { + // Starts a build with the specified configuration. + // + // The long-running Operation returned by this method will include the ID of + // the build, which can be passed to GetBuild to determine its status (e.g., + // success or failure). + rpc CreateBuild(CreateBuildRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/projects/{project_id}/builds" body: "build" }; + } + + // Returns information about a previously requested build. + // + // The Build that is returned includes its status (e.g., success or failure, + // or in-progress), and timing information. + rpc GetBuild(GetBuildRequest) returns (Build) { + option (google.api.http) = { get: "/v1/projects/{project_id}/builds/{id}" }; + } + + // Lists previously requested builds. + // + // Previously requested builds may still be in-progress, or may have finished + // successfully or unsuccessfully. + rpc ListBuilds(ListBuildsRequest) returns (ListBuildsResponse) { + option (google.api.http) = { get: "/v1/projects/{project_id}/builds" }; + } + + // Cancels a requested build in progress. + rpc CancelBuild(CancelBuildRequest) returns (Build) { + option (google.api.http) = { post: "/v1/projects/{project_id}/builds/{id}:cancel" body: "*" }; + } + + // Creates a new BuildTrigger. + // + // This API is experimental. + rpc CreateBuildTrigger(CreateBuildTriggerRequest) returns (BuildTrigger) { + option (google.api.http) = { post: "/v1/projects/{project_id}/triggers" body: "trigger" }; + } + + // Gets information about a BuildTrigger. + // + // This API is experimental. + rpc GetBuildTrigger(GetBuildTriggerRequest) returns (BuildTrigger) { + option (google.api.http) = { get: "/v1/projects/{project_id}/triggers/{trigger_id}" }; + } + + // Lists existing BuildTrigger. + // + // This API is experimental. + rpc ListBuildTriggers(ListBuildTriggersRequest) returns (ListBuildTriggersResponse) { + option (google.api.http) = { get: "/v1/projects/{project_id}/triggers" }; + } + + // Deletes an BuildTrigger by its project ID and trigger ID. + // + // This API is experimental. + rpc DeleteBuildTrigger(DeleteBuildTriggerRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/projects/{project_id}/triggers/{trigger_id}" }; + } + + // Updates an BuildTrigger by its project ID and trigger ID. + // + // This API is experimental. + rpc UpdateBuildTrigger(UpdateBuildTriggerRequest) returns (BuildTrigger) { + option (google.api.http) = { patch: "/v1/projects/{project_id}/triggers/{trigger_id}" body: "trigger" }; + } +} + +// StorageSource describes the location of the source in an archive file in +// Google Cloud Storage. +message StorageSource { + // Google Cloud Storage bucket containing source (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Google Cloud Storage object containing source. + // + // This object must be a gzipped archive file (.tar.gz) containing source to + // build. + string object = 2; + + // Google Cloud Storage generation for the object. If the generation is + // omitted, the latest generation will be used. + int64 generation = 3; +} + +// RepoSource describes the location of the source in a Google Cloud Source +// Repository. +message RepoSource { + // ID of the project that owns the repo. If omitted, the project ID requesting + // the build is assumed. + string project_id = 1; + + // Name of the repo. If omitted, the name "default" is assumed. + string repo_name = 2; + + // A revision within the source repository must be specified in + // one of these ways. + oneof revision { + // Name of the branch to build. + string branch_name = 3; + + // Name of the tag to build. + string tag_name = 4; + + // Explicit commit SHA to build. + string commit_sha = 5; + } +} + +// Source describes the location of the source in a supported storage +// service. +message Source { + // Describes location of source. + oneof source { + // If provided, get the source from this location in in Google Cloud + // Storage. + StorageSource storage_source = 2; + + // If provided, get source from this location in a Cloud Repo. + RepoSource repo_source = 3; + } +} + +// BuiltImage describes an image built by the pipeline. +message BuiltImage { + // Name used to push the container image to Google Container Registry, as + // presented to `docker push`. + string name = 1; + + // Docker Registry 2.0 digest. + string digest = 3; +} + +// BuildStep describes a step to perform in the build pipeline. +message BuildStep { + // The name of the container image that will run this particular build step. + // + // If the image is already available in the host's Docker daemon's cache, it + // will be run directly. If not, the host will attempt to pull the image + // first, using the builder service account's credentials if necessary. + // + // The Docker daemon's cache will already have the latest versions of all of + // the officially supported build steps + // ([https://github.com/GoogleCloudPlatform/cloud-builders](https://github.com/GoogleCloudPlatform/cloud-builders)). + // The Docker daemon will also have cached many of the layers for some popular + // images, like "ubuntu", "debian", but they will be refreshed at the time you + // attempt to use them. + // + // If you built an image in a previous build step, it will be stored in the + // host's Docker daemon's cache and is available to use as the name for a + // later build step. + string name = 1; + + // A list of environment variable definitions to be used when running a step. + // + // The elements are of the form "KEY=VALUE" for the environment variable "KEY" + // being given the value "VALUE". + repeated string env = 2; + + // A list of arguments that will be presented to the step when it is started. + // + // If the image used to run the step's container has an entrypoint, these args + // will be used as arguments to that entrypoint. If the image does not define + // an entrypoint, the first element in args will be used as the entrypoint, + // and the remainder will be used as arguments. + repeated string args = 3; + + // Working directory (relative to project source root) to use when running + // this operation's container. + string dir = 4; + + // Optional unique identifier for this build step, used in wait_for to + // reference this build step as a dependency. + string id = 5; + + // The ID(s) of the step(s) that this build step depends on. + // This build step will not start until all the build steps in wait_for + // have completed successfully. If wait_for is empty, this build step will + // start when all previous build steps in the Build.Steps list have completed + // successfully. + repeated string wait_for = 6; + + // Optional entrypoint to be used instead of the build step image's default + // If unset, the image's default will be used. + string entrypoint = 7; + + // A list of environment variables which are encrypted using a Cloud KMS + // crypto key. These values must be specified in the build's secrets. + repeated string secret_env = 8; + + // List of volumes to mount into the build step. + // + // Each volume will be created as an empty volume prior to execution of the + // build step. Upon completion of the build, volumes and their contents will + // be discarded. + // + // Using a named volume in only one step is not valid as it is indicative + // of a mis-configured build request. + repeated Volume volumes = 9; +} + +// Volume describes a Docker container volume which is mounted into build steps +// in order to persist files across build step execution. +message Volume { + // Name of the volume to mount. + // + // Volume names must be unique per build step and must be valid names for + // Docker volumes. Each named volume must be used by at least two build steps. + string name = 1; + + // Path at which to mount the volume. + // + // Paths must be absolute and cannot conflict with other volume paths on the + // same build step or with certain reserved volume paths. + string path = 2; +} + +// Results describes the artifacts created by the build pipeline. +message Results { + // Images that were built as a part of the build. + repeated BuiltImage images = 2; + + // List of build step digests, in order corresponding to build step indices. + repeated string build_step_images = 3; +} + +// A build resource in the Container Builder API. +// +// At a high level, a Build describes where to find source code, how to build +// it (for example, the builder image to run on the source), and what tag to +// apply to the built image when it is pushed to Google Container Registry. +// +// Fields can include the following variables which will be expanded when the +// build is created: +// +// - $PROJECT_ID: the project ID of the build. +// - $BUILD_ID: the autogenerated ID of the build. +// - $REPO_NAME: the source repository name specified by RepoSource. +// - $BRANCH_NAME: the branch name specified by RepoSource. +// - $TAG_NAME: the tag name specified by RepoSource. +// - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or +// resolved from the specified branch or tag. +message Build { + // Possible status of a build. + enum Status { + // Status of the build is unknown. + STATUS_UNKNOWN = 0; + + // Build is queued; work has not yet begun. + QUEUED = 1; + + // Build is being executed. + WORKING = 2; + + // Build finished successfully. + SUCCESS = 3; + + // Build failed to complete successfully. + FAILURE = 4; + + // Build failed due to an internal cause. + INTERNAL_ERROR = 5; + + // Build took longer than was allowed. + TIMEOUT = 6; + + // Build was canceled by a user. + CANCELLED = 7; + } + + // Unique identifier of the build. + // @OutputOnly + string id = 1; + + // ID of the project. + // @OutputOnly. + string project_id = 16; + + // Status of the build. + // @OutputOnly + Status status = 2; + + // Customer-readable message about the current status. + // @OutputOnly + string status_detail = 24; + + // Describes where to find the source files to build. + Source source = 3; + + // Describes the operations to be performed on the workspace. + repeated BuildStep steps = 11; + + // Results of the build. + // @OutputOnly + Results results = 10; + + // Time at which the request to create the build was received. + // @OutputOnly + google.protobuf.Timestamp create_time = 6; + + // Time at which execution of the build was started. + // @OutputOnly + google.protobuf.Timestamp start_time = 7; + + // Time at which execution of the build was finished. + // + // The difference between finish_time and start_time is the duration of the + // build's execution. + // @OutputOnly + google.protobuf.Timestamp finish_time = 8; + + // Amount of time that this build should be allowed to run, to second + // granularity. If this amount of time elapses, work on the build will cease + // and the build status will be TIMEOUT. + // + // Default time is ten minutes. + google.protobuf.Duration timeout = 12; + + // A list of images to be pushed upon the successful completion of all build + // steps. + // + // The images will be pushed using the builder service account's credentials. + // + // The digests of the pushed images will be stored in the Build resource's + // results field. + // + // If any of the images fail to be pushed, the build is marked FAILURE. + repeated string images = 13; + + // Google Cloud Storage bucket where logs should be written (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + // Logs file names will be of the format `${logs_bucket}/log-${build_id}.txt`. + string logs_bucket = 19; + + // A permanent fixed identifier for source. + // @OutputOnly + SourceProvenance source_provenance = 21; + + // The ID of the BuildTrigger that triggered this build, if it was + // triggered automatically. + // @OutputOnly + string build_trigger_id = 22; + + // Special options for this build. + BuildOptions options = 23; + + // URL to logs for this build in Google Cloud Logging. + // @OutputOnly + string log_url = 25; + + // Substitutions data for Build resource. + map substitutions = 29; + + // Tags for annotation of a Build. These are not docker tags. + repeated string tags = 31; + + // Secrets to decrypt using Cloud KMS. + repeated Secret secrets = 32; +} + +// Metadata for build operations. +message BuildOperationMetadata { + // The build that the operation is tracking. + Build build = 1; +} + +// Provenance of the source. Ways to find the original source, or verify that +// some source was used for this build. +message SourceProvenance { + // A copy of the build's source.storage_source, if exists, with any + // generations resolved. + StorageSource resolved_storage_source = 3; + + // A copy of the build's source.repo_source, if exists, with any + // revisions resolved. + RepoSource resolved_repo_source = 6; + + // Hash(es) of the build source, which can be used to verify that the original + // source integrity was maintained in the build. Note that FileHashes will + // only be populated if BuildOptions has requested a SourceProvenanceHash. + // + // The keys to this map are file paths used as build source and the values + // contain the hash values for those files. + // + // If the build source came in a single package such as a gzipped tarfile + // (.tar.gz), the FileHash will be for the single path to that file. + // @OutputOnly + map file_hashes = 4; +} + +// Container message for hashes of byte content of files, used in +// SourceProvenance messages to verify integrity of source input to the build. +message FileHashes { + // Collection of file hashes. + repeated Hash file_hash = 1; +} + +// Container message for hash values. +message Hash { + // Specifies the hash algorithm, if any. + enum HashType { + // No hash requested. + NONE = 0; + + // Use a sha256 hash. + SHA256 = 1; + } + + // The type of hash that was performed. + HashType type = 1; + + // The hash value. + bytes value = 2; +} + +// Secret pairs a set of secret environment variables containing encrypted +// values with the Cloud KMS key to use to decrypt the value. +message Secret { + // Cloud KMS key name to use to decrypt these envs. + string kms_key_name = 1; + + // Map of environment variable name to its encrypted value. + // + // Secret environment variables must be unique across all of a build's + // secrets, and must be used by at least one build step. Values can be at most + // 1 KB in size. There can be at most ten secret values across all of a + // build's secrets. + map secret_env = 3; +} + +// Request to create a new build. +message CreateBuildRequest { + // ID of the project. + string project_id = 1; + + // Build resource to create. + Build build = 2; +} + +// Request to get a build. +message GetBuildRequest { + // ID of the project. + string project_id = 1; + + // ID of the build. + string id = 2; +} + +// Request to list builds. +message ListBuildsRequest { + // ID of the project. + string project_id = 1; + + // Number of results to return in the list. + int32 page_size = 2; + + // Token to provide to skip to a particular spot in the list. + string page_token = 3; + + // The raw filter text to constrain the results. + string filter = 8; +} + +// Response including listed builds. +message ListBuildsResponse { + // Builds will be sorted by create_time, descending. + repeated Build builds = 1; + + // Token to receive the next page of results. + string next_page_token = 2; +} + +// Request to cancel an ongoing build. +message CancelBuildRequest { + // ID of the project. + string project_id = 1; + + // ID of the build. + string id = 2; +} + +// Configuration for an automated build in response to source repository +// changes. +message BuildTrigger { + // Unique identifier of the trigger. + // + // @OutputOnly + string id = 1; + + // Human-readable description of this trigger. + string description = 10; + + // Template describing the types of source changes to trigger a build. + // + // Branch and tag names in trigger templates are interpreted as regular + // expressions. Any branch or tag change that matches that regular expression + // will trigger a build. + RepoSource trigger_template = 7; + + // Template describing the Build request to make when the trigger is matched. + oneof build_template { + // Contents of the build template. + Build build = 4; + + // Path, from the source root, to a file whose contents is used for the + // template. + string filename = 8; + } + + // Time when the trigger was created. + // + // @OutputOnly + google.protobuf.Timestamp create_time = 5; + + // If true, the trigger will never result in a build. + bool disabled = 9; + + // Substitutions data for Build resource. + map substitutions = 11; +} + +// Request to create a new BuildTrigger. +message CreateBuildTriggerRequest { + // ID of the project for which to configure automatic builds. + string project_id = 1; + + // BuildTrigger to create. + BuildTrigger trigger = 2; +} + +// Returns the BuildTrigger with the specified ID. +message GetBuildTriggerRequest { + // ID of the project that owns the trigger. + string project_id = 1; + + // ID of the BuildTrigger to get. + string trigger_id = 2; +} + +// Request to list existing BuildTriggers. +message ListBuildTriggersRequest { + // ID of the project for which to list BuildTriggers. + string project_id = 1; +} + +// Response containing existing BuildTriggers. +message ListBuildTriggersResponse { + // BuildTriggers for the project, sorted by create_time descending. + repeated BuildTrigger triggers = 1; +} + +// Request to delete a BuildTrigger. +message DeleteBuildTriggerRequest { + // ID of the project that owns the trigger. + string project_id = 1; + + // ID of the BuildTrigger to delete. + string trigger_id = 2; +} + +// Request to update an existing BuildTrigger. +message UpdateBuildTriggerRequest { + // ID of the project that owns the trigger. + string project_id = 1; + + // ID of the BuildTrigger to update. + string trigger_id = 2; + + // BuildTrigger to update. + BuildTrigger trigger = 3; +} + +// Optional arguments to enable specific features of builds. +message BuildOptions { + // Specifies the manner in which the build should be verified, if at all. + enum VerifyOption { + // Not a verifiable build. (default) + NOT_VERIFIED = 0; + + // Verified build. + VERIFIED = 1; + } + + // Specifies the behavior when there is an error in the substitution checks. + enum SubstitutionOption { + // Fails the build if error in substitutions checks, like missing + // a substitution in the template or in the map. + MUST_MATCH = 0; + + // Do not fail the build if error in substitutions checks. + ALLOW_LOOSE = 1; + } + + // Requested hash for SourceProvenance. + repeated Hash.HashType source_provenance_hash = 1; + + // Requested verifiability options. + VerifyOption requested_verify_option = 2; + + // SubstitutionOption to allow unmatch substitutions. + SubstitutionOption substitution_option = 4; +} diff --git a/handwritten/cloud-profiler/google/devtools/clouddebugger/clouddebugger.yaml b/handwritten/cloud-profiler/google/devtools/clouddebugger/clouddebugger.yaml new file mode 100644 index 00000000000..2277b933226 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/clouddebugger/clouddebugger.yaml @@ -0,0 +1,36 @@ +type: google.api.Service + +config_version: 2 + +name: clouddebugger.googleapis.com +title: Stackdriver Debugger API + +documentation: + summary: | + Examines the call stack and variables of a running application + without stopping or slowing it down. + +apis: +- name: google.devtools.clouddebugger.v2.Debugger2 +- name: google.devtools.clouddebugger.v2.Controller2 + +authentication: + rules: + - selector: |- + google.devtools.clouddebugger.v2.Debugger2.SetBreakpoint, + google.devtools.clouddebugger.v2.Debugger2.GetBreakpoint, + google.devtools.clouddebugger.v2.Debugger2.DeleteBreakpoint, + google.devtools.clouddebugger.v2.Debugger2.ListBreakpoints, + google.devtools.clouddebugger.v2.Debugger2.ListDebuggees + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud_debugger, + https://www.googleapis.com/auth/cloud-platform + - selector: |- + google.devtools.clouddebugger.v2.Controller2.RegisterDebuggee, + google.devtools.clouddebugger.v2.Controller2.ListActiveBreakpoints, + google.devtools.clouddebugger.v2.Controller2.UpdateActiveBreakpoint + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud_debugger, + https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/devtools/clouddebugger/v2/clouddebugger_gapic.yaml b/handwritten/cloud-profiler/google/devtools/clouddebugger/v2/clouddebugger_gapic.yaml new file mode 100644 index 00000000000..e7088ee57dd --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/clouddebugger/v2/clouddebugger_gapic.yaml @@ -0,0 +1,167 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.debugger.v2 + python: + package_name: google.cloud.debugger_v2.gapic + go: + package_name: cloud.google.com/go/debugger/apiv2 + domain_layer_location: cloud.google.com/go/cmd/go-cloud-debug-agent + csharp: + package_name: Google.Cloud.Debugger.V2 + ruby: + package_name: Google::Cloud::Debugger::V2 + php: + package_name: Google\Cloud\Debugger\V2 + nodejs: + package_name: debugger.v2 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.devtools.clouddebugger.v2.Debugger2 + collections: [] + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 60000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 60000 + total_timeout_millis: 600000 + methods: + - name: SetBreakpoint + required_fields: + - debuggee_id + - breakpoint + - client_version + flattening: + groups: + - parameters: + - debuggee_id + - breakpoint + - client_version + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: GetBreakpoint + required_fields: + - debuggee_id + - breakpoint_id + - client_version + flattening: + groups: + - parameters: + - debuggee_id + - breakpoint_id + - client_version + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: DeleteBreakpoint + required_fields: + - debuggee_id + - breakpoint_id + - client_version + flattening: + groups: + - parameters: + - debuggee_id + - breakpoint_id + - client_version + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: ListBreakpoints + required_fields: + - debuggee_id + - client_version + flattening: + groups: + - parameters: + - debuggee_id + - client_version + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: ListDebuggees + required_fields: + - project + - client_version + flattening: + groups: + - parameters: + - project + - client_version + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 +- name: google.devtools.clouddebugger.v2.Controller2 + collections: [] + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 60000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 60000 + total_timeout_millis: 600000 + methods: + - name: RegisterDebuggee + required_fields: + - debuggee + flattening: + groups: + - parameters: + - debuggee + request_object_method: false + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: ListActiveBreakpoints + required_fields: + - debuggee_id + flattening: + groups: + - parameters: + - debuggee_id + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: UpdateActiveBreakpoint + required_fields: + - debuggee_id + - breakpoint + flattening: + groups: + - parameters: + - debuggee_id + - breakpoint + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 diff --git a/handwritten/cloud-profiler/google/devtools/clouddebugger/v2/controller.proto b/handwritten/cloud-profiler/google/devtools/clouddebugger/v2/controller.proto new file mode 100644 index 00000000000..3b94f3ad1ac --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/clouddebugger/v2/controller.proto @@ -0,0 +1,164 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.clouddebugger.v2; + +import "google/api/annotations.proto"; +import "google/devtools/clouddebugger/v2/data.proto"; +import "google/protobuf/empty.proto"; + +option csharp_namespace = "Google.Cloud.Debugger.V2"; +option go_package = "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2;clouddebugger"; +option java_multiple_files = true; +option java_outer_classname = "ControllerProto"; +option java_package = "com.google.devtools.clouddebugger.v2"; + + +// The Controller service provides the API for orchestrating a collection of +// debugger agents to perform debugging tasks. These agents are each attached +// to a process of an application which may include one or more replicas. +// +// The debugger agents register with the Controller to identify the application +// being debugged, the Debuggee. All agents that register with the same data, +// represent the same Debuggee, and are assigned the same `debuggee_id`. +// +// The debugger agents call the Controller to retrieve the list of active +// Breakpoints. Agents with the same `debuggee_id` get the same breakpoints +// list. An agent that can fulfill the breakpoint request updates the +// Controller with the breakpoint result. The controller selects the first +// result received and discards the rest of the results. +// Agents that poll again for active breakpoints will no longer have +// the completed breakpoint in the list and should remove that breakpoint from +// their attached process. +// +// The Controller service does not provide a way to retrieve the results of +// a completed breakpoint. This functionality is available using the Debugger +// service. +service Controller2 { + // Registers the debuggee with the controller service. + // + // All agents attached to the same application must call this method with + // exactly the same request content to get back the same stable `debuggee_id`. + // Agents should call this method again whenever `google.rpc.Code.NOT_FOUND` + // is returned from any controller method. + // + // This protocol allows the controller service to disable debuggees, recover + // from data loss, or change the `debuggee_id` format. Agents must handle + // `debuggee_id` value changing upon re-registration. + rpc RegisterDebuggee(RegisterDebuggeeRequest) returns (RegisterDebuggeeResponse) { + option (google.api.http) = { post: "/v2/controller/debuggees/register" body: "*" }; + } + + // Returns the list of all active breakpoints for the debuggee. + // + // The breakpoint specification (`location`, `condition`, and `expressions` + // fields) is semantically immutable, although the field values may + // change. For example, an agent may update the location line number + // to reflect the actual line where the breakpoint was set, but this + // doesn't change the breakpoint semantics. + // + // This means that an agent does not need to check if a breakpoint has changed + // when it encounters the same breakpoint on a successive call. + // Moreover, an agent should remember the breakpoints that are completed + // until the controller removes them from the active list to avoid + // setting those breakpoints again. + rpc ListActiveBreakpoints(ListActiveBreakpointsRequest) returns (ListActiveBreakpointsResponse) { + option (google.api.http) = { get: "/v2/controller/debuggees/{debuggee_id}/breakpoints" }; + } + + // Updates the breakpoint state or mutable fields. + // The entire Breakpoint message must be sent back to the controller service. + // + // Updates to active breakpoint fields are only allowed if the new value + // does not change the breakpoint specification. Updates to the `location`, + // `condition` and `expressions` fields should not alter the breakpoint + // semantics. These may only make changes such as canonicalizing a value + // or snapping the location to the correct line of code. + rpc UpdateActiveBreakpoint(UpdateActiveBreakpointRequest) returns (UpdateActiveBreakpointResponse) { + option (google.api.http) = { put: "/v2/controller/debuggees/{debuggee_id}/breakpoints/{breakpoint.id}" body: "*" }; + } +} + +// Request to register a debuggee. +message RegisterDebuggeeRequest { + // Debuggee information to register. + // The fields `project`, `uniquifier`, `description` and `agent_version` + // of the debuggee must be set. + Debuggee debuggee = 1; +} + +// Response for registering a debuggee. +message RegisterDebuggeeResponse { + // Debuggee resource. + // The field `id` is guranteed to be set (in addition to the echoed fields). + // If the field `is_disabled` is set to `true`, the agent should disable + // itself by removing all breakpoints and detaching from the application. + // It should however continue to poll `RegisterDebuggee` until reenabled. + Debuggee debuggee = 1; +} + +// Request to list active breakpoints. +message ListActiveBreakpointsRequest { + // Identifies the debuggee. + string debuggee_id = 1; + + // A token that, if specified, blocks the method call until the list + // of active breakpoints has changed, or a server-selected timeout has + // expired. The value should be set from the `next_wait_token` field in + // the last response. The initial value should be set to `"init"`. + string wait_token = 2; + + // If set to `true` (recommended), returns `google.rpc.Code.OK` status and + // sets the `wait_expired` response field to `true` when the server-selected + // timeout has expired. + // + // If set to `false` (deprecated), returns `google.rpc.Code.ABORTED` status + // when the server-selected timeout has expired. + bool success_on_timeout = 3; +} + +// Response for listing active breakpoints. +message ListActiveBreakpointsResponse { + // List of all active breakpoints. + // The fields `id` and `location` are guaranteed to be set on each breakpoint. + repeated Breakpoint breakpoints = 1; + + // A token that can be used in the next method call to block until + // the list of breakpoints changes. + string next_wait_token = 2; + + // If set to `true`, indicates that there is no change to the + // list of active breakpoints and the server-selected timeout has expired. + // The `breakpoints` field would be empty and should be ignored. + bool wait_expired = 3; +} + +// Request to update an active breakpoint. +message UpdateActiveBreakpointRequest { + // Identifies the debuggee being debugged. + string debuggee_id = 1; + + // Updated breakpoint information. + // The field `id` must be set. + // The agent must echo all Breakpoint specification fields in the update. + Breakpoint breakpoint = 2; +} + +// Response for updating an active breakpoint. +// The message is defined to allow future extensions. +message UpdateActiveBreakpointResponse { + +} diff --git a/handwritten/cloud-profiler/google/devtools/clouddebugger/v2/data.proto b/handwritten/cloud-profiler/google/devtools/clouddebugger/v2/data.proto new file mode 100644 index 00000000000..0312478f0a6 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/clouddebugger/v2/data.proto @@ -0,0 +1,446 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.clouddebugger.v2; + +import "google/api/annotations.proto"; +import "google/devtools/source/v1/source_context.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Debugger.V2"; +option go_package = "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2;clouddebugger"; +option java_multiple_files = true; +option java_outer_classname = "DataProto"; +option java_package = "com.google.devtools.clouddebugger.v2"; + + +// Represents a message with parameters. +message FormatMessage { + // Format template for the message. The `format` uses placeholders `$0`, + // `$1`, etc. to reference parameters. `$$` can be used to denote the `$` + // character. + // + // Examples: + // + // * `Failed to load '$0' which helps debug $1 the first time it + // is loaded. Again, $0 is very important.` + // * `Please pay $$10 to use $0 instead of $1.` + string format = 1; + + // Optional parameters to be embedded into the message. + repeated string parameters = 2; +} + +// Represents a contextual status message. +// The message can indicate an error or informational status, and refer to +// specific parts of the containing object. +// For example, the `Breakpoint.status` field can indicate an error referring +// to the `BREAKPOINT_SOURCE_LOCATION` with the message `Location not found`. +message StatusMessage { + // Enumerates references to which the message applies. + enum Reference { + // Status doesn't refer to any particular input. + UNSPECIFIED = 0; + + // Status applies to the breakpoint and is related to its location. + BREAKPOINT_SOURCE_LOCATION = 3; + + // Status applies to the breakpoint and is related to its condition. + BREAKPOINT_CONDITION = 4; + + // Status applies to the breakpoint and is related to its expressions. + BREAKPOINT_EXPRESSION = 7; + + // Status applies to the breakpoint and is related to its age. + BREAKPOINT_AGE = 8; + + // Status applies to the entire variable. + VARIABLE_NAME = 5; + + // Status applies to variable value (variable name is valid). + VARIABLE_VALUE = 6; + } + + // Distinguishes errors from informational messages. + bool is_error = 1; + + // Reference to which the message applies. + Reference refers_to = 2; + + // Status message text. + FormatMessage description = 3; +} + +// Represents a location in the source code. +message SourceLocation { + // Path to the source file within the source context of the target binary. + string path = 1; + + // Line inside the file. The first line in the file has the value `1`. + int32 line = 2; +} + +// Represents a variable or an argument possibly of a compound object type. +// Note how the following variables are represented: +// +// 1) A simple variable: +// +// int x = 5 +// +// { name: "x", value: "5", type: "int" } // Captured variable +// +// 2) A compound object: +// +// struct T { +// int m1; +// int m2; +// }; +// T x = { 3, 7 }; +// +// { // Captured variable +// name: "x", +// type: "T", +// members { name: "m1", value: "3", type: "int" }, +// members { name: "m2", value: "7", type: "int" } +// } +// +// 3) A pointer where the pointee was captured: +// +// T x = { 3, 7 }; +// T* p = &x; +// +// { // Captured variable +// name: "p", +// type: "T*", +// value: "0x00500500", +// members { name: "m1", value: "3", type: "int" }, +// members { name: "m2", value: "7", type: "int" } +// } +// +// 4) A pointer where the pointee was not captured: +// +// T* p = new T; +// +// { // Captured variable +// name: "p", +// type: "T*", +// value: "0x00400400" +// status { is_error: true, description { format: "unavailable" } } +// } +// +// The status should describe the reason for the missing value, +// such as ``, ``, ``. +// +// Note that a null pointer should not have members. +// +// 5) An unnamed value: +// +// int* p = new int(7); +// +// { // Captured variable +// name: "p", +// value: "0x00500500", +// type: "int*", +// members { value: "7", type: "int" } } +// +// 6) An unnamed pointer where the pointee was not captured: +// +// int* p = new int(7); +// int** pp = &p; +// +// { // Captured variable +// name: "pp", +// value: "0x00500500", +// type: "int**", +// members { +// value: "0x00400400", +// type: "int*" +// status { +// is_error: true, +// description: { format: "unavailable" } } +// } +// } +// } +// +// To optimize computation, memory and network traffic, variables that +// repeat in the output multiple times can be stored once in a shared +// variable table and be referenced using the `var_table_index` field. The +// variables stored in the shared table are nameless and are essentially +// a partition of the complete variable. To reconstruct the complete +// variable, merge the referencing variable with the referenced variable. +// +// When using the shared variable table, the following variables: +// +// T x = { 3, 7 }; +// T* p = &x; +// T& r = x; +// +// { name: "x", var_table_index: 3, type: "T" } // Captured variables +// { name: "p", value "0x00500500", type="T*", var_table_index: 3 } +// { name: "r", type="T&", var_table_index: 3 } +// +// { // Shared variable table entry #3: +// members { name: "m1", value: "3", type: "int" }, +// members { name: "m2", value: "7", type: "int" } +// } +// +// Note that the pointer address is stored with the referencing variable +// and not with the referenced variable. This allows the referenced variable +// to be shared between pointers and references. +// +// The type field is optional. The debugger agent may or may not support it. +message Variable { + // Name of the variable, if any. + string name = 1; + + // Simple value of the variable. + string value = 2; + + // Variable type (e.g. `MyClass`). If the variable is split with + // `var_table_index`, `type` goes next to `value`. The interpretation of + // a type is agent specific. It is recommended to include the dynamic type + // rather than a static type of an object. + string type = 6; + + // Members contained or pointed to by the variable. + repeated Variable members = 3; + + // Reference to a variable in the shared variable table. More than + // one variable can reference the same variable in the table. The + // `var_table_index` field is an index into `variable_table` in Breakpoint. + google.protobuf.Int32Value var_table_index = 4; + + // Status associated with the variable. This field will usually stay + // unset. A status of a single variable only applies to that variable or + // expression. The rest of breakpoint data still remains valid. Variables + // might be reported in error state even when breakpoint is not in final + // state. + // + // The message may refer to variable name with `refers_to` set to + // `VARIABLE_NAME`. Alternatively `refers_to` will be set to `VARIABLE_VALUE`. + // In either case variable value and members will be unset. + // + // Example of error message applied to name: `Invalid expression syntax`. + // + // Example of information message applied to value: `Not captured`. + // + // Examples of error message applied to value: + // + // * `Malformed string`, + // * `Field f not found in class C` + // * `Null pointer dereference` + StatusMessage status = 5; +} + +// Represents a stack frame context. +message StackFrame { + // Demangled function name at the call site. + string function = 1; + + // Source location of the call site. + SourceLocation location = 2; + + // Set of arguments passed to this function. + // Note that this might not be populated for all stack frames. + repeated Variable arguments = 3; + + // Set of local variables at the stack frame location. + // Note that this might not be populated for all stack frames. + repeated Variable locals = 4; +} + +// Represents the breakpoint specification, status and results. +message Breakpoint { + // Actions that can be taken when a breakpoint hits. + // Agents should reject breakpoints with unsupported or unknown action values. + enum Action { + // Capture stack frame and variables and update the breakpoint. + // The data is only captured once. After that the breakpoint is set + // in a final state. + CAPTURE = 0; + + // Log each breakpoint hit. The breakpoint remains active until + // deleted or expired. + LOG = 1; + } + + // Log severity levels. + enum LogLevel { + // Information log message. + INFO = 0; + + // Warning log message. + WARNING = 1; + + // Error log message. + ERROR = 2; + } + + // Breakpoint identifier, unique in the scope of the debuggee. + string id = 1; + + // Action that the agent should perform when the code at the + // breakpoint location is hit. + Action action = 13; + + // Breakpoint source location. + SourceLocation location = 2; + + // Condition that triggers the breakpoint. + // The condition is a compound boolean expression composed using expressions + // in a programming language at the source location. + string condition = 3; + + // List of read-only expressions to evaluate at the breakpoint location. + // The expressions are composed using expressions in the programming language + // at the source location. If the breakpoint action is `LOG`, the evaluated + // expressions are included in log statements. + repeated string expressions = 4; + + // Only relevant when action is `LOG`. Defines the message to log when + // the breakpoint hits. The message may include parameter placeholders `$0`, + // `$1`, etc. These placeholders are replaced with the evaluated value + // of the appropriate expression. Expressions not referenced in + // `log_message_format` are not logged. + // + // Example: `Message received, id = $0, count = $1` with + // `expressions` = `[ message.id, message.count ]`. + string log_message_format = 14; + + // Indicates the severity of the log. Only relevant when action is `LOG`. + LogLevel log_level = 15; + + // When true, indicates that this is a final result and the + // breakpoint state will not change from here on. + bool is_final_state = 5; + + // Time this breakpoint was created by the server in seconds resolution. + google.protobuf.Timestamp create_time = 11; + + // Time this breakpoint was finalized as seen by the server in seconds + // resolution. + google.protobuf.Timestamp final_time = 12; + + // E-mail address of the user that created this breakpoint + string user_email = 16; + + // Breakpoint status. + // + // The status includes an error flag and a human readable message. + // This field is usually unset. The message can be either + // informational or an error message. Regardless, clients should always + // display the text message back to the user. + // + // Error status indicates complete failure of the breakpoint. + // + // Example (non-final state): `Still loading symbols...` + // + // Examples (final state): + // + // * `Invalid line number` referring to location + // * `Field f not found in class C` referring to condition + StatusMessage status = 10; + + // The stack at breakpoint time. + repeated StackFrame stack_frames = 7; + + // Values of evaluated expressions at breakpoint time. + // The evaluated expressions appear in exactly the same order they + // are listed in the `expressions` field. + // The `name` field holds the original expression text, the `value` or + // `members` field holds the result of the evaluated expression. + // If the expression cannot be evaluated, the `status` inside the `Variable` + // will indicate an error and contain the error text. + repeated Variable evaluated_expressions = 8; + + // The `variable_table` exists to aid with computation, memory and network + // traffic optimization. It enables storing a variable once and reference + // it from multiple variables, including variables stored in the + // `variable_table` itself. + // For example, the same `this` object, which may appear at many levels of + // the stack, can have all of its data stored once in this table. The + // stack frame variables then would hold only a reference to it. + // + // The variable `var_table_index` field is an index into this repeated field. + // The stored objects are nameless and get their name from the referencing + // variable. The effective variable is a merge of the referencing variable + // and the referenced variable. + repeated Variable variable_table = 9; + + // A set of custom breakpoint properties, populated by the agent, to be + // displayed to the user. + map labels = 17; +} + +// Represents the debugged application. The application may include one or more +// replicated processes executing the same code. Each of these processes is +// attached with a debugger agent, carrying out the debugging commands. +// Agents attached to the same debuggee identify themselves as such by using +// exactly the same Debuggee message value when registering. +message Debuggee { + // Unique identifier for the debuggee generated by the controller service. + string id = 1; + + // Project the debuggee is associated with. + // Use project number or id when registering a Google Cloud Platform project. + string project = 2; + + // Uniquifier to further distiguish the application. + // It is possible that different applications might have identical values in + // the debuggee message, thus, incorrectly identified as a single application + // by the Controller service. This field adds salt to further distiguish the + // application. Agents should consider seeding this field with value that + // identifies the code, binary, configuration and environment. + string uniquifier = 3; + + // Human readable description of the debuggee. + // Including a human-readable project name, environment name and version + // information is recommended. + string description = 4; + + // If set to `true`, indicates that Controller service does not detect any + // activity from the debuggee agents and the application is possibly stopped. + bool is_inactive = 5; + + // Version ID of the agent. + // Schema: `domain/language-platform/vmajor.minor` (for example + // `google.com/java-gcp/v1.1`). + string agent_version = 6; + + // If set to `true`, indicates that the agent should disable itself and + // detach from the debuggee. + bool is_disabled = 7; + + // Human readable message to be displayed to the user about this debuggee. + // Absence of this field indicates no status. The message can be either + // informational or an error status. + StatusMessage status = 8; + + // References to the locations and revisions of the source code used in the + // deployed application. + repeated google.devtools.source.v1.SourceContext source_contexts = 9; + + // References to the locations and revisions of the source code used in the + // deployed application. + // + // NOTE: this field is experimental and can be ignored. + repeated google.devtools.source.v1.ExtendedSourceContext ext_source_contexts = 13; + + // A set of custom debuggee properties, populated by the agent, to be + // displayed to the user. + map labels = 11; +} diff --git a/handwritten/cloud-profiler/google/devtools/clouddebugger/v2/debugger.proto b/handwritten/cloud-profiler/google/devtools/clouddebugger/v2/debugger.proto new file mode 100644 index 00000000000..755a9002f81 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/clouddebugger/v2/debugger.proto @@ -0,0 +1,196 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.clouddebugger.v2; + +import "google/api/annotations.proto"; +import "google/devtools/clouddebugger/v2/data.proto"; +import "google/protobuf/empty.proto"; + +option csharp_namespace = "Google.Cloud.Debugger.V2"; +option go_package = "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2;clouddebugger"; +option java_multiple_files = true; +option java_outer_classname = "DebuggerProto"; +option java_package = "com.google.devtools.clouddebugger.v2"; + + +// The Debugger service provides the API that allows users to collect run-time +// information from a running application, without stopping or slowing it down +// and without modifying its state. An application may include one or +// more replicated processes performing the same work. +// +// A debugged application is represented using the Debuggee concept. The +// Debugger service provides a way to query for available debuggees, but does +// not provide a way to create one. A debuggee is created using the Controller +// service, usually by running a debugger agent with the application. +// +// The Debugger service enables the client to set one or more Breakpoints on a +// Debuggee and collect the results of the set Breakpoints. +service Debugger2 { + // Sets the breakpoint to the debuggee. + rpc SetBreakpoint(SetBreakpointRequest) returns (SetBreakpointResponse) { + option (google.api.http) = { post: "/v2/debugger/debuggees/{debuggee_id}/breakpoints/set" body: "breakpoint" }; + } + + // Gets breakpoint information. + rpc GetBreakpoint(GetBreakpointRequest) returns (GetBreakpointResponse) { + option (google.api.http) = { get: "/v2/debugger/debuggees/{debuggee_id}/breakpoints/{breakpoint_id}" }; + } + + // Deletes the breakpoint from the debuggee. + rpc DeleteBreakpoint(DeleteBreakpointRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v2/debugger/debuggees/{debuggee_id}/breakpoints/{breakpoint_id}" }; + } + + // Lists all breakpoints for the debuggee. + rpc ListBreakpoints(ListBreakpointsRequest) returns (ListBreakpointsResponse) { + option (google.api.http) = { get: "/v2/debugger/debuggees/{debuggee_id}/breakpoints" }; + } + + // Lists all the debuggees that the user has access to. + rpc ListDebuggees(ListDebuggeesRequest) returns (ListDebuggeesResponse) { + option (google.api.http) = { get: "/v2/debugger/debuggees" }; + } +} + +// Request to set a breakpoint +message SetBreakpointRequest { + // ID of the debuggee where the breakpoint is to be set. + string debuggee_id = 1; + + // Breakpoint specification to set. + // The field `location` of the breakpoint must be set. + Breakpoint breakpoint = 2; + + // The client version making the call. + // Schema: `domain/type/version` (e.g., `google.com/intellij/v1`). + string client_version = 4; +} + +// Response for setting a breakpoint. +message SetBreakpointResponse { + // Breakpoint resource. + // The field `id` is guaranteed to be set (in addition to the echoed fileds). + Breakpoint breakpoint = 1; +} + +// Request to get breakpoint information. +message GetBreakpointRequest { + // ID of the debuggee whose breakpoint to get. + string debuggee_id = 1; + + // ID of the breakpoint to get. + string breakpoint_id = 2; + + // The client version making the call. + // Schema: `domain/type/version` (e.g., `google.com/intellij/v1`). + string client_version = 4; +} + +// Response for getting breakpoint information. +message GetBreakpointResponse { + // Complete breakpoint state. + // The fields `id` and `location` are guaranteed to be set. + Breakpoint breakpoint = 1; +} + +// Request to delete a breakpoint. +message DeleteBreakpointRequest { + // ID of the debuggee whose breakpoint to delete. + string debuggee_id = 1; + + // ID of the breakpoint to delete. + string breakpoint_id = 2; + + // The client version making the call. + // Schema: `domain/type/version` (e.g., `google.com/intellij/v1`). + string client_version = 3; +} + +// Request to list breakpoints. +message ListBreakpointsRequest { + // Wrapper message for `Breakpoint.Action`. Defines a filter on the action + // field of breakpoints. + message BreakpointActionValue { + // Only breakpoints with the specified action will pass the filter. + Breakpoint.Action value = 1; + } + + // ID of the debuggee whose breakpoints to list. + string debuggee_id = 1; + + // When set to `true`, the response includes the list of breakpoints set by + // any user. Otherwise, it includes only breakpoints set by the caller. + bool include_all_users = 2; + + // When set to `true`, the response includes active and inactive + // breakpoints. Otherwise, it includes only active breakpoints. + bool include_inactive = 3; + + // When set, the response includes only breakpoints with the specified action. + BreakpointActionValue action = 4; + + // This field is deprecated. The following fields are always stripped out of + // the result: `stack_frames`, `evaluated_expressions` and `variable_table`. + bool strip_results = 5; + + // A wait token that, if specified, blocks the call until the breakpoints + // list has changed, or a server selected timeout has expired. The value + // should be set from the last response. The error code + // `google.rpc.Code.ABORTED` (RPC) is returned on wait timeout, which + // should be called again with the same `wait_token`. + string wait_token = 6; + + // The client version making the call. + // Schema: `domain/type/version` (e.g., `google.com/intellij/v1`). + string client_version = 8; +} + +// Response for listing breakpoints. +message ListBreakpointsResponse { + // List of breakpoints matching the request. + // The fields `id` and `location` are guaranteed to be set on each breakpoint. + // The fields: `stack_frames`, `evaluated_expressions` and `variable_table` + // are cleared on each breakpoint regardless of its status. + repeated Breakpoint breakpoints = 1; + + // A wait token that can be used in the next call to `list` (REST) or + // `ListBreakpoints` (RPC) to block until the list of breakpoints has changes. + string next_wait_token = 2; +} + +// Request to list debuggees. +message ListDebuggeesRequest { + // Project number of a Google Cloud project whose debuggees to list. + string project = 2; + + // When set to `true`, the result includes all debuggees. Otherwise, the + // result includes only debuggees that are active. + bool include_inactive = 3; + + // The client version making the call. + // Schema: `domain/type/version` (e.g., `google.com/intellij/v1`). + string client_version = 4; +} + +// Response for listing debuggees. +message ListDebuggeesResponse { + // List of debuggees accessible to the calling user. + // The fields `debuggee.id` and `description` are guaranteed to be set. + // The `description` field is a human readable field provided by agents and + // can be displayed to users. + repeated Debuggee debuggees = 1; +} diff --git a/handwritten/cloud-profiler/google/devtools/clouderrorreporting/README.md b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/README.md new file mode 100644 index 00000000000..3edcebe6f26 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/README.md @@ -0,0 +1 @@ +Read more about the Stackdriver Error Reporting API [here](https://cloud.google.com/error-reporting/reference/) diff --git a/handwritten/cloud-profiler/google/devtools/clouderrorreporting/artman_errorreporting.yaml b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/artman_errorreporting.yaml new file mode 100644 index 00000000000..7fc75857ceb --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/artman_errorreporting.yaml @@ -0,0 +1,109 @@ +common: + api_name: error-reporting + api_version: v1beta1 + organization_name: google-cloud + service_yaml: errorreporting.yaml + gapic_yaml: v1beta1/errorreporting_gapic.yaml + src_proto_paths: + - v1beta1 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-errorreporting + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-error-reporting-v1beta1 + - name: grpc + dest: generated/java/grpc-google-cloud-error-reporting-v1beta1 + - name: proto + dest: generated/java/proto-google-cloud-error-reporting-v1beta1 +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: google/cloud/errorreporting_v1beta1 + dest: errorreporting/google/cloud/errorreporting_v1beta1 + - src: tests/unit/gapic/v1beta1 + dest: errorreporting/tests/gapic + - name: grpc + src: google/cloud/proto + dest: errorreporting/google/cloud/proto + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-error-reporting-v1beta1 + - name: grpc + dest: generated/python/proto-google-cloud-error-reporting-v1beta1 +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-error-reporting-v1beta1 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/error_reporting/v1beta1 + dest: google-cloud-error_reporting/lib/google/cloud/error_reporting/v1beta1 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-error_reporting +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: error-reporting/apiv1beta1 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-devtools-clouderrorreporting-v1beta1/vendor +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + publish_targets: + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v1beta1 + dest: packages/error-reporting/src/v1beta1 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/errorreporting +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/devtools/clouderrorreporting/errorreporting.yaml b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/errorreporting.yaml new file mode 100644 index 00000000000..75df65ced88 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/errorreporting.yaml @@ -0,0 +1,24 @@ +type: google.api.Service +config_version: 3 +title: Stackdriver Error Reporting API +name: clouderrorreporting.googleapis.com + +documentation: + summary: >- + + Stackdriver Error Reporting groups and counts similar errors + from cloud services. + The Stackdriver Error Reporting API provides a way to report new errors and + read access to error groups and their associated errors. + +apis: +- name: google.devtools.clouderrorreporting.v1beta1.ErrorGroupService +- name: google.devtools.clouderrorreporting.v1beta1.ErrorStatsService +- name: google.devtools.clouderrorreporting.v1beta1.ReportErrorsService + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: + https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/common.proto b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/common.proto new file mode 100644 index 00000000000..33d5cf8248f --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/common.proto @@ -0,0 +1,164 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.clouderrorreporting.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/monitored_resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ErrorReporting.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1;clouderrorreporting"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.devtools.clouderrorreporting.v1beta1"; + + +// Description of a group of similar error events. +message ErrorGroup { + // The group resource name. + // Example: projects/my-project-123/groups/my-groupid + string name = 1; + + // Group IDs are unique for a given project. If the same kind of error + // occurs in different service contexts, it will receive the same group ID. + string group_id = 2; + + // Associated tracking issues. + repeated TrackingIssue tracking_issues = 3; +} + +// Information related to tracking the progress on resolving the error. +message TrackingIssue { + // A URL pointing to a related entry in an issue tracking system. + // Example: https://github.com/user/project/issues/4 + string url = 1; +} + +// An error event which is returned by the Error Reporting system. +message ErrorEvent { + // Time when the event occurred as provided in the error report. + // If the report did not contain a timestamp, the time the error was received + // by the Error Reporting system is used. + google.protobuf.Timestamp event_time = 1; + + // The `ServiceContext` for which this error was reported. + ServiceContext service_context = 2; + + // The stack trace that was reported or logged by the service. + string message = 3; + + // Data about the context in which the error occurred. + ErrorContext context = 5; +} + +// Describes a running service that sends errors. +// Its version changes over time and multiple versions can run in parallel. +message ServiceContext { + // An identifier of the service, such as the name of the + // executable, job, or Google App Engine service name. This field is expected + // to have a low number of values that are relatively stable over time, as + // opposed to `version`, which can be changed whenever new code is deployed. + // + // Contains the service name for error reports extracted from Google + // App Engine logs or `default` if the App Engine default service is used. + string service = 2; + + // Represents the source code version that the developer provided, + // which could represent a version label or a Git SHA-1 hash, for example. + string version = 3; + + // Type of the MonitoredResource. List of possible values: + // https://cloud.google.com/monitoring/api/resources + // + // Value is set automatically for incoming errors and must not be set when + // reporting errors. + string resource_type = 4; +} + +// A description of the context in which an error occurred. +// This data should be provided by the application when reporting an error, +// unless the +// error report has been generated automatically from Google App Engine logs. +message ErrorContext { + // The HTTP request which was processed when the error was + // triggered. + HttpRequestContext http_request = 1; + + // The user who caused or was affected by the crash. + // This can be a user ID, an email address, or an arbitrary token that + // uniquely identifies the user. + // When sending an error report, leave this field empty if the user was not + // logged in. In this case the + // Error Reporting system will use other data, such as remote IP address, to + // distinguish affected users. See `affected_users_count` in + // `ErrorGroupStats`. + string user = 2; + + // The location in the source code where the decision was made to + // report the error, usually the place where it was logged. + // For a logged exception this would be the source line where the + // exception is logged, usually close to the place where it was + // caught. This value is in contrast to `Exception.cause_location`, + // which describes the source line where the exception was thrown. + SourceLocation report_location = 3; +} + +// HTTP request data that is related to a reported error. +// This data should be provided by the application when reporting an error, +// unless the +// error report has been generated automatically from Google App Engine logs. +message HttpRequestContext { + // The type of HTTP request, such as `GET`, `POST`, etc. + string method = 1; + + // The URL of the request. + string url = 2; + + // The user agent information that is provided with the request. + string user_agent = 3; + + // The referrer information that is provided with the request. + string referrer = 4; + + // The HTTP response status code for the request. + int32 response_status_code = 5; + + // The IP address from which the request originated. + // This can be IPv4, IPv6, or a token which is derived from the + // IP address, depending on the data that has been provided + // in the error report. + string remote_ip = 6; +} + +// Indicates a location in the source code of the service for which +// errors are reported. +// This data should be provided by the application when reporting an error, +// unless the error report has been generated automatically from Google App +// Engine logs. All fields are optional. +message SourceLocation { + // The source code filename, which can include a truncated relative + // path, or a full path from a production machine. + string file_path = 1; + + // 1-based. 0 indicates that the line number is unknown. + int32 line_number = 2; + + // Human-readable name of a function or method. + // The value can include optional context like the class or package name. + // For example, `my.package.MyClass.method` in case of Java. + string function_name = 4; +} diff --git a/handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/error_group_service.proto b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/error_group_service.proto new file mode 100644 index 00000000000..e607e368f2c --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/error_group_service.proto @@ -0,0 +1,60 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.clouderrorreporting.v1beta1; + +import "google/api/annotations.proto"; +import "google/devtools/clouderrorreporting/v1beta1/common.proto"; + +option csharp_namespace = "Google.Cloud.ErrorReporting.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1;clouderrorreporting"; +option java_multiple_files = true; +option java_outer_classname = "ErrorGroupServiceProto"; +option java_package = "com.google.devtools.clouderrorreporting.v1beta1"; + + +// Service for retrieving and updating individual error groups. +service ErrorGroupService { + // Get the specified group. + rpc GetGroup(GetGroupRequest) returns (ErrorGroup) { + option (google.api.http) = { get: "/v1beta1/{group_name=projects/*/groups/*}" }; + } + + // Replace the data for the specified group. + // Fails if the group does not exist. + rpc UpdateGroup(UpdateGroupRequest) returns (ErrorGroup) { + option (google.api.http) = { put: "/v1beta1/{group.name=projects/*/groups/*}" body: "group" }; + } +} + +// A request to return an individual group. +message GetGroupRequest { + // [Required] The group resource name. Written as + // projects/projectID/groups/group_name. + // Call + // + // groupStats.list to return a list of groups belonging to + // this project. + // + // Example: projects/my-project-123/groups/my-group + string group_name = 1; +} + +// A request to replace the existing data for the given group. +message UpdateGroupRequest { + // [Required] The group which replaces the resource on the server. + ErrorGroup group = 1; +} diff --git a/handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/error_stats_service.proto b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/error_stats_service.proto new file mode 100644 index 00000000000..f8a0e837b21 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/error_stats_service.proto @@ -0,0 +1,341 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.clouderrorreporting.v1beta1; + +import "google/api/annotations.proto"; +import "google/devtools/clouderrorreporting/v1beta1/common.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ErrorReporting.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1;clouderrorreporting"; +option java_multiple_files = true; +option java_outer_classname = "ErrorStatsServiceProto"; +option java_package = "com.google.devtools.clouderrorreporting.v1beta1"; + + +// An API for retrieving and managing error statistics as well as data for +// individual events. +service ErrorStatsService { + // Lists the specified groups. + rpc ListGroupStats(ListGroupStatsRequest) returns (ListGroupStatsResponse) { + option (google.api.http) = { get: "/v1beta1/{project_name=projects/*}/groupStats" }; + } + + // Lists the specified events. + rpc ListEvents(ListEventsRequest) returns (ListEventsResponse) { + option (google.api.http) = { get: "/v1beta1/{project_name=projects/*}/events" }; + } + + // Deletes all error events of a given project. + rpc DeleteEvents(DeleteEventsRequest) returns (DeleteEventsResponse) { + option (google.api.http) = { delete: "/v1beta1/{project_name=projects/*}/events" }; + } +} + +// Specifies a set of `ErrorGroupStats` to return. +message ListGroupStatsRequest { + // [Required] The resource name of the Google Cloud Platform project. Written + // as projects/ plus the + // Google Cloud + // Platform project ID. + // + // Example: projects/my-project-123. + string project_name = 1; + + // [Optional] List all ErrorGroupStats with these IDs. + repeated string group_id = 2; + + // [Optional] List only ErrorGroupStats which belong to a service + // context that matches the filter. + // Data for all service contexts is returned if this field is not specified. + ServiceContextFilter service_filter = 3; + + // [Optional] List data for the given time range. + // If not set a default time range is used. The field time_range_begin + // in the response will specify the beginning of this time range. + // Only ErrorGroupStats with a non-zero count in the given time + // range are returned, unless the request contains an explicit group_id list. + // If a group_id list is given, also ErrorGroupStats with zero + // occurrences are returned. + QueryTimeRange time_range = 5; + + // [Optional] The preferred duration for a single returned `TimedCount`. + // If not set, no timed counts are returned. + google.protobuf.Duration timed_count_duration = 6; + + // [Optional] The alignment of the timed counts to be returned. + // Default is `ALIGNMENT_EQUAL_AT_END`. + TimedCountAlignment alignment = 7; + + // [Optional] Time where the timed counts shall be aligned if rounded + // alignment is chosen. Default is 00:00 UTC. + google.protobuf.Timestamp alignment_time = 8; + + // [Optional] The sort order in which the results are returned. + // Default is `COUNT_DESC`. + ErrorGroupOrder order = 9; + + // [Optional] The maximum number of results to return per response. + // Default is 20. + int32 page_size = 11; + + // [Optional] A `next_page_token` provided by a previous response. To view + // additional results, pass this token along with the identical query + // parameters as the first request. + string page_token = 12; +} + +// Contains a set of requested error group stats. +message ListGroupStatsResponse { + // The error group stats which match the given request. + repeated ErrorGroupStats error_group_stats = 1; + + // If non-empty, more results are available. + // Pass this token, along with the same query parameters as the first + // request, to view the next page of results. + string next_page_token = 2; + + // The timestamp specifies the start time to which the request was restricted. + // The start time is set based on the requested time range. It may be adjusted + // to a later time if a project has exceeded the storage quota and older data + // has been deleted. + google.protobuf.Timestamp time_range_begin = 4; +} + +// Data extracted for a specific group based on certain filter criteria, +// such as a given time period and/or service filter. +message ErrorGroupStats { + // Group data that is independent of the filter criteria. + ErrorGroup group = 1; + + // Approximate total number of events in the given group that match + // the filter criteria. + int64 count = 2; + + // Approximate number of affected users in the given group that + // match the filter criteria. + // Users are distinguished by data in the `ErrorContext` of the + // individual error events, such as their login name or their remote + // IP address in case of HTTP requests. + // The number of affected users can be zero even if the number of + // errors is non-zero if no data was provided from which the + // affected user could be deduced. + // Users are counted based on data in the request + // context that was provided in the error report. If more users are + // implicitly affected, such as due to a crash of the whole service, + // this is not reflected here. + int64 affected_users_count = 3; + + // Approximate number of occurrences over time. + // Timed counts returned by ListGroups are guaranteed to be: + // + // - Inside the requested time interval + // - Non-overlapping, and + // - Ordered by ascending time. + repeated TimedCount timed_counts = 4; + + // Approximate first occurrence that was ever seen for this group + // and which matches the given filter criteria, ignoring the + // time_range that was specified in the request. + google.protobuf.Timestamp first_seen_time = 5; + + // Approximate last occurrence that was ever seen for this group and + // which matches the given filter criteria, ignoring the time_range + // that was specified in the request. + google.protobuf.Timestamp last_seen_time = 6; + + // Service contexts with a non-zero error count for the given filter + // criteria. This list can be truncated if multiple services are affected. + // Refer to `num_affected_services` for the total count. + repeated ServiceContext affected_services = 7; + + // The total number of services with a non-zero error count for the given + // filter criteria. + int32 num_affected_services = 8; + + // An arbitrary event that is chosen as representative for the whole group. + // The representative event is intended to be used as a quick preview for + // the whole group. Events in the group are usually sufficiently similar + // to each other such that showing an arbitrary representative provides + // insight into the characteristics of the group as a whole. + ErrorEvent representative = 9; +} + +// The number of errors in a given time period. +// All numbers are approximate since the error events are sampled +// before counting them. +message TimedCount { + // Approximate number of occurrences in the given time period. + int64 count = 1; + + // Start of the time period to which `count` refers (included). + google.protobuf.Timestamp start_time = 2; + + // End of the time period to which `count` refers (excluded). + google.protobuf.Timestamp end_time = 3; +} + +// Specifies a set of error events to return. +message ListEventsRequest { + // [Required] The resource name of the Google Cloud Platform project. Written + // as `projects/` plus the + // [Google Cloud Platform project + // ID](https://support.google.com/cloud/answer/6158840). + // Example: `projects/my-project-123`. + string project_name = 1; + + // [Required] The group for which events shall be returned. + string group_id = 2; + + // [Optional] List only ErrorGroups which belong to a service context that + // matches the filter. + // Data for all service contexts is returned if this field is not specified. + ServiceContextFilter service_filter = 3; + + // [Optional] List only data for the given time range. + // If not set a default time range is used. The field time_range_begin + // in the response will specify the beginning of this time range. + QueryTimeRange time_range = 4; + + // [Optional] The maximum number of results to return per response. + int32 page_size = 6; + + // [Optional] A `next_page_token` provided by a previous response. + string page_token = 7; +} + +// Contains a set of requested error events. +message ListEventsResponse { + // The error events which match the given request. + repeated ErrorEvent error_events = 1; + + // If non-empty, more results are available. + // Pass this token, along with the same query parameters as the first + // request, to view the next page of results. + string next_page_token = 2; + + // The timestamp specifies the start time to which the request was restricted. + google.protobuf.Timestamp time_range_begin = 4; +} + +// Requests might be rejected or the resulting timed count durations might be +// adjusted for lower durations. +message QueryTimeRange { + // The supported time ranges. + enum Period { + // Do not use. + PERIOD_UNSPECIFIED = 0; + + // Retrieve data for the last hour. + // Recommended minimum timed count duration: 1 min. + PERIOD_1_HOUR = 1; + + // Retrieve data for the last 6 hours. + // Recommended minimum timed count duration: 10 min. + PERIOD_6_HOURS = 2; + + // Retrieve data for the last day. + // Recommended minimum timed count duration: 1 hour. + PERIOD_1_DAY = 3; + + // Retrieve data for the last week. + // Recommended minimum timed count duration: 6 hours. + PERIOD_1_WEEK = 4; + + // Retrieve data for the last 30 days. + // Recommended minimum timed count duration: 1 day. + PERIOD_30_DAYS = 5; + } + + // Restricts the query to the specified time range. + Period period = 1; +} + +// Specifies criteria for filtering a subset of service contexts. +// The fields in the filter correspond to the fields in `ServiceContext`. +// Only exact, case-sensitive matches are supported. +// If a field is unset or empty, it matches arbitrary values. +message ServiceContextFilter { + // [Optional] The exact value to match against + // [`ServiceContext.service`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service). + string service = 2; + + // [Optional] The exact value to match against + // [`ServiceContext.version`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version). + string version = 3; + + // [Optional] The exact value to match against + // [`ServiceContext.resource_type`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type). + string resource_type = 4; +} + +// Deletes all events in the project. +message DeleteEventsRequest { + // [Required] The resource name of the Google Cloud Platform project. Written + // as `projects/` plus the + // [Google Cloud Platform project + // ID](https://support.google.com/cloud/answer/6158840). + // Example: `projects/my-project-123`. + string project_name = 1; +} + +// Response message for deleting error events. +message DeleteEventsResponse { + +} + +// Specifies how the time periods of error group counts are aligned. +enum TimedCountAlignment { + // No alignment specified. + ERROR_COUNT_ALIGNMENT_UNSPECIFIED = 0; + + // The time periods shall be consecutive, have width equal to the + // requested duration, and be aligned at the `alignment_time` provided in + // the request. + // The `alignment_time` does not have to be inside the query period but + // even if it is outside, only time periods are returned which overlap + // with the query period. + // A rounded alignment will typically result in a + // different size of the first or the last time period. + ALIGNMENT_EQUAL_ROUNDED = 1; + + // The time periods shall be consecutive, have width equal to the + // requested duration, and be aligned at the end of the requested time + // period. This can result in a different size of the + // first time period. + ALIGNMENT_EQUAL_AT_END = 2; +} + +// A sorting order of error groups. +enum ErrorGroupOrder { + // No group order specified. + GROUP_ORDER_UNSPECIFIED = 0; + + // Total count of errors in the given time window in descending order. + COUNT_DESC = 1; + + // Timestamp when the group was last seen in the given time window + // in descending order. + LAST_SEEN_DESC = 2; + + // Timestamp when the group was created in descending order. + CREATED_DESC = 3; + + // Number of affected users in the given time window in descending order. + AFFECTED_USERS_DESC = 4; +} diff --git a/handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/errorreporting_gapic.yaml b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/errorreporting_gapic.yaml new file mode 100644 index 00000000000..4daa94fb159 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/errorreporting_gapic.yaml @@ -0,0 +1,223 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.errorreporting.v1beta1 + python: + package_name: google.cloud.errorreporting_v1beta1.gapic + go: + package_name: cloud.google.com/go/errorreporting/apiv1beta1 + domain_layer_location: cloud.google.com/go/errorreporting + csharp: + package_name: Google.Cloud.ErrorReporting.V1Beta1 + ruby: + package_name: Google::Cloud::ErrorReporting::V1beta1 + php: + package_name: Google\Cloud\ErrorReporting\V1beta1 + nodejs: + package_name: errorreporting.v1beta1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +collections: +- name_pattern: projects/{project} + entity_name: project +- name_pattern: projects/{project}/groups/{group} + entity_name: group +interfaces: +- name: google.devtools.clouderrorreporting.v1beta1.ErrorGroupService + collections: + - name_pattern: projects/{project}/groups/{group} + entity_name: group + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + methods: + - name: GetGroup + flattening: + groups: + - parameters: + - group_name + required_fields: + - group_name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + group_name: group + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: UpdateGroup + flattening: + groups: + - parameters: + - group + required_fields: + - group + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + group.name: group + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 +- name: google.devtools.clouderrorreporting.v1beta1.ReportErrorsService + smoke_test: + method: ReportErrorEvent + init_fields: + - project_name%project=$PROJECT_ID + - event.message="[MESSAGE]" + - event.service_context.service="[SERVICE]" + - event.context.report_location.file_path="path/to/file.lang" + - event.context.report_location.line_number=42 + - event.context.report_location.function_name="meaningOfLife" + collections: + - name_pattern: projects/{project} + entity_name: project + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + methods: + - name: ReportErrorEvent + flattening: + groups: + - parameters: + - project_name + - event + required_fields: + - project_name + - event + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + project_name: project + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 +- name: google.devtools.clouderrorreporting.v1beta1.ErrorStatsService + collections: + - name_pattern: projects/{project} + entity_name: project + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + methods: + - name: ListGroupStats + flattening: + groups: + - parameters: + - project_name + - time_range + required_fields: + - project_name + - time_range + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: error_group_stats + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + project_name: project + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: ListEvents + flattening: + groups: + - parameters: + - project_name + - group_id + required_fields: + - project_name + - group_id + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: error_events + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + project_name: project + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: DeleteEvents + flattening: + groups: + - parameters: + - project_name + required_fields: + - project_name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + project_name: project + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 +resource_name_generation: +- message_name: ErrorGroup + field_entity_map: + name: group +- message_name: GetGroupRequest + field_entity_map: + group_name: group +- message_name: ListGroupStatsRequest + field_entity_map: + project_name: project +- message_name: ListEventsRequest + field_entity_map: + project_name: project +- message_name: DeleteEventsRequest + field_entity_map: + project_name: project +- message_name: ReportErrorEventRequest + field_entity_map: + project_name: project diff --git a/handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/report_errors_service.proto b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/report_errors_service.proto new file mode 100644 index 00000000000..e48fd00767a --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/clouderrorreporting/v1beta1/report_errors_service.proto @@ -0,0 +1,81 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.clouderrorreporting.v1beta1; + +import "google/api/annotations.proto"; +import "google/devtools/clouderrorreporting/v1beta1/common.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ErrorReporting.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1;clouderrorreporting"; +option java_multiple_files = true; +option java_outer_classname = "ReportErrorsServiceProto"; +option java_package = "com.google.devtools.clouderrorreporting.v1beta1"; + + +// An API for reporting error events. +service ReportErrorsService { + // Report an individual error event. + // + // This endpoint accepts either an OAuth token, + // or an + // API key + // for authentication. To use an API key, append it to the URL as the value of + // a `key` parameter. For example: + //
POST https://clouderrorreporting.googleapis.com/v1beta1/projects/example-project/events:report?key=123ABC456
+ rpc ReportErrorEvent(ReportErrorEventRequest) returns (ReportErrorEventResponse) { + option (google.api.http) = { post: "/v1beta1/{project_name=projects/*}/events:report" body: "event" }; + } +} + +// A request for reporting an individual error event. +message ReportErrorEventRequest { + // [Required] The resource name of the Google Cloud Platform project. Written + // as `projects/` plus the + // [Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840). + // Example: `projects/my-project-123`. + string project_name = 1; + + // [Required] The error event to be reported. + ReportedErrorEvent event = 2; +} + +// Response for reporting an individual error event. +// Data may be added to this message in the future. +message ReportErrorEventResponse { + +} + +// An error event which is reported to the Error Reporting system. +message ReportedErrorEvent { + // [Optional] Time when the event occurred. + // If not provided, the time when the event was received by the + // Error Reporting system will be used. + google.protobuf.Timestamp event_time = 1; + + // [Required] The service context in which this error has occurred. + ServiceContext service_context = 2; + + // [Required] A message describing the error. The message can contain an + // exception stack in one of the supported programming languages and formats. + // In that case, the message is parsed and detailed exception information + // is returned when retrieving the error event again. + string message = 3; + + // [Optional] A description of the context in which the error occurred. + ErrorContext context = 4; +} diff --git a/handwritten/cloud-profiler/google/devtools/cloudprofiler/cloudprofiler.yaml b/handwritten/cloud-profiler/google/devtools/cloudprofiler/cloudprofiler.yaml new file mode 100644 index 00000000000..632db5a6c19 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudprofiler/cloudprofiler.yaml @@ -0,0 +1,22 @@ +type: google.api.Service +config_version: 3 +name: cloudprofiler.googleapis.com +title: Stackdriver Profiler API + +apis: +- name: google.devtools.cloudprofiler.v2.ProfilerService + +documentation: + summary: Allows Google services to send in continuous profiling information. + overview: |- + The Stackdriver Profiler API allows Google services manage the continuous + profiling information collected in cloud environments like Flex and GCE VMs. + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/monitoring, + https://www.googleapis.com/auth/monitoring.write diff --git a/handwritten/cloud-profiler/google/devtools/cloudprofiler/v2/profiler.proto b/handwritten/cloud-profiler/google/devtools/cloudprofiler/v2/profiler.proto new file mode 100644 index 00000000000..a42dd741f51 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudprofiler/v2/profiler.proto @@ -0,0 +1,169 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.cloudprofiler.v2; + +import "google/api/annotations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/devtools/cloudprofiler/v2;cloudprofiler"; + + +// Service for recording the profiling data from profiling agents running +// in the cloud or from an offline provider of profiling data. +// +// General guidelines: +// * Profiles for a single deployment must be created in ascending time order. +// * Profiles can be created in either online or offline mode, see below. +service ProfilerService { + // CreateProfile creates a new profile resource. + // + // In the online creation mode: + // * The server ensures that the new profiles are created at a constant rate + // per deployment, so the creation request may hang for some time until the + // next profile session is available. + // * The request may fail with ABORTED error if the creation is not + // available within ~1m, the response will indicate the duration of the + // backoff the client should take before attempting creating a profile + // again. The backoff duration is returned in google.rpc.RetryInfo extension + // on the response status. To a gRPC client, the extension will be return as + // a binary-serialized proto in the trailing metadata item named + // "google.rpc.retryinfo-bin". + // + // In the offline creation mode: + // * The client provides the profile to create along with the profile bytes, + // the server records it. + rpc CreateProfile(CreateProfileRequest) returns (Profile) { + option (google.api.http) = { post: "/v2/projects/{deployment.project_id}/profiles" body: "*" }; + } + + // UpdateProfile updates the profile bytes and labels on the profile resource + // created in the online mode. + rpc UpdateProfile(UpdateProfileRequest) returns (Profile) { + option (google.api.http) = { patch: "/v2/{profile.name=projects/*/profiles/*}" body: "profile" }; + } +} + +// CreateProfileRequest describes a profile resource creation request. +// Deployment field must be populated for both online and offline modes. +// For the online mode, profile field is not set and the profile_type specifies +// the list of profile types supported by the agent. The creation call will hang +// until a profile of one of these types needs to be collected. For offline +// mode, profile field must be set, profile_type must be empty, and deployment +// field must be identical to the deployment in the profile. +message CreateProfileRequest { + // Deployment details. + Deployment deployment = 1; + + // Online mode: One or more profile types that the agent is capable of + // providing. + repeated ProfileType profile_type = 2; + + // Offline mode: Contents of the profile to create. + Profile profile = 3; +} + +// UpdateProfileRequest contains the profile to update. +message UpdateProfileRequest { + // Profile to update + Profile profile = 1; +} + +// Profile resource. +message Profile { + // Opaque, server-assigned, unique ID for this profile. + // Output only. + string name = 1; + + // Type of profile. + // Input (for the offline mode) or output (for the online mode). + ProfileType profile_type = 2; + + // Deployment this profile corresponds to. + Deployment deployment = 3; + + // Duration of the profiling session. + // Input (for the offline mode) or output (for the online mode). + // The field represents requested profiling duration. It may slightly differ + // from the effective profiling duration, which is recorded in the profile + // data, in case the profiling can't be stopped immediately (e.g. in case + // stopping the profiling is handled asynchronously). + google.protobuf.Duration duration = 4; + + // Profile bytes, as a gzip compressed serialized proto, the format is + // https://github.com/google/pprof/blob/master/proto/profile.proto. + bytes profile_bytes = 5; + + // Labels associated to this specific profile. These labels will get merged + // with the deployment labels for the final data set. + // See documentation on deployment labels for validation rules and limits. + // Input only, will not be populated on responses. + map labels = 6; +} + +// Deployment contains the deployment identification information. +message Deployment { + // Project ID is the ID of a cloud project. + // Validation regex: `^[a-z][-a-z0-9:.]{4,61}[a-z0-9]$`. + string project_id = 1; + + // Target is the service name used to group related deployments: + // * Service name for GAE Flex / Standard. + // * Cluster and container name for GKE. + // * User-specified string for direct GCE profiling (e.g. Java). + // * Job name for Dataflow. + // Validation regex: `^[a-z]([-a-z0-9_.]{0,253}[a-z0-9])?$`. + string target = 2; + + // Labels identify the deployment within the user universe and same target. + // Validation regex for label names: `^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$`. + // Value for an individual label must be <= 512 bytes, the total + // size of all label names and values must be <= 1024 bytes. + // + // Label named "language" can be used to record the programming language of + // the profiled deployment. The standard choices for the value include "java", + // "go", "python", "ruby", "nodejs", "php", "dotnet". + // + // For deployments running on Google Cloud Platform, "zone" or "region" label + // should be present describing the deployment location. An example of a zone + // is "us-central1-a", an example of a region is "us-central1" or + // "us-central". + map labels = 3; +} + +// ProfileType is type of profiling data. +// NOTE: the enumeration member names are used (in lowercase) as unique string +// identifiers of profile types, so they must not be renamed. +enum ProfileType { + // Unspecified profile type. + PROFILE_TYPE_UNSPECIFIED = 0; + + // Thread CPU time sampling. + CPU = 1; + + // Wallclock time sampling. More expensive as stops all threads. + WALL = 2; + + // Heap allocation sampling. + HEAP = 3; + + // Single-shot collection of all thread stacks. + THREADS = 4; + + // Synchronization contention profile. + CONTENTION = 5; +} diff --git a/handwritten/cloud-profiler/google/devtools/cloudtrace/artman_cloudtrace_v1.yaml b/handwritten/cloud-profiler/google/devtools/cloudtrace/artman_cloudtrace_v1.yaml new file mode 100644 index 00000000000..a54eff79fd9 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudtrace/artman_cloudtrace_v1.yaml @@ -0,0 +1,34 @@ +common: + api_name: cloudtrace + api_version: v1 + organization_name: google-cloud + proto_deps: + - name: google-common-protos + src_proto_paths: + - v1 + service_yaml: cloudtrace_v1.yaml + gapic_yaml: v1/cloudtrace_gapic.yaml +artifacts: +- name: gapic_config + type: GAPIC_CONFIG +- name: java_gapic + type: GAPIC + language: JAVA +- name: python_gapic + type: GAPIC + language: PYTHON +- name: nodejs_gapic + type: GAPIC + language: NODEJS +- name: php_gapic + type: GAPIC + language: PHP +- name: go_gapic + type: GAPIC + language: GO +- name: ruby_gapic + type: GAPIC + language: RUBY +- name: csharp_gapic + type: GAPIC + language: CSHARP diff --git a/handwritten/cloud-profiler/google/devtools/cloudtrace/artman_cloudtrace_v2.yaml b/handwritten/cloud-profiler/google/devtools/cloudtrace/artman_cloudtrace_v2.yaml new file mode 100644 index 00000000000..c7e6781c66d --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudtrace/artman_cloudtrace_v2.yaml @@ -0,0 +1,34 @@ +common: + api_name: cloudtrace + api_version: v2 + organization_name: google-cloud + proto_deps: + - name: google-common-protos + src_proto_paths: + - v2 + service_yaml: cloudtrace_v2.yaml + gapic_yaml: v2/cloudtrace_gapic.yaml +artifacts: +- name: gapic_config + type: GAPIC_CONFIG +- name: java_gapic + type: GAPIC + language: JAVA +- name: python_gapic + type: GAPIC + language: PYTHON +- name: nodejs_gapic + type: GAPIC + language: NODEJS +- name: php_gapic + type: GAPIC + language: PHP +- name: go_gapic + type: GAPIC + language: GO +- name: ruby_gapic + type: GAPIC + language: RUBY +- name: csharp_gapic + type: GAPIC + language: CSHARP diff --git a/handwritten/cloud-profiler/google/devtools/cloudtrace/artman_trace.yaml b/handwritten/cloud-profiler/google/devtools/cloudtrace/artman_trace.yaml new file mode 100644 index 00000000000..3466168d871 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudtrace/artman_trace.yaml @@ -0,0 +1,108 @@ +common: + api_name: trace + api_version: v1 + organization_name: google-cloud + service_yaml: trace.yaml + gapic_yaml: v1/trace_gapic.yaml + src_proto_paths: + - v1 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-trace-v1 + - name: grpc + dest: generated/java/grpc-google-cloud-trace-v1 + - name: proto + dest: generated/java/proto-google-cloud-trace-v1 + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-trace +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-trace-v1 + - name: grpc + dest: generated/python/proto-google-cloud-trace-v1 + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: google/cloud/trace_v1 + dest: trace/google/cloud/trace_v1 + - src: tests/unit/gapic/v1 + dest: trace/tests/gapic + - name: grpc + src: google/cloud/proto + dest: trace/google/cloud/proto +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-trace-v1 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-trace + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/trace/v1 + dest: google-cloud-trace/lib/google/cloud/trace/v1 +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: trace/apiv1 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-trace-v1/vendor +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/trace + - name: node + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - dest: packages/trace +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/devtools/cloudtrace/cloudtrace.yaml b/handwritten/cloud-profiler/google/devtools/cloudtrace/cloudtrace.yaml new file mode 100644 index 00000000000..06e2a984f32 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudtrace/cloudtrace.yaml @@ -0,0 +1,30 @@ +type: google.api.Service +config_version: 3 +name: cloudtrace.googleapis.com +title: Stackdriver Trace API + +apis: +- name: google.devtools.cloudtrace.v1.TraceService +- name: google.devtools.cloudtrace.v2.TraceService + +documentation: + summary: |- + Send and retrieve trace data from Stackdriver Trace. Data is generated and + available by default for all App Engine applications. Data from other + applications can be written to Stackdriver Trace for display, reporting, and + analysis. + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/trace.append + - selector: |- + google.devtools.cloudtrace.v1.TraceService.GetTrace, + google.devtools.cloudtrace.v1.TraceService.ListTraces + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/trace.readonly diff --git a/handwritten/cloud-profiler/google/devtools/cloudtrace/cloudtrace_v1.yaml b/handwritten/cloud-profiler/google/devtools/cloudtrace/cloudtrace_v1.yaml new file mode 100644 index 00000000000..1efb3fa377d --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudtrace/cloudtrace_v1.yaml @@ -0,0 +1,29 @@ +type: google.api.Service +config_version: 3 +name: cloudtrace.googleapis.com +title: Stackdriver Trace API + +apis: +- name: google.devtools.cloudtrace.v1.TraceService + +documentation: + summary: |- + Send and retrieve trace data from Stackdriver Trace. Data is generated and + available by default for all App Engine applications. Data from other + applications can be written to Stackdriver Trace for display, reporting, and + analysis. + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/trace.append + - selector: |- + google.devtools.cloudtrace.v1.TraceService.GetTrace, + google.devtools.cloudtrace.v1.TraceService.ListTraces + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/trace.readonly diff --git a/handwritten/cloud-profiler/google/devtools/cloudtrace/cloudtrace_v2.yaml b/handwritten/cloud-profiler/google/devtools/cloudtrace/cloudtrace_v2.yaml new file mode 100644 index 00000000000..efca8f52592 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudtrace/cloudtrace_v2.yaml @@ -0,0 +1,22 @@ +type: google.api.Service +config_version: 3 +name: cloudtrace.googleapis.com +title: Stackdriver Trace API + +apis: +- name: google.devtools.cloudtrace.v2.TraceService + +documentation: + summary: |- + Send and retrieve trace data from Stackdriver Trace. Data is generated and + available by default for all App Engine applications. Data from other + applications can be written to Stackdriver Trace for display, reporting, and + analysis. + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/trace.append diff --git a/handwritten/cloud-profiler/google/devtools/cloudtrace/trace.yaml b/handwritten/cloud-profiler/google/devtools/cloudtrace/trace.yaml new file mode 100644 index 00000000000..195d17dee20 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudtrace/trace.yaml @@ -0,0 +1,32 @@ +type: google.api.Service +title: Stackdriver Trace API +config_version: 2 +name: cloudtrace.googleapis.com + +documentation: + summary: > + Send and retrieve trace data from Stackdriver Trace. Data is + generated and available by default for all App Engine applications. + Data from other applications can be written to Stackdriver Trace + for display, reporting, and analysis. + +apis: +- name: google.devtools.cloudtrace.v1.TraceService + +http: + rules: + - selector: google.devtools.cloudtrace.v1.TraceService.GetTrace + get: /v1/projects/{project_id}/traces/{trace_id} + - selector: google.devtools.cloudtrace.v1.TraceService.ListTraces + get: /v1/projects/{project_id}/traces + - selector: google.devtools.cloudtrace.v1.TraceService.PatchTraces + patch: /v1/projects/{project_id}/traces + body: traces + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/trace.readonly, + https://www.googleapis.com/auth/trace.append diff --git a/handwritten/cloud-profiler/google/devtools/cloudtrace/v1/cloudtrace_gapic.yaml b/handwritten/cloud-profiler/google/devtools/cloudtrace/v1/cloudtrace_gapic.yaml new file mode 100644 index 00000000000..1e094a0808d --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudtrace/v1/cloudtrace_gapic.yaml @@ -0,0 +1,148 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +# The settings of generated code in a specific language. +language_settings: + java: + package_name: com.google.cloud.devtools.cloudtrace.v1 + python: + package_name: google.cloud.devtools.cloudtrace_v1.gapic + go: + package_name: cloud.google.com/go/devtools/cloudtrace/apiv1 + csharp: + package_name: Google.Devtools.Cloudtrace.V1 + ruby: + package_name: Google::Cloud::Devtools::Cloudtrace::V1 + php: + package_name: Google\Cloud\Devtools\Cloudtrace\V1 + nodejs: + package_name: cloudtrace.v1 +# The configuration for the license header to put on generated files. +license_header: + # The file containing the copyright line(s). + copyright_file: copyright-google.txt + # The file containing the raw license header without any copyright line(s). + license_file: license-header-apache-2.0.txt +# A list of API interface configurations. +interfaces: + # The fully qualified name of the API interface. +- name: google.devtools.cloudtrace.v1.TraceService + # A list of resource collection configurations. + # Consists of a name_pattern and an entity_name. + # The name_pattern is a pattern to describe the names of the resources of this + # collection, using the platform's conventions for URI patterns. A generator + # may use this to generate methods to compose and decompose such names. The + # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`; + # those will be taken as hints for the parameter names of the generated + # methods. If empty, no name methods are generated. + # The entity_name is the name to be used as a basis for generated methods and + # classes. + collections: [] + # Definition for retryable codes. + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + # Definition for retry/backoff parameters. + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.2 + max_retry_delay_millis: 1000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1.5 + max_rpc_timeout_millis: 30000 + total_timeout_millis: 45000 + - name: write_sink + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.2 + max_retry_delay_millis: 1000 + initial_rpc_timeout_millis: 30000 + rpc_timeout_multiplier: 1.5 + max_rpc_timeout_millis: 60000 + total_timeout_millis: 120000 + # A list of method configurations. + # Common properties: + # name - The simple name of the method. + # flattening - Specifies the configuration for parameter flattening. + # Describes the parameter groups for which a generator should produce + # method overloads which allow a client to directly pass request message + # fields as method parameters. This information may or may not be used, + # depending on the target language. + # Consists of groups, which each represent a list of parameters to be + # flattened. Each parameter listed must be a field of the request + # message. + # required_fields - Fields that are always required for a request to be + # valid. + # request_object_method - Turns on or off the generation of a method whose + # sole parameter is a request object. Not all languages will generate + # this method. + # page_streaming - Specifies the configuration for paging. + # Describes information for generating a method which transforms a + # paging list RPC into a stream of resources. + # Consists of a request and a response. + # The request specifies request information of the list method. It + # defines which fields match the paging pattern in the request. The + # request consists of a page_size_field and a token_field. The + # page_size_field is the name of the optional field specifying the + # maximum number of elements to be returned in the response. The + # token_field is the name of the field in the request containing the + # page token. + # The response specifies response information of the list method. It + # defines which fields match the paging pattern in the response. The + # response consists of a token_field and a resources_field. The + # token_field is the name of the field in the response containing the + # next page token. The resources_field is the name of the field in the + # response containing the list of resources belonging to the page. + # retry_codes_name - Specifies the configuration for retryable codes. The + # name must be defined in interfaces.retry_codes_def. + # retry_params_name - Specifies the configuration for retry/backoff + # parameters. The name must be defined in interfaces.retry_params_def. + # field_name_patterns - Maps the field name of the request type to + # entity_name of interfaces.collections. + # Specifies the string pattern that the field must follow. + # timeout_millis - Specifies the default timeout for a non-retrying call. If + # the call is retrying, refer to retry_params_name instead. + methods: + - name: ListTraces + required_fields: + - project_id + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: traces + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: GetTrace + flattening: + groups: + - parameters: + - project_id + - trace_id + required_fields: + - project_id + - trace_id + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: PatchTraces + flattening: + groups: + - parameters: + - project_id + - traces + required_fields: + - project_id + - traces + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: write_sink + timeout_millis: 30000 diff --git a/handwritten/cloud-profiler/google/devtools/cloudtrace/v1/trace.proto b/handwritten/cloud-profiler/google/devtools/cloudtrace/v1/trace.proto new file mode 100644 index 00000000000..84f9b7ec673 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudtrace/v1/trace.proto @@ -0,0 +1,282 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.cloudtrace.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Trace.V1"; +option go_package = "google.golang.org/genproto/googleapis/devtools/cloudtrace/v1;cloudtrace"; +option java_multiple_files = true; +option java_outer_classname = "TraceProto"; +option java_package = "com.google.devtools.cloudtrace.v1"; + + +// This file describes an API for collecting and viewing traces and spans +// within a trace. A Trace is a collection of spans corresponding to a single +// operation or set of operations for an application. A span is an individual +// timed event which forms a node of the trace tree. Spans for a single trace +// may span multiple services. +service TraceService { + // Returns of a list of traces that match the specified filter conditions. + rpc ListTraces(ListTracesRequest) returns (ListTracesResponse) { + option (google.api.http) = { get: "/v1/projects/{project_id}/traces" }; + } + + // Gets a single trace by its ID. + rpc GetTrace(GetTraceRequest) returns (Trace) { + option (google.api.http) = { get: "/v1/projects/{project_id}/traces/{trace_id}" }; + } + + // Sends new traces to Stackdriver Trace or updates existing traces. If the ID + // of a trace that you send matches that of an existing trace, any fields + // in the existing trace and its spans are overwritten by the provided values, + // and any new fields provided are merged with the existing trace data. If the + // ID does not match, a new trace is created. + rpc PatchTraces(PatchTracesRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { patch: "/v1/projects/{project_id}/traces" body: "traces" }; + } +} + +// A trace describes how long it takes for an application to perform an +// operation. It consists of a set of spans, each of which represent a single +// timed event within the operation. +message Trace { + // Project ID of the Cloud project where the trace data is stored. + string project_id = 1; + + // Globally unique identifier for the trace. This identifier is a 128-bit + // numeric value formatted as a 32-byte hex string. + string trace_id = 2; + + // Collection of spans in the trace. + repeated TraceSpan spans = 3; +} + +// List of new or updated traces. +message Traces { + // List of traces. + repeated Trace traces = 1; +} + +// A span represents a single timed event within a trace. Spans can be nested +// and form a trace tree. Often, a trace contains a root span that describes the +// end-to-end latency of an operation and, optionally, one or more subspans for +// its suboperations. Spans do not need to be contiguous. There may be gaps +// between spans in a trace. +message TraceSpan { + // Type of span. Can be used to specify additional relationships between spans + // in addition to a parent/child relationship. + enum SpanKind { + // Unspecified. + SPAN_KIND_UNSPECIFIED = 0; + + // Indicates that the span covers server-side handling of an RPC or other + // remote network request. + RPC_SERVER = 1; + + // Indicates that the span covers the client-side wrapper around an RPC or + // other remote request. + RPC_CLIENT = 2; + } + + // Identifier for the span. Must be a 64-bit integer other than 0 and + // unique within a trace. + fixed64 span_id = 1; + + // Distinguishes between spans generated in a particular context. For example, + // two spans with the same name may be distinguished using `RPC_CLIENT` + // and `RPC_SERVER` to identify queueing latency associated with the span. + SpanKind kind = 2; + + // Name of the span. Must be less than 128 bytes. The span name is sanitized + // and displayed in the Stackdriver Trace tool in the + // {% dynamic print site_values.console_name %}. + // The name may be a method name or some other per-call site name. + // For the same executable and the same call point, a best practice is + // to use a consistent name, which makes it easier to correlate + // cross-trace spans. + string name = 3; + + // Start time of the span in nanoseconds from the UNIX epoch. + google.protobuf.Timestamp start_time = 4; + + // End time of the span in nanoseconds from the UNIX epoch. + google.protobuf.Timestamp end_time = 5; + + // ID of the parent span, if any. Optional. + fixed64 parent_span_id = 6; + + // Collection of labels associated with the span. Label keys must be less than + // 128 bytes. Label values must be less than 16 kilobytes (10MB for + // `/stacktrace` values). + // + // Some predefined label keys exist, or you may create your own. When creating + // your own, we recommend the following formats: + // + // * `/category/product/key` for agents of well-known products (e.g. + // `/db/mongodb/read_size`). + // * `short_host/path/key` for domain-specific keys (e.g. + // `foo.com/myproduct/bar`) + // + // Predefined labels include: + // + // * `/agent` + // * `/component` + // * `/error/message` + // * `/error/name` + // * `/http/client_city` + // * `/http/client_country` + // * `/http/client_protocol` + // * `/http/client_region` + // * `/http/host` + // * `/http/method` + // * `/http/redirected_url` + // * `/http/request/size` + // * `/http/response/size` + // * `/http/status_code` + // * `/http/url` + // * `/http/user_agent` + // * `/pid` + // * `/stacktrace` + // * `/tid` + map labels = 7; +} + +// The request message for the `ListTraces` method. All fields are required +// unless specified. +message ListTracesRequest { + // Type of data returned for traces in the list. + enum ViewType { + // Default is `MINIMAL` if unspecified. + VIEW_TYPE_UNSPECIFIED = 0; + + // Minimal view of the trace record that contains only the project + // and trace IDs. + MINIMAL = 1; + + // Root span view of the trace record that returns the root spans along + // with the minimal trace data. + ROOTSPAN = 2; + + // Complete view of the trace record that contains the actual trace data. + // This is equivalent to calling the REST `get` or RPC `GetTrace` method + // using the ID of each listed trace. + COMPLETE = 3; + } + + // ID of the Cloud project where the trace data is stored. + string project_id = 1; + + // Type of data returned for traces in the list. Optional. Default is + // `MINIMAL`. + ViewType view = 2; + + // Maximum number of traces to return. If not specified or <= 0, the + // implementation selects a reasonable value. The implementation may + // return fewer traces than the requested page size. Optional. + int32 page_size = 3; + + // Token identifying the page of results to return. If provided, use the + // value of the `next_page_token` field from a previous request. Optional. + string page_token = 4; + + // Start of the time interval (inclusive) during which the trace data was + // collected from the application. + google.protobuf.Timestamp start_time = 5; + + // End of the time interval (inclusive) during which the trace data was + // collected from the application. + google.protobuf.Timestamp end_time = 6; + + // An optional filter against labels for the request. + // + // By default, searches use prefix matching. To specify exact match, prepend + // a plus symbol (`+`) to the search term. + // Multiple terms are ANDed. Syntax: + // + // * `root:NAME_PREFIX` or `NAME_PREFIX`: Return traces where any root + // span starts with `NAME_PREFIX`. + // * `+root:NAME` or `+NAME`: Return traces where any root span's name is + // exactly `NAME`. + // * `span:NAME_PREFIX`: Return traces where any span starts with + // `NAME_PREFIX`. + // * `+span:NAME`: Return traces where any span's name is exactly + // `NAME`. + // * `latency:DURATION`: Return traces whose overall latency is + // greater or equal to than `DURATION`. Accepted units are nanoseconds + // (`ns`), milliseconds (`ms`), and seconds (`s`). Default is `ms`. For + // example, `latency:24ms` returns traces whose overall latency + // is greater than or equal to 24 milliseconds. + // * `label:LABEL_KEY`: Return all traces containing the specified + // label key (exact match, case-sensitive) regardless of the key:value + // pair's value (including empty values). + // * `LABEL_KEY:VALUE_PREFIX`: Return all traces containing the specified + // label key (exact match, case-sensitive) whose value starts with + // `VALUE_PREFIX`. Both a key and a value must be specified. + // * `+LABEL_KEY:VALUE`: Return all traces containing a key:value pair + // exactly matching the specified text. Both a key and a value must be + // specified. + // * `method:VALUE`: Equivalent to `/http/method:VALUE`. + // * `url:VALUE`: Equivalent to `/http/url:VALUE`. + string filter = 7; + + // Field used to sort the returned traces. Optional. + // Can be one of the following: + // + // * `trace_id` + // * `name` (`name` field of root span in the trace) + // * `duration` (difference between `end_time` and `start_time` fields of + // the root span) + // * `start` (`start_time` field of the root span) + // + // Descending order can be specified by appending `desc` to the sort field + // (for example, `name desc`). + // + // Only one sort field is permitted. + string order_by = 8; +} + +// The response message for the `ListTraces` method. +message ListTracesResponse { + // List of trace records returned. + repeated Trace traces = 1; + + // If defined, indicates that there are more traces that match the request + // and that this value should be passed to the next request to continue + // retrieving additional traces. + string next_page_token = 2; +} + +// The request message for the `GetTrace` method. +message GetTraceRequest { + // ID of the Cloud project where the trace data is stored. + string project_id = 1; + + // ID of the trace to return. + string trace_id = 2; +} + +// The request message for the `PatchTraces` method. +message PatchTracesRequest { + // ID of the Cloud project where the trace data is stored. + string project_id = 1; + + // The body of the message. + Traces traces = 2; +} diff --git a/handwritten/cloud-profiler/google/devtools/cloudtrace/v1/trace_gapic.yaml b/handwritten/cloud-profiler/google/devtools/cloudtrace/v1/trace_gapic.yaml new file mode 100644 index 00000000000..465573bc2d9 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudtrace/v1/trace_gapic.yaml @@ -0,0 +1,88 @@ +type: com.google.api.codegen.ConfigProto +language_settings: + java: + package_name: com.google.cloud.trace.v1 + python: + package_name: google.cloud.trace_v1.gapic + ruby: + package_name: Google::Cloud::Trace::V1 + php: + package_name: Google\Cloud\Trace\V1 + nodejs: + package_name: trace.v1 + domain_layer_location: google-cloud + go: + package_name: cloud.google.com/go/trace/apiv1 + domain_layer_location: cloud.google.com/go/trace + csharp: + package_name: Google.Cloud.Trace.V1 + release_level: GA +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.devtools.cloudtrace.v1.TraceService + smoke_test: + method: ListTraces + init_fields: + - project_id=$PROJECT_ID + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.2 + max_retry_delay_millis: 1000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1.5 + max_rpc_timeout_millis: 30000 + total_timeout_millis: 45000 + methods: + - name: PatchTraces + flattening: + groups: + - parameters: + - project_id + - traces + required_fields: + - project_id + - traces + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 + request_object_method: true + - name: GetTrace + flattening: + groups: + - parameters: + - project_id + - trace_id + required_fields: + - project_id + - trace_id + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 + request_object_method: false + - name: ListTraces + page_streaming: + request: + token_field: page_token + response: + token_field: next_page_token + resources_field: traces + flattening: + groups: + - parameters: + - project_id + required_fields: + - project_id + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 30000 + request_object_method: true diff --git a/handwritten/cloud-profiler/google/devtools/cloudtrace/v2/cloudtrace_gapic.yaml b/handwritten/cloud-profiler/google/devtools/cloudtrace/v2/cloudtrace_gapic.yaml new file mode 100644 index 00000000000..a4d611e51f8 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudtrace/v2/cloudtrace_gapic.yaml @@ -0,0 +1,141 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +# The settings of generated code in a specific language. +language_settings: + java: + package_name: com.google.cloud.devtools.cloudtrace.v2 + python: + package_name: google.cloud.devtools.cloudtrace_v2.gapic + go: + package_name: cloud.google.com/go/devtools/cloudtrace/apiv2 + csharp: + package_name: Google.Devtools.Cloudtrace.V2 + ruby: + package_name: Google::Cloud::Devtools::Cloudtrace::V2 + php: + package_name: Google\Cloud\Devtools\Cloudtrace\V2 + nodejs: + package_name: cloudtrace.v2 +# The configuration for the license header to put on generated files. +license_header: + # The file containing the copyright line(s). + copyright_file: copyright-google.txt + # The file containing the raw license header without any copyright line(s). + license_file: license-header-apache-2.0.txt +# A list of API interface configurations. +interfaces: + # The fully qualified name of the API interface. +- name: google.devtools.cloudtrace.v2.TraceService + # A list of resource collection configurations. + # Consists of a name_pattern and an entity_name. + # The name_pattern is a pattern to describe the names of the resources of this + # collection, using the platform's conventions for URI patterns. A generator + # may use this to generate methods to compose and decompose such names. The + # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`; + # those will be taken as hints for the parameter names of the generated + # methods. If empty, no name methods are generated. + # The entity_name is the name to be used as a basis for generated methods and + # classes. + collections: + - name_pattern: projects/{project} + entity_name: project + - name_pattern: projects/{project}/traces/{trace}/spans/{span} + entity_name: span + # Definition for retryable codes. + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + # Definition for retry/backoff parameters. + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.2 + max_retry_delay_millis: 1000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1.5 + max_rpc_timeout_millis: 30000 + total_timeout_millis: 45000 + - name: write_sink + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.2 + max_retry_delay_millis: 1000 + initial_rpc_timeout_millis: 30000 + rpc_timeout_multiplier: 1.5 + max_rpc_timeout_millis: 60000 + total_timeout_millis: 120000 + + # A list of method configurations. + # Common properties: + # name - The simple name of the method. + # flattening - Specifies the configuration for parameter flattening. + # Describes the parameter groups for which a generator should produce + # method overloads which allow a client to directly pass request message + # fields as method parameters. This information may or may not be used, + # depending on the target language. + # Consists of groups, which each represent a list of parameters to be + # flattened. Each parameter listed must be a field of the request + # message. + # required_fields - Fields that are always required for a request to be + # valid. + # request_object_method - Turns on or off the generation of a method whose + # sole parameter is a request object. Not all languages will generate + # this method. + # page_streaming - Specifies the configuration for paging. + # Describes information for generating a method which transforms a + # paging list RPC into a stream of resources. + # Consists of a request and a response. + # The request specifies request information of the list method. It + # defines which fields match the paging pattern in the request. The + # request consists of a page_size_field and a token_field. The + # page_size_field is the name of the optional field specifying the + # maximum number of elements to be returned in the response. The + # token_field is the name of the field in the request containing the + # page token. + # The response specifies response information of the list method. It + # defines which fields match the paging pattern in the response. The + # response consists of a token_field and a resources_field. The + # token_field is the name of the field in the response containing the + # next page token. The resources_field is the name of the field in the + # response containing the list of resources belonging to the page. + # retry_codes_name - Specifies the configuration for retryable codes. The + # name must be defined in interfaces.retry_codes_def. + # retry_params_name - Specifies the configuration for retry/backoff + # parameters. The name must be defined in interfaces.retry_params_def. + # field_name_patterns - Maps the field name of the request type to + # entity_name of interfaces.collections. + # Specifies the string pattern that the field must follow. + # timeout_millis - Specifies the default timeout for a non-retrying call. If + # the call is retrying, refer to retry_params_name instead. + methods: + - name: BatchWriteSpans + flattening: + groups: + - parameters: + - name + - spans + required_fields: + - name + - spans + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: write_sink + field_name_patterns: + name: project + timeout_millis: 30000 + - name: CreateSpan + required_fields: + - name + - span_id + - display_name + - start_time + - end_time + request_object_method: true + retry_codes_name: idempotent + retry_params_name: write_sink + field_name_patterns: + name: span + timeout_millis: 30000 diff --git a/handwritten/cloud-profiler/google/devtools/cloudtrace/v2/trace.proto b/handwritten/cloud-profiler/google/devtools/cloudtrace/v2/trace.proto new file mode 100644 index 00000000000..2750be9721e --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudtrace/v2/trace.proto @@ -0,0 +1,332 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.cloudtrace.v2; + +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Trace.V2"; +option go_package = "google.golang.org/genproto/googleapis/devtools/cloudtrace/v2;cloudtrace"; +option java_multiple_files = true; +option java_outer_classname = "TraceProto"; +option java_package = "com.google.devtools.cloudtrace.v2"; + + +// A span represents a single operation within a trace. Spans can be +// nested to form a trace tree. Often, a trace contains a root span +// that describes the end-to-end latency, and one or more subspans for +// its sub-operations. A trace can also contain multiple root spans, +// or none at all. Spans do not need to be contiguous—there may be +// gaps or overlaps between spans in a trace. +message Span { + // A set of attributes, each in the format `[KEY]:[VALUE]`. + message Attributes { + // The set of attributes. Each attribute's key can be up to 128 bytes + // long. The value can be a string up to 256 bytes, an integer, or the + // Boolean values `true` and `false`. For example: + // + // "/instance_id": "my-instance" + // "/http/user_agent": "" + // "/http/request_bytes": 300 + // "abc.com/myattribute": true + map attribute_map = 1; + + // The number of attributes that were discarded. Attributes can be discarded + // because their keys are too long or because there are too many attributes. + // If this value is 0 then all attributes are valid. + int32 dropped_attributes_count = 2; + } + + // A time-stamped annotation or message event in the Span. + message TimeEvent { + // Text annotation with a set of attributes. + message Annotation { + // A user-supplied message describing the event. The maximum length for + // the description is 256 bytes. + TruncatableString description = 1; + + // A set of attributes on the annotation. There is a limit of 4 attributes + // per Annotation. + Attributes attributes = 2; + } + + // An event describing a message sent/received between Spans. + message MessageEvent { + // Indicates whether the message was sent or received. + enum Type { + // Unknown event type. + TYPE_UNSPECIFIED = 0; + + // Indicates a sent message. + SENT = 1; + + // Indicates a received message. + RECEIVED = 2; + } + + // Type of MessageEvent. Indicates whether the message was sent or + // received. + Type type = 1; + + // An identifier for the MessageEvent's message that can be used to match + // SENT and RECEIVED MessageEvents. It is recommended to be unique within + // a Span. + int64 id = 2; + + // The number of uncompressed bytes sent or received. + int64 uncompressed_size_bytes = 3; + + // The number of compressed bytes sent or received. If missing assumed to + // be the same size as uncompressed. + int64 compressed_size_bytes = 4; + } + + // The timestamp indicating the time the event occurred. + google.protobuf.Timestamp time = 1; + + // A `TimeEvent` can contain either an `Annotation` object or a + // `MessageEvent` object, but not both. + oneof value { + // Text annotation with a set of attributes. + Annotation annotation = 2; + + // An event describing a message sent/received between Spans. + MessageEvent message_event = 3; + } + } + + // A collection of `TimeEvent`s. A `TimeEvent` is a time-stamped annotation + // on the span, consisting of either user-supplied key:value pairs, or + // details of a message sent/received between Spans. + message TimeEvents { + // A collection of `TimeEvent`s. + repeated TimeEvent time_event = 1; + + // The number of dropped annotations in all the included time events. + // If the value is 0, then no annotations were dropped. + int32 dropped_annotations_count = 2; + + // The number of dropped message events in all the included time events. + // If the value is 0, then no message events were dropped. + int32 dropped_message_events_count = 3; + } + + // A pointer from the current span to another span in the same trace or in a + // different trace. For example, this can be used in batching operations, + // where a single batch handler processes multiple requests from different + // traces or when the handler receives a request from a different project. + message Link { + // The relationship of the current span relative to the linked span: child, + // parent, or unspecified. + enum Type { + // The relationship of the two spans is unknown. + TYPE_UNSPECIFIED = 0; + + // The linked span is a child of the current span. + CHILD_LINKED_SPAN = 1; + + // The linked span is a parent of the current span. + PARENT_LINKED_SPAN = 2; + } + + // `TRACE_ID` identifies a trace within a project. + string trace_id = 1; + + // `SPAN_ID` identifies a span within a trace. + string span_id = 2; + + // The relationship of the current span relative to the linked span. + Type type = 3; + + // A set of attributes on the link. There is a limit of 32 attributes per + // link. + Attributes attributes = 4; + } + + // A collection of links, which are references from this span to a span + // in the same or different trace. + message Links { + // A collection of links. + repeated Link link = 1; + + // The number of dropped links after the maximum size was enforced. If + // this value is 0, then no links were dropped. + int32 dropped_links_count = 2; + } + + // The resource name of the span in the following format: + // + // projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID] + // + // [TRACE_ID] is a unique identifier for a trace within a project. + // [SPAN_ID] is a unique identifier for a span within a trace, + // assigned when the span is created. + string name = 1; + + // The [SPAN_ID] portion of the span's resource name. + // The ID is a 16-character hexadecimal encoding of an 8-byte array. + string span_id = 2; + + // The [SPAN_ID] of this span's parent span. If this is a root span, + // then this field must be empty. + string parent_span_id = 3; + + // A description of the span's operation (up to 128 bytes). + // Stackdriver Trace displays the description in the + // {% dynamic print site_values.console_name %}. + // For example, the display name can be a qualified method name or a file name + // and a line number where the operation is called. A best practice is to use + // the same display name within an application and at the same call point. + // This makes it easier to correlate spans in different traces. + TruncatableString display_name = 4; + + // The start time of the span. On the client side, this is the time kept by + // the local machine where the span execution starts. On the server side, this + // is the time when the server's application handler starts running. + google.protobuf.Timestamp start_time = 5; + + // The end time of the span. On the client side, this is the time kept by + // the local machine where the span execution ends. On the server side, this + // is the time when the server application handler stops running. + google.protobuf.Timestamp end_time = 6; + + // A set of attributes on the span. There is a limit of 32 attributes per + // span. + Attributes attributes = 7; + + // Stack trace captured at the start of the span. + StackTrace stack_trace = 8; + + // The included time events. There can be up to 32 annotations and 128 message + // events per span. + TimeEvents time_events = 9; + + // A maximum of 128 links are allowed per Span. + Links links = 10; + + // An optional final status for this span. + google.rpc.Status status = 11; + + // A highly recommended but not required flag that identifies when a trace + // crosses a process boundary. True when the parent_span belongs to the + // same process as the current span. + google.protobuf.BoolValue same_process_as_parent_span = 12; + + // An optional number of child spans that were generated while this span + // was active. If set, allows implementation to detect missing child spans. + google.protobuf.Int32Value child_span_count = 13; +} + +// The allowed types for [VALUE] in a `[KEY]:[VALUE]` attribute. +message AttributeValue { + // The type of the value. + oneof value { + // A string up to 256 bytes long. + TruncatableString string_value = 1; + + // A 64-bit signed integer. + int64 int_value = 2; + + // A Boolean value represented by `true` or `false`. + bool bool_value = 3; + } +} + +// A call stack appearing in a trace. +message StackTrace { + // Represents a single stack frame in a stack trace. + message StackFrame { + // The fully-qualified name that uniquely identifies the function or + // method that is active in this frame (up to 1024 bytes). + TruncatableString function_name = 1; + + // An un-mangled function name, if `function_name` is + // [mangled](http://www.avabodh.com/cxxin/namemangling.html). The name can + // be fully-qualified (up to 1024 bytes). + TruncatableString original_function_name = 2; + + // The name of the source file where the function call appears (up to 256 + // bytes). + TruncatableString file_name = 3; + + // The line number in `file_name` where the function call appears. + int64 line_number = 4; + + // The column number where the function call appears, if available. + // This is important in JavaScript because of its anonymous functions. + int64 column_number = 5; + + // The binary module from where the code was loaded. + Module load_module = 6; + + // The version of the deployed source code (up to 128 bytes). + TruncatableString source_version = 7; + } + + // A collection of stack frames, which can be truncated. + message StackFrames { + // Stack frames in this call stack. + repeated StackFrame frame = 1; + + // The number of stack frames that were dropped because there + // were too many stack frames. + // If this value is 0, then no stack frames were dropped. + int32 dropped_frames_count = 2; + } + + // Stack frames in this stack trace. A maximum of 128 frames are allowed. + StackFrames stack_frames = 1; + + // The hash ID is used to conserve network bandwidth for duplicate + // stack traces within a single trace. + // + // Often multiple spans will have identical stack traces. + // The first occurrence of a stack trace should contain both the + // `stackFrame` content and a value in `stackTraceHashId`. + // + // Subsequent spans within the same request can refer + // to that stack trace by only setting `stackTraceHashId`. + int64 stack_trace_hash_id = 2; +} + +// Binary module. +message Module { + // For example: main binary, kernel modules, and dynamic libraries + // such as libc.so, sharedlib.so (up to 256 bytes). + TruncatableString module = 1; + + // A unique identifier for the module, usually a hash of its + // contents (up to 128 bytes). + TruncatableString build_id = 2; +} + +// Represents a string that might be shortened to a specified length. +message TruncatableString { + // The shortened string. For example, if the original string was 500 + // bytes long and the limit of the string was 128 bytes, then this + // value contains the first 128 bytes of the 500-byte string. Note that + // truncation always happens on the character boundary, to ensure that + // truncated string is still valid UTF8. In case of multi-byte characters, + // size of truncated string can be less than truncation limit. + string value = 1; + + // The number of bytes removed from the original string. If this + // value is 0, then the string was not shortened. + int32 truncated_byte_count = 2; +} diff --git a/handwritten/cloud-profiler/google/devtools/cloudtrace/v2/tracing.proto b/handwritten/cloud-profiler/google/devtools/cloudtrace/v2/tracing.proto new file mode 100644 index 00000000000..a99fae74a9b --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/cloudtrace/v2/tracing.proto @@ -0,0 +1,60 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.cloudtrace.v2; + +import "google/api/annotations.proto"; +import "google/devtools/cloudtrace/v2/trace.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Trace.V2"; +option go_package = "google.golang.org/genproto/googleapis/devtools/cloudtrace/v2;cloudtrace"; +option java_multiple_files = true; +option java_outer_classname = "TracingProto"; +option java_package = "com.google.devtools.cloudtrace.v2"; + + +// This file describes an API for collecting and viewing traces and spans +// within a trace. A Trace is a collection of spans corresponding to a single +// operation or set of operations for an application. A span is an individual +// timed event which forms a node of the trace tree. A single trace may +// contain span(s) from multiple services. +service TraceService { + // Sends new spans to Stackdriver Trace or updates existing traces. If the + // name of a trace that you send matches that of an existing trace, new spans + // are added to the existing trace. Attempt to update existing spans results + // undefined behavior. If the name does not match, a new trace is created + // with given set of spans. + rpc BatchWriteSpans(BatchWriteSpansRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v2/{name=projects/*}/traces:batchWrite" body: "*" }; + } + + // Creates a new Span. + rpc CreateSpan(Span) returns (Span) { + option (google.api.http) = { put: "/v2/{name=projects/*/traces/*/spans/*}" body: "*" }; + } +} + +// The request message for the `BatchWriteSpans` method. +message BatchWriteSpansRequest { + // Required. Name of the project where the spans belong. The format is + // `projects/PROJECT_ID`. + string name = 1; + + // A collection of spans. + repeated Span spans = 2; +} diff --git a/handwritten/cloud-profiler/google/devtools/remoteexecution/v1test/remote_execution.proto b/handwritten/cloud-profiler/google/devtools/remoteexecution/v1test/remote_execution.proto new file mode 100644 index 00000000000..454962a88bf --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/remoteexecution/v1test/remote_execution.proto @@ -0,0 +1,957 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.remoteexecution.v1test; + +import "google/api/annotations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.RemoteExecution.V1Test"; +option go_package = "google.golang.org/genproto/googleapis/devtools/remoteexecution/v1test;remoteexecution"; +option java_multiple_files = true; +option java_outer_classname = "RemoteExecutionProto"; +option java_package = "com.google.devtools.remoteexecution.v1test"; +option objc_class_prefix = "REX"; + + +// The Remote Execution API is used to execute an +// [Action][google.devtools.remoteexecution.v1test.Action] on the remote +// workers. +// +// As with other services in the Remote Execution API, any call may return an +// error with a [RetryInfo][google.rpc.RetryInfo] error detail providing +// information about when the client should retry the request; clients SHOULD +// respect the information provided. +service Execution { + // Execute an action remotely. + // + // In order to execute an action, the client must first upload all of the + // inputs, as well as the + // [Command][google.devtools.remoteexecution.v1test.Command] to run, into the + // [ContentAddressableStorage][google.devtools.remoteexecution.v1test.ContentAddressableStorage]. + // It then calls `Execute` with an + // [Action][google.devtools.remoteexecution.v1test.Action] referring to them. + // The server will run the action and eventually return the result. + // + // The input `Action`'s fields MUST meet the various canonicalization + // requirements specified in the documentation for their types so that it has + // the same digest as other logically equivalent `Action`s. The server MAY + // enforce the requirements and return errors if a non-canonical input is + // received. It MAY also proceed without verifying some or all of the + // requirements, such as for performance reasons. If the server does not + // verify the requirement, then it will treat the `Action` as distinct from + // another logically equivalent action if they hash differently. + // + // Returns a [google.longrunning.Operation][google.longrunning.Operation] + // describing the resulting execution, with eventual `response` + // [ExecuteResponse][google.devtools.remoteexecution.v1test.ExecuteResponse]. + // The `metadata` on the operation is of type + // [ExecuteOperationMetadata][google.devtools.remoteexecution.v1test.ExecuteOperationMetadata]. + // + // To query the operation, you can use the + // [Operations API][google.longrunning.Operations.GetOperation]. If you wish + // to allow the server to stream operations updates, rather than requiring + // client polling, you can use the + // [Watcher API][google.watcher.v1.Watcher.Watch] with the Operation's `name` + // as the `target`. + // + // When using the Watcher API, the initial `data` will be the `Operation` at + // the time of the request. Updates will be provided periodically by the + // server until the `Operation` completes, at which point the response message + // will (assuming no error) be at `data.response`. + // + // The server NEED NOT implement other methods or functionality of the + // Operation and Watcher APIs. + // + // Errors discovered during creation of the `Operation` will be reported + // as gRPC Status errors, while errors that occurred while running the + // action will be reported in the `status` field of the `ExecuteResponse`. The + // server MUST NOT set the `error` field of the `Operation` proto. + // The possible errors include: + // * `INVALID_ARGUMENT`: One or more arguments are invalid. + // * `FAILED_PRECONDITION`: One or more errors occurred in setting up the + // action requested, such as a missing input or command or no worker being + // available. The client may be able to fix the errors and retry. + // * `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to run + // the action. + // * `UNAVAILABLE`: Due to a transient condition, such as all workers being + // occupied (and the server does not support a queue), the action could not + // be started. The client should retry. + // * `INTERNAL`: An internal error occurred in the execution engine or the + // worker. + // * `DEADLINE_EXCEEDED`: The execution timed out. + // + // In the case of a missing input or command, the server SHOULD additionally + // send a [PreconditionFailure][google.rpc.PreconditionFailure] error detail + // where, for each requested blob not present in the CAS, there is a + // `Violation` with a `type` of `MISSING` and a `subject` of + // `"blobs/{hash}/{size}"` indicating the digest of the missing blob. + rpc Execute(ExecuteRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1test/{instance_name=**}/actions:execute" body: "*" }; + } +} + +// The action cache API is used to query whether a given action has already been +// performed and, if so, retrieve its result. Unlike the +// [ContentAddressableStorage][google.devtools.remoteexecution.v1test.ContentAddressableStorage], +// which addresses blobs by their own content, the action cache addresses the +// [ActionResult][google.devtools.remoteexecution.v1test.ActionResult] by a +// digest of the encoded [Action][google.devtools.remoteexecution.v1test.Action] +// which produced them. +// +// The lifetime of entries in the action cache is implementation-specific, but +// the server SHOULD assume that more recently used entries are more likely to +// be used again. Additionally, action cache implementations SHOULD ensure that +// any blobs referenced in the +// [ContentAddressableStorage][google.devtools.remoteexecution.v1test.ContentAddressableStorage] +// are still valid when returning a result. +// +// As with other services in the Remote Execution API, any call may return an +// error with a [RetryInfo][google.rpc.RetryInfo] error detail providing +// information about when the client should retry the request; clients SHOULD +// respect the information provided. +service ActionCache { + // Retrieve a cached execution result. + // + // Errors: + // * `NOT_FOUND`: The requested `ActionResult` is not in the cache. + rpc GetActionResult(GetActionResultRequest) returns (ActionResult) { + option (google.api.http) = { get: "/v1test/{instance_name=**}/actionResults/{action_digest.hash}/{action_digest.size_bytes}" }; + } + + // Upload a new execution result. + // + // This method is intended for servers which implement the distributed cache + // independently of the + // [Execution][google.devtools.remoteexecution.v1test.Execution] API. As a + // result, it is OPTIONAL for servers to implement. + // + // Errors: + // * `NOT_IMPLEMENTED`: This method is not supported by the server. + // * `RESOURCE_EXHAUSTED`: There is insufficient storage space to add the + // entry to the cache. + rpc UpdateActionResult(UpdateActionResultRequest) returns (ActionResult) { + option (google.api.http) = { put: "/v1test/{instance_name=**}/actionResults/{action_digest.hash}/{action_digest.size_bytes}" body: "action_result" }; + } +} + +// The CAS (content-addressable storage) is used to store the inputs to and +// outputs from the execution service. Each piece of content is addressed by the +// digest of its binary data. +// +// Most of the binary data stored in the CAS is opaque to the execution engine, +// and is only used as a communication medium. In order to build an +// [Action][google.devtools.remoteexecution.v1test.Action], +// however, the client will need to also upload the +// [Command][google.devtools.remoteexecution.v1test.Command] and input root +// [Directory][google.devtools.remoteexecution.v1test.Directory] for the Action. +// The Command and Directory messages must be marshalled to wire format and then +// uploaded under the hash as with any other piece of content. In practice, the +// input root directory is likely to refer to other Directories in its +// hierarchy, which must also each be uploaded on their own. +// +// For small file uploads the client should group them together and call +// [BatchUpdateBlobs][google.devtools.remoteexecution.v1test.ContentAddressableStorage.BatchUpdateBlobs] +// on chunks of no more than 10 MiB. For large uploads, the client must use the +// [Write method][google.bytestream.ByteStream.Write] of the ByteStream API. The +// `resource_name` is `{instance_name}/uploads/{uuid}/blobs/{hash}/{size}`, +// where `instance_name` is as described in the next paragraph, `uuid` is a +// version 4 UUID generated by the client, and `hash` and `size` are the +// [Digest][google.devtools.remoteexecution.v1test.Digest] of the blob. The +// `uuid` is used only to avoid collisions when multiple clients try to upload +// the same file (or the same client tries to upload the file multiple times at +// once on different threads), so the client MAY reuse the `uuid` for uploading +// different blobs. The `resource_name` may optionally have a trailing filename +// (or other metadata) for a client to use if it is storing URLs, as in +// `{instance}/uploads/{uuid}/blobs/{hash}/{size}/foo/bar/baz.cc`. Anything +// after the `size` is ignored. +// +// A single server MAY support multiple instances of the execution system, each +// with their own workers, storage, cache, etc. The exact relationship between +// instances is up to the server. If the server does, then the `instance_name` +// is an identifier, possibly containing multiple path segments, used to +// distinguish between the various instances on the server, in a manner defined +// by the server. For servers which do not support multiple instances, then the +// `instance_name` is the empty path and the leading slash is omitted, so that +// the `resource_name` becomes `uploads/{uuid}/blobs/{hash}/{size}`. +// +// When attempting an upload, if another client has already completed the upload +// (which may occur in the middle of a single upload if another client uploads +// the same blob concurrently), the request will terminate immediately with +// a response whose `committed_size` is the full size of the uploaded file +// (regardless of how much data was transmitted by the client). If the client +// completes the upload but the +// [Digest][google.devtools.remoteexecution.v1test.Digest] does not match, an +// `INVALID_ARGUMENT` error will be returned. In either case, the client should +// not attempt to retry the upload. +// +// For downloading blobs, the client must use the +// [Read method][google.bytestream.ByteStream.Read] of the ByteStream API, with +// a `resource_name` of `"{instance_name}/blobs/{hash}/{size}"`, where +// `instance_name` is the instance name (see above), and `hash` and `size` are +// the [Digest][google.devtools.remoteexecution.v1test.Digest] of the blob. +// +// The lifetime of entries in the CAS is implementation specific, but it SHOULD +// be long enough to allow for newly-added and recently looked-up entries to be +// used in subsequent calls (e.g. to +// [Execute][google.devtools.remoteexecution.v1test.Execution.Execute]). +// +// As with other services in the Remote Execution API, any call may return an +// error with a [RetryInfo][google.rpc.RetryInfo] error detail providing +// information about when the client should retry the request; clients SHOULD +// respect the information provided. +service ContentAddressableStorage { + // Determine if blobs are present in the CAS. + // + // Clients can use this API before uploading blobs to determine which ones are + // already present in the CAS and do not need to be uploaded again. + // + // There are no method-specific errors. + rpc FindMissingBlobs(FindMissingBlobsRequest) returns (FindMissingBlobsResponse) { + option (google.api.http) = { post: "/v1test/{instance_name=**}/blobs:findMissing" body: "*" }; + } + + // Upload many blobs at once. + // + // The client MUST NOT upload blobs with a combined total size of more than 10 + // MiB using this API. Such requests should either be split into smaller + // chunks or uploaded using the + // [ByteStream API][google.bytestream.ByteStream], as appropriate. + // + // This request is equivalent to calling [UpdateBlob][] on each individual + // blob, in parallel. The requests may succeed or fail independently. + // + // Errors: + // * `INVALID_ARGUMENT`: The client attempted to upload more than 10 MiB of + // data. + // + // Individual requests may return the following errors, additionally: + // * `RESOURCE_EXHAUSTED`: There is insufficient disk quota to store the blob. + // * `INVALID_ARGUMENT`: The + // [Digest][google.devtools.remoteexecution.v1test.Digest] does not match the + // provided data. + rpc BatchUpdateBlobs(BatchUpdateBlobsRequest) returns (BatchUpdateBlobsResponse) { + option (google.api.http) = { post: "/v1test/{instance_name=**}/blobs:batchUpdate" body: "*" }; + } + + // DEPRECATED: This method is deprecated and should no longer be used. + rpc GetTree(GetTreeRequest) returns (GetTreeResponse) { + option (google.api.http) = { get: "/v1test/{instance_name=**}/blobs/{root_digest.hash}/{root_digest.size_bytes}:getTree" }; + } +} + +// An `Action` captures all the information about an execution which is required +// to reproduce it. +// +// `Action`s are the core component of the [Execution] service. A single +// `Action` represents a repeatable action that can be performed by the +// execution service. `Action`s can be succinctly identified by the digest of +// their wire format encoding and, once an `Action` has been executed, will be +// cached in the action cache. Future requests can then use the cached result +// rather than needing to run afresh. +// +// When a server completes execution of an +// [Action][google.devtools.remoteexecution.v1test.Action], it MAY choose to +// cache the [result][google.devtools.remoteexecution.v1test.ActionResult] in +// the [ActionCache][google.devtools.remoteexecution.v1test.ActionCache] unless +// `do_not_cache` is `true`. Clients SHOULD expect the server to do so. By +// default, future calls to [Execute][] the same `Action` will also serve their +// results from the cache. Clients must take care to understand the caching +// behaviour. Ideally, all `Action`s will be reproducible so that serving a +// result from cache is always desirable and correct. +message Action { + // The digest of the [Command][google.devtools.remoteexecution.v1test.Command] + // to run, which MUST be present in the + // [ContentAddressableStorage][google.devtools.remoteexecution.v1test.ContentAddressableStorage]. + Digest command_digest = 1; + + // The digest of the root + // [Directory][google.devtools.remoteexecution.v1test.Directory] for the input + // files. The files in the directory tree are available in the correct + // location on the build machine before the command is executed. The root + // directory, as well as every subdirectory and content blob referred to, MUST + // be in the + // [ContentAddressableStorage][google.devtools.remoteexecution.v1test.ContentAddressableStorage]. + Digest input_root_digest = 2; + + // A list of the output files that the client expects to retrieve from the + // action. Only the listed files, as well as directories listed in + // `output_directories`, will be returned to the client as output. + // Other files that may be created during command execution are discarded. + // + // The paths are specified using forward slashes (`/`) as path separators, + // even if the execution platform natively uses a different separator. The + // path MUST NOT include a trailing slash. + // + // In order to ensure consistent hashing of the same Action, the output paths + // MUST be sorted lexicographically by code point (or, equivalently, by UTF-8 + // bytes). + repeated string output_files = 3; + + // A list of the output directories that the client expects to retrieve from + // the action. Only the contents of the indicated directories (recursively + // including the contents of their subdirectories) will be + // returned, as well as files listed in `output_files`. Other files that may + // be created during command execution are discarded. + // + // The paths are specified using forward slashes (`/`) as path separators, + // even if the execution platform natively uses a different separator. The + // path MUST NOT include a trailing slash, unless the path is `"/"` (which, + // although not recommended, can be used to capture the entire working + // directory tree, including inputs). + // + // In order to ensure consistent hashing of the same Action, the output paths + // MUST be sorted lexicographically by code point (or, equivalently, by UTF-8 + // bytes). + repeated string output_directories = 4; + + // The platform requirements for the execution environment. The server MAY + // choose to execute the action on any worker satisfying the requirements, so + // the client SHOULD ensure that running the action on any such worker will + // have the same result. + Platform platform = 5; + + // A timeout after which the execution should be killed. If the timeout is + // absent, then the client is specifying that the execution should continue + // as long as the server will let it. The server SHOULD impose a timeout if + // the client does not specify one, however, if the client does specify a + // timeout that is longer than the server's maximum timeout, the server MUST + // reject the request. + // + // The timeout is a part of the + // [Action][google.devtools.remoteexecution.v1test.Action] message, and + // therefore two `Actions` with different timeouts are different, even if they + // are otherwise identical. This is because, if they were not, running an + // `Action` with a lower timeout than is required might result in a cache hit + // from an execution run with a longer timeout, hiding the fact that the + // timeout is too short. By encoding it directly in the `Action`, a lower + // timeout will result in a cache miss and the execution timeout will fail + // immediately, rather than whenever the cache entry gets evicted. + google.protobuf.Duration timeout = 6; + + // If true, then the `Action`'s result cannot be cached. + bool do_not_cache = 7; +} + +// A `Command` is the actual command executed by a worker running an +// [Action][google.devtools.remoteexecution.v1test.Action]. +// +// Except as otherwise required, the environment (such as which system +// libraries or binaries are available, and what filesystems are mounted where) +// is defined by and specific to the implementation of the remote execution API. +message Command { + // An `EnvironmentVariable` is one variable to set in the running program's + // environment. + message EnvironmentVariable { + // The variable name. + string name = 1; + + // The variable value. + string value = 2; + } + + // The arguments to the command. The first argument must be the path to the + // executable, which must be either a relative path, in which case it is + // evaluated with respect to the input root, or an absolute path. The `PATH` + // environment variable, or similar functionality on other systems, is not + // used to determine which executable to run. + // + // The working directory will always be the input root. + repeated string arguments = 1; + + // The environment variables to set when running the program. The worker may + // provide its own default environment variables; these defaults can be + // overridden using this field. Additional variables can also be specified. + // + // In order to ensure that equivalent `Command`s always hash to the same + // value, the environment variables MUST be lexicographically sorted by name. + // Sorting of strings is done by code point, equivalently, by the UTF-8 bytes. + repeated EnvironmentVariable environment_variables = 2; +} + +// A `Platform` is a set of requirements, such as hardware, operation system, or +// compiler toolchain, for an +// [Action][google.devtools.remoteexecution.v1test.Action]'s execution +// environment. A `Platform` is represented as a series of key-value pairs +// representing the properties that are required of the platform. +// +// This message is currently being redeveloped since it is an overly simplistic +// model of platforms. +message Platform { + // A single property for the environment. The server is responsible for + // specifying the property `name`s that it accepts. If an unknown `name` is + // provided in the requirements for an + // [Action][google.devtools.remoteexecution.v1test.Action], the server SHOULD + // reject the execution request. If permitted by the server, the same `name` + // may occur multiple times. + // + // The server is also responsible for specifying the interpretation of + // property `value`s. For instance, a property describing how much RAM must be + // available may be interpreted as allowing a worker with 16GB to fulfill a + // request for 8GB, while a property describing the OS environment on which + // the action must be performed may require an exact match with the worker's + // OS. + // + // The server MAY use the `value` of one or more properties to determine how + // it sets up the execution environment, such as by making specific system + // files available to the worker. + message Property { + // The property name. + string name = 1; + + // The property value. + string value = 2; + } + + // The properties that make up this platform. In order to ensure that + // equivalent `Platform`s always hash to the same value, the properties MUST + // be lexicographically sorted by name, and then by value. Sorting of strings + // is done by code point, equivalently, by the UTF-8 bytes. + repeated Property properties = 1; +} + +// A `Directory` represents a directory node in a file tree, containing zero or +// more children [FileNodes][google.devtools.remoteexecution.v1test.FileNode] +// and [DirectoryNodes][google.devtools.remoteexecution.v1test.DirectoryNode]. +// Each `Node` contains its name in the directory, the digest of its content +// (either a file blob or a `Directory` proto), as well as possibly some +// metadata about the file or directory. +// +// In order to ensure that two equivalent directory trees hash to the same +// value, the following restrictions MUST be obeyed when constructing a +// a `Directory`: +// - Every child in the directory must have a path of exactly one segment. +// Multiple levels of directory hierarchy may not be collapsed. +// - Each child in the directory must have a unique path segment (file name). +// - The files and directories in the directory must each be sorted in +// lexicographical order by path. The path strings must be sorted by code +// point, equivalently, by UTF-8 bytes. +// +// A `Directory` that obeys the restrictions is said to be in canonical form. +// +// As an example, the following could be used for a file named `bar` and a +// directory named `foo` with an executable file named `baz` (hashes shortened +// for readability): +// +// ```json +// // (Directory proto) +// { +// files: [ +// { +// name: "bar", +// digest: { +// hash: "4a73bc9d03...", +// size: 65534 +// } +// } +// ], +// directories: [ +// { +// name: "foo", +// digest: { +// hash: "4cf2eda940...", +// size: 43 +// } +// } +// ] +// } +// +// // (Directory proto with hash "4cf2eda940..." and size 43) +// { +// files: [ +// { +// name: "baz", +// digest: { +// hash: "b2c941073e...", +// size: 1294, +// }, +// is_executable: true +// } +// ] +// } +// ``` +message Directory { + // The files in the directory. + repeated FileNode files = 1; + + // The subdirectories in the directory. + repeated DirectoryNode directories = 2; +} + +// A `FileNode` represents a single file and associated metadata. +message FileNode { + // The name of the file. + string name = 1; + + // The digest of the file's content. + Digest digest = 2; + + // True if file is executable, false otherwise. + bool is_executable = 4; +} + +// A `DirectoryNode` represents a child of a +// [Directory][google.devtools.remoteexecution.v1test.Directory] which is itself +// a `Directory` and its associated metadata. +message DirectoryNode { + // The name of the directory. + string name = 1; + + // The digest of the + // [Directory][google.devtools.remoteexecution.v1test.Directory] object + // represented. See [Digest][google.devtools.remoteexecution.v1test.Digest] + // for information about how to take the digest of a proto message. + Digest digest = 2; +} + +// A content digest. A digest for a given blob consists of the size of the blob +// and its hash. The hash algorithm to use is defined by the server, but servers +// SHOULD use SHA-256. +// +// The size is considered to be an integral part of the digest and cannot be +// separated. That is, even if the `hash` field is correctly specified but +// `size_bytes` is not, the server MUST reject the request. +// +// The reason for including the size in the digest is as follows: in a great +// many cases, the server needs to know the size of the blob it is about to work +// with prior to starting an operation with it, such as flattening Merkle tree +// structures or streaming it to a worker. Technically, the server could +// implement a separate metadata store, but this results in a significantly more +// complicated implementation as opposed to having the client specify the size +// up-front (or storing the size along with the digest in every message where +// digests are embedded). This does mean that the API leaks some implementation +// details of (what we consider to be) a reasonable server implementation, but +// we consider this to be a worthwhile tradeoff. +// +// When a `Digest` is used to refer to a proto message, it always refers to the +// message in binary encoded form. To ensure consistent hashing, clients and +// servers MUST ensure that they serialize messages according to the following +// rules, even if there are alternate valid encodings for the same message. +// - Fields are serialized in tag order. +// - There are no unknown fields. +// - There are no duplicate fields. +// - Fields are serialized according to the default semantics for their type. +// +// Most protocol buffer implementations will always follow these rules when +// serializing, but care should be taken to avoid shortcuts. For instance, +// concatenating two messages to merge them may produce duplicate fields. +message Digest { + // The hash. In the case of SHA-256, it will always be a lowercase hex string + // exactly 64 characters long. + string hash = 1; + + // The size of the blob, in bytes. + int64 size_bytes = 2; +} + +// An ActionResult represents the result of an +// [Action][google.devtools.remoteexecution.v1test.Action] being run. +message ActionResult { + // The output files of the action. For each output file requested, if the + // corresponding file existed after the action completed, a single entry will + // be present in the output list. + // + // If the action does not produce the requested output, or produces a + // directory where a regular file is expected or vice versa, then that output + // will be omitted from the list. The server is free to arrange the output + // list as desired; clients MUST NOT assume that the output list is sorted. + repeated OutputFile output_files = 2; + + // The output directories of the action. For each output directory requested, + // if the corresponding directory existed after the action completed, a single + // entry will be present in the output list, which will contain the digest of + // a [Tree][google.devtools.remoteexecution.v1.test.Tree] message containing + // the directory tree. + repeated OutputDirectory output_directories = 3; + + // The exit code of the command. + int32 exit_code = 4; + + // The standard output buffer of the action. The server will determine, based + // on the size of the buffer, whether to return it in raw form or to return + // a digest in `stdout_digest` that points to the buffer. If neither is set, + // then the buffer is empty. The client SHOULD NOT assume it will get one of + // the raw buffer or a digest on any given request and should be prepared to + // handle either. + bytes stdout_raw = 5; + + // The digest for a blob containing the standard output of the action, which + // can be retrieved from the + // [ContentAddressableStorage][google.devtools.remoteexecution.v1test.ContentAddressableStorage]. + // See `stdout_raw` for when this will be set. + Digest stdout_digest = 6; + + // The standard error buffer of the action. The server will determine, based + // on the size of the buffer, whether to return it in raw form or to return + // a digest in `stderr_digest` that points to the buffer. If neither is set, + // then the buffer is empty. The client SHOULD NOT assume it will get one of + // the raw buffer or a digest on any given request and should be prepared to + // handle either. + bytes stderr_raw = 7; + + // The digest for a blob containing the standard error of the action, which + // can be retrieved from the + // [ContentAddressableStorage][google.devtools.remoteexecution.v1test.ContentAddressableStorage]. + // See `stderr_raw` for when this will be set. + Digest stderr_digest = 8; +} + +// An `OutputFile` is similar to a +// [FileNode][google.devtools.remoteexecution.v1test.FileNode], but it is +// tailored for output as part of an `ActionResult`. It allows a full file path +// rather than only a name, and allows the server to include content inline. +// +// `OutputFile` is binary-compatible with `FileNode`. +message OutputFile { + // The full path of the file relative to the input root, including the + // filename. The path separator is a forward slash `/`. + string path = 1; + + // The digest of the file's content. + Digest digest = 2; + + // The raw content of the file. + // + // This field may be used by the server to provide the content of a file + // inline in an + // [ActionResult][google.devtools.remoteexecution.v1test.ActionResult] and + // avoid requiring that the client make a separate call to + // [ContentAddressableStorage.GetBlob] to retrieve it. + // + // The client SHOULD NOT assume that it will get raw content with any request, + // and always be prepared to retrieve it via `digest`. + bytes content = 3; + + // True if file is executable, false otherwise. + bool is_executable = 4; +} + +// A `Tree` contains all the +// [Directory][google.devtools.remoteexecution.v1test.Directory] protos in a +// single directory Merkle tree, compressed into one message. +message Tree { + // The root directory in the tree. + Directory root = 1; + + // All the child directories: the directories referred to by the root and, + // recursively, all its children. In order to reconstruct the directory tree, + // the client must take the digests of each of the child directories and then + // build up a tree starting from the `root`. + repeated Directory children = 2; +} + +// An `OutputDirectory` is the output in an `ActionResult` corresponding to a +// directory's full contents rather than a single file. +message OutputDirectory { + // The full path of the directory relative to the input root, including the + // filename. The path separator is a forward slash `/`. + string path = 1; + + // DEPRECATED: This field is deprecated and should no longer be used. + Digest digest = 2; + + // The digest of the encoded + // [Tree][google.devtools.remoteexecution.v1test.Tree] proto containing the + // directory's contents. + Digest tree_digest = 3; +} + +// A request message for +// [Execution.Execute][google.devtools.remoteexecution.v1test.Execution.Execute]. +message ExecuteRequest { + // The instance of the execution system to operate against. A server may + // support multiple instances of the execution system (with their own workers, + // storage, caches, etc.). The server MAY require use of this field to select + // between them in an implementation-defined fashion, otherwise it can be + // omitted. + string instance_name = 1; + + // The action to be performed. + Action action = 2; + + // If true, the action will be executed anew even if its result was already + // present in the cache. If false, the result may be served from the + // [ActionCache][google.devtools.remoteexecution.v1test.ActionCache]. + bool skip_cache_lookup = 3; + + // DEPRECATED: This field should be ignored by clients and servers and will be + // removed. + int32 total_input_file_count = 4; + + // DEPRECATED: This field should be ignored by clients and servers and will be + // removed. + int64 total_input_file_bytes = 5; +} + +// A `LogFile` is a log stored in the CAS. +message LogFile { + // The digest of the log contents. + Digest digest = 1; + + // This is a hint as to the purpose of the log, and is set to true if the log + // is human-readable text that can be usefully displayed to a user, and false + // otherwise. For instance, if a command-line client wishes to print the + // server logs to the terminal for a failed action, this allows it to avoid + // displaying a binary file. + bool human_readable = 2; +} + +// The response message for +// [Execution.Execute][google.devtools.remoteexecution.v1test.Execution.Execute], +// which will be contained in the [response +// field][google.longrunning.Operation.response] of the +// [Operation][google.longrunning.Operation]. +message ExecuteResponse { + // The result of the action. + ActionResult result = 1; + + // True if the result was served from cache, false if it was executed. + bool cached_result = 2; + + // If the status has a code other than `OK`, it indicates that the action did + // not finish execution. For example, if the operation times out during + // execution, the status will have a `DEADLINE_EXCEEDED` code. Servers MUST + // use this field for errors in execution, rather than the error field on the + // `Operation` object. + // + // If the status code is other than `OK`, then the result MUST NOT be cached. + // For an error status, the `result` field is optional; the server may + // populate the output-, stdout-, and stderr-related fields if it has any + // information available, such as the stdout and stderr of a timed-out action. + google.rpc.Status status = 3; + + // An optional list of additional log outputs the server wishes to provide. A + // server can use this to return execution-specific logs however it wishes. + // This is intended primarily to make it easier for users to debug issues that + // may be outside of the actual job execution, such as by identifying the + // worker executing the action or by providing logs from the worker's setup + // phase. The keys SHOULD be human readable so that a client can display them + // to a user. + map server_logs = 4; +} + +// Metadata about an ongoing +// [execution][google.devtools.remoteexecution.v1test.Execution.Execute], which +// will be contained in the [metadata +// field][google.longrunning.Operation.response] of the +// [Operation][google.longrunning.Operation]. +message ExecuteOperationMetadata { + // The current stage of execution. + enum Stage { + UNKNOWN = 0; + + // Checking the result against the cache. + CACHE_CHECK = 1; + + // Currently idle, awaiting a free machine to execute. + QUEUED = 2; + + // Currently being executed by a worker. + EXECUTING = 3; + + // Finished execution. + COMPLETED = 4; + } + + Stage stage = 1; + + // The digest of the [Action][google.devtools.remoteexecution.v1test.Action] + // being executed. + Digest action_digest = 2; + + // If set, the client can use this name with + // [ByteStream.Read][google.bytestream.ByteStream.Read] to stream the + // standard output. + string stdout_stream_name = 3; + + // If set, the client can use this name with + // [ByteStream.Read][google.bytestream.ByteStream.Read] to stream the + // standard error. + string stderr_stream_name = 4; +} + +// A request message for +// [ActionCache.GetActionResult][google.devtools.remoteexecution.v1test.ActionCache.GetActionResult]. +message GetActionResultRequest { + // The instance of the execution system to operate against. A server may + // support multiple instances of the execution system (with their own workers, + // storage, caches, etc.). The server MAY require use of this field to select + // between them in an implementation-defined fashion, otherwise it can be + // omitted. + string instance_name = 1; + + // The digest of the [Action][google.devtools.remoteexecution.v1test.Action] + // whose result is requested. + Digest action_digest = 2; +} + +// A request message for +// [ActionCache.UpdateActionResult][google.devtools.remoteexecution.v1test.ActionCache.UpdateActionResult]. +message UpdateActionResultRequest { + // The instance of the execution system to operate against. A server may + // support multiple instances of the execution system (with their own workers, + // storage, caches, etc.). The server MAY require use of this field to select + // between them in an implementation-defined fashion, otherwise it can be + // omitted. + string instance_name = 1; + + // The digest of the [Action][google.devtools.remoteexecution.v1test.Action] + // whose result is being uploaded. + Digest action_digest = 2; + + // The [ActionResult][google.devtools.remoteexecution.v1test.ActionResult] + // to store in the cache. + ActionResult action_result = 3; +} + +// A request message for +// [ContentAddressableStorage.FindMissingBlobs][google.devtools.remoteexecution.v1test.ContentAddressableStorage.FindMissingBlobs]. +message FindMissingBlobsRequest { + // The instance of the execution system to operate against. A server may + // support multiple instances of the execution system (with their own workers, + // storage, caches, etc.). The server MAY require use of this field to select + // between them in an implementation-defined fashion, otherwise it can be + // omitted. + string instance_name = 1; + + // A list of the blobs to check. + repeated Digest blob_digests = 2; +} + +// A response message for +// [ContentAddressableStorage.FindMissingBlobs][google.devtools.remoteexecution.v1test.ContentAddressableStorage.FindMissingBlobs]. +message FindMissingBlobsResponse { + // A list of the blobs requested *not* present in the storage. + repeated Digest missing_blob_digests = 2; +} + +// A single request message for +// [ContentAddressableStorage.BatchUpdateBlobs][google.devtools.remoteexecution.v1test.ContentAddressableStorage.BatchUpdateBlobs]. +message UpdateBlobRequest { + // The digest of the blob. This MUST be the digest of `data`. + Digest content_digest = 1; + + // The raw binary data. + bytes data = 2; +} + +// A request message for +// [ContentAddressableStorage.BatchUpdateBlobs][google.devtools.remoteexecution.v1test.ContentAddressableStorage.BatchUpdateBlobs]. +message BatchUpdateBlobsRequest { + // The instance of the execution system to operate against. A server may + // support multiple instances of the execution system (with their own workers, + // storage, caches, etc.). The server MAY require use of this field to select + // between them in an implementation-defined fashion, otherwise it can be + // omitted. + string instance_name = 1; + + // The individual upload requests. + repeated UpdateBlobRequest requests = 2; +} + +// A response message for +// [ContentAddressableStorage.BatchUpdateBlobs][google.devtools.remoteexecution.v1test.ContentAddressableStorage.BatchUpdateBlobs]. +message BatchUpdateBlobsResponse { + // A response corresponding to a single blob that the client tried to upload. + message Response { + // The digest to which this response corresponds. + Digest blob_digest = 1; + + // The result of attempting to upload that blob. + google.rpc.Status status = 2; + } + + // The responses to the requests. + repeated Response responses = 1; +} + +// A request message for +// [ContentAddressableStorage.GetTree][google.devtools.remoteexecution.v1test.ContentAddressableStorage.GetTree]. +// This message is deprecated and should no longer be used. +message GetTreeRequest { + // The instance of the execution system to operate against. A server may + // support multiple instances of the execution system (with their own workers, + // storage, caches, etc.). The server MAY require use of this field to select + // between them in an implementation-defined fashion, otherwise it can be + // omitted. + string instance_name = 1; + + // The digest of the root, which must be an encoded + // [Directory][google.devtools.remoteexecution.v1test.Directory] message + // stored in the + // [ContentAddressableStorage][google.devtools.remoteexecution.v1test.ContentAddressableStorage]. + Digest root_digest = 2; + + // A maximum page size to request. If present, the server will request no more + // than this many items. Regardless of whether a page size is specified, the + // server may place its own limit on the number of items to be returned and + // require the client to retrieve more items using a subsequent request. + int32 page_size = 3; + + // A page token, which must be a value received in a previous + // [GetTreeResponse][google.devtools.remoteexecution.v1test.GetTreeResponse]. + // If present, the server will use it to return the following page of results. + string page_token = 4; +} + +// A response message for +// [ContentAddressableStorage.GetTree][google.devtools.remoteexecution.v1test.ContentAddressableStorage.GetTree]. +// This message is deprecated and should no longer be used. +message GetTreeResponse { + // The directories descended from the requested root. + repeated Directory directories = 1; + + // If present, signifies that there are more results which the client can + // retrieve by passing this as the page_token in a subsequent + // [request][google.devtools.remoteexecution.v1test.GetTreeRequest]. + // If empty, signifies that this is the last page of results. + string next_page_token = 2; +} + +// Details for the tool used to call the API. +message ToolDetails { + // Name of the tool, e.g. bazel. + string tool_name = 1; + + // Version of the tool used for the request, e.g. 5.0.3. + string tool_version = 2; +} + +// An optional Metadata to attach to any RPC request to tell the server about an +// external context of the request. The server may use this for logging or other +// purposes. To use it, the client attaches the header to the call using the +// canonical proto serialization: +// name: google.devtools.remoteexecution.v1test.requestmetadata-bin +// contents: the base64 encoded binary RequestMetadata message. +message RequestMetadata { + // The details for the tool invoking the requests. + ToolDetails tool_details = 1; + + // An identifier that ties multiple requests to the same action. + // For example, multiple requests to the CAS, Action Cache, and Execution + // API are used in order to compile foo.cc. + string action_id = 2; + + // An identifier that ties multiple actions together to a final result. + // For example, multiple actions are required to build and run foo_test. + string tool_invocation_id = 3; + + // An identifier to tie multiple tool invocations together. For example, + // runs of foo_test, bar_test and baz_test on a post-submit of a given patch. + string correlated_invocations_id = 4; +} diff --git a/handwritten/cloud-profiler/google/devtools/remoteexecution/v1test/remote_execution.yaml b/handwritten/cloud-profiler/google/devtools/remoteexecution/v1test/remote_execution.yaml new file mode 100644 index 00000000000..3d4503bbab0 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/remoteexecution/v1test/remote_execution.yaml @@ -0,0 +1,19 @@ +type: google.api.Service +config_version: 3 +name: remoteexecution.googleapis.com +title: Remote Execution API + +apis: +- name: google.bytestream.ByteStream +- name: google.devtools.remoteexecution.v1test.ActionCache +- name: google.devtools.remoteexecution.v1test.ContentAddressableStorage +- name: google.devtools.remoteexecution.v1test.Execution +- name: google.longrunning.Operations +- name: google.watcher.v1.Watcher + +types: +- name: google.devtools.remoteexecution.v1test.Command +- name: google.devtools.remoteexecution.v1test.ExecuteResponse +- name: google.devtools.remoteexecution.v1test.ExecuteOperationMetadata +- name: google.devtools.remoteexecution.v1test.RequestMetadata +- name: google.devtools.remoteexecution.v1test.Tree diff --git a/handwritten/cloud-profiler/google/devtools/source/v1/source_context.proto b/handwritten/cloud-profiler/google/devtools/source/v1/source_context.proto new file mode 100644 index 00000000000..cacfebdd2b1 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/source/v1/source_context.proto @@ -0,0 +1,181 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.source.v1; + +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.DevTools.Source.V1"; +option go_package = "google.golang.org/genproto/googleapis/devtools/source/v1;source"; +option java_multiple_files = true; +option java_outer_classname = "SourceContextProto"; +option java_package = "com.google.devtools.source.v1"; + + +// A SourceContext is a reference to a tree of files. A SourceContext together +// with a path point to a unique revision of a single file or directory. +message SourceContext { + // A SourceContext can refer any one of the following types of repositories. + oneof context { + // A SourceContext referring to a revision in a cloud repo. + CloudRepoSourceContext cloud_repo = 1; + + // A SourceContext referring to a snapshot in a cloud workspace. + CloudWorkspaceSourceContext cloud_workspace = 2; + + // A SourceContext referring to a Gerrit project. + GerritSourceContext gerrit = 3; + + // A SourceContext referring to any third party Git repo (e.g. GitHub). + GitSourceContext git = 6; + } +} + +// An ExtendedSourceContext is a SourceContext combined with additional +// details describing the context. +message ExtendedSourceContext { + // Any source context. + SourceContext context = 1; + + // Labels with user defined metadata. + map labels = 2; +} + +// An alias to a repo revision. +message AliasContext { + // The type of an Alias. + enum Kind { + // Do not use. + ANY = 0; + + // Git tag + FIXED = 1; + + // Git branch + MOVABLE = 2; + + // OTHER is used to specify non-standard aliases, those not of the kinds + // above. For example, if a Git repo has a ref named "refs/foo/bar", it + // is considered to be of kind OTHER. + OTHER = 4; + } + + // The alias kind. + Kind kind = 1; + + // The alias name. + string name = 2; +} + +// A CloudRepoSourceContext denotes a particular revision in a cloud +// repo (a repo hosted by the Google Cloud Platform). +message CloudRepoSourceContext { + // The ID of the repo. + RepoId repo_id = 1; + + // A revision in a cloud repository can be identified by either its revision + // ID or its Alias. + oneof revision { + // A revision ID. + string revision_id = 2; + + // The name of an alias (branch, tag, etc.). + string alias_name = 3; + + // An alias, which may be a branch or tag. + AliasContext alias_context = 4; + } +} + +// A CloudWorkspaceSourceContext denotes a workspace at a particular snapshot. +message CloudWorkspaceSourceContext { + // The ID of the workspace. + CloudWorkspaceId workspace_id = 1; + + // The ID of the snapshot. + // An empty snapshot_id refers to the most recent snapshot. + string snapshot_id = 2; +} + +// A SourceContext referring to a Gerrit project. +message GerritSourceContext { + // The URI of a running Gerrit instance. + string host_uri = 1; + + // The full project name within the host. Projects may be nested, so + // "project/subproject" is a valid project name. + // The "repo name" is hostURI/project. + string gerrit_project = 2; + + // A revision in a Gerrit project can be identified by either its revision ID + // or its alias. + oneof revision { + // A revision (commit) ID. + string revision_id = 3; + + // The name of an alias (branch, tag, etc.). + string alias_name = 4; + + // An alias, which may be a branch or tag. + AliasContext alias_context = 5; + } +} + +// A GitSourceContext denotes a particular revision in a third party Git +// repository (e.g. GitHub). +message GitSourceContext { + // Git repository URL. + string url = 1; + + // Git commit hash. + // required. + string revision_id = 2; +} + +// A unique identifier for a cloud repo. +message RepoId { + // A cloud repository can be identified by either its project ID and + // repository name combination, or its globally unique identifier. + oneof id { + // A combination of a project ID and a repo name. + ProjectRepoId project_repo_id = 1; + + // A server-assigned, globally unique identifier. + string uid = 2; + } +} + +// Selects a repo using a Google Cloud Platform project ID +// (e.g. winged-cargo-31) and a repo name within that project. +message ProjectRepoId { + // The ID of the project. + string project_id = 1; + + // The name of the repo. Leave empty for the default repo. + string repo_name = 2; +} + +// A CloudWorkspaceId is a unique identifier for a cloud workspace. +// A cloud workspace is a place associated with a repo where modified files +// can be stored before they are committed. +message CloudWorkspaceId { + // The ID of the repo containing the workspace. + RepoId repo_id = 1; + + // The unique name of the workspace within the repo. This is the name + // chosen by the client in the Source API's CreateWorkspace method. + string name = 2; +} diff --git a/handwritten/cloud-profiler/google/devtools/sourcerepo/v1/sourcerepo.proto b/handwritten/cloud-profiler/google/devtools/sourcerepo/v1/sourcerepo.proto new file mode 100644 index 00000000000..2fb04b2b024 --- /dev/null +++ b/handwritten/cloud-profiler/google/devtools/sourcerepo/v1/sourcerepo.proto @@ -0,0 +1,163 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.devtools.sourcerepo.v1; + +import "google/api/annotations.proto"; +import "google/api/auth.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/protobuf/empty.proto"; + +option go_package = "google.golang.org/genproto/googleapis/devtools/sourcerepo/v1;sourcerepo"; +option java_multiple_files = true; +option java_outer_classname = "SourceRepoProto"; +option java_package = "com.google.devtools.sourcerepo.v1"; + + +// The Source Repo API service. +service SourceRepo { + // Returns all repos belonging to a project. The sizes of the repos are + // not set by ListRepos. To get the size of a repo, use GetRepo. + rpc ListRepos(ListReposRequest) returns (ListReposResponse) { + option (google.api.http) = { get: "/v1/{name=projects/*}/repos" }; + } + + // Returns information about a repo. + rpc GetRepo(GetRepoRequest) returns (Repo) { + option (google.api.http) = { get: "/v1/{name=projects/*/repos/**}" }; + } + + // Creates a repo in the given project with the given name. + // + // If the named repository already exists, `CreateRepo` returns + // `ALREADY_EXISTS`. + rpc CreateRepo(CreateRepoRequest) returns (Repo) { + option (google.api.http) = { post: "/v1/{parent=projects/*}/repos" body: "repo" }; + } + + // Deletes a repo. + rpc DeleteRepo(DeleteRepoRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/{name=projects/*/repos/**}" }; + } + + // Sets the access control policy on the specified resource. Replaces any + // existing policy. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { post: "/v1/{resource=projects/*/repos/**}:setIamPolicy" body: "*" }; + } + + // Gets the access control policy for a resource. + // Returns an empty policy if the resource exists and does not have a policy + // set. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { get: "/v1/{resource=projects/*/repos/**}:getIamPolicy" }; + } + + // Returns permissions that a caller has on the specified resource. + // If the resource does not exist, this will return an empty set of + // permissions, not a NOT_FOUND error. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { post: "/v1/{resource=projects/*/repos/**}:testIamPermissions" body: "*" }; + } +} + +// A repository (or repo) is a Git repository storing versioned source content. +message Repo { + // Resource name of the repository, of the form + // `projects//repos/`. + string name = 1; + + // The disk usage of the repo, in bytes. + // Only returned by GetRepo. + int64 size = 2; + + // URL to clone the repository from Google Cloud Source Repositories. + string url = 3; + + // How this repository mirrors a repository managed by another service. + MirrorConfig mirror_config = 4; +} + +// Configuration to automatically mirror a repository from another +// hosting service, for example GitHub or BitBucket. +message MirrorConfig { + // URL of the main repository at the other hosting service. + string url = 1; + + // ID of the webhook listening to updates to trigger mirroring. + // Removing this webook from the other hosting service will stop + // Google Cloud Source Repositories from receiving notifications, + // and thereby disabling mirroring. + string webhook_id = 2; + + // ID of the SSH deploy key at the other hosting service. + // Removing this key from the other service would deauthorize + // Google Cloud Source Repositories from mirroring. + string deploy_key_id = 3; +} + +// Request for GetRepo. +message GetRepoRequest { + // The name of the requested repository. Values are of the form + // `projects//repos/`. + string name = 1; +} + +// Request for ListRepos. +message ListReposRequest { + // The project ID whose repos should be listed. Values are of the form + // `projects/`. + string name = 1; + + // Maximum number of repositories to return; between 1 and 500. + // If not set or zero, defaults to 100 at the server. + int32 page_size = 2; + + // Resume listing repositories where a prior ListReposResponse + // left off. This is an opaque token that must be obtained from + // a recent, prior ListReposResponse's next_page_token field. + string page_token = 3; +} + +// Response for ListRepos. The size is not set in the returned repositories. +message ListReposResponse { + // The listed repos. + repeated Repo repos = 1; + + // If non-empty, additional repositories exist within the project. These + // can be retrieved by including this value in the next ListReposRequest's + // page_token field. + string next_page_token = 2; +} + +// Request for CreateRepo +message CreateRepoRequest { + // The project in which to create the repo. Values are of the form + // `projects/`. + string parent = 1; + + // The repo to create. Only name should be set; setting other fields + // is an error. The project in the name should match the parent field. + Repo repo = 2; +} + +// Request for DeleteRepo. +message DeleteRepoRequest { + // The name of the repo to delete. Values are of the form + // `projects//repos/`. + string name = 1; +} diff --git a/handwritten/cloud-profiler/google/example/library/README.md b/handwritten/cloud-profiler/google/example/library/README.md new file mode 100644 index 00000000000..ee3aa684d58 --- /dev/null +++ b/handwritten/cloud-profiler/google/example/library/README.md @@ -0,0 +1,4 @@ +# Introduction +This is a Google example service representing a simple digital library. +It manages a collection of shelf resources, and each shelf owns a collection +of book resources. diff --git a/handwritten/cloud-profiler/google/example/library/library.yaml b/handwritten/cloud-profiler/google/example/library/library.yaml new file mode 100644 index 00000000000..56c6c021efc --- /dev/null +++ b/handwritten/cloud-profiler/google/example/library/library.yaml @@ -0,0 +1,7 @@ +type: google.api.Service +config_version: 3 +name: library-example.googleapis.com +title: Google Example Library API + +apis: +- name: google.example.library.v1.LibraryService diff --git a/handwritten/cloud-profiler/google/example/library/library_gapic.yaml b/handwritten/cloud-profiler/google/example/library/library_gapic.yaml new file mode 100755 index 00000000000..0233e2758da --- /dev/null +++ b/handwritten/cloud-profiler/google/example/library/library_gapic.yaml @@ -0,0 +1,199 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +language_settings: + java: + package_name: com.google.cloud.example.library.spi.v1 + python: + package_name: google.cloud.gapic.example.library.v1 + go: + package_name: cloud.google.com/go/example/library/apiv1 + csharp: + package_name: Google.Example.Library.V1 + ruby: + package_name: Google::Cloud::Example::Library::V1 + php: + package_name: Google\Cloud\Example\Library\V1 + nodejs: + package_name: library.v1 +interfaces: +- name: google.example.library.v1.LibraryService + collections: + - name_pattern: shelves/{shelf} + entity_name: shelf + - name_pattern: shelves/{shelf}/books/{book} + entity_name: book + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + methods: + - name: CreateShelf + flattening: + groups: + - parameters: + - shelf + required_fields: + - shelf + request_object_method: false + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: GetShelf + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: shelf + timeout_millis: 60000 + - name: ListShelves + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: shelves + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: DeleteShelf + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: shelf + timeout_millis: 60000 + - name: MergeShelves + flattening: + groups: + - parameters: + - name + - other_shelf_name + required_fields: + - name + - other_shelf_name + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + name: shelf + timeout_millis: 60000 + - name: CreateBook + flattening: + groups: + - parameters: + - name + - book + required_fields: + - name + - book + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + name: shelf + timeout_millis: 60000 + - name: GetBook + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: book + timeout_millis: 60000 + - name: ListBooks + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: books + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: shelf + timeout_millis: 60000 + - name: DeleteBook + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: book + timeout_millis: 60000 + - name: UpdateBook + flattening: + groups: + - parameters: + - name + - book + required_fields: + - name + - book + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: book + timeout_millis: 60000 + - name: MoveBook + flattening: + groups: + - parameters: + - name + - other_shelf_name + required_fields: + - name + - other_shelf_name + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + name: book + timeout_millis: 60000 diff --git a/handwritten/cloud-profiler/google/example/library/v1/library.proto b/handwritten/cloud-profiler/google/example/library/v1/library.proto new file mode 100644 index 00000000000..c31f77201e2 --- /dev/null +++ b/handwritten/cloud-profiler/google/example/library/v1/library.proto @@ -0,0 +1,254 @@ +// Copyright (c) 2015, Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.example.library.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; + +option go_package = "google.golang.org/genproto/googleapis/example/library/v1;library"; +option java_multiple_files = true; +option java_outer_classname = "LibraryProto"; +option java_package = "com.google.example.library.v1"; + + +// This API represents a simple digital library. It lets you manage Shelf +// resources and Book resources in the library. It defines the following +// resource model: +// +// - The API has a collection of [Shelf][google.example.library.v1.Shelf] +// resources, named `shelves/*` +// +// - Each Shelf has a collection of [Book][google.example.library.v1.Book] +// resources, named `shelves/*/books/*` +service LibraryService { + // Creates a shelf, and returns the new Shelf. + rpc CreateShelf(CreateShelfRequest) returns (Shelf) { + option (google.api.http) = { post: "/v1/shelves" body: "shelf" }; + } + + // Gets a shelf. Returns NOT_FOUND if the shelf does not exist. + rpc GetShelf(GetShelfRequest) returns (Shelf) { + option (google.api.http) = { get: "/v1/{name=shelves/*}" }; + } + + // Lists shelves. The order is unspecified but deterministic. Newly created + // shelves will not necessarily be added to the end of this list. + rpc ListShelves(ListShelvesRequest) returns (ListShelvesResponse) { + option (google.api.http) = { get: "/v1/shelves" }; + } + + // Deletes a shelf. Returns NOT_FOUND if the shelf does not exist. + rpc DeleteShelf(DeleteShelfRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/{name=shelves/*}" }; + } + + // Merges two shelves by adding all books from the shelf named + // `other_shelf_name` to shelf `name`, and deletes + // `other_shelf_name`. Returns the updated shelf. + // The book ids of the moved books may not be the same as the original books. + // + // Returns NOT_FOUND if either shelf does not exist. + // This call is a no-op if the specified shelves are the same. + rpc MergeShelves(MergeShelvesRequest) returns (Shelf) { + option (google.api.http) = { post: "/v1/{name=shelves/*}:merge" body: "*" }; + } + + // Creates a book, and returns the new Book. + rpc CreateBook(CreateBookRequest) returns (Book) { + option (google.api.http) = { post: "/v1/{name=shelves/*}/books" body: "book" }; + } + + // Gets a book. Returns NOT_FOUND if the book does not exist. + rpc GetBook(GetBookRequest) returns (Book) { + option (google.api.http) = { get: "/v1/{name=shelves/*/books/*}" }; + } + + // Lists books in a shelf. The order is unspecified but deterministic. Newly + // created books will not necessarily be added to the end of this list. + // Returns NOT_FOUND if the shelf does not exist. + rpc ListBooks(ListBooksRequest) returns (ListBooksResponse) { + option (google.api.http) = { get: "/v1/{name=shelves/*}/books" }; + } + + // Deletes a book. Returns NOT_FOUND if the book does not exist. + rpc DeleteBook(DeleteBookRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/{name=shelves/*/books/*}" }; + } + + // Updates a book. Returns INVALID_ARGUMENT if the name of the book + // is non-empty and does equal the previous name. + rpc UpdateBook(UpdateBookRequest) returns (Book) { + option (google.api.http) = { put: "/v1/{name=shelves/*/books/*}" body: "book" }; + } + + // Moves a book to another shelf, and returns the new book. The book + // id of the new book may not be the same as the original book. + rpc MoveBook(MoveBookRequest) returns (Book) { + option (google.api.http) = { post: "/v1/{name=shelves/*/books/*}:move" body: "*" }; + } +} + +// A single book in the library. +message Book { + // The resource name of the book. + // Book names have the form `shelves/{shelf_id}/books/{book_id}`. + // The name is ignored when creating a book. + string name = 1; + + // The name of the book author. + string author = 2; + + // The title of the book. + string title = 3; + + // Value indicating whether the book has been read. + bool read = 4; +} + +// A Shelf contains a collection of books with a theme. +message Shelf { + // The resource name of the shelf. + // Shelf names have the form `shelves/{shelf_id}`. + // The name is ignored when creating a shelf. + string name = 1; + + // The theme of the shelf + string theme = 2; +} + +// Request message for LibraryService.CreateShelf. +message CreateShelfRequest { + // The shelf to create. + Shelf shelf = 1; +} + +// Request message for LibraryService.GetShelf. +message GetShelfRequest { + // The name of the shelf to retrieve. + string name = 1; +} + +// Request message for LibraryService.ListShelves. +message ListShelvesRequest { + // Requested page size. Server may return fewer shelves than requested. + // If unspecified, server will pick an appropriate default. + int32 page_size = 1; + + // A token identifying a page of results the server should return. + // Typically, this is the value of + // [ListShelvesResponse.next_page_token][google.example.library.v1.ListShelvesResponse.next_page_token] + // returned from the previous call to `ListShelves` method. + string page_token = 2; +} + +// Response message for LibraryService.ListShelves. +message ListShelvesResponse { + // The list of shelves. + repeated Shelf shelves = 1; + + // A token to retrieve next page of results. + // Pass this value in the + // [ListShelvesRequest.page_token][google.example.library.v1.ListShelvesRequest.page_token] + // field in the subsequent call to `ListShelves` method to retrieve the next + // page of results. + string next_page_token = 2; +} + +// Request message for LibraryService.DeleteShelf. +message DeleteShelfRequest { + // The name of the shelf to delete. + string name = 1; +} + +// Describes the shelf being removed (other_shelf_name) and updated +// (name) in this merge. +message MergeShelvesRequest { + // The name of the shelf we're adding books to. + string name = 1; + + // The name of the shelf we're removing books from and deleting. + string other_shelf_name = 2; +} + +// Request message for LibraryService.CreateBook. +message CreateBookRequest { + // The name of the shelf in which the book is created. + string name = 1; + + // The book to create. + Book book = 2; +} + +// Request message for LibraryService.GetBook. +message GetBookRequest { + // The name of the book to retrieve. + string name = 1; +} + +// Request message for LibraryService.ListBooks. +message ListBooksRequest { + // The name of the shelf whose books we'd like to list. + string name = 1; + + // Requested page size. Server may return fewer books than requested. + // If unspecified, server will pick an appropriate default. + int32 page_size = 2; + + // A token identifying a page of results the server should return. + // Typically, this is the value of + // [ListBooksResponse.next_page_token][google.example.library.v1.ListBooksResponse.next_page_token]. + // returned from the previous call to `ListBooks` method. + string page_token = 3; +} + +// Response message for LibraryService.ListBooks. +message ListBooksResponse { + // The list of books. + repeated Book books = 1; + + // A token to retrieve next page of results. + // Pass this value in the + // [ListBooksRequest.page_token][google.example.library.v1.ListBooksRequest.page_token] + // field in the subsequent call to `ListBooks` method to retrieve the next + // page of results. + string next_page_token = 2; +} + +// Request message for LibraryService.UpdateBook. +message UpdateBookRequest { + // The name of the book to update. + string name = 1; + + // The book to update with. The name must match or be empty. + Book book = 2; +} + +// Request message for LibraryService.DeleteBook. +message DeleteBookRequest { + // The name of the book to delete. + string name = 1; +} + +// Describes what book to move (name) and what shelf we're moving it +// to (other_shelf_name). +message MoveBookRequest { + // The name of the book to move. + string name = 1; + + // The name of the destination shelf. + string other_shelf_name = 2; +} diff --git a/handwritten/cloud-profiler/google/firestore/README.md b/handwritten/cloud-profiler/google/firestore/README.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/handwritten/cloud-profiler/google/firestore/admin/v1beta1/firestore_admin.proto b/handwritten/cloud-profiler/google/firestore/admin/v1beta1/firestore_admin.proto new file mode 100644 index 00000000000..823bb315cd8 --- /dev/null +++ b/handwritten/cloud-profiler/google/firestore/admin/v1beta1/firestore_admin.proto @@ -0,0 +1,203 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.firestore.admin.v1beta1; + +import "google/api/annotations.proto"; +import "google/firestore/admin/v1beta1/index.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1beta1;admin"; +option java_multiple_files = true; +option java_outer_classname = "FirestoreAdminProto"; +option java_package = "com.google.firestore.admin.v1beta1"; +option objc_class_prefix = "GCFS"; + + +// The Cloud Firestore Admin API. +// +// This API provides several administrative services for Cloud Firestore. +// +// # Concepts +// +// Project, Database, Namespace, Collection, and Document are used as defined in +// the Google Cloud Firestore API. +// +// Operation: An Operation represents work being performed in the background. +// +// +// # Services +// +// ## Index +// +// The index service manages Cloud Firestore indexes. +// +// Index creation is performed asynchronously. +// An Operation resource is created for each such asynchronous operation. +// The state of the operation (including any errors encountered) +// may be queried via the Operation resource. +// +// ## Metadata +// +// Provides metadata and statistical information about data in Cloud Firestore. +// The data provided as part of this API may be stale. +// +// ## Operation +// +// The Operations collection provides a record of actions performed for the +// specified Project (including any Operations in progress). Operations are not +// created directly but through calls on other collections or resources. +// +// An Operation that is not yet done may be cancelled. The request to cancel is +// asynchronous and the Operation may continue to run for some time after the +// request to cancel is made. +// +// An Operation that is done may be deleted so that it is no longer listed as +// part of the Operation collection. +// +// Operations are created by service `FirestoreAdmin`, but are accessed via +// service `google.longrunning.Operations`. +service FirestoreAdmin { + // Creates the specified index. + // A newly created index's initial state is `CREATING`. On completion of the + // returned [google.longrunning.Operation][google.longrunning.Operation], the state will be `READY`. + // If the index already exists, the call will return an `ALREADY_EXISTS` + // status. + // + // During creation, the process could result in an error, in which case the + // index will move to the `ERROR` state. The process can be recovered by + // fixing the data that caused the error, removing the index with + // [delete][google.firestore.admin.v1beta1.FirestoreAdmin.DeleteIndex], then re-creating the index with + // [create][google.firestore.admin.v1beta1.FirestoreAdmin.CreateIndex]. + // + // Indexes with a single field cannot be created. + rpc CreateIndex(CreateIndexRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1beta1/{parent=projects/*/databases/*}/indexes" body: "index" }; + } + + // Lists the indexes that match the specified filters. + rpc ListIndexes(ListIndexesRequest) returns (ListIndexesResponse) { + option (google.api.http) = { get: "/v1beta1/{parent=projects/*/databases/*}/indexes" }; + } + + // Gets an index. + rpc GetIndex(GetIndexRequest) returns (Index) { + option (google.api.http) = { get: "/v1beta1/{name=projects/*/databases/*/indexes/*}" }; + } + + // Deletes an index. + rpc DeleteIndex(DeleteIndexRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1beta1/{name=projects/*/databases/*/indexes/*}" }; + } +} + +// Metadata for index operations. This metadata populates +// the metadata field of [google.longrunning.Operation][google.longrunning.Operation]. +message IndexOperationMetadata { + // The type of index operation. + enum OperationType { + // Unspecified. Never set by server. + OPERATION_TYPE_UNSPECIFIED = 0; + + // The operation is creating the index. Initiated by a `CreateIndex` call. + CREATING_INDEX = 1; + } + + // The time that work began on the operation. + google.protobuf.Timestamp start_time = 1; + + // The time the operation ended, either successfully or otherwise. Unset if + // the operation is still active. + google.protobuf.Timestamp end_time = 2; + + // The index resource that this operation is acting on. For example: + // `projects/{project_id}/databases/{database_id}/indexes/{index_id}` + string index = 3; + + // The type of index operation. + OperationType operation_type = 4; + + // True if the [google.longrunning.Operation] was cancelled. If the + // cancellation is in progress, cancelled will be true but + // [google.longrunning.Operation.done][google.longrunning.Operation.done] will be false. + bool cancelled = 5; + + // Progress of the existing operation, measured in number of documents. + Progress document_progress = 6; +} + +// Measures the progress of a particular metric. +message Progress { + // An estimate of how much work has been completed. Note that this may be + // greater than `work_estimated`. + int64 work_completed = 1; + + // An estimate of how much work needs to be performed. Zero if the + // work estimate is unavailable. May change as work progresses. + int64 work_estimated = 2; +} + +// The request for [FirestoreAdmin.CreateIndex][google.firestore.admin.v1beta1.FirestoreAdmin.CreateIndex]. +message CreateIndexRequest { + // The name of the database this index will apply to. For example: + // `projects/{project_id}/databases/{database_id}` + string parent = 1; + + // The index to create. The name and state should not be specified. + // Certain single field indexes cannot be created or deleted. + Index index = 2; +} + +// The request for [FirestoreAdmin.GetIndex][google.firestore.admin.v1beta1.FirestoreAdmin.GetIndex]. +message GetIndexRequest { + // The name of the index. For example: + // `projects/{project_id}/databases/{database_id}/indexes/{index_id}` + string name = 1; +} + +// The request for [FirestoreAdmin.ListIndexes][google.firestore.admin.v1beta1.FirestoreAdmin.ListIndexes]. +message ListIndexesRequest { + // The database name. For example: + // `projects/{project_id}/databases/{database_id}` + string parent = 1; + + string filter = 2; + + // The standard List page size. + int32 page_size = 3; + + // The standard List page token. + string page_token = 4; +} + +// The request for [FirestoreAdmin.DeleteIndex][google.firestore.admin.v1beta1.FirestoreAdmin.DeleteIndex]. +message DeleteIndexRequest { + // The index name. For example: + // `projects/{project_id}/databases/{database_id}/indexes/{index_id}` + string name = 1; +} + +// The response for [FirestoreAdmin.ListIndexes][google.firestore.admin.v1beta1.FirestoreAdmin.ListIndexes]. +message ListIndexesResponse { + // The indexes. + repeated Index indexes = 1; + + // The standard List next-page token. + string next_page_token = 2; +} diff --git a/handwritten/cloud-profiler/google/firestore/admin/v1beta1/index.proto b/handwritten/cloud-profiler/google/firestore/admin/v1beta1/index.proto new file mode 100644 index 00000000000..e777e5b9236 --- /dev/null +++ b/handwritten/cloud-profiler/google/firestore/admin/v1beta1/index.proto @@ -0,0 +1,97 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.firestore.admin.v1beta1; + +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1beta1;admin"; +option java_multiple_files = true; +option java_outer_classname = "IndexProto"; +option java_package = "com.google.firestore.admin.v1beta1"; +option objc_class_prefix = "GCFS"; + + +// A field of an index. +message IndexField { + // The mode determines how a field is indexed. + enum Mode { + // The mode is unspecified. + MODE_UNSPECIFIED = 0; + + // The field's values are indexed so as to support sequencing in + // ascending order and also query by <, >, <=, >=, and =. + ASCENDING = 2; + + // The field's values are indexed so as to support sequencing in + // descending order and also query by <, >, <=, >=, and =. + DESCENDING = 3; + } + + // The path of the field. Must match the field path specification described + // by [google.firestore.v1beta1.Document.fields][fields]. + // Special field path `__name__` may be used by itself or at the end of a + // path. `__type__` may be used only at the end of path. + string field_path = 1; + + // The field's mode. + Mode mode = 2; +} + +// An index definition. +message Index { + // The state of an index. During index creation, an index will be in the + // `CREATING` state. If the index is created successfully, it will transition + // to the `READY` state. If the index is not able to be created, it will + // transition to the `ERROR` state. + enum State { + // The state is unspecified. + STATE_UNSPECIFIED = 0; + + // The index is being created. + // There is an active long-running operation for the index. + // The index is updated when writing a document. + // Some index data may exist. + CREATING = 3; + + // The index is ready to be used. + // The index is updated when writing a document. + // The index is fully populated from all stored documents it applies to. + READY = 2; + + // The index was being created, but something went wrong. + // There is no active long-running operation for the index, + // and the most recently finished long-running operation failed. + // The index is not updated when writing a document. + // Some index data may exist. + ERROR = 5; + } + + // The resource name of the index. + string name = 1; + + // The collection ID to which this index applies. Required. + string collection_id = 2; + + // The fields to index. + repeated IndexField fields = 3; + + // The state of the index. + // The state is read-only. + // @OutputOnly + State state = 6; +} diff --git a/handwritten/cloud-profiler/google/firestore/artman_firestore.yaml b/handwritten/cloud-profiler/google/firestore/artman_firestore.yaml new file mode 100644 index 00000000000..d8c357b2a78 --- /dev/null +++ b/handwritten/cloud-profiler/google/firestore/artman_firestore.yaml @@ -0,0 +1,49 @@ +common: + api_name: firestore + api_version: v1beta1 + organization_name: google-cloud + proto_deps: + - name: google-common-protos + gapic_yaml: v1beta1/firestore_gapic.yaml + src_proto_paths: + - v1beta1 + service_yaml: firestore.yaml +artifacts: +- name: gapic_config + type: GAPIC_CONFIG +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-firestore-v1beta1 + - name: grpc + dest: generated/java/grpc-google-cloud-firestore-v1beta1 + - name: proto + dest: generated/java/proto-google-cloud-firestore-v1beta1 + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-firestore +- name: python_gapic + type: GAPIC + language: PYTHON +- name: nodejs_gapic + type: GAPIC + language: NODEJS +- name: php_gapic + type: GAPIC + language: PHP +- name: go_gapic + type: GAPIC + language: GO +- name: ruby_gapic + type: GAPIC + language: RUBY +- name: csharp_gapic + type: GAPIC + language: CSHARP diff --git a/handwritten/cloud-profiler/google/firestore/firestore.yaml b/handwritten/cloud-profiler/google/firestore/firestore.yaml new file mode 100644 index 00000000000..e3632cdc5e9 --- /dev/null +++ b/handwritten/cloud-profiler/google/firestore/firestore.yaml @@ -0,0 +1,19 @@ +type: google.api.Service +config_version: 3 +name: firestore.googleapis.com +title: Google Cloud Firestore API + +apis: +# - name: google.firestore.admin.v1beta1.FirestoreAdmin +- name: google.firestore.v1beta1.Firestore + +# types: +# - name: google.firestore.admin.v1beta1.IndexOperationMetadata + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/datastore diff --git a/handwritten/cloud-profiler/google/firestore/v1beta1/common.proto b/handwritten/cloud-profiler/google/firestore/v1beta1/common.proto new file mode 100644 index 00000000000..e6243234657 --- /dev/null +++ b/handwritten/cloud-profiler/google/firestore/v1beta1/common.proto @@ -0,0 +1,82 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.firestore.v1beta1; + +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/firestore/v1beta1;firestore"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.firestore.v1beta1"; +option objc_class_prefix = "GCFS"; + + +// A set of field paths on a document. +// Used to restrict a get or update operation on a document to a subset of its +// fields. +// This is different from standard field masks, as this is always scoped to a +// [Document][google.firestore.v1beta1.Document], and takes in account the dynamic nature of [Value][google.firestore.v1beta1.Value]. +message DocumentMask { + // The list of field paths in the mask. See [Document.fields][google.firestore.v1beta1.Document.fields] for a field + // path syntax reference. + repeated string field_paths = 1; +} + +// A precondition on a document, used for conditional operations. +message Precondition { + // The type of precondition. + oneof condition_type { + // When set to `true`, the target document must exist. + // When set to `false`, the target document must not exist. + bool exists = 1; + + // When set, the target document must exist and have been last updated at + // that time. + google.protobuf.Timestamp update_time = 2; + } +} + +// Options for creating a new transaction. +message TransactionOptions { + // Options for a transaction that can be used to read and write documents. + message ReadWrite { + // An optional transaction to retry. + bytes retry_transaction = 1; + } + + // Options for a transaction that can only be used to read documents. + message ReadOnly { + // The consistency mode for this transaction. If not set, defaults to strong + // consistency. + oneof consistency_selector { + // Reads documents at the given time. + // This may not be older than 60 seconds. + google.protobuf.Timestamp read_time = 2; + } + } + + // The mode of the transaction. + oneof mode { + // The transaction can only be used for read operations. + ReadOnly read_only = 2; + + // The transaction can be used for both read and write operations. + ReadWrite read_write = 3; + } +} diff --git a/handwritten/cloud-profiler/google/firestore/v1beta1/document.proto b/handwritten/cloud-profiler/google/firestore/v1beta1/document.proto new file mode 100644 index 00000000000..cf6001dbfc0 --- /dev/null +++ b/handwritten/cloud-profiler/google/firestore/v1beta1/document.proto @@ -0,0 +1,148 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.firestore.v1beta1; + +import "google/api/annotations.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/latlng.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/firestore/v1beta1;firestore"; +option java_multiple_files = true; +option java_outer_classname = "DocumentProto"; +option java_package = "com.google.firestore.v1beta1"; +option objc_class_prefix = "GCFS"; + + +// A Firestore document. +// +// Must not exceed 1 MiB - 4 bytes. +message Document { + // The resource name of the document, for example + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string name = 1; + + // The document's fields. + // + // The map keys represent field names. + // + // A simple field name contains only characters `a` to `z`, `A` to `Z`, + // `0` to `9`, or `_`, and must not start with `0` to `9` or `_`. For example, + // `foo_bar_17`. + // + // Field names matching the regular expression `__.*__` are reserved. Reserved + // field names are forbidden except in certain documented contexts. The map + // keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be + // empty. + // + // Field paths may be used in other contexts to refer to structured fields + // defined here. For `map_value`, the field path is represented by the simple + // or quoted field names of the containing fields, delimited by `.`. For + // example, the structured field + // `"foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would be + // represented by the field path `foo.x&y`. + // + // Within a field path, a quoted field name starts and ends with `` ` `` and + // may contain any character. Some characters, including `` ` ``, must be + // escaped using a `\`. For example, `` `x&y` `` represents `x&y` and + // `` `bak\`tik` `` represents `` bak`tik ``. + map fields = 2; + + // Output only. The time at which the document was created. + // + // This value increases monotonically when a document is deleted then + // recreated. It can also be compared to values from other documents and + // the `read_time` of a query. + google.protobuf.Timestamp create_time = 3; + + // Output only. The time at which the document was last changed. + // + // This value is initally set to the `create_time` then increases + // monotonically with each change to the document. It can also be + // compared to values from other documents and the `read_time` of a query. + google.protobuf.Timestamp update_time = 4; +} + +// A message that can hold any of the supported value types. +message Value { + // Must have a value set. + oneof value_type { + // A null value. + google.protobuf.NullValue null_value = 11; + + // A boolean value. + bool boolean_value = 1; + + // An integer value. + int64 integer_value = 2; + + // A double value. + double double_value = 3; + + // A timestamp value. + // + // Precise only to microseconds. When stored, any additional precision is + // rounded down. + google.protobuf.Timestamp timestamp_value = 10; + + // A string value. + // + // The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes. + // Only the first 1,500 bytes of the UTF-8 representation are considered by + // queries. + string string_value = 17; + + // A bytes value. + // + // Must not exceed 1 MiB - 89 bytes. + // Only the first 1,500 bytes are considered by queries. + bytes bytes_value = 18; + + // A reference to a document. For example: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string reference_value = 5; + + // A geo point value representing a point on the surface of Earth. + google.type.LatLng geo_point_value = 8; + + // An array value. + // + // Cannot contain another array value. + ArrayValue array_value = 9; + + // A map value. + MapValue map_value = 6; + } +} + +// An array value. +message ArrayValue { + // Values in the array. + repeated Value values = 1; +} + +// A map value. +message MapValue { + // The map's fields. + // + // The map keys represent field names. Field names matching the regular + // expression `__.*__` are reserved. Reserved field names are forbidden except + // in certain documented contexts. The map keys, represented as UTF-8, must + // not exceed 1,500 bytes and cannot be empty. + map fields = 1; +} diff --git a/handwritten/cloud-profiler/google/firestore/v1beta1/firestore.proto b/handwritten/cloud-profiler/google/firestore/v1beta1/firestore.proto new file mode 100644 index 00000000000..624ce6cba14 --- /dev/null +++ b/handwritten/cloud-profiler/google/firestore/v1beta1/firestore.proto @@ -0,0 +1,718 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.firestore.v1beta1; + +import "google/api/annotations.proto"; +import "google/firestore/v1beta1/common.proto"; +import "google/firestore/v1beta1/document.proto"; +import "google/firestore/v1beta1/query.proto"; +import "google/firestore/v1beta1/write.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/firestore/v1beta1;firestore"; +option java_multiple_files = true; +option java_outer_classname = "FirestoreProto"; +option java_package = "com.google.firestore.v1beta1"; +option objc_class_prefix = "GCFS"; + +// Specification of the Firestore API. + + + +// The Cloud Firestore service. +// +// This service exposes several types of comparable timestamps: +// +// * `create_time` - The time at which a document was created. Changes only +// when a document is deleted, then re-created. Increases in a strict +// monotonic fashion. +// * `update_time` - The time at which a document was last updated. Changes +// every time a document is modified. Does not change when a write results +// in no modifications. Increases in a strict monotonic fashion. +// * `read_time` - The time at which a particular state was observed. Used +// to denote a consistent snapshot of the database or the time at which a +// Document was observed to not exist. +// * `commit_time` - The time at which the writes in a transaction were +// committed. Any read with an equal or greater `read_time` is guaranteed +// to see the effects of the transaction. +service Firestore { + // Gets a single document. + rpc GetDocument(GetDocumentRequest) returns (Document) { + option (google.api.http) = { get: "/v1beta1/{name=projects/*/databases/*/documents/*/**}" }; + } + + // Lists documents. + rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) { + option (google.api.http) = { get: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}" }; + } + + // Creates a new document. + rpc CreateDocument(CreateDocumentRequest) returns (Document) { + option (google.api.http) = { post: "/v1beta1/{parent=projects/*/databases/*/documents/**}/{collection_id}" body: "document" }; + } + + // Updates or inserts a document. + rpc UpdateDocument(UpdateDocumentRequest) returns (Document) { + option (google.api.http) = { patch: "/v1beta1/{document.name=projects/*/databases/*/documents/*/**}" body: "document" }; + } + + // Deletes a document. + rpc DeleteDocument(DeleteDocumentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1beta1/{name=projects/*/databases/*/documents/*/**}" }; + } + + // Gets multiple documents. + // + // Documents returned by this method are not guaranteed to be returned in the + // same order that they were requested. + rpc BatchGetDocuments(BatchGetDocumentsRequest) returns (stream BatchGetDocumentsResponse) { + option (google.api.http) = { post: "/v1beta1/{database=projects/*/databases/*}/documents:batchGet" body: "*" }; + } + + // Starts a new transaction. + rpc BeginTransaction(BeginTransactionRequest) returns (BeginTransactionResponse) { + option (google.api.http) = { post: "/v1beta1/{database=projects/*/databases/*}/documents:beginTransaction" body: "*" }; + } + + // Commits a transaction, while optionally updating documents. + rpc Commit(CommitRequest) returns (CommitResponse) { + option (google.api.http) = { post: "/v1beta1/{database=projects/*/databases/*}/documents:commit" body: "*" }; + } + + // Rolls back a transaction. + rpc Rollback(RollbackRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1beta1/{database=projects/*/databases/*}/documents:rollback" body: "*" }; + } + + // Runs a query. + rpc RunQuery(RunQueryRequest) returns (stream RunQueryResponse) { + option (google.api.http) = { post: "/v1beta1/{parent=projects/*/databases/*/documents}:runQuery" body: "*" }; + } + + // Streams batches of document updates and deletes, in order. + rpc Write(stream WriteRequest) returns (stream WriteResponse) { + option (google.api.http) = { post: "/v1beta1/{database=projects/*/databases/*}/documents:write" body: "*" }; + } + + // Listens to changes. + rpc Listen(stream ListenRequest) returns (stream ListenResponse) { + option (google.api.http) = { post: "/v1beta1/{database=projects/*/databases/*}/documents:listen" body: "*" }; + } + + // Lists all the collection IDs underneath a document. + rpc ListCollectionIds(ListCollectionIdsRequest) returns (ListCollectionIdsResponse) { + option (google.api.http) = { post: "/v1beta1/{parent=projects/*/databases/*/documents}:listCollectionIds" body: "*" }; + } +} + +// The request for [Firestore.GetDocument][google.firestore.v1beta1.Firestore.GetDocument]. +message GetDocumentRequest { + // The resource name of the Document to get. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string name = 1; + + // The fields to return. If not set, returns all fields. + // + // If the document has a field that is not present in this mask, that field + // will not be returned in the response. + DocumentMask mask = 2; + + // The consistency mode for this transaction. + // If not set, defaults to strong consistency. + oneof consistency_selector { + // Reads the document in a transaction. + bytes transaction = 3; + + // Reads the version of the document at the given time. + // This may not be older than 60 seconds. + google.protobuf.Timestamp read_time = 5; + } +} + +// The request for [Firestore.ListDocuments][google.firestore.v1beta1.Firestore.ListDocuments]. +message ListDocumentsRequest { + // The parent resource name. In the format: + // `projects/{project_id}/databases/{database_id}/documents` or + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // For example: + // `projects/my-project/databases/my-database/documents` or + // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + string parent = 1; + + // The collection ID, relative to `parent`, to list. For example: `chatrooms` + // or `messages`. + string collection_id = 2; + + // The maximum number of documents to return. + int32 page_size = 3; + + // The `next_page_token` value returned from a previous List request, if any. + string page_token = 4; + + // The order to sort results by. For example: `priority desc, name`. + string order_by = 6; + + // The fields to return. If not set, returns all fields. + // + // If a document has a field that is not present in this mask, that field + // will not be returned in the response. + DocumentMask mask = 7; + + // The consistency mode for this transaction. + // If not set, defaults to strong consistency. + oneof consistency_selector { + // Reads documents in a transaction. + bytes transaction = 8; + + // Reads documents as they were at the given time. + // This may not be older than 60 seconds. + google.protobuf.Timestamp read_time = 10; + } + + // If the list should show missing documents. A missing document is a + // document that does not exist but has sub-documents. These documents will + // be returned with a key but will not have fields, [Document.create_time][google.firestore.v1beta1.Document.create_time], + // or [Document.update_time][google.firestore.v1beta1.Document.update_time] set. + // + // Requests with `show_missing` may not specify `where` or + // `order_by`. + bool show_missing = 12; +} + +// The response for [Firestore.ListDocuments][google.firestore.v1beta1.Firestore.ListDocuments]. +message ListDocumentsResponse { + // The Documents found. + repeated Document documents = 1; + + // The next page token. + string next_page_token = 2; +} + +// The request for [Firestore.CreateDocument][google.firestore.v1beta1.Firestore.CreateDocument]. +message CreateDocumentRequest { + // The parent resource. For example: + // `projects/{project_id}/databases/{database_id}/documents` or + // `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}` + string parent = 1; + + // The collection ID, relative to `parent`, to list. For example: `chatrooms`. + string collection_id = 2; + + // The client-assigned document ID to use for this document. + // + // Optional. If not specified, an ID will be assigned by the service. + string document_id = 3; + + // The document to create. `name` must not be set. + Document document = 4; + + // The fields to return. If not set, returns all fields. + // + // If the document has a field that is not present in this mask, that field + // will not be returned in the response. + DocumentMask mask = 5; +} + +// The request for [Firestore.UpdateDocument][google.firestore.v1beta1.Firestore.UpdateDocument]. +message UpdateDocumentRequest { + // The updated document. + // Creates the document if it does not already exist. + Document document = 1; + + // The fields to update. + // None of the field paths in the mask may contain a reserved name. + // + // If the document exists on the server and has fields not referenced in the + // mask, they are left unchanged. + // Fields referenced in the mask, but not present in the input document, are + // deleted from the document on the server. + DocumentMask update_mask = 2; + + // The fields to return. If not set, returns all fields. + // + // If the document has a field that is not present in this mask, that field + // will not be returned in the response. + DocumentMask mask = 3; + + // An optional precondition on the document. + // The request will fail if this is set and not met by the target document. + Precondition current_document = 4; +} + +// The request for [Firestore.DeleteDocument][google.firestore.v1beta1.Firestore.DeleteDocument]. +message DeleteDocumentRequest { + // The resource name of the Document to delete. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string name = 1; + + // An optional precondition on the document. + // The request will fail if this is set and not met by the target document. + Precondition current_document = 2; +} + +// The request for [Firestore.BatchGetDocuments][google.firestore.v1beta1.Firestore.BatchGetDocuments]. +message BatchGetDocumentsRequest { + // The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1; + + // The names of the documents to retrieve. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // The request will fail if any of the document is not a child resource of the + // given `database`. Duplicate names will be elided. + repeated string documents = 2; + + // The fields to return. If not set, returns all fields. + // + // If a document has a field that is not present in this mask, that field will + // not be returned in the response. + DocumentMask mask = 3; + + // The consistency mode for this transaction. + // If not set, defaults to strong consistency. + oneof consistency_selector { + // Reads documents in a transaction. + bytes transaction = 4; + + // Starts a new transaction and reads the documents. + // Defaults to a read-only transaction. + // The new transaction ID will be returned as the first response in the + // stream. + TransactionOptions new_transaction = 5; + + // Reads documents as they were at the given time. + // This may not be older than 60 seconds. + google.protobuf.Timestamp read_time = 7; + } +} + +// The streamed response for [Firestore.BatchGetDocuments][google.firestore.v1beta1.Firestore.BatchGetDocuments]. +message BatchGetDocumentsResponse { + // A single result. + // This can be empty if the server is just returning a transaction. + oneof result { + // A document that was requested. + Document found = 1; + + // A document name that was requested but does not exist. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string missing = 2; + } + + // The transaction that was started as part of this request. + // Will only be set in the first response, and only if + // [BatchGetDocumentsRequest.new_transaction][google.firestore.v1beta1.BatchGetDocumentsRequest.new_transaction] was set in the request. + bytes transaction = 3; + + // The time at which the document was read. + // This may be monotically increasing, in this case the previous documents in + // the result stream are guaranteed not to have changed between their + // read_time and this one. + google.protobuf.Timestamp read_time = 4; +} + +// The request for [Firestore.BeginTransaction][google.firestore.v1beta1.Firestore.BeginTransaction]. +message BeginTransactionRequest { + // The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1; + + // The options for the transaction. + // Defaults to a read-write transaction. + TransactionOptions options = 2; +} + +// The response for [Firestore.BeginTransaction][google.firestore.v1beta1.Firestore.BeginTransaction]. +message BeginTransactionResponse { + // The transaction that was started. + bytes transaction = 1; +} + +// The request for [Firestore.Commit][google.firestore.v1beta1.Firestore.Commit]. +message CommitRequest { + // The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1; + + // The writes to apply. + // + // Always executed atomically and in order. + repeated Write writes = 2; + + // If set, applies all writes in this transaction, and commits it. + bytes transaction = 3; +} + +// The response for [Firestore.Commit][google.firestore.v1beta1.Firestore.Commit]. +message CommitResponse { + // The result of applying the writes. + // + // This i-th write result corresponds to the i-th write in the + // request. + repeated WriteResult write_results = 1; + + // The time at which the commit occurred. + google.protobuf.Timestamp commit_time = 2; +} + +// The request for [Firestore.Rollback][google.firestore.v1beta1.Firestore.Rollback]. +message RollbackRequest { + // The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1; + + // The transaction to roll back. + bytes transaction = 2; +} + +// The request for [Firestore.RunQuery][google.firestore.v1beta1.Firestore.RunQuery]. +message RunQueryRequest { + // The parent resource name. In the format: + // `projects/{project_id}/databases/{database_id}/documents` or + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // For example: + // `projects/my-project/databases/my-database/documents` or + // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + string parent = 1; + + // The query to run. + oneof query_type { + // A structured query. + StructuredQuery structured_query = 2; + } + + // The consistency mode for this transaction. + // If not set, defaults to strong consistency. + oneof consistency_selector { + // Reads documents in a transaction. + bytes transaction = 5; + + // Starts a new transaction and reads the documents. + // Defaults to a read-only transaction. + // The new transaction ID will be returned as the first response in the + // stream. + TransactionOptions new_transaction = 6; + + // Reads documents as they were at the given time. + // This may not be older than 60 seconds. + google.protobuf.Timestamp read_time = 7; + } +} + +// The response for [Firestore.RunQuery][google.firestore.v1beta1.Firestore.RunQuery]. +message RunQueryResponse { + // The transaction that was started as part of this request. + // Can only be set in the first response, and only if + // [RunQueryRequest.new_transaction][google.firestore.v1beta1.RunQueryRequest.new_transaction] was set in the request. + // If set, no other fields will be set in this response. + bytes transaction = 2; + + // A query result. + // Not set when reporting partial progress. + Document document = 1; + + // The time at which the document was read. This may be monotonically + // increasing; in this case, the previous documents in the result stream are + // guaranteed not to have changed between their `read_time` and this one. + // + // If the query returns no results, a response with `read_time` and no + // `document` will be sent, and this represents the time at which the query + // was run. + google.protobuf.Timestamp read_time = 3; + + // The number of results that have been skipped due to an offset between + // the last response and the current response. + int32 skipped_results = 4; +} + +// The request for [Firestore.Write][google.firestore.v1beta1.Firestore.Write]. +// +// The first request creates a stream, or resumes an existing one from a token. +// +// When creating a new stream, the server replies with a response containing +// only an ID and a token, to use in the next request. +// +// When resuming a stream, the server first streams any responses later than the +// given token, then a response containing only an up-to-date token, to use in +// the next request. +message WriteRequest { + // The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + // This is only required in the first message. + string database = 1; + + // The ID of the write stream to resume. + // This may only be set in the first message. When left empty, a new write + // stream will be created. + string stream_id = 2; + + // The writes to apply. + // + // Always executed atomically and in order. + // This must be empty on the first request. + // This may be empty on the last request. + // This must not be empty on all other requests. + repeated Write writes = 3; + + // A stream token that was previously sent by the server. + // + // The client should set this field to the token from the most recent + // [WriteResponse][google.firestore.v1beta1.WriteResponse] it has received. This acknowledges that the client has + // received responses up to this token. After sending this token, earlier + // tokens may not be used anymore. + // + // The server may close the stream if there are too many unacknowledged + // responses. + // + // Leave this field unset when creating a new stream. To resume a stream at + // a specific point, set this field and the `stream_id` field. + // + // Leave this field unset when creating a new stream. + bytes stream_token = 4; + + // Labels associated with this write request. + map labels = 5; +} + +// The response for [Firestore.Write][google.firestore.v1beta1.Firestore.Write]. +message WriteResponse { + // The ID of the stream. + // Only set on the first message, when a new stream was created. + string stream_id = 1; + + // A token that represents the position of this response in the stream. + // This can be used by a client to resume the stream at this point. + // + // This field is always set. + bytes stream_token = 2; + + // The result of applying the writes. + // + // This i-th write result corresponds to the i-th write in the + // request. + repeated WriteResult write_results = 3; + + // The time at which the commit occurred. + google.protobuf.Timestamp commit_time = 4; +} + +// A request for [Firestore.Listen][google.firestore.v1beta1.Firestore.Listen] +message ListenRequest { + // The database name. In the format: + // `projects/{project_id}/databases/{database_id}`. + string database = 1; + + // The supported target changes. + oneof target_change { + // A target to add to this stream. + Target add_target = 2; + + // The ID of a target to remove from this stream. + int32 remove_target = 3; + } + + // Labels associated with this target change. + map labels = 4; +} + +// The response for [Firestore.Listen][google.firestore.v1beta1.Firestore.Listen]. +message ListenResponse { + // The supported responses. + oneof response_type { + // Targets have changed. + TargetChange target_change = 2; + + // A [Document][google.firestore.v1beta1.Document] has changed. + DocumentChange document_change = 3; + + // A [Document][google.firestore.v1beta1.Document] has been deleted. + DocumentDelete document_delete = 4; + + // A [Document][google.firestore.v1beta1.Document] has been removed from a target (because it is no longer + // relevant to that target). + DocumentRemove document_remove = 6; + + // A filter to apply to the set of documents previously returned for the + // given target. + // + // Returned when documents may have been removed from the given target, but + // the exact documents are unknown. + ExistenceFilter filter = 5; + } +} + +// A specification of a set of documents to listen to. +message Target { + // A target specified by a set of documents names. + message DocumentsTarget { + // The names of the documents to retrieve. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // The request will fail if any of the document is not a child resource of + // the given `database`. Duplicate names will be elided. + repeated string documents = 2; + } + + // A target specified by a query. + message QueryTarget { + // The parent resource name. In the format: + // `projects/{project_id}/databases/{database_id}/documents` or + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // For example: + // `projects/my-project/databases/my-database/documents` or + // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + string parent = 1; + + // The query to run. + oneof query_type { + // A structured query. + StructuredQuery structured_query = 2; + } + } + + // The type of target to listen to. + oneof target_type { + // A target specified by a query. + QueryTarget query = 2; + + // A target specified by a set of document names. + DocumentsTarget documents = 3; + } + + // When to start listening. + // + // If not specified, all matching Documents are returned before any + // subsequent changes. + oneof resume_type { + // A resume token from a prior [TargetChange][google.firestore.v1beta1.TargetChange] for an identical target. + // + // Using a resume token with a different target is unsupported and may fail. + bytes resume_token = 4; + + // Start listening after a specific `read_time`. + // + // The client must know the state of matching documents at this time. + google.protobuf.Timestamp read_time = 11; + } + + // A client provided target ID. + // + // If not set, the server will assign an ID for the target. + // + // Used for resuming a target without changing IDs. The IDs can either be + // client-assigned or be server-assigned in a previous stream. All targets + // with client provided IDs must be added before adding a target that needs + // a server-assigned id. + int32 target_id = 5; + + // If the target should be removed once it is current and consistent. + bool once = 6; +} + +// Targets being watched have changed. +message TargetChange { + // The type of change. + enum TargetChangeType { + // No change has occurred. Used only to send an updated `resume_token`. + NO_CHANGE = 0; + + // The targets have been added. + ADD = 1; + + // The targets have been removed. + REMOVE = 2; + + // The targets reflect all changes committed before the targets were added + // to the stream. + // + // This will be sent after or with a `read_time` that is greater than or + // equal to the time at which the targets were added. + // + // Listeners can wait for this change if read-after-write semantics + // are desired. + CURRENT = 3; + + // The targets have been reset, and a new initial state for the targets + // will be returned in subsequent changes. + // + // After the initial state is complete, `CURRENT` will be returned even + // if the target was previously indicated to be `CURRENT`. + RESET = 4; + } + + // The type of change that occurred. + TargetChangeType target_change_type = 1; + + // The target IDs of targets that have changed. + // + // If empty, the change applies to all targets. + // + // For `target_change_type=ADD`, the order of the target IDs matches the order + // of the requests to add the targets. This allows clients to unambiguously + // associate server-assigned target IDs with added targets. + // + // For other states, the order of the target IDs is not defined. + repeated int32 target_ids = 2; + + // The error that resulted in this change, if applicable. + google.rpc.Status cause = 3; + + // A token that can be used to resume the stream for the given `target_ids`, + // or all targets if `target_ids` is empty. + // + // Not set on every target change. + bytes resume_token = 4; + + // The consistent `read_time` for the given `target_ids` (omitted when the + // target_ids are not at a consistent snapshot). + // + // The stream is guaranteed to send a `read_time` with `target_ids` empty + // whenever the entire stream reaches a new consistent snapshot. ADD, + // CURRENT, and RESET messages are guaranteed to (eventually) result in a + // new consistent snapshot (while NO_CHANGE and REMOVE messages are not). + // + // For a given stream, `read_time` is guaranteed to be monotonically + // increasing. + google.protobuf.Timestamp read_time = 6; +} + +// The request for [Firestore.ListCollectionIds][google.firestore.v1beta1.Firestore.ListCollectionIds]. +message ListCollectionIdsRequest { + // The parent document. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + // For example: + // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + string parent = 1; + + // The maximum number of results to return. + int32 page_size = 2; + + // A page token. Must be a value from + // [ListCollectionIdsResponse][google.firestore.v1beta1.ListCollectionIdsResponse]. + string page_token = 3; +} + +// The response from [Firestore.ListCollectionIds][google.firestore.v1beta1.Firestore.ListCollectionIds]. +message ListCollectionIdsResponse { + // The collection ids. + repeated string collection_ids = 1; + + // A page token that may be used to continue the list. + string next_page_token = 2; +} diff --git a/handwritten/cloud-profiler/google/firestore/v1beta1/firestore_gapic.yaml b/handwritten/cloud-profiler/google/firestore/v1beta1/firestore_gapic.yaml new file mode 100644 index 00000000000..39b1067701d --- /dev/null +++ b/handwritten/cloud-profiler/google/firestore/v1beta1/firestore_gapic.yaml @@ -0,0 +1,314 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.firestore.v1beta1 + python: + package_name: google.cloud.firestore_v1beta1.gapic + go: + package_name: cloud.google.com/go/firestore/apiv1beta1 + domain_layer_location: cloud.google.com/go/firestore + release_level: BETA + csharp: + package_name: Google.Cloud.Firestore.V1Beta1 + ruby: + package_name: Google::Cloud::Firestore::V1beta1 + php: + package_name: Google\Cloud\Firestore\V1beta1 + nodejs: + package_name: firestore.v1beta1 +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +# - name: google.firestore.admin.v1beta1.FirestoreAdmin +# collections: +# - name_pattern: projects/{project}/databases/{database} +# entity_name: database +# - name_pattern: projects/{project}/databases/{database}/indexes/{index} +# entity_name: index +# retry_codes_def: +# - name: idempotent +# retry_codes: +# - UNAVAILABLE +# - DEADLINE_EXCEEDED +# - name: non_idempotent +# retry_codes: [] +# retry_params_def: +# - name: default +# initial_retry_delay_millis: 100 +# retry_delay_multiplier: 1.3 +# max_retry_delay_millis: 60000 +# initial_rpc_timeout_millis: 20000 +# rpc_timeout_multiplier: 1 +# max_rpc_timeout_millis: 20000 +# total_timeout_millis: 600000 +# methods: +# - name: CreateIndex +# flattening: +# groups: +# - parameters: +# - parent +# - index +# required_fields: +# - parent +# - index +# request_object_method: true +# retry_codes_name: non_idempotent +# retry_params_name: default +# field_name_patterns: +# parent: database +# timeout_millis: 60000 +# - name: ListIndexes +# flattening: +# groups: +# - parameters: +# - parent +# required_fields: +# - parent +# request_object_method: true +# page_streaming: +# request: +# page_size_field: page_size +# token_field: page_token +# response: +# token_field: next_page_token +# resources_field: indexes +# retry_codes_name: idempotent +# retry_params_name: default +# field_name_patterns: +# parent: database +# timeout_millis: 60000 +# - name: GetIndex +# flattening: +# groups: +# - parameters: +# - name +# required_fields: +# - name +# request_object_method: false +# retry_codes_name: idempotent +# retry_params_name: default +# field_name_patterns: +# name: index +# timeout_millis: 60000 +# - name: DeleteIndex +# flattening: +# groups: +# - parameters: +# - name +# required_fields: +# - name +# request_object_method: false +# retry_codes_name: idempotent +# retry_params_name: default +# field_name_patterns: +# name: index +# timeout_millis: 60000 +- name: google.firestore.v1beta1.Firestore + collections: + - name_pattern: projects/{project}/databases/{database} + entity_name: database_root + - name_pattern: projects/{project}/databases/{database}/documents + entity_name: document_root + - name_pattern: projects/{project}/databases/{database}/documents/{document_path=**} + entity_name: document_path + - name_pattern: projects/{project}/databases/{database}/documents/{document}/{any_path=**} + entity_name: any_path + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + - name: streaming + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + # Five minutes + initial_rpc_timeout_millis: 300000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 300000 + total_timeout_millis: 600000 + methods: + - name: GetDocument + required_fields: + - name + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: any_path + timeout_millis: 60000 + - name: ListDocuments + required_fields: + - parent + - collection_id + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: documents + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + parent: document_root + parent: any_path + timeout_millis: 60000 + - name: CreateDocument + required_fields: + - parent + - collection_id + - document_id + - document + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + parent: document_root + parent: any_path + timeout_millis: 60000 + - name: UpdateDocument + flattening: + groups: + - parameters: + - document + - update_mask + required_fields: + - document + - update_mask + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + document.name: any_path + timeout_millis: 60000 + - name: DeleteDocument + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: any_path + timeout_millis: 60000 + - name: BatchGetDocuments + required_fields: + - database + - documents + request_object_method: true + retry_codes_name: idempotent + retry_params_name: streaming + field_name_patterns: + database: database_root + # Five minutes + timeout_millis: 300000 + - name: BeginTransaction + flattening: + groups: + - parameters: + - database + required_fields: + - database + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + database: database_root + timeout_millis: 60000 + - name: Commit + flattening: + groups: + - parameters: + - database + - writes + required_fields: + - database + - writes + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + database: database_root + timeout_millis: 60000 + - name: Rollback + flattening: + groups: + - parameters: + - database + - transaction + required_fields: + - database + - transaction + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + database: database_root + timeout_millis: 60000 + - name: RunQuery + required_fields: + - parent + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + parent: document_root + parent: any_path + timeout_millis: 60000 + - name: Write + required_fields: + - database + retry_codes_name: non_idempotent + retry_params_name: streaming + field_name_patterns: + database: database_root + # Five minutes + timeout_millis: 300000 + - name: Listen + required_fields: + - database + retry_codes_name: idempotent + retry_params_name: streaming + field_name_patterns: + database: database_root + # Five minutes + timeout_millis: 300000 + - name: ListCollectionIds + flattening: + groups: + - parameters: + - parent + required_fields: + - parent + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: collection_ids + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + parent: document_root + parent: any_path + timeout_millis: 60000 diff --git a/handwritten/cloud-profiler/google/firestore/v1beta1/query.proto b/handwritten/cloud-profiler/google/firestore/v1beta1/query.proto new file mode 100644 index 00000000000..d19b0222822 --- /dev/null +++ b/handwritten/cloud-profiler/google/firestore/v1beta1/query.proto @@ -0,0 +1,231 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.firestore.v1beta1; + +import "google/api/annotations.proto"; +import "google/firestore/v1beta1/document.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/firestore/v1beta1;firestore"; +option java_multiple_files = true; +option java_outer_classname = "QueryProto"; +option java_package = "com.google.firestore.v1beta1"; +option objc_class_prefix = "GCFS"; + + +// A Firestore query. +message StructuredQuery { + // A selection of a collection, such as `messages as m1`. + message CollectionSelector { + // The collection ID. + // When set, selects only collections with this ID. + string collection_id = 2; + + // When false, selects only collections that are immediate children of + // the `parent` specified in the containing `RunQueryRequest`. + // When true, selects all descendant collections. + bool all_descendants = 3; + } + + // A filter. + message Filter { + // The type of filter. + oneof filter_type { + // A composite filter. + CompositeFilter composite_filter = 1; + + // A filter on a document field. + FieldFilter field_filter = 2; + + // A filter that takes exactly one argument. + UnaryFilter unary_filter = 3; + } + } + + // A filter that merges multiple other filters using the given operator. + message CompositeFilter { + // A composite filter operator. + enum Operator { + // Unspecified. This value must not be used. + OPERATOR_UNSPECIFIED = 0; + + // The results are required to satisfy each of the combined filters. + AND = 1; + } + + // The operator for combining multiple filters. + Operator op = 1; + + // The list of filters to combine. + // Must contain at least one filter. + repeated Filter filters = 2; + } + + // A filter on a specific field. + message FieldFilter { + // A field filter operator. + enum Operator { + // Unspecified. This value must not be used. + OPERATOR_UNSPECIFIED = 0; + + // Less than. Requires that the field come first in `order_by`. + LESS_THAN = 1; + + // Less than or equal. Requires that the field come first in `order_by`. + LESS_THAN_OR_EQUAL = 2; + + // Greater than. Requires that the field come first in `order_by`. + GREATER_THAN = 3; + + // Greater than or equal. Requires that the field come first in + // `order_by`. + GREATER_THAN_OR_EQUAL = 4; + + // Equal. + EQUAL = 5; + } + + // The field to filter by. + FieldReference field = 1; + + // The operator to filter by. + Operator op = 2; + + // The value to compare to. + Value value = 3; + } + + // A filter with a single operand. + message UnaryFilter { + // A unary operator. + enum Operator { + // Unspecified. This value must not be used. + OPERATOR_UNSPECIFIED = 0; + + // Test if a field is equal to NaN. + IS_NAN = 2; + + // Test if an exprestion evaluates to Null. + IS_NULL = 3; + } + + // The unary operator to apply. + Operator op = 1; + + // The argument to the filter. + oneof operand_type { + // The field to which to apply the operator. + FieldReference field = 2; + } + } + + // An order on a field. + message Order { + // The field to order by. + FieldReference field = 1; + + // The direction to order by. Defaults to `ASCENDING`. + Direction direction = 2; + } + + // A reference to a field, such as `max(messages.time) as max_time`. + message FieldReference { + string field_path = 2; + } + + // The projection of document's fields to return. + message Projection { + // The fields to return. + // + // If empty, all fields are returned. To only return the name + // of the document, use `['__name__']`. + repeated FieldReference fields = 2; + } + + // A sort direction. + enum Direction { + // Unspecified. + DIRECTION_UNSPECIFIED = 0; + + // Ascending. + ASCENDING = 1; + + // Descending. + DESCENDING = 2; + } + + // The projection to return. + Projection select = 1; + + // The collections to query. + repeated CollectionSelector from = 2; + + // The filter to apply. + Filter where = 3; + + // The order to apply to the query results. + // + // Firestore guarantees a stable ordering through the following rules: + // + // * Any field required to appear in `order_by`, that is not already + // specified in `order_by`, is appended to the order in field name order + // by default. + // * If an order on `__name__` is not specified, it is appended by default. + // + // Fields are appended with the same sort direction as the last order + // specified, or 'ASCENDING' if no order was specified. For example: + // + // * `SELECT * FROM Foo ORDER BY A` becomes + // `SELECT * FROM Foo ORDER BY A, __name__` + // * `SELECT * FROM Foo ORDER BY A DESC` becomes + // `SELECT * FROM Foo ORDER BY A DESC, __name__ DESC` + // * `SELECT * FROM Foo WHERE A > 1` becomes + // `SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__` + repeated Order order_by = 4; + + // A starting point for the query results. + Cursor start_at = 7; + + // A end point for the query results. + Cursor end_at = 8; + + // The number of results to skip. + // + // Applies before limit, but after all other constraints. Must be >= 0 if + // specified. + int32 offset = 6; + + // The maximum number of results to return. + // + // Applies after all other constraints. + // Must be >= 0 if specified. + google.protobuf.Int32Value limit = 5; +} + +// A position in a query result set. +message Cursor { + // The values that represent a position, in the order they appear in + // the order by clause of a query. + // + // Can contain fewer values than specified in the order by clause. + repeated Value values = 1; + + // If the position is just before or just after the given values, relative + // to the sort order defined by the query. + bool before = 2; +} diff --git a/handwritten/cloud-profiler/google/firestore/v1beta1/write.proto b/handwritten/cloud-profiler/google/firestore/v1beta1/write.proto new file mode 100644 index 00000000000..73ec3d9a4a3 --- /dev/null +++ b/handwritten/cloud-profiler/google/firestore/v1beta1/write.proto @@ -0,0 +1,184 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.firestore.v1beta1; + +import "google/api/annotations.proto"; +import "google/firestore/v1beta1/common.proto"; +import "google/firestore/v1beta1/document.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/firestore/v1beta1;firestore"; +option java_multiple_files = true; +option java_outer_classname = "WriteProto"; +option java_package = "com.google.firestore.v1beta1"; +option objc_class_prefix = "GCFS"; + + +// A write on a document. +message Write { + // The operation to execute. + oneof operation { + // A document to write. + Document update = 1; + + // A document name to delete. In the format: + // `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + string delete = 2; + + // Applies a tranformation to a document. + // At most one `transform` per document is allowed in a given request. + // An `update` cannot follow a `transform` on the same document in a given + // request. + DocumentTransform transform = 6; + } + + // The fields to update in this write. + // + // This field can be set only when the operation is `update`. + // None of the field paths in the mask may contain a reserved name. + // If the document exists on the server and has fields not referenced in the + // mask, they are left unchanged. + // Fields referenced in the mask, but not present in the input document, are + // deleted from the document on the server. + // The field paths in this mask must not contain a reserved field name. + DocumentMask update_mask = 3; + + // An optional precondition on the document. + // + // The write will fail if this is set and not met by the target document. + Precondition current_document = 4; +} + +// A transformation of a document. +message DocumentTransform { + // A transformation of a field of the document. + message FieldTransform { + // A value that is calculated by the server. + enum ServerValue { + // Unspecified. This value must not be used. + SERVER_VALUE_UNSPECIFIED = 0; + + // The time at which the server processed the request. + REQUEST_TIME = 1; + } + + // The path of the field. See [Document.fields][google.firestore.v1beta1.Document.fields] for the field path syntax + // reference. + string field_path = 1; + + // The transformation to apply on the field. + oneof transform_type { + // Sets the field to the given server value. + ServerValue set_to_server_value = 2; + } + } + + // The name of the document to transform. + string document = 1; + + // The list of transformations to apply to the fields of the document, in + // order. + repeated FieldTransform field_transforms = 2; +} + +// The result of applying a write. +message WriteResult { + // The last update time of the document after applying the write. Not set + // after a `delete`. + // + // If the write did not actually change the document, this will be the + // previous update_time. + google.protobuf.Timestamp update_time = 1; + + // The results of applying each [DocumentTransform.FieldTransform][google.firestore.v1beta1.DocumentTransform.FieldTransform], in the + // same order. + repeated Value transform_results = 2; +} + +// A [Document][google.firestore.v1beta1.Document] has changed. +// +// May be the result of multiple [writes][google.firestore.v1beta1.Write], including deletes, that +// ultimately resulted in a new value for the [Document][google.firestore.v1beta1.Document]. +// +// Multiple [DocumentChange][google.firestore.v1beta1.DocumentChange] messages may be returned for the same logical +// change, if multiple targets are affected. +message DocumentChange { + // The new state of the [Document][google.firestore.v1beta1.Document]. + // + // If `mask` is set, contains only fields that were updated or added. + Document document = 1; + + // A set of target IDs of targets that match this document. + repeated int32 target_ids = 5; + + // A set of target IDs for targets that no longer match this document. + repeated int32 removed_target_ids = 6; +} + +// A [Document][google.firestore.v1beta1.Document] has been deleted. +// +// May be the result of multiple [writes][google.firestore.v1beta1.Write], including updates, the +// last of which deleted the [Document][google.firestore.v1beta1.Document]. +// +// Multiple [DocumentDelete][google.firestore.v1beta1.DocumentDelete] messages may be returned for the same logical +// delete, if multiple targets are affected. +message DocumentDelete { + // The resource name of the [Document][google.firestore.v1beta1.Document] that was deleted. + string document = 1; + + // A set of target IDs for targets that previously matched this entity. + repeated int32 removed_target_ids = 6; + + // The read timestamp at which the delete was observed. + // + // Greater or equal to the `commit_time` of the delete. + google.protobuf.Timestamp read_time = 4; +} + +// A [Document][google.firestore.v1beta1.Document] has been removed from the view of the targets. +// +// Sent if the document is no longer relevant to a target and is out of view. +// Can be sent instead of a DocumentDelete or a DocumentChange if the server +// can not send the new value of the document. +// +// Multiple [DocumentRemove][google.firestore.v1beta1.DocumentRemove] messages may be returned for the same logical +// write or delete, if multiple targets are affected. +message DocumentRemove { + // The resource name of the [Document][google.firestore.v1beta1.Document] that has gone out of view. + string document = 1; + + // A set of target IDs for targets that previously matched this document. + repeated int32 removed_target_ids = 2; + + // The read timestamp at which the remove was observed. + // + // Greater or equal to the `commit_time` of the change/delete/remove. + google.protobuf.Timestamp read_time = 4; +} + +// A digest of all the documents that match a given target. +message ExistenceFilter { + // The target ID to which this filter applies. + int32 target_id = 1; + + // The total count of documents that match [target_id][google.firestore.v1beta1.ExistenceFilter.target_id]. + // + // If different from the count of documents in the client that match, the + // client must manually determine which documents no longer match the target. + int32 count = 2; +} diff --git a/handwritten/cloud-profiler/google/genomics/README.md b/handwritten/cloud-profiler/google/genomics/README.md new file mode 100644 index 00000000000..8bc621804ac --- /dev/null +++ b/handwritten/cloud-profiler/google/genomics/README.md @@ -0,0 +1,14 @@ +Stores, processes, explores and shares genomic data. This API implements +the Global Alliance for Genomics and Health (GA4GH) v0.5.1 API as well as +several extensions. + +The Google Genomics API supports access via both +[JSON/REST](https://cloud.google.com/genomics/reference/rest) and +[gRPC](https://cloud.google.com/genomics/reference/rpc). JSON/REST is more +broadly available and is easier for getting started with Google Genomics; it +works well for small metadata resources (datasets, variant sets, read group +sets) and for browsing small genomic regions for datasets of any size. For +performant bulk data access (reads and variants), use gRPC. + +See also an [overview of genomic resources](https://cloud.google.com/genomics/v1/users-guide) +and an overview of [Genomics on Google Cloud](https://cloud.google.com/genomics/overview). \ No newline at end of file diff --git a/handwritten/cloud-profiler/google/genomics/v1/annotations.proto b/handwritten/cloud-profiler/google/genomics/v1/annotations.proto new file mode 100644 index 00000000000..0a1e999eb2f --- /dev/null +++ b/handwritten/cloud-profiler/google/genomics/v1/annotations.proto @@ -0,0 +1,672 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.genomics.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/wrappers.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/genomics/v1;genomics"; +option java_multiple_files = true; +option java_outer_classname = "AnnotationsProto"; +option java_package = "com.google.genomics.v1"; + + +// This service provides storage and positional retrieval of genomic +// reference annotations, including variant annotations. +service AnnotationServiceV1 { + // Creates a new annotation set. Caller must have WRITE permission for the + // associated dataset. + // + // The following fields are required: + // + // * [datasetId][google.genomics.v1.AnnotationSet.dataset_id] + // * [referenceSetId][google.genomics.v1.AnnotationSet.reference_set_id] + // + // All other fields may be optionally specified, unless documented as being + // server-generated (for example, the `id` field). + rpc CreateAnnotationSet(CreateAnnotationSetRequest) returns (AnnotationSet) { + option (google.api.http) = { post: "/v1/annotationsets" body: "annotation_set" }; + } + + // Gets an annotation set. Caller must have READ permission for + // the associated dataset. + rpc GetAnnotationSet(GetAnnotationSetRequest) returns (AnnotationSet) { + option (google.api.http) = { get: "/v1/annotationsets/{annotation_set_id}" }; + } + + // Updates an annotation set. The update must respect all mutability + // restrictions and other invariants described on the annotation set resource. + // Caller must have WRITE permission for the associated dataset. + rpc UpdateAnnotationSet(UpdateAnnotationSetRequest) returns (AnnotationSet) { + option (google.api.http) = { put: "/v1/annotationsets/{annotation_set_id}" body: "annotation_set" }; + } + + // Deletes an annotation set. Caller must have WRITE permission + // for the associated annotation set. + rpc DeleteAnnotationSet(DeleteAnnotationSetRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/annotationsets/{annotation_set_id}" }; + } + + // Searches for annotation sets that match the given criteria. Annotation sets + // are returned in an unspecified order. This order is consistent, such that + // two queries for the same content (regardless of page size) yield annotation + // sets in the same order across their respective streams of paginated + // responses. Caller must have READ permission for the queried datasets. + rpc SearchAnnotationSets(SearchAnnotationSetsRequest) returns (SearchAnnotationSetsResponse) { + option (google.api.http) = { post: "/v1/annotationsets/search" body: "*" }; + } + + // Creates a new annotation. Caller must have WRITE permission + // for the associated annotation set. + // + // The following fields are required: + // + // * [annotationSetId][google.genomics.v1.Annotation.annotation_set_id] + // * [referenceName][google.genomics.v1.Annotation.reference_name] or + // [referenceId][google.genomics.v1.Annotation.reference_id] + // + // ### Transcripts + // + // For annotations of type TRANSCRIPT, the following fields of + // [transcript][google.genomics.v1.Annotation.transcript] must be provided: + // + // * [exons.start][google.genomics.v1.Transcript.Exon.start] + // * [exons.end][google.genomics.v1.Transcript.Exon.end] + // + // All other fields may be optionally specified, unless documented as being + // server-generated (for example, the `id` field). The annotated + // range must be no longer than 100Mbp (mega base pairs). See the + // [Annotation resource][google.genomics.v1.Annotation] + // for additional restrictions on each field. + rpc CreateAnnotation(CreateAnnotationRequest) returns (Annotation) { + option (google.api.http) = { post: "/v1/annotations" body: "annotation" }; + } + + // Creates one or more new annotations atomically. All annotations must + // belong to the same annotation set. Caller must have WRITE + // permission for this annotation set. For optimal performance, batch + // positionally adjacent annotations together. + // + // If the request has a systemic issue, such as an attempt to write to + // an inaccessible annotation set, the entire RPC will fail accordingly. For + // lesser data issues, when possible an error will be isolated to the + // corresponding batch entry in the response; the remaining well formed + // annotations will be created normally. + // + // For details on the requirements for each individual annotation resource, + // see + // [CreateAnnotation][google.genomics.v1.AnnotationServiceV1.CreateAnnotation]. + rpc BatchCreateAnnotations(BatchCreateAnnotationsRequest) returns (BatchCreateAnnotationsResponse) { + option (google.api.http) = { post: "/v1/annotations:batchCreate" body: "*" }; + } + + // Gets an annotation. Caller must have READ permission + // for the associated annotation set. + rpc GetAnnotation(GetAnnotationRequest) returns (Annotation) { + option (google.api.http) = { get: "/v1/annotations/{annotation_id}" }; + } + + // Updates an annotation. Caller must have + // WRITE permission for the associated dataset. + rpc UpdateAnnotation(UpdateAnnotationRequest) returns (Annotation) { + option (google.api.http) = { put: "/v1/annotations/{annotation_id}" body: "annotation" }; + } + + // Deletes an annotation. Caller must have WRITE permission for + // the associated annotation set. + rpc DeleteAnnotation(DeleteAnnotationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/annotations/{annotation_id}" }; + } + + // Searches for annotations that match the given criteria. Results are + // ordered by genomic coordinate (by reference sequence, then position). + // Annotations with equivalent genomic coordinates are returned in an + // unspecified order. This order is consistent, such that two queries for the + // same content (regardless of page size) yield annotations in the same order + // across their respective streams of paginated responses. Caller must have + // READ permission for the queried annotation sets. + rpc SearchAnnotations(SearchAnnotationsRequest) returns (SearchAnnotationsResponse) { + option (google.api.http) = { post: "/v1/annotations/search" body: "*" }; + } +} + +// An annotation set is a logical grouping of annotations that share consistent +// type information and provenance. Examples of annotation sets include 'all +// genes from refseq', and 'all variant annotations from ClinVar'. +message AnnotationSet { + // The server-generated annotation set ID, unique across all annotation sets. + string id = 1; + + // The dataset to which this annotation set belongs. + string dataset_id = 2; + + // The ID of the reference set that defines the coordinate space for this + // set's annotations. + string reference_set_id = 3; + + // The display name for this annotation set. + string name = 4; + + // The source URI describing the file from which this annotation set was + // generated, if any. + string source_uri = 5; + + // The type of annotations contained within this set. + AnnotationType type = 6; + + // A map of additional read alignment information. This must be of the form + // map (string key mapping to a list of string values). + map info = 17; +} + +// An annotation describes a region of reference genome. The value of an +// annotation may be one of several canonical types, supplemented by arbitrary +// info tags. An annotation is not inherently associated with a specific +// sample or individual (though a client could choose to use annotations in +// this way). Example canonical annotation types are `GENE` and +// `VARIANT`. +message Annotation { + // The server-generated annotation ID, unique across all annotations. + string id = 1; + + // The annotation set to which this annotation belongs. + string annotation_set_id = 2; + + // The display name of this annotation. + string name = 3; + + // The ID of the Google Genomics reference associated with this range. + string reference_id = 4; + + // The display name corresponding to the reference specified by + // `referenceId`, for example `chr1`, `1`, or `chrX`. + string reference_name = 5; + + // The start position of the range on the reference, 0-based inclusive. + int64 start = 6; + + // The end position of the range on the reference, 0-based exclusive. + int64 end = 7; + + // Whether this range refers to the reverse strand, as opposed to the forward + // strand. Note that regardless of this field, the start/end position of the + // range always refer to the forward strand. + bool reverse_strand = 8; + + // The data type for this annotation. Must match the containing annotation + // set's type. + AnnotationType type = 9; + + oneof value { + // A variant annotation, which describes the effect of a variant on the + // genome, the coding sequence, and/or higher level consequences at the + // organism level e.g. pathogenicity. This field is only set for annotations + // of type `VARIANT`. + VariantAnnotation variant = 10; + + // A transcript value represents the assertion that a particular region of + // the reference genome may be transcribed as RNA. An alternative splicing + // pattern would be represented as a separate transcript object. This field + // is only set for annotations of type `TRANSCRIPT`. + Transcript transcript = 11; + } + + // A map of additional read alignment information. This must be of the form + // map (string key mapping to a list of string values). + map info = 12; +} + +message VariantAnnotation { + message ClinicalCondition { + // A set of names for the condition. + repeated string names = 1; + + // The set of external IDs for this condition. + repeated ExternalId external_ids = 2; + + // The MedGen concept id associated with this gene. + // Search for these IDs at http://www.ncbi.nlm.nih.gov/medgen/ + string concept_id = 3; + + // The OMIM id for this condition. + // Search for these IDs at http://omim.org/ + string omim_id = 4; + } + + enum Type { + TYPE_UNSPECIFIED = 0; + + // `TYPE_OTHER` should be used when no other Type will suffice. + // Further explanation of the variant type may be included in the + // [info][google.genomics.v1.Annotation.info] field. + TYPE_OTHER = 1; + + // `INSERTION` indicates an insertion. + INSERTION = 2; + + // `DELETION` indicates a deletion. + DELETION = 3; + + // `SUBSTITUTION` indicates a block substitution of + // two or more nucleotides. + SUBSTITUTION = 4; + + // `SNP` indicates a single nucleotide polymorphism. + SNP = 5; + + // `STRUCTURAL` indicates a large structural variant, + // including chromosomal fusions, inversions, etc. + STRUCTURAL = 6; + + // `CNV` indicates a variation in copy number. + CNV = 7; + } + + enum Effect { + EFFECT_UNSPECIFIED = 0; + + // `EFFECT_OTHER` should be used when no other Effect + // will suffice. + EFFECT_OTHER = 1; + + // `FRAMESHIFT` indicates a mutation in which the insertion or + // deletion of nucleotides resulted in a frameshift change. + FRAMESHIFT = 2; + + // `FRAME_PRESERVING_INDEL` indicates a mutation in which a + // multiple of three nucleotides has been inserted or deleted, resulting + // in no change to the reading frame of the coding sequence. + FRAME_PRESERVING_INDEL = 3; + + // `SYNONYMOUS_SNP` indicates a single nucleotide polymorphism + // mutation that results in no amino acid change. + SYNONYMOUS_SNP = 4; + + // `NONSYNONYMOUS_SNP` indicates a single nucleotide + // polymorphism mutation that results in an amino acid change. + NONSYNONYMOUS_SNP = 5; + + // `STOP_GAIN` indicates a mutation that leads to the creation + // of a stop codon at the variant site. Frameshift mutations creating + // downstream stop codons do not count as `STOP_GAIN`. + STOP_GAIN = 6; + + // `STOP_LOSS` indicates a mutation that eliminates a + // stop codon at the variant site. + STOP_LOSS = 7; + + // `SPLICE_SITE_DISRUPTION` indicates that this variant is + // found in a splice site for the associated transcript, and alters the + // normal splicing pattern. + SPLICE_SITE_DISRUPTION = 8; + } + + enum ClinicalSignificance { + CLINICAL_SIGNIFICANCE_UNSPECIFIED = 0; + + // `OTHER` should be used when no other clinical significance + // value will suffice. + CLINICAL_SIGNIFICANCE_OTHER = 1; + + UNCERTAIN = 2; + + BENIGN = 3; + + LIKELY_BENIGN = 4; + + LIKELY_PATHOGENIC = 5; + + PATHOGENIC = 6; + + DRUG_RESPONSE = 7; + + HISTOCOMPATIBILITY = 8; + + CONFERS_SENSITIVITY = 9; + + RISK_FACTOR = 10; + + ASSOCIATION = 11; + + PROTECTIVE = 12; + + // `MULTIPLE_REPORTED` should be used when multiple clinical + // signficances are reported for a variant. The original clinical + // significance values may be provided in the `info` field. + MULTIPLE_REPORTED = 13; + } + + // Type has been adapted from ClinVar's list of variant types. + Type type = 1; + + // Effect of the variant on the coding sequence. + Effect effect = 2; + + // The alternate allele for this variant. If multiple alternate alleles + // exist at this location, create a separate variant for each one, as they + // may represent distinct conditions. + string alternate_bases = 3; + + // Google annotation ID of the gene affected by this variant. This should + // be provided when the variant is created. + string gene_id = 4; + + // Google annotation IDs of the transcripts affected by this variant. These + // should be provided when the variant is created. + repeated string transcript_ids = 5; + + // The set of conditions associated with this variant. + // A condition describes the way a variant influences human health. + repeated ClinicalCondition conditions = 6; + + // Describes the clinical significance of a variant. + // It is adapted from the ClinVar controlled vocabulary for clinical + // significance described at: + // http://www.ncbi.nlm.nih.gov/clinvar/docs/clinsig/ + ClinicalSignificance clinical_significance = 7; +} + +// A transcript represents the assertion that a particular region of the +// reference genome may be transcribed as RNA. +message Transcript { + message Exon { + // The start position of the exon on this annotation's reference sequence, + // 0-based inclusive. Note that this is relative to the reference start, and + // **not** the containing annotation start. + int64 start = 1; + + // The end position of the exon on this annotation's reference sequence, + // 0-based exclusive. Note that this is relative to the reference start, and + // *not* the containing annotation start. + int64 end = 2; + + // The frame of this exon. Contains a value of 0, 1, or 2, which indicates + // the offset of the first coding base of the exon within the reading frame + // of the coding DNA sequence, if any. This field is dependent on the + // strandedness of this annotation (see + // [Annotation.reverse_strand][google.genomics.v1.Annotation.reverse_strand]). + // For forward stranded annotations, this offset is relative to the + // [exon.start][google.genomics.v1.Transcript.Exon.start]. For reverse + // strand annotations, this offset is relative to the + // [exon.end][google.genomics.v1.Transcript.Exon.end] `- 1`. + // + // Unset if this exon does not intersect the coding sequence. Upon creation + // of a transcript, the frame must be populated for all or none of the + // coding exons. + google.protobuf.Int32Value frame = 3; + } + + message CodingSequence { + // The start of the coding sequence on this annotation's reference sequence, + // 0-based inclusive. Note that this position is relative to the reference + // start, and *not* the containing annotation start. + int64 start = 1; + + // The end of the coding sequence on this annotation's reference sequence, + // 0-based exclusive. Note that this position is relative to the reference + // start, and *not* the containing annotation start. + int64 end = 2; + } + + // The annotation ID of the gene from which this transcript is transcribed. + string gene_id = 1; + + // The exons that compose + // this transcript. This field should be unset for genomes where transcript + // splicing does not occur, for example prokaryotes. + // + // Introns are regions of the transcript that are not included in the + // spliced RNA product. Though not explicitly modeled here, intron ranges can + // be deduced; all regions of this transcript that are not exons are introns. + // + // Exonic sequences do not necessarily code for a translational product + // (amino acids). Only the regions of exons bounded by the + // [codingSequence][google.genomics.v1.Transcript.coding_sequence] correspond + // to coding DNA sequence. + // + // Exons are ordered by start position and may not overlap. + repeated Exon exons = 2; + + // The range of the coding sequence for this transcript, if any. To determine + // the exact ranges of coding sequence, intersect this range with those of the + // [exons][google.genomics.v1.Transcript.exons], if any. If there are any + // [exons][google.genomics.v1.Transcript.exons], the + // [codingSequence][google.genomics.v1.Transcript.coding_sequence] must start + // and end within them. + // + // Note that in some cases, the reference genome will not exactly match the + // observed mRNA transcript e.g. due to variance in the source genome from + // reference. In these cases, + // [exon.frame][google.genomics.v1.Transcript.Exon.frame] will not necessarily + // match the expected reference reading frame and coding exon reference bases + // cannot necessarily be concatenated to produce the original transcript mRNA. + CodingSequence coding_sequence = 3; +} + +message ExternalId { + // The name of the source of this data. + string source_name = 1; + + // The id used by the source of this data. + string id = 2; +} + +message CreateAnnotationSetRequest { + // The annotation set to create. + AnnotationSet annotation_set = 1; +} + +message GetAnnotationSetRequest { + // The ID of the annotation set to be retrieved. + string annotation_set_id = 1; +} + +message UpdateAnnotationSetRequest { + // The ID of the annotation set to be updated. + string annotation_set_id = 1; + + // The new annotation set. + AnnotationSet annotation_set = 2; + + // An optional mask specifying which fields to update. Mutable fields are + // [name][google.genomics.v1.AnnotationSet.name], + // [source_uri][google.genomics.v1.AnnotationSet.source_uri], and + // [info][google.genomics.v1.AnnotationSet.info]. If unspecified, all + // mutable fields will be updated. + google.protobuf.FieldMask update_mask = 3; +} + +message DeleteAnnotationSetRequest { + // The ID of the annotation set to be deleted. + string annotation_set_id = 1; +} + +message SearchAnnotationSetsRequest { + // Required. The dataset IDs to search within. Caller must have `READ` access + // to these datasets. + repeated string dataset_ids = 1; + + // If specified, only annotation sets associated with the given reference set + // are returned. + string reference_set_id = 2; + + // Only return annotations sets for which a substring of the name matches this + // string (case insensitive). + string name = 3; + + // If specified, only annotation sets that have any of these types are + // returned. + repeated AnnotationType types = 4; + + // The continuation token, which is used to page through large result sets. + // To get the next page of results, set this parameter to the value of + // `nextPageToken` from the previous response. + string page_token = 5; + + // The maximum number of results to return in a single page. If unspecified, + // defaults to 128. The maximum value is 1024. + int32 page_size = 6; +} + +message SearchAnnotationSetsResponse { + // The matching annotation sets. + repeated AnnotationSet annotation_sets = 1; + + // The continuation token, which is used to page through large result sets. + // Provide this value in a subsequent request to return the next page of + // results. This field will be empty if there aren't any additional results. + string next_page_token = 2; +} + +message CreateAnnotationRequest { + // The annotation to be created. + Annotation annotation = 1; +} + +message BatchCreateAnnotationsRequest { + // The annotations to be created. At most 4096 can be specified in a single + // request. + repeated Annotation annotations = 1; + + // A unique request ID which enables the server to detect duplicated requests. + // If provided, duplicated requests will result in the same response; if not + // provided, duplicated requests may result in duplicated data. For a given + // annotation set, callers should not reuse `request_id`s when writing + // different batches of annotations - behavior in this case is undefined. + // A common approach is to use a UUID. For batch jobs where worker crashes are + // a possibility, consider using some unique variant of a worker or run ID. + string request_id = 2; +} + +message BatchCreateAnnotationsResponse { + message Entry { + // The creation status. + google.rpc.Status status = 1; + + // The created annotation, if creation was successful. + Annotation annotation = 2; + } + + // The resulting per-annotation entries, ordered consistently with the + // original request. + repeated Entry entries = 1; +} + +message GetAnnotationRequest { + // The ID of the annotation to be retrieved. + string annotation_id = 1; +} + +message UpdateAnnotationRequest { + // The ID of the annotation to be updated. + string annotation_id = 1; + + // The new annotation. + Annotation annotation = 2; + + // An optional mask specifying which fields to update. Mutable fields are + // [name][google.genomics.v1.Annotation.name], + // [variant][google.genomics.v1.Annotation.variant], + // [transcript][google.genomics.v1.Annotation.transcript], and + // [info][google.genomics.v1.Annotation.info]. If unspecified, all mutable + // fields will be updated. + google.protobuf.FieldMask update_mask = 3; +} + +message DeleteAnnotationRequest { + // The ID of the annotation to be deleted. + string annotation_id = 1; +} + +message SearchAnnotationsRequest { + // Required. The annotation sets to search within. The caller must have + // `READ` access to these annotation sets. + // All queried annotation sets must have the same type. + repeated string annotation_set_ids = 1; + + // Required. `reference_id` or `reference_name` must be set. + oneof reference { + // The ID of the reference to query. + string reference_id = 2; + + // The name of the reference to query, within the reference set associated + // with this query. + string reference_name = 3; + } + + // The start position of the range on the reference, 0-based inclusive. If + // specified, + // [referenceId][google.genomics.v1.SearchAnnotationsRequest.reference_id] or + // [referenceName][google.genomics.v1.SearchAnnotationsRequest.reference_name] + // must be specified. Defaults to 0. + int64 start = 4; + + // The end position of the range on the reference, 0-based exclusive. If + // [referenceId][google.genomics.v1.SearchAnnotationsRequest.reference_id] or + // [referenceName][google.genomics.v1.SearchAnnotationsRequest.reference_name] + // must be specified, Defaults to the length of the reference. + int64 end = 5; + + // The continuation token, which is used to page through large result sets. + // To get the next page of results, set this parameter to the value of + // `nextPageToken` from the previous response. + string page_token = 6; + + // The maximum number of results to return in a single page. If unspecified, + // defaults to 256. The maximum value is 2048. + int32 page_size = 7; +} + +message SearchAnnotationsResponse { + // The matching annotations. + repeated Annotation annotations = 1; + + // The continuation token, which is used to page through large result sets. + // Provide this value in a subsequent request to return the next page of + // results. This field will be empty if there aren't any additional results. + string next_page_token = 2; +} + +// When an [Annotation][google.genomics.v1.Annotation] or +// [AnnotationSet][google.genomics.v1.AnnotationSet] is created, if `type` is +// not specified it will be set to `GENERIC`. +enum AnnotationType { + ANNOTATION_TYPE_UNSPECIFIED = 0; + + // A `GENERIC` annotation type should be used when no other annotation + // type will suffice. This represents an untyped annotation of the reference + // genome. + GENERIC = 1; + + // A `VARIANT` annotation type. + VARIANT = 2; + + // A `GENE` annotation type represents the existence of a gene at the + // associated reference coordinates. The start coordinate is typically the + // gene's transcription start site and the end is typically the end of the + // gene's last exon. + GENE = 3; + + // A `TRANSCRIPT` annotation type represents the assertion that a + // particular region of the reference genome may be transcribed as RNA. + TRANSCRIPT = 4; +} diff --git a/handwritten/cloud-profiler/google/genomics/v1/cigar.proto b/handwritten/cloud-profiler/google/genomics/v1/cigar.proto new file mode 100644 index 00000000000..e70e9438774 --- /dev/null +++ b/handwritten/cloud-profiler/google/genomics/v1/cigar.proto @@ -0,0 +1,99 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.genomics.v1; + +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/genomics/v1;genomics"; +option java_multiple_files = true; +option java_outer_classname = "CigarProto"; +option java_package = "com.google.genomics.v1"; + + +// A single CIGAR operation. +message CigarUnit { + // Describes the different types of CIGAR alignment operations that exist. + // Used wherever CIGAR alignments are used. + enum Operation { + OPERATION_UNSPECIFIED = 0; + + // An alignment match indicates that a sequence can be aligned to the + // reference without evidence of an INDEL. Unlike the + // `SEQUENCE_MATCH` and `SEQUENCE_MISMATCH` operators, + // the `ALIGNMENT_MATCH` operator does not indicate whether the + // reference and read sequences are an exact match. This operator is + // equivalent to SAM's `M`. + ALIGNMENT_MATCH = 1; + + // The insert operator indicates that the read contains evidence of bases + // being inserted into the reference. This operator is equivalent to SAM's + // `I`. + INSERT = 2; + + // The delete operator indicates that the read contains evidence of bases + // being deleted from the reference. This operator is equivalent to SAM's + // `D`. + DELETE = 3; + + // The skip operator indicates that this read skips a long segment of the + // reference, but the bases have not been deleted. This operator is commonly + // used when working with RNA-seq data, where reads may skip long segments + // of the reference between exons. This operator is equivalent to SAM's + // `N`. + SKIP = 4; + + // The soft clip operator indicates that bases at the start/end of a read + // have not been considered during alignment. This may occur if the majority + // of a read maps, except for low quality bases at the start/end of a read. + // This operator is equivalent to SAM's `S`. Bases that are soft + // clipped will still be stored in the read. + CLIP_SOFT = 5; + + // The hard clip operator indicates that bases at the start/end of a read + // have been omitted from this alignment. This may occur if this linear + // alignment is part of a chimeric alignment, or if the read has been + // trimmed (for example, during error correction or to trim poly-A tails for + // RNA-seq). This operator is equivalent to SAM's `H`. + CLIP_HARD = 6; + + // The pad operator indicates that there is padding in an alignment. This + // operator is equivalent to SAM's `P`. + PAD = 7; + + // This operator indicates that this portion of the aligned sequence exactly + // matches the reference. This operator is equivalent to SAM's `=`. + SEQUENCE_MATCH = 8; + + // This operator indicates that this portion of the aligned sequence is an + // alignment match to the reference, but a sequence mismatch. This can + // indicate a SNP or a read error. This operator is equivalent to SAM's + // `X`. + SEQUENCE_MISMATCH = 9; + } + + Operation operation = 1; + + // The number of genomic bases that the operation runs for. Required. + int64 operation_length = 2; + + // `referenceSequence` is only used at mismatches + // (`SEQUENCE_MISMATCH`) and deletions (`DELETE`). + // Filling this field replaces SAM's MD tag. If the relevant information is + // not available, this field is unset. + string reference_sequence = 3; +} diff --git a/handwritten/cloud-profiler/google/genomics/v1/datasets.proto b/handwritten/cloud-profiler/google/genomics/v1/datasets.proto new file mode 100644 index 00000000000..d312f3d1cc1 --- /dev/null +++ b/handwritten/cloud-profiler/google/genomics/v1/datasets.proto @@ -0,0 +1,212 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.genomics.v1; + +import "google/api/annotations.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/genomics/v1;genomics"; +option java_multiple_files = true; +option java_outer_classname = "DatasetsProto"; +option java_package = "com.google.genomics.v1"; + + +// This service manages datasets, which are collections of genomic data. +service DatasetServiceV1 { + // Lists datasets within a project. + // + // For the definitions of datasets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc ListDatasets(ListDatasetsRequest) returns (ListDatasetsResponse) { + option (google.api.http) = { get: "/v1/datasets" }; + } + + // Creates a new dataset. + // + // For the definitions of datasets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc CreateDataset(CreateDatasetRequest) returns (Dataset) { + option (google.api.http) = { post: "/v1/datasets" body: "dataset" }; + } + + // Gets a dataset by ID. + // + // For the definitions of datasets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc GetDataset(GetDatasetRequest) returns (Dataset) { + option (google.api.http) = { get: "/v1/datasets/{dataset_id}" }; + } + + // Updates a dataset. + // + // For the definitions of datasets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // This method supports patch semantics. + rpc UpdateDataset(UpdateDatasetRequest) returns (Dataset) { + option (google.api.http) = { patch: "/v1/datasets/{dataset_id}" body: "dataset" }; + } + + // Deletes a dataset and all of its contents (all read group sets, + // reference sets, variant sets, call sets, annotation sets, etc.) + // This is reversible (up to one week after the deletion) via + // the + // [datasets.undelete][google.genomics.v1.DatasetServiceV1.UndeleteDataset] + // operation. + // + // For the definitions of datasets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc DeleteDataset(DeleteDatasetRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/datasets/{dataset_id}" }; + } + + // Undeletes a dataset by restoring a dataset which was deleted via this API. + // + // For the definitions of datasets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // This operation is only possible for a week after the deletion occurred. + rpc UndeleteDataset(UndeleteDatasetRequest) returns (Dataset) { + option (google.api.http) = { post: "/v1/datasets/{dataset_id}:undelete" body: "*" }; + } + + // Sets the access control policy on the specified dataset. Replaces any + // existing policy. + // + // For the definitions of datasets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // See Setting a + // Policy for more information. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { post: "/v1/{resource=datasets/*}:setIamPolicy" body: "*" }; + } + + // Gets the access control policy for the dataset. This is empty if the + // policy or resource does not exist. + // + // See Getting a + // Policy for more information. + // + // For the definitions of datasets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { post: "/v1/{resource=datasets/*}:getIamPolicy" body: "*" }; + } + + // Returns permissions that a caller has on the specified resource. + // See Testing + // Permissions for more information. + // + // For the definitions of datasets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { post: "/v1/{resource=datasets/*}:testIamPermissions" body: "*" }; + } +} + +// A Dataset is a collection of genomic data. +// +// For more genomics resource definitions, see [Fundamentals of Google +// Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) +message Dataset { + // The server-generated dataset ID, unique across all datasets. + string id = 1; + + // The Google Cloud project ID that this dataset belongs to. + string project_id = 2; + + // The dataset name. + string name = 3; + + // The time this dataset was created, in seconds from the epoch. + google.protobuf.Timestamp create_time = 4; +} + +// The dataset list request. +message ListDatasetsRequest { + // Required. The Google Cloud project ID to list datasets for. + string project_id = 1; + + // The maximum number of results to return in a single page. If unspecified, + // defaults to 50. The maximum value is 1024. + int32 page_size = 2; + + // The continuation token, which is used to page through large result sets. + // To get the next page of results, set this parameter to the value of + // `nextPageToken` from the previous response. + string page_token = 3; +} + +// The dataset list response. +message ListDatasetsResponse { + // The list of matching Datasets. + repeated Dataset datasets = 1; + + // The continuation token, which is used to page through large result sets. + // Provide this value in a subsequent request to return the next page of + // results. This field will be empty if there aren't any additional results. + string next_page_token = 2; +} + +message CreateDatasetRequest { + // The dataset to be created. Must contain projectId and name. + Dataset dataset = 1; +} + +message UpdateDatasetRequest { + // The ID of the dataset to be updated. + string dataset_id = 1; + + // The new dataset data. + Dataset dataset = 2; + + // An optional mask specifying which fields to update. At this time, the only + // mutable field is [name][google.genomics.v1.Dataset.name]. The only + // acceptable value is "name". If unspecified, all mutable fields will be + // updated. + google.protobuf.FieldMask update_mask = 3; +} + +message DeleteDatasetRequest { + // The ID of the dataset to be deleted. + string dataset_id = 1; +} + +message UndeleteDatasetRequest { + // The ID of the dataset to be undeleted. + string dataset_id = 1; +} + +message GetDatasetRequest { + // The ID of the dataset. + string dataset_id = 1; +} diff --git a/handwritten/cloud-profiler/google/genomics/v1/operations.proto b/handwritten/cloud-profiler/google/genomics/v1/operations.proto new file mode 100644 index 00000000000..12bf7d2a369 --- /dev/null +++ b/handwritten/cloud-profiler/google/genomics/v1/operations.proto @@ -0,0 +1,77 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.genomics.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/genomics/v1;genomics"; +option java_multiple_files = true; +option java_outer_classname = "OperationsProto"; +option java_package = "com.google.genomics.v1"; + + +// Metadata describing an [Operation][google.longrunning.Operation]. +message OperationMetadata { + // The Google Cloud Project in which the job is scoped. + string project_id = 1; + + // The time at which the job was submitted to the Genomics service. + google.protobuf.Timestamp create_time = 2; + + // The time at which the job began to run. + google.protobuf.Timestamp start_time = 3; + + // The time at which the job stopped running. + google.protobuf.Timestamp end_time = 4; + + // The original request that started the operation. Note that this will be in + // current version of the API. If the operation was started with v1beta2 API + // and a GetOperation is performed on v1 API, a v1 request will be returned. + google.protobuf.Any request = 5; + + // Optional event messages that were generated during the job's execution. + // This also contains any warnings that were generated during import + // or export. + repeated OperationEvent events = 6; + + // This field is deprecated. Use `labels` instead. Optionally provided by the + // caller when submitting the request that creates the operation. + string client_id = 7; + + // Runtime metadata on this Operation. + google.protobuf.Any runtime_metadata = 8; + + // Optionally provided by the caller when submitting the request that creates + // the operation. + map labels = 9; +} + +// An event that occurred during an [Operation][google.longrunning.Operation]. +message OperationEvent { + // Optional time of when event started. + google.protobuf.Timestamp start_time = 1; + + // Optional time of when event finished. An event can have a start time and no + // finish time. If an event has a finish time, there must be a start time. + google.protobuf.Timestamp end_time = 2; + + // Required description of event. + string description = 3; +} diff --git a/handwritten/cloud-profiler/google/genomics/v1/position.proto b/handwritten/cloud-profiler/google/genomics/v1/position.proto new file mode 100644 index 00000000000..b4e2403d6c7 --- /dev/null +++ b/handwritten/cloud-profiler/google/genomics/v1/position.proto @@ -0,0 +1,42 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.genomics.v1; + +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/genomics/v1;genomics"; +option java_multiple_files = true; +option java_outer_classname = "PositionProto"; +option java_package = "com.google.genomics.v1"; + + +// An abstraction for referring to a genomic position, in relation to some +// already known reference. For now, represents a genomic position as a +// reference name, a base number on that reference (0-based), and a +// determination of forward or reverse strand. +message Position { + // The name of the reference in whatever reference set is being used. + string reference_name = 1; + + // The 0-based offset from the start of the forward strand for that reference. + int64 position = 2; + + // Whether this position is on the reverse strand, as opposed to the forward + // strand. + bool reverse_strand = 3; +} diff --git a/handwritten/cloud-profiler/google/genomics/v1/range.proto b/handwritten/cloud-profiler/google/genomics/v1/range.proto new file mode 100644 index 00000000000..4f2a454050f --- /dev/null +++ b/handwritten/cloud-profiler/google/genomics/v1/range.proto @@ -0,0 +1,39 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.genomics.v1; + +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/genomics/v1;genomics"; +option java_multiple_files = true; +option java_outer_classname = "RangeProto"; +option java_package = "com.google.genomics.v1"; + + +// A 0-based half-open genomic coordinate range for search requests. +message Range { + // The reference sequence name, for example `chr1`, + // `1`, or `chrX`. + string reference_name = 1; + + // The start position of the range on the reference, 0-based inclusive. + int64 start = 2; + + // The end position of the range on the reference, 0-based exclusive. + int64 end = 3; +} diff --git a/handwritten/cloud-profiler/google/genomics/v1/readalignment.proto b/handwritten/cloud-profiler/google/genomics/v1/readalignment.proto new file mode 100644 index 00000000000..c505584c54f --- /dev/null +++ b/handwritten/cloud-profiler/google/genomics/v1/readalignment.proto @@ -0,0 +1,221 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.genomics.v1; + +import "google/api/annotations.proto"; +import "google/genomics/v1/cigar.proto"; +import "google/genomics/v1/position.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/genomics/v1;genomics"; +option java_multiple_files = true; +option java_outer_classname = "ReadAlignmentProto"; +option java_package = "com.google.genomics.v1"; + + +// A linear alignment can be represented by one CIGAR string. Describes the +// mapped position and local alignment of the read to the reference. +message LinearAlignment { + // The position of this alignment. + Position position = 1; + + // The mapping quality of this alignment. Represents how likely + // the read maps to this position as opposed to other locations. + // + // Specifically, this is -10 log10 Pr(mapping position is wrong), rounded to + // the nearest integer. + int32 mapping_quality = 2; + + // Represents the local alignment of this sequence (alignment matches, indels, + // etc) against the reference. + repeated CigarUnit cigar = 3; +} + +// A read alignment describes a linear alignment of a string of DNA to a +// [reference sequence][google.genomics.v1.Reference], in addition to metadata +// about the fragment (the molecule of DNA sequenced) and the read (the bases +// which were read by the sequencer). A read is equivalent to a line in a SAM +// file. A read belongs to exactly one read group and exactly one +// [read group set][google.genomics.v1.ReadGroupSet]. +// +// For more genomics resource definitions, see [Fundamentals of Google +// Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) +// +// ### Reverse-stranded reads +// +// Mapped reads (reads having a non-null `alignment`) can be aligned to either +// the forward or the reverse strand of their associated reference. Strandedness +// of a mapped read is encoded by `alignment.position.reverseStrand`. +// +// If we consider the reference to be a forward-stranded coordinate space of +// `[0, reference.length)` with `0` as the left-most position and +// `reference.length` as the right-most position, reads are always aligned left +// to right. That is, `alignment.position.position` always refers to the +// left-most reference coordinate and `alignment.cigar` describes the alignment +// of this read to the reference from left to right. All per-base fields such as +// `alignedSequence` and `alignedQuality` share this same left-to-right +// orientation; this is true of reads which are aligned to either strand. For +// reverse-stranded reads, this means that `alignedSequence` is the reverse +// complement of the bases that were originally reported by the sequencing +// machine. +// +// ### Generating a reference-aligned sequence string +// +// When interacting with mapped reads, it's often useful to produce a string +// representing the local alignment of the read to reference. The following +// pseudocode demonstrates one way of doing this: +// +// out = "" +// offset = 0 +// for c in read.alignment.cigar { +// switch c.operation { +// case "ALIGNMENT_MATCH", "SEQUENCE_MATCH", "SEQUENCE_MISMATCH": +// out += read.alignedSequence[offset:offset+c.operationLength] +// offset += c.operationLength +// break +// case "CLIP_SOFT", "INSERT": +// offset += c.operationLength +// break +// case "PAD": +// out += repeat("*", c.operationLength) +// break +// case "DELETE": +// out += repeat("-", c.operationLength) +// break +// case "SKIP": +// out += repeat(" ", c.operationLength) +// break +// case "CLIP_HARD": +// break +// } +// } +// return out +// +// ### Converting to SAM's CIGAR string +// +// The following pseudocode generates a SAM CIGAR string from the +// `cigar` field. Note that this is a lossy conversion +// (`cigar.referenceSequence` is lost). +// +// cigarMap = { +// "ALIGNMENT_MATCH": "M", +// "INSERT": "I", +// "DELETE": "D", +// "SKIP": "N", +// "CLIP_SOFT": "S", +// "CLIP_HARD": "H", +// "PAD": "P", +// "SEQUENCE_MATCH": "=", +// "SEQUENCE_MISMATCH": "X", +// } +// cigarStr = "" +// for c in read.alignment.cigar { +// cigarStr += c.operationLength + cigarMap[c.operation] +// } +// return cigarStr +message Read { + // The server-generated read ID, unique across all reads. This is different + // from the `fragmentName`. + string id = 1; + + // The ID of the read group this read belongs to. A read belongs to exactly + // one read group. This is a server-generated ID which is distinct from SAM's + // RG tag (for that value, see + // [ReadGroup.name][google.genomics.v1.ReadGroup.name]). + string read_group_id = 2; + + // The ID of the read group set this read belongs to. A read belongs to + // exactly one read group set. + string read_group_set_id = 3; + + // The fragment name. Equivalent to QNAME (query template name) in SAM. + string fragment_name = 4; + + // The orientation and the distance between reads from the fragment are + // consistent with the sequencing protocol (SAM flag 0x2). + bool proper_placement = 5; + + // The fragment is a PCR or optical duplicate (SAM flag 0x400). + bool duplicate_fragment = 6; + + // The observed length of the fragment, equivalent to TLEN in SAM. + int32 fragment_length = 7; + + // The read number in sequencing. 0-based and less than numberReads. This + // field replaces SAM flag 0x40 and 0x80. + int32 read_number = 8; + + // The number of reads in the fragment (extension to SAM flag 0x1). + int32 number_reads = 9; + + // Whether this read did not pass filters, such as platform or vendor quality + // controls (SAM flag 0x200). + bool failed_vendor_quality_checks = 10; + + // The linear alignment for this alignment record. This field is null for + // unmapped reads. + LinearAlignment alignment = 11; + + // Whether this alignment is secondary. Equivalent to SAM flag 0x100. + // A secondary alignment represents an alternative to the primary alignment + // for this read. Aligners may return secondary alignments if a read can map + // ambiguously to multiple coordinates in the genome. By convention, each read + // has one and only one alignment where both `secondaryAlignment` + // and `supplementaryAlignment` are false. + bool secondary_alignment = 12; + + // Whether this alignment is supplementary. Equivalent to SAM flag 0x800. + // Supplementary alignments are used in the representation of a chimeric + // alignment. In a chimeric alignment, a read is split into multiple + // linear alignments that map to different reference contigs. The first + // linear alignment in the read will be designated as the representative + // alignment; the remaining linear alignments will be designated as + // supplementary alignments. These alignments may have different mapping + // quality scores. In each linear alignment in a chimeric alignment, the read + // will be hard clipped. The `alignedSequence` and + // `alignedQuality` fields in the alignment record will only + // represent the bases for its respective linear alignment. + bool supplementary_alignment = 13; + + // The bases of the read sequence contained in this alignment record, + // **without CIGAR operations applied** (equivalent to SEQ in SAM). + // `alignedSequence` and `alignedQuality` may be + // shorter than the full read sequence and quality. This will occur if the + // alignment is part of a chimeric alignment, or if the read was trimmed. When + // this occurs, the CIGAR for this read will begin/end with a hard clip + // operator that will indicate the length of the excised sequence. + string aligned_sequence = 14; + + // The quality of the read sequence contained in this alignment record + // (equivalent to QUAL in SAM). + // `alignedSequence` and `alignedQuality` may be shorter than the full read + // sequence and quality. This will occur if the alignment is part of a + // chimeric alignment, or if the read was trimmed. When this occurs, the CIGAR + // for this read will begin/end with a hard clip operator that will indicate + // the length of the excised sequence. + repeated int32 aligned_quality = 15; + + // The mapping of the primary alignment of the + // `(readNumber+1)%numberReads` read in the fragment. It replaces + // mate position and mate strand in SAM. + Position next_mate_position = 16; + + // A map of additional read alignment information. This must be of the form + // map (string key mapping to a list of string values). + map info = 17; +} diff --git a/handwritten/cloud-profiler/google/genomics/v1/readgroup.proto b/handwritten/cloud-profiler/google/genomics/v1/readgroup.proto new file mode 100644 index 00000000000..73e05769ee2 --- /dev/null +++ b/handwritten/cloud-profiler/google/genomics/v1/readgroup.proto @@ -0,0 +1,106 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.genomics.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/genomics/v1;genomics"; +option java_multiple_files = true; +option java_outer_classname = "ReadGroupProto"; +option java_package = "com.google.genomics.v1"; + + +// A read group is all the data that's processed the same way by the sequencer. +message ReadGroup { + message Experiment { + // A client-supplied library identifier; a library is a collection of DNA + // fragments which have been prepared for sequencing from a sample. This + // field is important for quality control as error or bias can be introduced + // during sample preparation. + string library_id = 1; + + // The platform unit used as part of this experiment, for example + // flowcell-barcode.lane for Illumina or slide for SOLiD. Corresponds to the + // @RG PU field in the SAM spec. + string platform_unit = 2; + + // The sequencing center used as part of this experiment. + string sequencing_center = 3; + + // The instrument model used as part of this experiment. This maps to + // sequencing technology in the SAM spec. + string instrument_model = 4; + } + + message Program { + // The command line used to run this program. + string command_line = 1; + + // The user specified locally unique ID of the program. Used along with + // `prevProgramId` to define an ordering between programs. + string id = 2; + + // The display name of the program. This is typically the colloquial name of + // the tool used, for example 'bwa' or 'picard'. + string name = 3; + + // The ID of the program run before this one. + string prev_program_id = 4; + + // The version of the program run. + string version = 5; + } + + // The server-generated read group ID, unique for all read groups. + // Note: This is different than the @RG ID field in the SAM spec. For that + // value, see [name][google.genomics.v1.ReadGroup.name]. + string id = 1; + + // The dataset to which this read group belongs. + string dataset_id = 2; + + // The read group name. This corresponds to the @RG ID field in the SAM spec. + string name = 3; + + // A free-form text description of this read group. + string description = 4; + + // A client-supplied sample identifier for the reads in this read group. + string sample_id = 5; + + // The experiment used to generate this read group. + Experiment experiment = 6; + + // The predicted insert size of this read group. The insert size is the length + // the sequenced DNA fragment from end-to-end, not including the adapters. + int32 predicted_insert_size = 7; + + // The programs used to generate this read group. Programs are always + // identical for all read groups within a read group set. For this reason, + // only the first read group in a returned set will have this field + // populated. + repeated Program programs = 10; + + // The reference set the reads in this read group are aligned to. + string reference_set_id = 11; + + // A map of additional read group information. This must be of the form + // map (string key mapping to a list of string values). + map info = 12; +} diff --git a/handwritten/cloud-profiler/google/genomics/v1/readgroupset.proto b/handwritten/cloud-profiler/google/genomics/v1/readgroupset.proto new file mode 100644 index 00000000000..8d5131e1a97 --- /dev/null +++ b/handwritten/cloud-profiler/google/genomics/v1/readgroupset.proto @@ -0,0 +1,64 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.genomics.v1; + +import "google/api/annotations.proto"; +import "google/genomics/v1/readgroup.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/genomics/v1;genomics"; +option java_multiple_files = true; +option java_outer_classname = "ReadGroupSetProto"; +option java_package = "com.google.genomics.v1"; + + +// A read group set is a logical collection of read groups, which are +// collections of reads produced by a sequencer. A read group set typically +// models reads corresponding to one sample, sequenced one way, and aligned one +// way. +// +// * A read group set belongs to one dataset. +// * A read group belongs to one read group set. +// * A read belongs to one read group. +// +// For more genomics resource definitions, see [Fundamentals of Google +// Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) +message ReadGroupSet { + // The server-generated read group set ID, unique for all read group sets. + string id = 1; + + // The dataset to which this read group set belongs. + string dataset_id = 2; + + // The reference set to which the reads in this read group set are aligned. + string reference_set_id = 3; + + // The read group set name. By default this will be initialized to the sample + // name of the sequenced data contained in this set. + string name = 4; + + // The filename of the original source file for this read group set, if any. + string filename = 5; + + // The read groups in this set. There are typically 1-10 read groups in a read + // group set. + repeated ReadGroup read_groups = 6; + + // A map of additional read group set information. + map info = 7; +} diff --git a/handwritten/cloud-profiler/google/genomics/v1/reads.proto b/handwritten/cloud-profiler/google/genomics/v1/reads.proto new file mode 100644 index 00000000000..f574707e397 --- /dev/null +++ b/handwritten/cloud-profiler/google/genomics/v1/reads.proto @@ -0,0 +1,468 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.genomics.v1; + +import "google/api/annotations.proto"; +import "google/genomics/v1/range.proto"; +import "google/genomics/v1/readalignment.proto"; +import "google/genomics/v1/readgroupset.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/genomics/v1;genomics"; +option java_multiple_files = true; +option java_outer_classname = "ReadsProto"; +option java_package = "com.google.genomics.v1"; + + +service StreamingReadService { + // Returns a stream of all the reads matching the search request, ordered + // by reference name, position, and ID. + rpc StreamReads(StreamReadsRequest) returns (stream StreamReadsResponse) { + option (google.api.http) = { post: "/v1/reads:stream" body: "*" }; + } +} + +// The Readstore. A data store for DNA sequencing Reads. +service ReadServiceV1 { + // Creates read group sets by asynchronously importing the provided + // information. + // + // For the definitions of read group sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // The caller must have WRITE permissions to the dataset. + // + // ## Notes on [BAM](https://samtools.github.io/hts-specs/SAMv1.pdf) import + // + // - Tags will be converted to strings - tag types are not preserved + // - Comments (`@CO`) in the input file header will not be preserved + // - Original header order of references (`@SQ`) will not be preserved + // - Any reverse stranded unmapped reads will be reverse complemented, and + // their qualities (also the "BQ" and "OQ" tags, if any) will be reversed + // - Unmapped reads will be stripped of positional information (reference name + // and position) + rpc ImportReadGroupSets(ImportReadGroupSetsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/readgroupsets:import" body: "*" }; + } + + // Exports a read group set to a BAM file in Google Cloud Storage. + // + // For the definitions of read group sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // Note that currently there may be some differences between exported BAM + // files and the original BAM file at the time of import. See + // [ImportReadGroupSets][google.genomics.v1.ReadServiceV1.ImportReadGroupSets] + // for caveats. + rpc ExportReadGroupSet(ExportReadGroupSetRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/readgroupsets/{read_group_set_id}:export" body: "*" }; + } + + // Searches for read group sets matching the criteria. + // + // For the definitions of read group sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // Implements + // [GlobalAllianceApi.searchReadGroupSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L135). + rpc SearchReadGroupSets(SearchReadGroupSetsRequest) returns (SearchReadGroupSetsResponse) { + option (google.api.http) = { post: "/v1/readgroupsets/search" body: "*" }; + } + + // Updates a read group set. + // + // For the definitions of read group sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // This method supports patch semantics. + rpc UpdateReadGroupSet(UpdateReadGroupSetRequest) returns (ReadGroupSet) { + option (google.api.http) = { patch: "/v1/readgroupsets/{read_group_set_id}" body: "read_group_set" }; + } + + // Deletes a read group set. + // + // For the definitions of read group sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc DeleteReadGroupSet(DeleteReadGroupSetRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/readgroupsets/{read_group_set_id}" }; + } + + // Gets a read group set by ID. + // + // For the definitions of read group sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc GetReadGroupSet(GetReadGroupSetRequest) returns (ReadGroupSet) { + option (google.api.http) = { get: "/v1/readgroupsets/{read_group_set_id}" }; + } + + // Lists fixed width coverage buckets for a read group set, each of which + // correspond to a range of a reference sequence. Each bucket summarizes + // coverage information across its corresponding genomic range. + // + // For the definitions of read group sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // Coverage is defined as the number of reads which are aligned to a given + // base in the reference sequence. Coverage buckets are available at several + // precomputed bucket widths, enabling retrieval of various coverage 'zoom + // levels'. The caller must have READ permissions for the target read group + // set. + rpc ListCoverageBuckets(ListCoverageBucketsRequest) returns (ListCoverageBucketsResponse) { + option (google.api.http) = { get: "/v1/readgroupsets/{read_group_set_id}/coveragebuckets" }; + } + + // Gets a list of reads for one or more read group sets. + // + // For the definitions of read group sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // Reads search operates over a genomic coordinate space of reference sequence + // & position defined over the reference sequences to which the requested + // read group sets are aligned. + // + // If a target positional range is specified, search returns all reads whose + // alignment to the reference genome overlap the range. A query which + // specifies only read group set IDs yields all reads in those read group + // sets, including unmapped reads. + // + // All reads returned (including reads on subsequent pages) are ordered by + // genomic coordinate (by reference sequence, then position). Reads with + // equivalent genomic coordinates are returned in an unspecified order. This + // order is consistent, such that two queries for the same content (regardless + // of page size) yield reads in the same order across their respective streams + // of paginated responses. + // + // Implements + // [GlobalAllianceApi.searchReads](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L85). + rpc SearchReads(SearchReadsRequest) returns (SearchReadsResponse) { + option (google.api.http) = { post: "/v1/reads/search" body: "*" }; + } +} + +// The read group set search request. +message SearchReadGroupSetsRequest { + // Restricts this query to read group sets within the given datasets. At least + // one ID must be provided. + repeated string dataset_ids = 1; + + // Only return read group sets for which a substring of the name matches this + // string. + string name = 3; + + // The continuation token, which is used to page through large result sets. + // To get the next page of results, set this parameter to the value of + // `nextPageToken` from the previous response. + string page_token = 2; + + // The maximum number of results to return in a single page. If unspecified, + // defaults to 256. The maximum value is 1024. + int32 page_size = 4; +} + +// The read group set search response. +message SearchReadGroupSetsResponse { + // The list of matching read group sets. + repeated ReadGroupSet read_group_sets = 1; + + // The continuation token, which is used to page through large result sets. + // Provide this value in a subsequent request to return the next page of + // results. This field will be empty if there aren't any additional results. + string next_page_token = 2; +} + +// The read group set import request. +message ImportReadGroupSetsRequest { + enum PartitionStrategy { + PARTITION_STRATEGY_UNSPECIFIED = 0; + + // In most cases, this strategy yields one read group set per file. This is + // the default behavior. + // + // Allocate one read group set per file per sample. For BAM files, read + // groups are considered to share a sample if they have identical sample + // names. Furthermore, all reads for each file which do not belong to a read + // group, if any, will be grouped into a single read group set per-file. + PER_FILE_PER_SAMPLE = 1; + + // Includes all read groups in all imported files into a single read group + // set. Requires that the headers for all imported files are equivalent. All + // reads which do not belong to a read group, if any, will be grouped into a + // separate read group set. + MERGE_ALL = 2; + } + + // Required. The ID of the dataset these read group sets will belong to. The + // caller must have WRITE permissions to this dataset. + string dataset_id = 1; + + // The reference set to which the imported read group sets are aligned to, if + // any. The reference names of this reference set must be a superset of those + // found in the imported file headers. If no reference set id is provided, a + // best effort is made to associate with a matching reference set. + string reference_set_id = 4; + + // A list of URIs pointing at [BAM + // files](https://samtools.github.io/hts-specs/SAMv1.pdf) + // in Google Cloud Storage. + // Those URIs can include wildcards (*), but do not add or remove + // matching files before import has completed. + // + // Note that Google Cloud Storage object listing is only eventually + // consistent: files added may be not be immediately visible to + // everyone. Thus, if using a wildcard it is preferable not to start + // the import immediately after the files are created. + repeated string source_uris = 2; + + // The partition strategy describes how read groups are partitioned into read + // group sets. + PartitionStrategy partition_strategy = 5; +} + +// The read group set import response. +message ImportReadGroupSetsResponse { + // IDs of the read group sets that were created. + repeated string read_group_set_ids = 1; +} + +// The read group set export request. +message ExportReadGroupSetRequest { + // Required. The Google Cloud project ID that owns this + // export. The caller must have WRITE access to this project. + string project_id = 1; + + // Required. A Google Cloud Storage URI for the exported BAM file. + // The currently authenticated user must have write access to the new file. + // An error will be returned if the URI already contains data. + string export_uri = 2; + + // Required. The ID of the read group set to export. The caller must have + // READ access to this read group set. + string read_group_set_id = 3; + + // The reference names to export. If this is not specified, all reference + // sequences, including unmapped reads, are exported. + // Use `*` to export only unmapped reads. + repeated string reference_names = 4; +} + +message UpdateReadGroupSetRequest { + // The ID of the read group set to be updated. The caller must have WRITE + // permissions to the dataset associated with this read group set. + string read_group_set_id = 1; + + // The new read group set data. See `updateMask` for details on mutability of + // fields. + ReadGroupSet read_group_set = 2; + + // An optional mask specifying which fields to update. Supported fields: + // + // * [name][google.genomics.v1.ReadGroupSet.name]. + // * [referenceSetId][google.genomics.v1.ReadGroupSet.reference_set_id]. + // + // Leaving `updateMask` unset is equivalent to specifying all mutable + // fields. + google.protobuf.FieldMask update_mask = 3; +} + +message DeleteReadGroupSetRequest { + // The ID of the read group set to be deleted. The caller must have WRITE + // permissions to the dataset associated with this read group set. + string read_group_set_id = 1; +} + +message GetReadGroupSetRequest { + // The ID of the read group set. + string read_group_set_id = 1; +} + +message ListCoverageBucketsRequest { + // Required. The ID of the read group set over which coverage is requested. + string read_group_set_id = 1; + + // The name of the reference to query, within the reference set associated + // with this query. Optional. + string reference_name = 3; + + // The start position of the range on the reference, 0-based inclusive. If + // specified, `referenceName` must also be specified. Defaults to 0. + int64 start = 4; + + // The end position of the range on the reference, 0-based exclusive. If + // specified, `referenceName` must also be specified. If unset or 0, defaults + // to the length of the reference. + int64 end = 5; + + // The desired width of each reported coverage bucket in base pairs. This + // will be rounded down to the nearest precomputed bucket width; the value + // of which is returned as `bucketWidth` in the response. Defaults + // to infinity (each bucket spans an entire reference sequence) or the length + // of the target range, if specified. The smallest precomputed + // `bucketWidth` is currently 2048 base pairs; this is subject to + // change. + int64 target_bucket_width = 6; + + // The continuation token, which is used to page through large result sets. + // To get the next page of results, set this parameter to the value of + // `nextPageToken` from the previous response. + string page_token = 7; + + // The maximum number of results to return in a single page. If unspecified, + // defaults to 1024. The maximum value is 2048. + int32 page_size = 8; +} + +// A bucket over which read coverage has been precomputed. A bucket corresponds +// to a specific range of the reference sequence. +message CoverageBucket { + // The genomic coordinate range spanned by this bucket. + Range range = 1; + + // The average number of reads which are aligned to each individual + // reference base in this bucket. + float mean_coverage = 2; +} + +message ListCoverageBucketsResponse { + // The length of each coverage bucket in base pairs. Note that buckets at the + // end of a reference sequence may be shorter. This value is omitted if the + // bucket width is infinity (the default behaviour, with no range or + // `targetBucketWidth`). + int64 bucket_width = 1; + + // The coverage buckets. The list of buckets is sparse; a bucket with 0 + // overlapping reads is not returned. A bucket never crosses more than one + // reference sequence. Each bucket has width `bucketWidth`, unless + // its end is the end of the reference sequence. + repeated CoverageBucket coverage_buckets = 2; + + // The continuation token, which is used to page through large result sets. + // Provide this value in a subsequent request to return the next page of + // results. This field will be empty if there aren't any additional results. + string next_page_token = 3; +} + +// The read search request. +message SearchReadsRequest { + // The IDs of the read groups sets within which to search for reads. All + // specified read group sets must be aligned against a common set of reference + // sequences; this defines the genomic coordinates for the query. Must specify + // one of `readGroupSetIds` or `readGroupIds`. + repeated string read_group_set_ids = 1; + + // The IDs of the read groups within which to search for reads. All specified + // read groups must belong to the same read group sets. Must specify one of + // `readGroupSetIds` or `readGroupIds`. + repeated string read_group_ids = 5; + + // The reference sequence name, for example `chr1`, `1`, or `chrX`. If set to + // `*`, only unmapped reads are returned. If unspecified, all reads (mapped + // and unmapped) are returned. + string reference_name = 7; + + // The start position of the range on the reference, 0-based inclusive. If + // specified, `referenceName` must also be specified. + int64 start = 8; + + // The end position of the range on the reference, 0-based exclusive. If + // specified, `referenceName` must also be specified. + int64 end = 9; + + // The continuation token, which is used to page through large result sets. + // To get the next page of results, set this parameter to the value of + // `nextPageToken` from the previous response. + string page_token = 3; + + // The maximum number of results to return in a single page. If unspecified, + // defaults to 256. The maximum value is 2048. + int32 page_size = 4; +} + +// The read search response. +message SearchReadsResponse { + // The list of matching alignments sorted by mapped genomic coordinate, + // if any, ascending in position within the same reference. Unmapped reads, + // which have no position, are returned contiguously and are sorted in + // ascending lexicographic order by fragment name. + repeated Read alignments = 1; + + // The continuation token, which is used to page through large result sets. + // Provide this value in a subsequent request to return the next page of + // results. This field will be empty if there aren't any additional results. + string next_page_token = 2; +} + +// The stream reads request. +message StreamReadsRequest { + // The Google Cloud project ID which will be billed + // for this access. The caller must have WRITE access to this project. + // Required. + string project_id = 1; + + // The ID of the read group set from which to stream reads. + string read_group_set_id = 2; + + // The reference sequence name, for example `chr1`, + // `1`, or `chrX`. If set to *, only unmapped reads are + // returned. + string reference_name = 3; + + // The start position of the range on the reference, 0-based inclusive. If + // specified, `referenceName` must also be specified. + int64 start = 4; + + // The end position of the range on the reference, 0-based exclusive. If + // specified, `referenceName` must also be specified. + int64 end = 5; + + // Restricts results to a shard containing approximately `1/totalShards` + // of the normal response payload for this query. Results from a sharded + // request are disjoint from those returned by all queries which differ only + // in their shard parameter. A shard may yield 0 results; this is especially + // likely for large values of `totalShards`. + // + // Valid values are `[0, totalShards)`. + int32 shard = 6; + + // Specifying `totalShards` causes a disjoint subset of the normal response + // payload to be returned for each query with a unique `shard` parameter + // specified. A best effort is made to yield equally sized shards. Sharding + // can be used to distribute processing amongst workers, where each worker is + // assigned a unique `shard` number and all workers specify the same + // `totalShards` number. The union of reads returned for all sharded queries + // `[0, totalShards)` is equal to those returned by a single unsharded query. + // + // Queries for different values of `totalShards` with common divisors will + // share shard boundaries. For example, streaming `shard` 2 of 5 + // `totalShards` yields the same results as streaming `shard`s 4 and 5 of 10 + // `totalShards`. This property can be leveraged for adaptive retries. + int32 total_shards = 7; +} + +message StreamReadsResponse { + repeated Read alignments = 1; +} diff --git a/handwritten/cloud-profiler/google/genomics/v1/references.proto b/handwritten/cloud-profiler/google/genomics/v1/references.proto new file mode 100644 index 00000000000..4ab107375df --- /dev/null +++ b/handwritten/cloud-profiler/google/genomics/v1/references.proto @@ -0,0 +1,282 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.genomics.v1; + +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/genomics/v1;genomics"; +option java_multiple_files = true; +option java_outer_classname = "ReferencesProto"; +option java_package = "com.google.genomics.v1"; + + +service ReferenceServiceV1 { + // Searches for reference sets which match the given criteria. + // + // For the definitions of references and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // Implements + // [GlobalAllianceApi.searchReferenceSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L71) + rpc SearchReferenceSets(SearchReferenceSetsRequest) returns (SearchReferenceSetsResponse) { + option (google.api.http) = { post: "/v1/referencesets/search" body: "*" }; + } + + // Gets a reference set. + // + // For the definitions of references and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // Implements + // [GlobalAllianceApi.getReferenceSet](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L83). + rpc GetReferenceSet(GetReferenceSetRequest) returns (ReferenceSet) { + option (google.api.http) = { get: "/v1/referencesets/{reference_set_id}" }; + } + + // Searches for references which match the given criteria. + // + // For the definitions of references and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // Implements + // [GlobalAllianceApi.searchReferences](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L146). + rpc SearchReferences(SearchReferencesRequest) returns (SearchReferencesResponse) { + option (google.api.http) = { post: "/v1/references/search" body: "*" }; + } + + // Gets a reference. + // + // For the definitions of references and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // Implements + // [GlobalAllianceApi.getReference](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L158). + rpc GetReference(GetReferenceRequest) returns (Reference) { + option (google.api.http) = { get: "/v1/references/{reference_id}" }; + } + + // Lists the bases in a reference, optionally restricted to a range. + // + // For the definitions of references and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // Implements + // [GlobalAllianceApi.getReferenceBases](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L221). + rpc ListBases(ListBasesRequest) returns (ListBasesResponse) { + option (google.api.http) = { get: "/v1/references/{reference_id}/bases" }; + } +} + +// A reference is a canonical assembled DNA sequence, intended to act as a +// reference coordinate space for other genomic annotations. A single reference +// might represent the human chromosome 1 or mitochandrial DNA, for instance. A +// reference belongs to one or more reference sets. +// +// For more genomics resource definitions, see [Fundamentals of Google +// Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) +message Reference { + // The server-generated reference ID, unique across all references. + string id = 1; + + // The length of this reference's sequence. + int64 length = 2; + + // MD5 of the upper-case sequence excluding all whitespace characters (this + // is equivalent to SQ:M5 in SAM). This value is represented in lower case + // hexadecimal format. + string md5checksum = 3; + + // The name of this reference, for example `22`. + string name = 4; + + // The URI from which the sequence was obtained. Typically specifies a FASTA + // format file. + string source_uri = 5; + + // All known corresponding accession IDs in INSDC (GenBank/ENA/DDBJ) ideally + // with a version number, for example `GCF_000001405.26`. + repeated string source_accessions = 6; + + // ID from http://www.ncbi.nlm.nih.gov/taxonomy. For example, 9606 for human. + int32 ncbi_taxon_id = 7; +} + +// A reference set is a set of references which typically comprise a reference +// assembly for a species, such as `GRCh38` which is representative +// of the human genome. A reference set defines a common coordinate space for +// comparing reference-aligned experimental data. A reference set contains 1 or +// more references. +// +// For more genomics resource definitions, see [Fundamentals of Google +// Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) +message ReferenceSet { + // The server-generated reference set ID, unique across all reference sets. + string id = 1; + + // The IDs of the reference objects that are part of this set. + // `Reference.md5checksum` must be unique within this set. + repeated string reference_ids = 2; + + // Order-independent MD5 checksum which identifies this reference set. The + // checksum is computed by sorting all lower case hexidecimal string + // `reference.md5checksum` (for all reference in this set) in + // ascending lexicographic order, concatenating, and taking the MD5 of that + // value. The resulting value is represented in lower case hexadecimal format. + string md5checksum = 3; + + // ID from http://www.ncbi.nlm.nih.gov/taxonomy (for example, 9606 for human) + // indicating the species which this reference set is intended to model. Note + // that contained references may specify a different `ncbiTaxonId`, as + // assemblies may contain reference sequences which do not belong to the + // modeled species, for example EBV in a human reference genome. + int32 ncbi_taxon_id = 4; + + // Free text description of this reference set. + string description = 5; + + // Public id of this reference set, such as `GRCh37`. + string assembly_id = 6; + + // The URI from which the references were obtained. + string source_uri = 7; + + // All known corresponding accession IDs in INSDC (GenBank/ENA/DDBJ) ideally + // with a version number, for example `NC_000001.11`. + repeated string source_accessions = 8; +} + +message SearchReferenceSetsRequest { + // If present, return reference sets for which the + // [md5checksum][google.genomics.v1.ReferenceSet.md5checksum] matches exactly. + repeated string md5checksums = 1; + + // If present, return reference sets for which a prefix of any of + // [sourceAccessions][google.genomics.v1.ReferenceSet.source_accessions] + // match any of these strings. Accession numbers typically have a main number + // and a version, for example `NC_000001.11`. + repeated string accessions = 2; + + // If present, return reference sets for which a substring of their + // `assemblyId` matches this string (case insensitive). + string assembly_id = 3; + + // The continuation token, which is used to page through large result sets. + // To get the next page of results, set this parameter to the value of + // `nextPageToken` from the previous response. + string page_token = 4; + + // The maximum number of results to return in a single page. If unspecified, + // defaults to 1024. The maximum value is 4096. + int32 page_size = 5; +} + +message SearchReferenceSetsResponse { + // The matching references sets. + repeated ReferenceSet reference_sets = 1; + + // The continuation token, which is used to page through large result sets. + // Provide this value in a subsequent request to return the next page of + // results. This field will be empty if there aren't any additional results. + string next_page_token = 2; +} + +message GetReferenceSetRequest { + // The ID of the reference set. + string reference_set_id = 1; +} + +message SearchReferencesRequest { + // If present, return references for which the + // [md5checksum][google.genomics.v1.Reference.md5checksum] matches exactly. + repeated string md5checksums = 1; + + // If present, return references for which a prefix of any of + // [sourceAccessions][google.genomics.v1.Reference.source_accessions] match + // any of these strings. Accession numbers typically have a main number and a + // version, for example `GCF_000001405.26`. + repeated string accessions = 2; + + // If present, return only references which belong to this reference set. + string reference_set_id = 3; + + // The continuation token, which is used to page through large result sets. + // To get the next page of results, set this parameter to the value of + // `nextPageToken` from the previous response. + string page_token = 4; + + // The maximum number of results to return in a single page. If unspecified, + // defaults to 1024. The maximum value is 4096. + int32 page_size = 5; +} + +message SearchReferencesResponse { + // The matching references. + repeated Reference references = 1; + + // The continuation token, which is used to page through large result sets. + // Provide this value in a subsequent request to return the next page of + // results. This field will be empty if there aren't any additional results. + string next_page_token = 2; +} + +message GetReferenceRequest { + // The ID of the reference. + string reference_id = 1; +} + +message ListBasesRequest { + // The ID of the reference. + string reference_id = 1; + + // The start position (0-based) of this query. Defaults to 0. + int64 start = 2; + + // The end position (0-based, exclusive) of this query. Defaults to the length + // of this reference. + int64 end = 3; + + // The continuation token, which is used to page through large result sets. + // To get the next page of results, set this parameter to the value of + // `nextPageToken` from the previous response. + string page_token = 4; + + // The maximum number of bases to return in a single page. If unspecified, + // defaults to 200Kbp (kilo base pairs). The maximum value is 10Mbp (mega base + // pairs). + int32 page_size = 5; +} + +message ListBasesResponse { + // The offset position (0-based) of the given `sequence` from the + // start of this `Reference`. This value will differ for each page + // in a paginated request. + int64 offset = 1; + + // A substring of the bases that make up this reference. + string sequence = 2; + + // The continuation token, which is used to page through large result sets. + // Provide this value in a subsequent request to return the next page of + // results. This field will be empty if there aren't any additional results. + string next_page_token = 3; +} diff --git a/handwritten/cloud-profiler/google/genomics/v1/variants.proto b/handwritten/cloud-profiler/google/genomics/v1/variants.proto new file mode 100644 index 00000000000..bdd80f98604 --- /dev/null +++ b/handwritten/cloud-profiler/google/genomics/v1/variants.proto @@ -0,0 +1,903 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.genomics.v1; + +import "google/api/annotations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/genomics/v1;genomics"; +option java_multiple_files = true; +option java_outer_classname = "VariantsProto"; +option java_package = "com.google.genomics.v1"; + + +service StreamingVariantService { + // Returns a stream of all the variants matching the search request, ordered + // by reference name, position, and ID. + rpc StreamVariants(StreamVariantsRequest) returns (stream StreamVariantsResponse) { + option (google.api.http) = { post: "/v1/variants:stream" body: "*" }; + } +} + +service VariantServiceV1 { + // Creates variant data by asynchronously importing the provided information. + // + // For the definitions of variant sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // The variants for import will be merged with any existing variant that + // matches its reference sequence, start, end, reference bases, and + // alternative bases. If no such variant exists, a new one will be created. + // + // When variants are merged, the call information from the new variant + // is added to the existing variant, and Variant info fields are merged + // as specified in + // [infoMergeConfig][google.genomics.v1.ImportVariantsRequest.info_merge_config]. + // As a special case, for single-sample VCF files, QUAL and FILTER fields will + // be moved to the call level; these are sometimes interpreted in a + // call-specific context. + // Imported VCF headers are appended to the metadata already in a variant set. + rpc ImportVariants(ImportVariantsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/variants:import" body: "*" }; + } + + // Creates a new variant set. + // + // For the definitions of variant sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // The provided variant set must have a valid `datasetId` set - all other + // fields are optional. Note that the `id` field will be ignored, as this is + // assigned by the server. + rpc CreateVariantSet(CreateVariantSetRequest) returns (VariantSet) { + option (google.api.http) = { post: "/v1/variantsets" body: "variant_set" }; + } + + // Exports variant set data to an external destination. + // + // For the definitions of variant sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc ExportVariantSet(ExportVariantSetRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/variantsets/{variant_set_id}:export" body: "*" }; + } + + // Gets a variant set by ID. + // + // For the definitions of variant sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc GetVariantSet(GetVariantSetRequest) returns (VariantSet) { + option (google.api.http) = { get: "/v1/variantsets/{variant_set_id}" }; + } + + // Returns a list of all variant sets matching search criteria. + // + // For the definitions of variant sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // Implements + // [GlobalAllianceApi.searchVariantSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L49). + rpc SearchVariantSets(SearchVariantSetsRequest) returns (SearchVariantSetsResponse) { + option (google.api.http) = { post: "/v1/variantsets/search" body: "*" }; + } + + // Deletes a variant set including all variants, call sets, and calls within. + // This is not reversible. + // + // For the definitions of variant sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc DeleteVariantSet(DeleteVariantSetRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/variantsets/{variant_set_id}" }; + } + + // Updates a variant set using patch semantics. + // + // For the definitions of variant sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc UpdateVariantSet(UpdateVariantSetRequest) returns (VariantSet) { + option (google.api.http) = { patch: "/v1/variantsets/{variant_set_id}" body: "variant_set" }; + } + + // Gets a list of variants matching the criteria. + // + // For the definitions of variants and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // Implements + // [GlobalAllianceApi.searchVariants](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L126). + rpc SearchVariants(SearchVariantsRequest) returns (SearchVariantsResponse) { + option (google.api.http) = { post: "/v1/variants/search" body: "*" }; + } + + // Creates a new variant. + // + // For the definitions of variants and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc CreateVariant(CreateVariantRequest) returns (Variant) { + option (google.api.http) = { post: "/v1/variants" body: "variant" }; + } + + // Updates a variant. + // + // For the definitions of variants and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // This method supports patch semantics. Returns the modified variant without + // its calls. + rpc UpdateVariant(UpdateVariantRequest) returns (Variant) { + option (google.api.http) = { patch: "/v1/variants/{variant_id}" body: "variant" }; + } + + // Deletes a variant. + // + // For the definitions of variants and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc DeleteVariant(DeleteVariantRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/variants/{variant_id}" }; + } + + // Gets a variant by ID. + // + // For the definitions of variants and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc GetVariant(GetVariantRequest) returns (Variant) { + option (google.api.http) = { get: "/v1/variants/{variant_id}" }; + } + + // Merges the given variants with existing variants. + // + // For the definitions of variants and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // Each variant will be + // merged with an existing variant that matches its reference sequence, + // start, end, reference bases, and alternative bases. If no such variant + // exists, a new one will be created. + // + // When variants are merged, the call information from the new variant + // is added to the existing variant. Variant info fields are merged as + // specified in the + // [infoMergeConfig][google.genomics.v1.MergeVariantsRequest.info_merge_config] + // field of the MergeVariantsRequest. + // + // Please exercise caution when using this method! It is easy to introduce + // mistakes in existing variants and difficult to back out of them. For + // example, + // suppose you were trying to merge a new variant with an existing one and + // both + // variants contain calls that belong to callsets with the same callset ID. + // + // // Existing variant - irrelevant fields trimmed for clarity + // { + // "variantSetId": "10473108253681171589", + // "referenceName": "1", + // "start": "10582", + // "referenceBases": "G", + // "alternateBases": [ + // "A" + // ], + // "calls": [ + // { + // "callSetId": "10473108253681171589-0", + // "callSetName": "CALLSET0", + // "genotype": [ + // 0, + // 1 + // ], + // } + // ] + // } + // + // // New variant with conflicting call information + // { + // "variantSetId": "10473108253681171589", + // "referenceName": "1", + // "start": "10582", + // "referenceBases": "G", + // "alternateBases": [ + // "A" + // ], + // "calls": [ + // { + // "callSetId": "10473108253681171589-0", + // "callSetName": "CALLSET0", + // "genotype": [ + // 1, + // 1 + // ], + // } + // ] + // } + // + // The resulting merged variant would overwrite the existing calls with those + // from the new variant: + // + // { + // "variantSetId": "10473108253681171589", + // "referenceName": "1", + // "start": "10582", + // "referenceBases": "G", + // "alternateBases": [ + // "A" + // ], + // "calls": [ + // { + // "callSetId": "10473108253681171589-0", + // "callSetName": "CALLSET0", + // "genotype": [ + // 1, + // 1 + // ], + // } + // ] + // } + // + // This may be the desired outcome, but it is up to the user to determine if + // if that is indeed the case. + rpc MergeVariants(MergeVariantsRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1/variants:merge" body: "*" }; + } + + // Gets a list of call sets matching the criteria. + // + // For the definitions of call sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // Implements + // [GlobalAllianceApi.searchCallSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L178). + rpc SearchCallSets(SearchCallSetsRequest) returns (SearchCallSetsResponse) { + option (google.api.http) = { post: "/v1/callsets/search" body: "*" }; + } + + // Creates a new call set. + // + // For the definitions of call sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc CreateCallSet(CreateCallSetRequest) returns (CallSet) { + option (google.api.http) = { post: "/v1/callsets" body: "call_set" }; + } + + // Updates a call set. + // + // For the definitions of call sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + // + // This method supports patch semantics. + rpc UpdateCallSet(UpdateCallSetRequest) returns (CallSet) { + option (google.api.http) = { patch: "/v1/callsets/{call_set_id}" body: "call_set" }; + } + + // Deletes a call set. + // + // For the definitions of call sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc DeleteCallSet(DeleteCallSetRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/callsets/{call_set_id}" }; + } + + // Gets a call set by ID. + // + // For the definitions of call sets and other genomics resources, see + // [Fundamentals of Google + // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + rpc GetCallSet(GetCallSetRequest) returns (CallSet) { + option (google.api.http) = { get: "/v1/callsets/{call_set_id}" }; + } +} + +// Metadata describes a single piece of variant call metadata. +// These data include a top level key and either a single value string (value) +// or a list of key-value pairs (info.) +// Value and info are mutually exclusive. +message VariantSetMetadata { + enum Type { + TYPE_UNSPECIFIED = 0; + + INTEGER = 1; + + FLOAT = 2; + + FLAG = 3; + + CHARACTER = 4; + + STRING = 5; + } + + // The top-level key. + string key = 1; + + // The value field for simple metadata + string value = 2; + + // User-provided ID field, not enforced by this API. + // Two or more pieces of structured metadata with identical + // id and key fields are considered equivalent. + string id = 4; + + // The type of data. Possible types include: Integer, Float, + // Flag, Character, and String. + Type type = 5; + + // The number of values that can be included in a field described by this + // metadata. + string number = 8; + + // A textual description of this metadata. + string description = 7; + + // Remaining structured metadata key-value pairs. This must be of the form + // map (string key mapping to a list of string values). + map info = 3; +} + +// A variant set is a collection of call sets and variants. It contains summary +// statistics of those contents. A variant set belongs to a dataset. +// +// For more genomics resource definitions, see [Fundamentals of Google +// Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) +message VariantSet { + // The dataset to which this variant set belongs. + string dataset_id = 1; + + // The server-generated variant set ID, unique across all variant sets. + string id = 2; + + // The reference set to which the variant set is mapped. The reference set + // describes the alignment provenance of the variant set, while the + // `referenceBounds` describe the shape of the actual variant data. The + // reference set's reference names are a superset of those found in the + // `referenceBounds`. + // + // For example, given a variant set that is mapped to the GRCh38 reference set + // and contains a single variant on reference 'X', `referenceBounds` would + // contain only an entry for 'X', while the associated reference set + // enumerates all possible references: '1', '2', 'X', 'Y', 'MT', etc. + string reference_set_id = 6; + + // A list of all references used by the variants in a variant set + // with associated coordinate upper bounds for each one. + repeated ReferenceBound reference_bounds = 5; + + // The metadata associated with this variant set. + repeated VariantSetMetadata metadata = 4; + + // User-specified, mutable name. + string name = 7; + + // A textual description of this variant set. + string description = 8; +} + +// A variant represents a change in DNA sequence relative to a reference +// sequence. For example, a variant could represent a SNP or an insertion. +// Variants belong to a variant set. +// +// For more genomics resource definitions, see [Fundamentals of Google +// Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) +// +// Each of the calls on a variant represent a determination of genotype with +// respect to that variant. For example, a call might assign probability of 0.32 +// to the occurrence of a SNP named rs1234 in a sample named NA12345. A call +// belongs to a call set, which contains related calls typically from one +// sample. +message Variant { + // The ID of the variant set this variant belongs to. + string variant_set_id = 15; + + // The server-generated variant ID, unique across all variants. + string id = 2; + + // Names for the variant, for example a RefSNP ID. + repeated string names = 3; + + // The date this variant was created, in milliseconds from the epoch. + int64 created = 12; + + // The reference on which this variant occurs. + // (such as `chr20` or `X`) + string reference_name = 14; + + // The position at which this variant occurs (0-based). + // This corresponds to the first base of the string of reference bases. + int64 start = 16; + + // The end position (0-based) of this variant. This corresponds to the first + // base after the last base in the reference allele. So, the length of + // the reference allele is (end - start). This is useful for variants + // that don't explicitly give alternate bases, for example large deletions. + int64 end = 13; + + // The reference bases for this variant. They start at the given + // position. + string reference_bases = 6; + + // The bases that appear instead of the reference bases. + repeated string alternate_bases = 7; + + // A measure of how likely this variant is to be real. + // A higher value is better. + double quality = 8; + + // A list of filters (normally quality filters) this variant has failed. + // `PASS` indicates this variant has passed all filters. + repeated string filter = 9; + + // A map of additional variant information. This must be of the form + // map (string key mapping to a list of string values). + map info = 10; + + // The variant calls for this particular variant. Each one represents the + // determination of genotype with respect to this variant. + repeated VariantCall calls = 11; +} + +// A call represents the determination of genotype with respect to a particular +// variant. It may include associated information such as quality and phasing. +// For example, a call might assign a probability of 0.32 to the occurrence of +// a SNP named rs1234 in a call set with the name NA12345. +message VariantCall { + // The ID of the call set this variant call belongs to. + string call_set_id = 8; + + // The name of the call set this variant call belongs to. + string call_set_name = 9; + + // The genotype of this variant call. Each value represents either the value + // of the `referenceBases` field or a 1-based index into + // `alternateBases`. If a variant had a `referenceBases` + // value of `T` and an `alternateBases` + // value of `["A", "C"]`, and the `genotype` was + // `[2, 1]`, that would mean the call + // represented the heterozygous value `CA` for this variant. + // If the `genotype` was instead `[0, 1]`, the + // represented value would be `TA`. Ordering of the + // genotype values is important if the `phaseset` is present. + // If a genotype is not called (that is, a `.` is present in the + // GT string) -1 is returned. + repeated int32 genotype = 7; + + // If this field is present, this variant call's genotype ordering implies + // the phase of the bases and is consistent with any other variant calls in + // the same reference sequence which have the same phaseset value. + // When importing data from VCF, if the genotype data was phased but no + // phase set was specified this field will be set to `*`. + string phaseset = 5; + + // The genotype likelihoods for this variant call. Each array entry + // represents how likely a specific genotype is for this call. The value + // ordering is defined by the GL tag in the VCF spec. + // If Phred-scaled genotype likelihood scores (PL) are available and + // log10(P) genotype likelihood scores (GL) are not, PL scores are converted + // to GL scores. If both are available, PL scores are stored in `info`. + repeated double genotype_likelihood = 6; + + // A map of additional variant call information. This must be of the form + // map (string key mapping to a list of string values). + map info = 2; +} + +// A call set is a collection of variant calls, typically for one sample. It +// belongs to a variant set. +// +// For more genomics resource definitions, see [Fundamentals of Google +// Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) +message CallSet { + // The server-generated call set ID, unique across all call sets. + string id = 1; + + // The call set name. + string name = 2; + + // The sample ID this call set corresponds to. + string sample_id = 7; + + // The IDs of the variant sets this call set belongs to. This field must + // have exactly length one, as a call set belongs to a single variant set. + // This field is repeated for compatibility with the + // [GA4GH 0.5.1 + // API](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variants.avdl#L76). + repeated string variant_set_ids = 6; + + // The date this call set was created in milliseconds from the epoch. + int64 created = 5; + + // A map of additional call set information. This must be of the form + // map (string key mapping to a list of string values). + map info = 4; +} + +// ReferenceBound records an upper bound for the starting coordinate of +// variants in a particular reference. +message ReferenceBound { + // The name of the reference associated with this reference bound. + string reference_name = 1; + + // An upper bound (inclusive) on the starting coordinate of any + // variant in the reference sequence. + int64 upper_bound = 2; +} + +// The variant data import request. +message ImportVariantsRequest { + enum Format { + FORMAT_UNSPECIFIED = 0; + + // VCF (Variant Call Format). The VCF files may be gzip compressed. gVCF is + // also supported. + FORMAT_VCF = 1; + + // Complete Genomics masterVarBeta format. The masterVarBeta files may + // be bzip2 compressed. + FORMAT_COMPLETE_GENOMICS = 2; + } + + // Required. The variant set to which variant data should be imported. + string variant_set_id = 1; + + // A list of URIs referencing variant files in Google Cloud Storage. URIs can + // include wildcards [as described + // here](https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames). + // Note that recursive wildcards ('**') are not supported. + repeated string source_uris = 2; + + // The format of the variant data being imported. If unspecified, defaults to + // to `VCF`. + Format format = 3; + + // Convert reference names to the canonical representation. + // hg19 haploytypes (those reference names containing "_hap") + // are not modified in any way. + // All other reference names are modified according to the following rules: + // The reference name is capitalized. + // The "chr" prefix is dropped for all autosomes and sex chromsomes. + // For example "chr17" becomes "17" and "chrX" becomes "X". + // All mitochondrial chromosomes ("chrM", "chrMT", etc) become "MT". + bool normalize_reference_names = 5; + + // A mapping between info field keys and the InfoMergeOperations to + // be performed on them. This is plumbed down to the MergeVariantRequests + // generated by the resulting import job. + map info_merge_config = 6; +} + +// The variant data import response. +message ImportVariantsResponse { + // IDs of the call sets created during the import. + repeated string call_set_ids = 1; +} + +// The CreateVariantSet request +message CreateVariantSetRequest { + // Required. The variant set to be created. Must have a valid `datasetId`. + VariantSet variant_set = 1; +} + +// The variant data export request. +message ExportVariantSetRequest { + enum Format { + FORMAT_UNSPECIFIED = 0; + + // Export the data to Google BigQuery. + FORMAT_BIGQUERY = 1; + } + + // Required. The ID of the variant set that contains variant data which + // should be exported. The caller must have READ access to this variant set. + string variant_set_id = 1; + + // If provided, only variant call information from the specified call sets + // will be exported. By default all variant calls are exported. + repeated string call_set_ids = 2; + + // Required. The Google Cloud project ID that owns the destination + // BigQuery dataset. The caller must have WRITE access to this project. This + // project will also own the resulting export job. + string project_id = 3; + + // The format for the exported data. + Format format = 4; + + // Required. The BigQuery dataset to export data to. This dataset must already + // exist. Note that this is distinct from the Genomics concept of "dataset". + string bigquery_dataset = 5; + + // Required. The BigQuery table to export data to. + // If the table doesn't exist, it will be created. If it already exists, it + // will be overwritten. + string bigquery_table = 6; +} + +// The variant set request. +message GetVariantSetRequest { + // Required. The ID of the variant set. + string variant_set_id = 1; +} + +// The search variant sets request. +message SearchVariantSetsRequest { + // Exactly one dataset ID must be provided here. Only variant sets which + // belong to this dataset will be returned. + repeated string dataset_ids = 1; + + // The continuation token, which is used to page through large result sets. + // To get the next page of results, set this parameter to the value of + // `nextPageToken` from the previous response. + string page_token = 2; + + // The maximum number of results to return in a single page. If unspecified, + // defaults to 1024. + int32 page_size = 3; +} + +// The search variant sets response. +message SearchVariantSetsResponse { + // The variant sets belonging to the requested dataset. + repeated VariantSet variant_sets = 1; + + // The continuation token, which is used to page through large result sets. + // Provide this value in a subsequent request to return the next page of + // results. This field will be empty if there aren't any additional results. + string next_page_token = 2; +} + +// The delete variant set request. +message DeleteVariantSetRequest { + // The ID of the variant set to be deleted. + string variant_set_id = 1; +} + +message UpdateVariantSetRequest { + // The ID of the variant to be updated (must already exist). + string variant_set_id = 1; + + // The new variant data. Only the variant_set.metadata will be considered + // for update. + VariantSet variant_set = 2; + + // An optional mask specifying which fields to update. Supported fields: + // + // * [metadata][google.genomics.v1.VariantSet.metadata]. + // * [name][google.genomics.v1.VariantSet.name]. + // * [description][google.genomics.v1.VariantSet.description]. + // + // Leaving `updateMask` unset is equivalent to specifying all mutable + // fields. + google.protobuf.FieldMask update_mask = 5; +} + +// The variant search request. +message SearchVariantsRequest { + // At most one variant set ID must be provided. Only variants from this + // variant set will be returned. If omitted, a call set id must be included in + // the request. + repeated string variant_set_ids = 1; + + // Only return variants which have exactly this name. + string variant_name = 2; + + // Only return variant calls which belong to call sets with these ids. + // Leaving this blank returns all variant calls. If a variant has no + // calls belonging to any of these call sets, it won't be returned at all. + repeated string call_set_ids = 3; + + // Required. Only return variants in this reference sequence. + string reference_name = 4; + + // The beginning of the window (0-based, inclusive) for which + // overlapping variants should be returned. If unspecified, defaults to 0. + int64 start = 5; + + // The end of the window, 0-based exclusive. If unspecified or 0, defaults to + // the length of the reference. + int64 end = 6; + + // The continuation token, which is used to page through large result sets. + // To get the next page of results, set this parameter to the value of + // `nextPageToken` from the previous response. + string page_token = 7; + + // The maximum number of variants to return in a single page. If unspecified, + // defaults to 5000. The maximum value is 10000. + int32 page_size = 8; + + // The maximum number of calls to return in a single page. Note that this + // limit may be exceeded in the event that a matching variant contains more + // calls than the requested maximum. If unspecified, defaults to 5000. The + // maximum value is 10000. + int32 max_calls = 9; +} + +// The variant search response. +message SearchVariantsResponse { + // The list of matching Variants. + repeated Variant variants = 1; + + // The continuation token, which is used to page through large result sets. + // Provide this value in a subsequent request to return the next page of + // results. This field will be empty if there aren't any additional results. + string next_page_token = 2; +} + +message CreateVariantRequest { + // The variant to be created. + Variant variant = 1; +} + +message UpdateVariantRequest { + // The ID of the variant to be updated. + string variant_id = 1; + + // The new variant data. + Variant variant = 2; + + // An optional mask specifying which fields to update. At this time, mutable + // fields are [names][google.genomics.v1.Variant.names] and + // [info][google.genomics.v1.Variant.info]. Acceptable values are "names" and + // "info". If unspecified, all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 3; +} + +message DeleteVariantRequest { + // The ID of the variant to be deleted. + string variant_id = 1; +} + +message GetVariantRequest { + // The ID of the variant. + string variant_id = 1; +} + +message MergeVariantsRequest { + // The destination variant set. + string variant_set_id = 1; + + // The variants to be merged with existing variants. + repeated Variant variants = 2; + + // A mapping between info field keys and the InfoMergeOperations to + // be performed on them. + map info_merge_config = 3; +} + +// The call set search request. +message SearchCallSetsRequest { + // Restrict the query to call sets within the given variant sets. At least one + // ID must be provided. + repeated string variant_set_ids = 1; + + // Only return call sets for which a substring of the name matches this + // string. + string name = 2; + + // The continuation token, which is used to page through large result sets. + // To get the next page of results, set this parameter to the value of + // `nextPageToken` from the previous response. + string page_token = 3; + + // The maximum number of results to return in a single page. If unspecified, + // defaults to 1024. + int32 page_size = 4; +} + +// The call set search response. +message SearchCallSetsResponse { + // The list of matching call sets. + repeated CallSet call_sets = 1; + + // The continuation token, which is used to page through large result sets. + // Provide this value in a subsequent request to return the next page of + // results. This field will be empty if there aren't any additional results. + string next_page_token = 2; +} + +message CreateCallSetRequest { + // The call set to be created. + CallSet call_set = 1; +} + +message UpdateCallSetRequest { + // The ID of the call set to be updated. + string call_set_id = 1; + + // The new call set data. + CallSet call_set = 2; + + // An optional mask specifying which fields to update. At this time, the only + // mutable field is [name][google.genomics.v1.CallSet.name]. The only + // acceptable value is "name". If unspecified, all mutable fields will be + // updated. + google.protobuf.FieldMask update_mask = 3; +} + +message DeleteCallSetRequest { + // The ID of the call set to be deleted. + string call_set_id = 1; +} + +message GetCallSetRequest { + // The ID of the call set. + string call_set_id = 1; +} + +// The stream variants request. +message StreamVariantsRequest { + // The Google Cloud project ID which will be billed + // for this access. The caller must have WRITE access to this project. + // Required. + string project_id = 1; + + // The variant set ID from which to stream variants. + string variant_set_id = 2; + + // Only return variant calls which belong to call sets with these IDs. + // Leaving this blank returns all variant calls. + repeated string call_set_ids = 3; + + // Required. Only return variants in this reference sequence. + string reference_name = 4; + + // The beginning of the window (0-based, inclusive) for which + // overlapping variants should be returned. + int64 start = 5; + + // The end of the window (0-based, exclusive) for which overlapping + // variants should be returned. + int64 end = 6; +} + +message StreamVariantsResponse { + repeated Variant variants = 1; +} + +// Operations to be performed during import on Variant info fields. +// These operations are set for each info field in the info_merge_config +// map of ImportVariantsRequest, which is plumbed down to the +// MergeVariantRequests generated by the import job. +enum InfoMergeOperation { + INFO_MERGE_OPERATION_UNSPECIFIED = 0; + + // By default, Variant info fields are persisted if the Variant doesn't + // already exist in the variantset. If the Variant is equivalent to a + // Variant already in the variantset, the incoming Variant's info field + // is ignored in favor of that of the already persisted Variant. + IGNORE_NEW = 1; + + // This operation removes an info field from the incoming Variant + // and persists this info field in each of the incoming Variant's Calls. + MOVE_TO_CALLS = 2; +} diff --git a/handwritten/cloud-profiler/google/genomics/v1alpha2/pipelines.proto b/handwritten/cloud-profiler/google/genomics/v1alpha2/pipelines.proto new file mode 100644 index 00000000000..c0f51022340 --- /dev/null +++ b/handwritten/cloud-profiler/google/genomics/v1alpha2/pipelines.proto @@ -0,0 +1,614 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.genomics.v1alpha2; + +import "google/api/annotations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/code.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/genomics/v1alpha2;genomics"; +option java_multiple_files = true; +option java_outer_classname = "PipelinesProto"; +option java_package = "com.google.genomics.v1a"; + + +// A service for running genomics pipelines. +service PipelinesV1Alpha2 { + // Creates a pipeline that can be run later. Create takes a Pipeline that + // has all fields other than `pipelineId` populated, and then returns + // the same pipeline with `pipelineId` populated. This id can be used + // to run the pipeline. + // + // Caller must have WRITE permission to the project. + rpc CreatePipeline(CreatePipelineRequest) returns (Pipeline) { + option (google.api.http) = { post: "/v1alpha2/pipelines" body: "pipeline" }; + } + + // Runs a pipeline. If `pipelineId` is specified in the request, then + // run a saved pipeline. If `ephemeralPipeline` is specified, then run + // that pipeline once without saving a copy. + // + // The caller must have READ permission to the project where the pipeline + // is stored and WRITE permission to the project where the pipeline will be + // run, as VMs will be created and storage will be used. + rpc RunPipeline(RunPipelineRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1alpha2/pipelines:run" body: "*" }; + } + + // Retrieves a pipeline based on ID. + // + // Caller must have READ permission to the project. + rpc GetPipeline(GetPipelineRequest) returns (Pipeline) { + option (google.api.http) = { get: "/v1alpha2/pipelines/{pipeline_id}" }; + } + + // Lists pipelines. + // + // Caller must have READ permission to the project. + rpc ListPipelines(ListPipelinesRequest) returns (ListPipelinesResponse) { + option (google.api.http) = { get: "/v1alpha2/pipelines" }; + } + + // Deletes a pipeline based on ID. + // + // Caller must have WRITE permission to the project. + rpc DeletePipeline(DeletePipelineRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1alpha2/pipelines/{pipeline_id}" }; + } + + // Gets controller configuration information. Should only be called + // by VMs created by the Pipelines Service and not by end users. + rpc GetControllerConfig(GetControllerConfigRequest) returns (ControllerConfig) { + option (google.api.http) = { get: "/v1alpha2/pipelines:getControllerConfig" }; + } + + // Sets status of a given operation. Any new timestamps (as determined by + // description) are appended to TimestampEvents. Should only be called by VMs + // created by the Pipelines Service and not by end users. + rpc SetOperationStatus(SetOperationStatusRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { put: "/v1alpha2/pipelines:setOperationStatus" body: "*" }; + } +} + +// Describes a Compute Engine resource that is being managed by a running +// [pipeline][google.genomics.v1alpha2.Pipeline]. +message ComputeEngine { + // The instance on which the operation is running. + string instance_name = 1; + + // The availability zone in which the instance resides. + string zone = 2; + + // The machine type of the instance. + string machine_type = 3; + + // The names of the disks that were created for this pipeline. + repeated string disk_names = 4; +} + +// Runtime metadata that will be populated in the +// [runtimeMetadata][google.genomics.v1.OperationMetadata.runtime_metadata] +// field of the Operation associated with a RunPipeline execution. +message RuntimeMetadata { + // Execution information specific to Google Compute Engine. + ComputeEngine compute_engine = 1; +} + +// The pipeline object. Represents a transformation from a set of input +// parameters to a set of output parameters. The transformation is defined +// as a docker image and command to run within that image. Each pipeline +// is run on a Google Compute Engine VM. A pipeline can be created with the +// `create` method and then later run with the `run` method, or a pipeline can +// be defined and run all at once with the `run` method. +message Pipeline { + // Required. The project in which to create the pipeline. The caller must have + // WRITE access. + string project_id = 1; + + // Required. A user specified pipeline name that does not have to be unique. + // This name can be used for filtering Pipelines in ListPipelines. + string name = 2; + + // User-specified description. + string description = 3; + + // Input parameters of the pipeline. + repeated PipelineParameter input_parameters = 8; + + // Output parameters of the pipeline. + repeated PipelineParameter output_parameters = 9; + + // Required. The executor indicates in which environment the pipeline runs. + oneof executor { + // Specifies the docker run information. + DockerExecutor docker = 5; + } + + // Required. Specifies resource requirements for the pipeline run. + // Required fields: + // + // * + // [minimumCpuCores][google.genomics.v1alpha2.PipelineResources.minimum_cpu_cores] + // + // * + // [minimumRamGb][google.genomics.v1alpha2.PipelineResources.minimum_ram_gb] + PipelineResources resources = 6; + + // Unique pipeline id that is generated by the service when CreatePipeline + // is called. Cannot be specified in the Pipeline used in the + // CreatePipelineRequest, and will be populated in the response to + // CreatePipeline and all subsequent Get and List calls. Indicates that the + // service has registered this pipeline. + string pipeline_id = 7; +} + +// The request to create a pipeline. The pipeline field here should not have +// `pipelineId` populated, as that will be populated by the server. +message CreatePipelineRequest { + // The pipeline to create. Should not have `pipelineId` populated. + Pipeline pipeline = 1; +} + +// The pipeline run arguments. +message RunPipelineArgs { + // Required. The project in which to run the pipeline. The caller must have + // WRITER access to all Google Cloud services and resources (e.g. Google + // Compute Engine) will be used. + string project_id = 1; + + // Pipeline input arguments; keys are defined in the pipeline documentation. + // All input parameters that do not have default values must be specified. + // If parameters with defaults are specified here, the defaults will be + // overridden. + map inputs = 2; + + // Pipeline output arguments; keys are defined in the pipeline + // documentation. All output parameters of without default values + // must be specified. If parameters with defaults are specified + // here, the defaults will be overridden. + map outputs = 3; + + // The Google Cloud Service Account that will be used to access data and + // services. By default, the compute service account associated with + // `projectId` is used. + ServiceAccount service_account = 4; + + // This field is deprecated. Use `labels` instead. Client-specified pipeline + // operation identifier. + string client_id = 5; + + // Specifies resource requirements/overrides for the pipeline run. + PipelineResources resources = 6; + + // Required. Logging options. Used by the service to communicate results + // to the user. + LoggingOptions logging = 7; + + // How long to keep the VM up after a failure (for example docker command + // failed, copying input or output files failed, etc). While the VM is up, one + // can ssh into the VM to debug. Default is 0; maximum allowed value is 1 day. + google.protobuf.Duration keep_vm_alive_on_failure_duration = 8; + + // Labels to apply to this pipeline run. Labels will also be applied to + // compute resources (VM, disks) created by this pipeline run. When listing + // operations, operations can [filtered by labels] + // [google.longrunning.ListOperationsRequest.filter]. + // Label keys may not be empty; label values may be empty. Non-empty labels + // must be 1-63 characters long, and comply with [RFC1035] + // (https://www.ietf.org/rfc/rfc1035.txt). + // Specifically, the name must be 1-63 characters long and match the regular + // expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first + // character must be a lowercase letter, and all following characters must be + // a dash, lowercase letter, or digit, except the last character, which cannot + // be a dash. + map labels = 9; +} + +// The request to run a pipeline. If `pipelineId` is specified, it +// refers to a saved pipeline created with CreatePipeline and set as +// the `pipelineId` of the returned Pipeline object. If +// `ephemeralPipeline` is specified, that pipeline is run once +// with the given args and not saved. It is an error to specify both +// `pipelineId` and `ephemeralPipeline`. `pipelineArgs` +// must be specified. +message RunPipelineRequest { + oneof pipeline { + // The already created pipeline to run. + string pipeline_id = 1; + + // A new pipeline object to run once and then delete. + Pipeline ephemeral_pipeline = 2; + } + + // The arguments to use when running this pipeline. + RunPipelineArgs pipeline_args = 3; +} + +// A request to get a saved pipeline by id. +message GetPipelineRequest { + // Caller must have READ access to the project in which this pipeline + // is defined. + string pipeline_id = 1; +} + +// A request to list pipelines in a given project. Pipelines can be +// filtered by name using `namePrefix`: all pipelines with names that +// begin with `namePrefix` will be returned. Uses standard pagination: +// `pageSize` indicates how many pipelines to return, and +// `pageToken` comes from a previous ListPipelinesResponse to +// indicate offset. +message ListPipelinesRequest { + // Required. The name of the project to search for pipelines. Caller + // must have READ access to this project. + string project_id = 1; + + // Pipelines with names that match this prefix should be + // returned. If unspecified, all pipelines in the project, up to + // `pageSize`, will be returned. + string name_prefix = 2; + + // Number of pipelines to return at once. Defaults to 256, and max + // is 2048. + int32 page_size = 3; + + // Token to use to indicate where to start getting results. + // If unspecified, returns the first page of results. + string page_token = 4; +} + +// The response of ListPipelines. Contains at most `pageSize` +// pipelines. If it contains `pageSize` pipelines, and more pipelines +// exist, then `nextPageToken` will be populated and should be +// used as the `pageToken` argument to a subsequent ListPipelines +// request. +message ListPipelinesResponse { + // The matched pipelines. + repeated Pipeline pipelines = 1; + + // The token to use to get the next page of results. + string next_page_token = 2; +} + +// The request to delete a saved pipeline by ID. +message DeletePipelineRequest { + // Caller must have WRITE access to the project in which this pipeline + // is defined. + string pipeline_id = 1; +} + +// Request to get controller configuation. Should only be used +// by VMs created by the Pipelines Service and not by end users. +message GetControllerConfigRequest { + // The operation to retrieve controller configuration for. + string operation_id = 1; + + uint64 validation_token = 2; +} + +// Stores the information that the controller will fetch from the +// server in order to run. Should only be used by VMs created by the +// Pipelines Service and not by end users. +message ControllerConfig { + message RepeatedString { + repeated string values = 1; + } + + string image = 1; + + string cmd = 2; + + string gcs_log_path = 3; + + string machine_type = 4; + + map vars = 5; + + map disks = 6; + + map gcs_sources = 7; + + map gcs_sinks = 8; +} + +// Stores the list of events and times they occured for major events in job +// execution. +message TimestampEvent { + // String indicating the type of event + string description = 1; + + // The time this event occured. + google.protobuf.Timestamp timestamp = 2; +} + +// Request to set operation status. Should only be used by VMs +// created by the Pipelines Service and not by end users. +message SetOperationStatusRequest { + string operation_id = 1; + + repeated TimestampEvent timestamp_events = 2; + + google.rpc.Code error_code = 3; + + string error_message = 4; + + uint64 validation_token = 5; +} + +// A Google Cloud Service Account. +message ServiceAccount { + // Email address of the service account. Defaults to `default`, + // which uses the compute service account associated with the project. + string email = 1; + + // List of scopes to be enabled for this service account on the VM. + // The following scopes are automatically included: + // + // * https://www.googleapis.com/auth/compute + // * https://www.googleapis.com/auth/devstorage.full_control + // * https://www.googleapis.com/auth/genomics + // * https://www.googleapis.com/auth/logging.write + // * https://www.googleapis.com/auth/monitoring.write + repeated string scopes = 2; +} + +// The logging options for the pipeline run. +message LoggingOptions { + // The location in Google Cloud Storage to which the pipeline logs + // will be copied. Can be specified as a fully qualified directory + // path, in which case logs will be output with a unique identifier + // as the filename in that directory, or as a fully specified path, + // which must end in `.log`, in which case that path will be + // used, and the user must ensure that logs are not + // overwritten. Stdout and stderr logs from the run are also + // generated and output as `-stdout.log` and `-stderr.log`. + string gcs_path = 1; +} + +// The system resources for the pipeline run. +message PipelineResources { + // A Google Compute Engine disk resource specification. + message Disk { + // The types of disks that may be attached to VMs. + enum Type { + // Default disk type. Use one of the other options below. + TYPE_UNSPECIFIED = 0; + + // Specifies a Google Compute Engine persistent hard disk. See + // https://cloud.google.com/compute/docs/disks/#pdspecs for details. + PERSISTENT_HDD = 1; + + // Specifies a Google Compute Engine persistent solid-state disk. See + // https://cloud.google.com/compute/docs/disks/#pdspecs for details. + PERSISTENT_SSD = 2; + + // Specifies a Google Compute Engine local SSD. + // See https://cloud.google.com/compute/docs/disks/local-ssd for details. + LOCAL_SSD = 3; + } + + // Required. The name of the disk that can be used in the pipeline + // parameters. Must be 1 - 63 characters. + // The name "boot" is reserved for system use. + string name = 1; + + // Required. The type of the disk to create. + Type type = 2; + + // The size of the disk. Defaults to 500 (GB). + // This field is not applicable for local SSD. + int32 size_gb = 3; + + // The full or partial URL of the persistent disk to attach. See + // https://cloud.google.com/compute/docs/reference/latest/instances#resource + // and + // https://cloud.google.com/compute/docs/disks/persistent-disks#snapshots + // for more details. + string source = 4; + + // Deprecated. Disks created by the Pipelines API will be deleted at the end + // of the pipeline run, regardless of what this field is set to. + bool auto_delete = 6; + + // Required at create time and cannot be overridden at run time. + // Specifies the path in the docker container where files on + // this disk should be located. For example, if `mountPoint` + // is `/mnt/disk`, and the parameter has `localPath` + // `inputs/file.txt`, the docker container can access the data at + // `/mnt/disk/inputs/file.txt`. + string mount_point = 8; + } + + // The minimum number of cores to use. Defaults to 1. + int32 minimum_cpu_cores = 1; + + // Whether to use preemptible VMs. Defaults to `false`. In order to use this, + // must be true for both create time and run time. Cannot be true at run time + // if false at create time. + bool preemptible = 2; + + // The minimum amount of RAM to use. Defaults to 3.75 (GB) + double minimum_ram_gb = 3; + + // Disks to attach. + repeated Disk disks = 4; + + // List of Google Compute Engine availability zones to which resource + // creation will restricted. If empty, any zone may be chosen. + repeated string zones = 5; + + // The size of the boot disk. Defaults to 10 (GB). + int32 boot_disk_size_gb = 6; + + // Whether to assign an external IP to the instance. This is an experimental + // feature that may go away. Defaults to false. + // Corresponds to `--no_address` flag for [gcloud compute instances create] + // (https://cloud.google.com/sdk/gcloud/reference/compute/instances/create). + // In order to use this, must be true for both create time and run time. + // Cannot be true at run time if false at create time. If you need to ssh into + // a private IP VM for debugging, you can ssh to a public VM and then ssh into + // the private VM's Internal IP. If noAddress is set, this pipeline run may + // only load docker images from Google Container Registry and not Docker Hub. + // ** Note: To use this option, your project must be in Google Access for + // Private IPs Early Access Program.** + bool no_address = 7; +} + +// Parameters facilitate setting and delivering data into the +// pipeline's execution environment. They are defined at create time, +// with optional defaults, and can be overridden at run time. +// +// If `localCopy` is unset, then the parameter specifies a string that +// is passed as-is into the pipeline, as the value of the environment +// variable with the given name. A default value can be optionally +// specified at create time. The default can be overridden at run time +// using the inputs map. If no default is given, a value must be +// supplied at runtime. +// +// If `localCopy` is defined, then the parameter specifies a data +// source or sink, both in Google Cloud Storage and on the Docker container +// where the pipeline computation is run. The [service account associated with +// the Pipeline][google.genomics.v1alpha2.RunPipelineArgs.service_account] (by +// default the project's Compute Engine service account) must have access to the +// Google Cloud Storage paths. +// +// At run time, the Google Cloud Storage paths can be overridden if a default +// was provided at create time, or must be set otherwise. The pipeline runner +// should add a key/value pair to either the inputs or outputs map. The +// indicated data copies will be carried out before/after pipeline execution, +// just as if the corresponding arguments were provided to `gsutil cp`. +// +// For example: Given the following `PipelineParameter`, specified +// in the `inputParameters` list: +// +// ``` +// {name: "input_file", localCopy: {path: "file.txt", disk: "pd1"}} +// ``` +// +// where `disk` is defined in the `PipelineResources` object as: +// +// ``` +// {name: "pd1", mountPoint: "/mnt/disk/"} +// ``` +// +// We create a disk named `pd1`, mount it on the host VM, and map +// `/mnt/pd1` to `/mnt/disk` in the docker container. At +// runtime, an entry for `input_file` would be required in the inputs +// map, such as: +// +// ``` +// inputs["input_file"] = "gs://my-bucket/bar.txt" +// ``` +// +// This would generate the following gsutil call: +// +// ``` +// gsutil cp gs://my-bucket/bar.txt /mnt/pd1/file.txt +// ``` +// +// The file `/mnt/pd1/file.txt` maps to `/mnt/disk/file.txt` in the +// Docker container. Acceptable paths are: +// +//
+// +// +// +// +// +// +// +//
Google Cloud storage pathLocal path
filefile
globdirectory
+// +// For outputs, the direction of the copy is reversed: +// +// ``` +// gsutil cp /mnt/disk/file.txt gs://my-bucket/bar.txt +// ``` +// +// Acceptable paths are: +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +//
Local pathGoogle Cloud Storage path
filefile
filedirectory - directory must already exist
globdirectory - directory will be created if it doesn't exist
+// +// One restriction due to docker limitations, is that for outputs that are found +// on the boot disk, the local path cannot be a glob and must be a file. +message PipelineParameter { + // LocalCopy defines how a remote file should be copied to and from the VM. + message LocalCopy { + // Required. The path within the user's docker container where + // this input should be localized to and from, relative to the specified + // disk's mount point. For example: file.txt, + string path = 1; + + // Required. The name of the disk where this parameter is + // located. Can be the name of one of the disks specified in the + // Resources field, or "boot", which represents the Docker + // instance's boot disk and has a mount point of `/`. + string disk = 2; + } + + // Required. Name of the parameter - the pipeline runner uses this string + // as the key to the input and output maps in RunPipeline. + string name = 1; + + // Human-readable description. + string description = 2; + + // The default value for this parameter. Can be overridden at runtime. + // If `localCopy` is present, then this must be a Google Cloud Storage path + // beginning with `gs://`. + string default_value = 5; + + // If present, this parameter is marked for copying to and from the VM. + // `LocalCopy` indicates where on the VM the file should be. The value + // given to this parameter (either at runtime or using `defaultValue`) + // must be the remote path where the file should be. + LocalCopy local_copy = 6; +} + +// The Docker execuctor specification. +message DockerExecutor { + // Required. Image name from either Docker Hub or Google Container Registry. + // Users that run pipelines must have READ access to the image. + string image_name = 1; + + // Required. The command or newline delimited script to run. The command + // string will be executed within a bash shell. + // + // If the command exits with a non-zero exit code, output parameter + // de-localization will be skipped and the pipeline operation's + // [`error`][google.longrunning.Operation.error] field will be populated. + // + // Maximum command string length is 16384. + string cmd = 2; +} diff --git a/handwritten/cloud-profiler/google/iam/README.md b/handwritten/cloud-profiler/google/iam/README.md new file mode 100644 index 00000000000..c402a9dd05b --- /dev/null +++ b/handwritten/cloud-profiler/google/iam/README.md @@ -0,0 +1,14 @@ +# Introduction + +# Key Concepts + +## Service Account + +A Service Account is an account used to identify services (non-humans) to Google. +A Service Account has a list of Service Account Keys, which can be used to authenticate to Google. + +## Service Account Keys + +A Service Account Key is a public/private keypair generated by Google. Google retains the public +key, while the customer is given the private key. The private key can be used to [sign JWTs and +authenticate Service Accounts to Google](https://developers.google.com/identity/protocols/OAuth2ServiceAccount#authorizingrequests). diff --git a/handwritten/cloud-profiler/google/iam/admin/v1/iam.proto b/handwritten/cloud-profiler/google/iam/admin/v1/iam.proto new file mode 100644 index 00000000000..8632b4d23bf --- /dev/null +++ b/handwritten/cloud-profiler/google/iam/admin/v1/iam.proto @@ -0,0 +1,772 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.iam.admin.v1; + +import "google/api/annotations.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/iam/admin/v1;admin"; +option java_multiple_files = true; +option java_outer_classname = "IamProto"; +option java_package = "com.google.iam.admin.v1"; + + +// Creates and manages service account objects. +// +// Service account is an account that belongs to your project instead +// of to an individual end user. It is used to authenticate calls +// to a Google API. +// +// To create a service account, specify the `project_id` and `account_id` +// for the account. The `account_id` is unique within the project, and used +// to generate the service account email address and a stable +// `unique_id`. +// +// All other methods can identify accounts using the format +// `projects/{PROJECT_ID}/serviceAccounts/{SERVICE_ACCOUNT_EMAIL}`. +// Using `-` as a wildcard for the project will infer the project from +// the account. The `account` value can be the `email` address or the +// `unique_id` of the service account. +service IAM { + // Lists [ServiceAccounts][google.iam.admin.v1.ServiceAccount] for a project. + rpc ListServiceAccounts(ListServiceAccountsRequest) returns (ListServiceAccountsResponse) { + option (google.api.http) = { get: "/v1/{name=projects/*}/serviceAccounts" }; + } + + // Gets a [ServiceAccount][google.iam.admin.v1.ServiceAccount]. + rpc GetServiceAccount(GetServiceAccountRequest) returns (ServiceAccount) { + option (google.api.http) = { get: "/v1/{name=projects/*/serviceAccounts/*}" }; + } + + // Creates a [ServiceAccount][google.iam.admin.v1.ServiceAccount] + // and returns it. + rpc CreateServiceAccount(CreateServiceAccountRequest) returns (ServiceAccount) { + option (google.api.http) = { post: "/v1/{name=projects/*}/serviceAccounts" body: "*" }; + } + + // Updates a [ServiceAccount][google.iam.admin.v1.ServiceAccount]. + // + // Currently, only the following fields are updatable: + // `display_name` . + // The `etag` is mandatory. + rpc UpdateServiceAccount(ServiceAccount) returns (ServiceAccount) { + option (google.api.http) = { put: "/v1/{name=projects/*/serviceAccounts/*}" body: "*" }; + } + + // Deletes a [ServiceAccount][google.iam.admin.v1.ServiceAccount]. + rpc DeleteServiceAccount(DeleteServiceAccountRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/{name=projects/*/serviceAccounts/*}" }; + } + + // Lists [ServiceAccountKeys][google.iam.admin.v1.ServiceAccountKey]. + rpc ListServiceAccountKeys(ListServiceAccountKeysRequest) returns (ListServiceAccountKeysResponse) { + option (google.api.http) = { get: "/v1/{name=projects/*/serviceAccounts/*}/keys" }; + } + + // Gets the [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey] + // by key id. + rpc GetServiceAccountKey(GetServiceAccountKeyRequest) returns (ServiceAccountKey) { + option (google.api.http) = { get: "/v1/{name=projects/*/serviceAccounts/*/keys/*}" }; + } + + // Creates a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey] + // and returns it. + rpc CreateServiceAccountKey(CreateServiceAccountKeyRequest) returns (ServiceAccountKey) { + option (google.api.http) = { post: "/v1/{name=projects/*/serviceAccounts/*}/keys" body: "*" }; + } + + // Deletes a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey]. + rpc DeleteServiceAccountKey(DeleteServiceAccountKeyRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/{name=projects/*/serviceAccounts/*/keys/*}" }; + } + + // Signs a blob using a service account's system-managed private key. + rpc SignBlob(SignBlobRequest) returns (SignBlobResponse) { + option (google.api.http) = { post: "/v1/{name=projects/*/serviceAccounts/*}:signBlob" body: "*" }; + } + + // Signs a JWT using a service account's system-managed private key. + // + // If no expiry time (`exp`) is provided in the `SignJwtRequest`, IAM sets an + // an expiry time of one hour by default. If you request an expiry time of + // more than one hour, the request will fail. + rpc SignJwt(SignJwtRequest) returns (SignJwtResponse) { + option (google.api.http) = { post: "/v1/{name=projects/*/serviceAccounts/*}:signJwt" body: "*" }; + } + + // Returns the IAM access control policy for a + // [ServiceAccount][google.iam.admin.v1.ServiceAccount]. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { post: "/v1/{resource=projects/*/serviceAccounts/*}:getIamPolicy" body: "" }; + } + + // Sets the IAM access control policy for a + // [ServiceAccount][google.iam.admin.v1.ServiceAccount]. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { post: "/v1/{resource=projects/*/serviceAccounts/*}:setIamPolicy" body: "*" }; + } + + // Tests the specified permissions against the IAM access control policy + // for a [ServiceAccount][google.iam.admin.v1.ServiceAccount]. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { post: "/v1/{resource=projects/*/serviceAccounts/*}:testIamPermissions" body: "*" }; + } + + // Queries roles that can be granted on a particular resource. + // A role is grantable if it can be used as the role in a binding for a policy + // for that resource. + rpc QueryGrantableRoles(QueryGrantableRolesRequest) returns (QueryGrantableRolesResponse) { + option (google.api.http) = { post: "/v1/roles:queryGrantableRoles" body: "*" }; + } + + // Lists the Roles defined on a resource. + rpc ListRoles(ListRolesRequest) returns (ListRolesResponse) { + option (google.api.http) = { get: "/v1/roles" }; + } + + // Gets a Role definition. + rpc GetRole(GetRoleRequest) returns (Role) { + option (google.api.http) = { get: "/v1/{name=roles/*}" }; + } + + // Creates a new Role. + rpc CreateRole(CreateRoleRequest) returns (Role) { + option (google.api.http) = { post: "/v1/{parent=organizations/*}/roles" body: "*" }; + } + + // Updates a Role definition. + rpc UpdateRole(UpdateRoleRequest) returns (Role) { + option (google.api.http) = { patch: "/v1/{name=organizations/*/roles/*}" body: "role" }; + } + + // Soft deletes a role. The role is suspended and cannot be used to create new + // IAM Policy Bindings. + // The Role will not be included in `ListRoles()` unless `show_deleted` is set + // in the `ListRolesRequest`. The Role contains the deleted boolean set. + // Existing Bindings remains, but are inactive. The Role can be undeleted + // within 7 days. After 7 days the Role is deleted and all Bindings associated + // with the role are removed. + rpc DeleteRole(DeleteRoleRequest) returns (Role) { + option (google.api.http) = { delete: "/v1/{name=organizations/*/roles/*}" }; + } + + // Undelete a Role, bringing it back in its previous state. + rpc UndeleteRole(UndeleteRoleRequest) returns (Role) { + option (google.api.http) = { post: "/v1/{name=organizations/*/roles/*}:undelete" body: "*" }; + } + + // Lists the permissions testable on a resource. + // A permission is testable if it can be tested for an identity on a resource. + rpc QueryTestablePermissions(QueryTestablePermissionsRequest) returns (QueryTestablePermissionsResponse) { + option (google.api.http) = { post: "/v1/permissions:queryTestablePermissions" body: "*" }; + } +} + +// A service account in the Identity and Access Management API. +// +// To create a service account, specify the `project_id` and the `account_id` +// for the account. The `account_id` is unique within the project, and is used +// to generate the service account email address and a stable +// `unique_id`. +// +// If the account already exists, the account's resource name is returned +// in util::Status's ResourceInfo.resource_name in the format of +// projects/{PROJECT_ID}/serviceAccounts/{SERVICE_ACCOUNT_EMAIL}. The caller can +// use the name in other methods to access the account. +// +// All other methods can identify the service account using the format +// `projects/{PROJECT_ID}/serviceAccounts/{SERVICE_ACCOUNT_EMAIL}`. +// Using `-` as a wildcard for the project will infer the project from +// the account. The `account` value can be the `email` address or the +// `unique_id` of the service account. +message ServiceAccount { + // The resource name of the service account in the following format: + // `projects/{PROJECT_ID}/serviceAccounts/{SERVICE_ACCOUNT_EMAIL}`. + // + // Requests using `-` as a wildcard for the project will infer the project + // from the `account` and the `account` value can be the `email` address or + // the `unique_id` of the service account. + // + // In responses the resource name will always be in the format + // `projects/{PROJECT_ID}/serviceAccounts/{SERVICE_ACCOUNT_EMAIL}`. + string name = 1; + + // @OutputOnly The id of the project that owns the service account. + string project_id = 2; + + // @OutputOnly The unique and stable id of the service account. + string unique_id = 4; + + // @OutputOnly The email address of the service account. + string email = 5; + + // Optional. A user-specified description of the service account. Must be + // fewer than 100 UTF-8 bytes. + string display_name = 6; + + // Used to perform a consistent read-modify-write. + bytes etag = 7; + + // @OutputOnly. The OAuth2 client id for the service account. + // This is used in conjunction with the OAuth2 clientconfig API to make + // three legged OAuth2 (3LO) flows to access the data of Google users. + string oauth2_client_id = 9; +} + +// The service account create request. +message CreateServiceAccountRequest { + // Required. The resource name of the project associated with the service + // accounts, such as `projects/my-project-123`. + string name = 1; + + // Required. The account id that is used to generate the service account + // email address and a stable unique id. It is unique within a project, + // must be 6-30 characters long, and match the regular expression + // `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035. + string account_id = 2; + + // The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to create. + // Currently, only the following values are user assignable: + // `display_name` . + ServiceAccount service_account = 3; +} + +// The service account list request. +message ListServiceAccountsRequest { + // Required. The resource name of the project associated with the service + // accounts, such as `projects/my-project-123`. + string name = 1; + + // Optional limit on the number of service accounts to include in the + // response. Further accounts can subsequently be obtained by including the + // [ListServiceAccountsResponse.next_page_token][google.iam.admin.v1.ListServiceAccountsResponse.next_page_token] + // in a subsequent request. + int32 page_size = 2; + + // Optional pagination token returned in an earlier + // [ListServiceAccountsResponse.next_page_token][google.iam.admin.v1.ListServiceAccountsResponse.next_page_token]. + string page_token = 3; +} + +// The service account list response. +message ListServiceAccountsResponse { + // The list of matching service accounts. + repeated ServiceAccount accounts = 1; + + // To retrieve the next page of results, set + // [ListServiceAccountsRequest.page_token][google.iam.admin.v1.ListServiceAccountsRequest.page_token] + // to this value. + string next_page_token = 2; +} + +// The service account get request. +message GetServiceAccountRequest { + // The resource name of the service account in the following format: + // `projects/{PROJECT_ID}/serviceAccounts/{SERVICE_ACCOUNT_EMAIL}`. + // Using `-` as a wildcard for the project will infer the project from + // the account. The `account` value can be the `email` address or the + // `unique_id` of the service account. + string name = 1; +} + +// The service account delete request. +message DeleteServiceAccountRequest { + // The resource name of the service account in the following format: + // `projects/{PROJECT_ID}/serviceAccounts/{SERVICE_ACCOUNT_EMAIL}`. + // Using `-` as a wildcard for the project will infer the project from + // the account. The `account` value can be the `email` address or the + // `unique_id` of the service account. + string name = 1; +} + +// The service account keys list request. +message ListServiceAccountKeysRequest { + // `KeyType` filters to selectively retrieve certain varieties + // of keys. + enum KeyType { + // Unspecified key type. The presence of this in the + // message will immediately result in an error. + KEY_TYPE_UNSPECIFIED = 0; + + // User-managed keys (managed and rotated by the user). + USER_MANAGED = 1; + + // System-managed keys (managed and rotated by Google). + SYSTEM_MANAGED = 2; + } + + // The resource name of the service account in the following format: + // `projects/{PROJECT_ID}/serviceAccounts/{SERVICE_ACCOUNT_EMAIL}`. + // + // Using `-` as a wildcard for the project, will infer the project from + // the account. The `account` value can be the `email` address or the + // `unique_id` of the service account. + string name = 1; + + // Filters the types of keys the user wants to include in the list + // response. Duplicate key types are not allowed. If no key type + // is provided, all keys are returned. + repeated KeyType key_types = 2; +} + +// The service account keys list response. +message ListServiceAccountKeysResponse { + // The public keys for the service account. + repeated ServiceAccountKey keys = 1; +} + +// The service account key get by id request. +message GetServiceAccountKeyRequest { + // The resource name of the service account key in the following format: + // `projects/{PROJECT_ID}/serviceAccounts/{SERVICE_ACCOUNT_EMAIL}/keys/{key}`. + // + // Using `-` as a wildcard for the project will infer the project from + // the account. The `account` value can be the `email` address or the + // `unique_id` of the service account. + string name = 1; + + // The output format of the public key requested. + // X509_PEM is the default output format. + ServiceAccountPublicKeyType public_key_type = 2; +} + +// Represents a service account key. +// +// A service account has two sets of key-pairs: user-managed, and +// system-managed. +// +// User-managed key-pairs can be created and deleted by users. Users are +// responsible for rotating these keys periodically to ensure security of +// their service accounts. Users retain the private key of these key-pairs, +// and Google retains ONLY the public key. +// +// System-managed key-pairs are managed automatically by Google, and rotated +// daily without user intervention. The private key never leaves Google's +// servers to maximize security. +// +// Public keys for all service accounts are also published at the OAuth2 +// Service Account API. +message ServiceAccountKey { + // The resource name of the service account key in the following format + // `projects/{PROJECT_ID}/serviceAccounts/{SERVICE_ACCOUNT_EMAIL}/keys/{key}`. + string name = 1; + + // The output format for the private key. + // Only provided in `CreateServiceAccountKey` responses, not + // in `GetServiceAccountKey` or `ListServiceAccountKey` responses. + // + // Google never exposes system-managed private keys, and never retains + // user-managed private keys. + ServiceAccountPrivateKeyType private_key_type = 2; + + // Specifies the algorithm (and possibly key size) for the key. + ServiceAccountKeyAlgorithm key_algorithm = 8; + + // The private key data. Only provided in `CreateServiceAccountKey` + // responses. Make sure to keep the private key data secure because it + // allows for the assertion of the service account identity. + // When decoded, the private key data can be used to authenticate with + // Google API client libraries and with + // gcloud + // auth activate-service-account. + bytes private_key_data = 3; + + // The public key data. Only provided in `GetServiceAccountKey` responses. + bytes public_key_data = 7; + + // The key can be used after this timestamp. + google.protobuf.Timestamp valid_after_time = 4; + + // The key can be used before this timestamp. + google.protobuf.Timestamp valid_before_time = 5; +} + +// The service account key create request. +message CreateServiceAccountKeyRequest { + // The resource name of the service account in the following format: + // `projects/{PROJECT_ID}/serviceAccounts/{SERVICE_ACCOUNT_EMAIL}`. + // Using `-` as a wildcard for the project will infer the project from + // the account. The `account` value can be the `email` address or the + // `unique_id` of the service account. + string name = 1; + + // The output format of the private key. `GOOGLE_CREDENTIALS_FILE` is the + // default output format. + ServiceAccountPrivateKeyType private_key_type = 2; + + // Which type of key and algorithm to use for the key. + // The default is currently a 2K RSA key. However this may change in the + // future. + ServiceAccountKeyAlgorithm key_algorithm = 3; +} + +// The service account key delete request. +message DeleteServiceAccountKeyRequest { + // The resource name of the service account key in the following format: + // `projects/{PROJECT_ID}/serviceAccounts/{SERVICE_ACCOUNT_EMAIL}/keys/{key}`. + // Using `-` as a wildcard for the project will infer the project from + // the account. The `account` value can be the `email` address or the + // `unique_id` of the service account. + string name = 1; +} + +// The service account sign blob request. +message SignBlobRequest { + // The resource name of the service account in the following format: + // `projects/{PROJECT_ID}/serviceAccounts/{SERVICE_ACCOUNT_EMAIL}`. + // Using `-` as a wildcard for the project will infer the project from + // the account. The `account` value can be the `email` address or the + // `unique_id` of the service account. + string name = 1; + + // The bytes to sign. + bytes bytes_to_sign = 2; +} + +// The service account sign blob response. +message SignBlobResponse { + // The id of the key used to sign the blob. + string key_id = 1; + + // The signed blob. + bytes signature = 2; +} + +// The service account sign JWT request. +message SignJwtRequest { + // The resource name of the service account in the following format: + // `projects/{PROJECT_ID}/serviceAccounts/{SERVICE_ACCOUNT_EMAIL}`. + // Using `-` as a wildcard for the project will infer the project from + // the account. The `account` value can be the `email` address or the + // `unique_id` of the service account. + string name = 1; + + // The JWT payload to sign, a JSON JWT Claim set. + string payload = 2; +} + +// The service account sign JWT response. +message SignJwtResponse { + // The id of the key used to sign the JWT. + string key_id = 1; + + // The signed JWT. + string signed_jwt = 2; +} + +// A role in the Identity and Access Management API. +message Role { + // A stage representing a role's lifecycle phase. + enum RoleLaunchStage { + // The user has indicated this role is currently in an alpha phase. + ALPHA = 0; + + // The user has indicated this role is currently in a beta phase. + BETA = 1; + + // The user has indicated this role is generally available. + GA = 2; + + // The user has indicated this role is being deprecated. + DEPRECATED = 4; + + // This role is disabled and will not contribute permissions to any members + // it is granted to in policies. + DISABLED = 5; + + // The user has indicated this role is currently in an eap phase. + EAP = 6; + } + + // The name of the role. + // + // When Role is used in CreateRole, the role name must not be set. + // + // When Role is used in output and other input such as UpdateRole, the role + // name is the complete path, e.g., roles/logging.viewer for curated roles + // and organizations/{ORGANIZATION_ID}/roles/logging.viewer for custom roles. + string name = 1; + + // Optional. A human-readable title for the role. Typically this + // is limited to 100 UTF-8 bytes. + string title = 2; + + // Optional. A human-readable description for the role. + string description = 3; + + // The names of the permissions this role grants when bound in an IAM policy. + repeated string included_permissions = 7; + + // The current launch stage of the role. + RoleLaunchStage stage = 8; + + // Used to perform a consistent read-modify-write. + bytes etag = 9; + + // The current deleted state of the role. This field is read only. + // It will be ignored in calls to CreateRole and UpdateRole. + bool deleted = 11; +} + +// The grantable role query request. +message QueryGrantableRolesRequest { + // Required. The full resource name to query from the list of grantable roles. + // + // The name follows the Google Cloud Platform resource format. + // For example, a Cloud Platform project with id `my-project` will be named + // `//cloudresourcemanager.googleapis.com/projects/my-project`. + string full_resource_name = 1; + + RoleView view = 2; + + // Optional limit on the number of roles to include in the response. + int32 page_size = 3; + + // Optional pagination token returned in an earlier + // QueryGrantableRolesResponse. + string page_token = 4; +} + +// The grantable role query response. +message QueryGrantableRolesResponse { + // The list of matching roles. + repeated Role roles = 1; + + // To retrieve the next page of results, set + // `QueryGrantableRolesRequest.page_token` to this value. + string next_page_token = 2; +} + +// The request to get all roles defined under a resource. +message ListRolesRequest { + // The resource name of the parent resource in one of the following formats: + // `` (empty string) -- this refers to curated roles. + // `organizations/{ORGANIZATION_ID}` + // `projects/{PROJECT_ID}` + string parent = 1; + + // Optional limit on the number of roles to include in the response. + int32 page_size = 2; + + // Optional pagination token returned in an earlier ListRolesResponse. + string page_token = 3; + + // Optional view for the returned Role objects. + RoleView view = 4; + + // Include Roles that have been deleted. + bool show_deleted = 6; +} + +// The response containing the roles defined under a resource. +message ListRolesResponse { + // The Roles defined on this resource. + repeated Role roles = 1; + + // To retrieve the next page of results, set + // `ListRolesRequest.page_token` to this value. + string next_page_token = 2; +} + +// The request to get the definition of an existing role. +message GetRoleRequest { + // The resource name of the role in one of the following formats: + // `roles/{ROLE_NAME}` + // `organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}` + // `projects/{PROJECT_ID}/roles/{ROLE_NAME}` + string name = 1; +} + +// The request to create a new role. +message CreateRoleRequest { + // The resource name of the parent resource in one of the following formats: + // `organizations/{ORGANIZATION_ID}` + // `projects/{PROJECT_ID}` + string parent = 1; + + // The role id to use for this role. + string role_id = 2; + + // The Role resource to create. + Role role = 3; +} + +// The request to update a role. +message UpdateRoleRequest { + // The resource name of the role in one of the following formats: + // `roles/{ROLE_NAME}` + // `organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}` + // `projects/{PROJECT_ID}/roles/{ROLE_NAME}` + string name = 1; + + // The updated role. + Role role = 2; + + // A mask describing which fields in the Role have changed. + google.protobuf.FieldMask update_mask = 3; +} + +// The request to delete an existing role. +message DeleteRoleRequest { + // The resource name of the role in one of the following formats: + // `organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}` + // `projects/{PROJECT_ID}/roles/{ROLE_NAME}` + string name = 1; + + // Used to perform a consistent read-modify-write. + bytes etag = 2; +} + +// The request to undelete an existing role. +message UndeleteRoleRequest { + // The resource name of the role in one of the following formats: + // `organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}` + // `projects/{PROJECT_ID}/roles/{ROLE_NAME}` + string name = 1; + + // Used to perform a consistent read-modify-write. + bytes etag = 2; +} + +// A permission which can be included by a role. +message Permission { + // A stage representing a permission's lifecycle phase. + enum PermissionLaunchStage { + // The permission is currently in an alpha phase. + ALPHA = 0; + + // The permission is currently in a beta phase. + BETA = 1; + + // The permission is generally available. + GA = 2; + + // The permission is being deprecated. + DEPRECATED = 3; + } + + // The state of the permission with regards to custom roles. + enum CustomRolesSupportLevel { + // Permission is fully supported for custom role use. + SUPPORTED = 0; + + // Permission is being tested to check custom role compatibility. + TESTING = 1; + + // Permission is not supported for custom role use. + NOT_SUPPORTED = 2; + } + + // The name of this Permission. + string name = 1; + + // The title of this Permission. + string title = 2; + + // A brief description of what this Permission is used for. + string description = 3; + + // This permission can ONLY be used in predefined roles. + bool only_in_predefined_roles = 4; + + // The current launch stage of the permission. + PermissionLaunchStage stage = 5; + + // The current custom role support level. + CustomRolesSupportLevel custom_roles_support_level = 6; +} + +// A request to get permissions which can be tested on a resource. +message QueryTestablePermissionsRequest { + // Required. The full resource name to query from the list of testable + // permissions. + // + // The name follows the Google Cloud Platform resource format. + // For example, a Cloud Platform project with id `my-project` will be named + // `//cloudresourcemanager.googleapis.com/projects/my-project`. + string full_resource_name = 1; + + // Optional limit on the number of permissions to include in the response. + int32 page_size = 2; + + // Optional pagination token returned in an earlier + // QueryTestablePermissionsRequest. + string page_token = 3; +} + +// The response containing permissions which can be tested on a resource. +message QueryTestablePermissionsResponse { + // The Permissions testable on the requested resource. + repeated Permission permissions = 1; + + // To retrieve the next page of results, set + // `QueryTestableRolesRequest.page_token` to this value. + string next_page_token = 2; +} + +// Supported key algorithms. +enum ServiceAccountKeyAlgorithm { + // An unspecified key algorithm. + KEY_ALG_UNSPECIFIED = 0; + + // 1k RSA Key. + KEY_ALG_RSA_1024 = 1; + + // 2k RSA Key. + KEY_ALG_RSA_2048 = 2; +} + +// Supported private key output formats. +enum ServiceAccountPrivateKeyType { + // Unspecified. Equivalent to `TYPE_GOOGLE_CREDENTIALS_FILE`. + TYPE_UNSPECIFIED = 0; + + // PKCS12 format. + // The password for the PKCS12 file is `notasecret`. + // For more information, see https://tools.ietf.org/html/rfc7292. + TYPE_PKCS12_FILE = 1; + + // Google Credentials File format. + TYPE_GOOGLE_CREDENTIALS_FILE = 2; +} + +// Supported public key output formats. +enum ServiceAccountPublicKeyType { + // Unspecified. Returns nothing here. + TYPE_NONE = 0; + + // X509 PEM format. + TYPE_X509_PEM_FILE = 1; + + // Raw public key. + TYPE_RAW_PUBLIC_KEY = 2; +} + +// A view for Role objects. +enum RoleView { + // Omits the `included_permissions` field. + // This is the default value. + BASIC = 0; + + // Returns all fields. + FULL = 1; +} diff --git a/handwritten/cloud-profiler/google/iam/admin/v1/iam_gapic.yaml b/handwritten/cloud-profiler/google/iam/admin/v1/iam_gapic.yaml new file mode 100644 index 00000000000..c01c3d3920a --- /dev/null +++ b/handwritten/cloud-profiler/google/iam/admin/v1/iam_gapic.yaml @@ -0,0 +1,251 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.iam.admin.v1 + python: + package_name: google.cloud.iam_admin_v1.gapic + go: + package_name: cloud.google.com/go/iam/admin/apiv1 + csharp: + package_name: Google.Iam.Admin.V1 + ruby: + package_name: Google::Cloud::Iam::Admin::V1 + php: + package_name: Google\Cloud\Iam\Admin\V1 + nodejs: + package_name: iam.v1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.iam.admin.v1.IAM + collections: + - name_pattern: projects/{project} + entity_name: project + - name_pattern: projects/{project}/serviceAccounts/{service_account} + entity_name: service_account + - name_pattern: projects/{project}/serviceAccounts/{service_account}/keys/{key} + entity_name: key + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + methods: + - name: ListServiceAccounts + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: accounts + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: project + timeout_millis: 60000 + - name: GetServiceAccount + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: service_account + timeout_millis: 60000 + - name: CreateServiceAccount + flattening: + groups: + - parameters: + - name + - account_id + - service_account + required_fields: + - name + - account_id + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + name: project + timeout_millis: 60000 + - name: UpdateServiceAccount + required_fields: + - etag + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: service_account + timeout_millis: 60000 + - name: DeleteServiceAccount + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: service_account + timeout_millis: 60000 + - name: ListServiceAccountKeys + flattening: + groups: + - parameters: + - name + - key_types + required_fields: + - name + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: service_account + timeout_millis: 60000 + - name: GetServiceAccountKey + flattening: + groups: + - parameters: + - name + - public_key_type + required_fields: + - name + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: key + timeout_millis: 60000 + - name: CreateServiceAccountKey + flattening: + groups: + - parameters: + - name + - private_key_type + - key_algorithm + required_fields: + - name + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + name: service_account + timeout_millis: 60000 + - name: DeleteServiceAccountKey + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: key + timeout_millis: 60000 + - name: SignBlob + flattening: + groups: + - parameters: + - name + - bytes_to_sign + required_fields: + - name + - bytes_to_sign + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + name: service_account + timeout_millis: 60000 + - name: GetIamPolicy + flattening: + groups: + - parameters: + - resource + required_fields: + - resource + request_object_method: false + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + resource: service_account + timeout_millis: 60000 + surface_treatments: + - include_languages: + - go + visibility: PRIVATE + - name: SetIamPolicy + flattening: + groups: + - parameters: + - resource + - policy + required_fields: + - resource + - policy + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + resource: service_account + timeout_millis: 60000 + surface_treatments: + - include_languages: + - go + visibility: PRIVATE + - name: TestIamPermissions + flattening: + groups: + - parameters: + - resource + - permissions + required_fields: + - resource + - permissions + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + resource: service_account + timeout_millis: 60000 + - name: QueryGrantableRoles + flattening: + groups: + - parameters: + - full_resource_name + required_fields: + - full_resource_name + request_object_method: false + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 diff --git a/handwritten/cloud-profiler/google/iam/artman_iam.yaml b/handwritten/cloud-profiler/google/iam/artman_iam.yaml new file mode 100644 index 00000000000..553c0f59109 --- /dev/null +++ b/handwritten/cloud-profiler/google/iam/artman_iam.yaml @@ -0,0 +1,40 @@ +common: + api_name: iam + api_version: v1 + organization_name: google + gapic_yaml: v1/iam_gapic.yaml + src_proto_paths: + - v1 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_proto + type: PROTOBUF + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - name: proto + dest: generated/java/proto-google-iam-v1 +- name: java_grpc + type: GRPC + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - name: grpc + dest: generated/java/grpc-google-iam-v1 +- name: php_grpc + type: GRPC + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - name: grpc + dest: generated/php/google-iam-v1 diff --git a/handwritten/cloud-profiler/google/iam/iam.yaml b/handwritten/cloud-profiler/google/iam/iam.yaml new file mode 100644 index 00000000000..ccff586b8c9 --- /dev/null +++ b/handwritten/cloud-profiler/google/iam/iam.yaml @@ -0,0 +1,21 @@ +# The IAM API Definition. + +type: google.api.Service +config_version: 2 +name: iam.googleapis.com + +title: Google Identity and Access Management (IAM) API + +documentation: + summary: + Manages identity and access control for Google Cloud Platform resources, including the creation of service accounts, which you can use to authenticate to Google and make API calls. + +apis: +- name: google.iam.admin.v1.IAM + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: https://www.googleapis.com/auth/iam, + https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/iam/v1/iam_gapic.yaml b/handwritten/cloud-profiler/google/iam/v1/iam_gapic.yaml new file mode 100644 index 00000000000..48ecc7f4e7a --- /dev/null +++ b/handwritten/cloud-profiler/google/iam/v1/iam_gapic.yaml @@ -0,0 +1,31 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.iam.v1 + python: + package_name: google.cloud.iam_v1.gapic + go: + package_name: cloud.google.com/go/iam/apiv1 + csharp: + package_name: Google.Iam.V1 + ruby: + package_name: Google::Cloud::Iam::V1 + php: + package_name: Google\Cloud\Iam\V1 + nodejs: + package_name: iam.core.v1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +resource_name_generation: +- message_name: SetIamPolicyRequest + field_entity_map: + resource: "*" +- message_name: GetIamPolicyRequest + field_entity_map: + resource: "*" +- message_name: TestIamPermissionsRequest + field_entity_map: + resource: "*" diff --git a/handwritten/cloud-profiler/google/iam/v1/iam_policy.proto b/handwritten/cloud-profiler/google/iam/v1/iam_policy.proto new file mode 100644 index 00000000000..15e216f194d --- /dev/null +++ b/handwritten/cloud-profiler/google/iam/v1/iam_policy.proto @@ -0,0 +1,118 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.iam.v1; + +import "google/api/annotations.proto"; +import "google/iam/v1/policy.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Iam.V1"; +option go_package = "google.golang.org/genproto/googleapis/iam/v1;iam"; +option java_multiple_files = true; +option java_outer_classname = "IamPolicyProto"; +option java_package = "com.google.iam.v1"; + + +// ## API Overview +// +// Manages Identity and Access Management (IAM) policies. +// +// Any implementation of an API that offers access control features +// implements the google.iam.v1.IAMPolicy interface. +// +// ## Data model +// +// Access control is applied when a principal (user or service account), takes +// some action on a resource exposed by a service. Resources, identified by +// URI-like names, are the unit of access control specification. Service +// implementations can choose the granularity of access control and the +// supported permissions for their resources. +// For example one database service may allow access control to be +// specified only at the Table level, whereas another might allow access control +// to also be specified at the Column level. +// +// ## Policy Structure +// +// See google.iam.v1.Policy +// +// This is intentionally not a CRUD style API because access control policies +// are created and deleted implicitly with the resources to which they are +// attached. +service IAMPolicy { + // Sets the access control policy on the specified resource. Replaces any + // existing policy. + rpc SetIamPolicy(SetIamPolicyRequest) returns (Policy) { + option (google.api.http) = { post: "/v1/{resource=**}:setIamPolicy" body: "*" }; + } + + // Gets the access control policy for a resource. + // Returns an empty policy if the resource exists and does not have a policy + // set. + rpc GetIamPolicy(GetIamPolicyRequest) returns (Policy) { + option (google.api.http) = { post: "/v1/{resource=**}:getIamPolicy" body: "*" }; + } + + // Returns permissions that a caller has on the specified resource. + // If the resource does not exist, this will return an empty set of + // permissions, not a NOT_FOUND error. + rpc TestIamPermissions(TestIamPermissionsRequest) returns (TestIamPermissionsResponse) { + option (google.api.http) = { post: "/v1/{resource=**}:testIamPermissions" body: "*" }; + } +} + +// Request message for `SetIamPolicy` method. +message SetIamPolicyRequest { + // REQUIRED: The resource for which the policy is being specified. + // `resource` is usually specified as a path. For example, a Project + // resource is specified as `projects/{project}`. + string resource = 1; + + // REQUIRED: The complete policy to be applied to the `resource`. The size of + // the policy is limited to a few 10s of KB. An empty policy is a + // valid policy but certain Cloud Platform services (such as Projects) + // might reject them. + Policy policy = 2; +} + +// Request message for `GetIamPolicy` method. +message GetIamPolicyRequest { + // REQUIRED: The resource for which the policy is being requested. + // `resource` is usually specified as a path. For example, a Project + // resource is specified as `projects/{project}`. + string resource = 1; +} + +// Request message for `TestIamPermissions` method. +message TestIamPermissionsRequest { + // REQUIRED: The resource for which the policy detail is being requested. + // `resource` is usually specified as a path. For example, a Project + // resource is specified as `projects/{project}`. + string resource = 1; + + // The set of permissions to check for the `resource`. Permissions with + // wildcards (such as '*' or 'storage.*') are not allowed. For more + // information see + // [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + repeated string permissions = 2; +} + +// Response message for `TestIamPermissions` method. +message TestIamPermissionsResponse { + // A subset of `TestPermissionsRequest.permissions` that the caller is + // allowed. + repeated string permissions = 1; +} diff --git a/handwritten/cloud-profiler/google/iam/v1/logging/audit_data.proto b/handwritten/cloud-profiler/google/iam/v1/logging/audit_data.proto new file mode 100644 index 00000000000..d3f803fe518 --- /dev/null +++ b/handwritten/cloud-profiler/google/iam/v1/logging/audit_data.proto @@ -0,0 +1,35 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.iam.v1.logging; + +import "google/api/annotations.proto"; +import "google/iam/v1/policy.proto"; + +option csharp_namespace = "Google.Cloud.Iam.V1.Logging"; +option go_package = "google.golang.org/genproto/googleapis/iam/v1/logging;logging"; +option java_multiple_files = true; +option java_outer_classname = "AuditDataProto"; +option java_package = "com.google.iam.v1.logging"; + + +// Audit log information specific to Cloud IAM. This message is serialized +// as an `Any` type in the `ServiceData` message of an +// `AuditLog` message. +message AuditData { + // Policy delta between the original policy and the newly set policy. + google.iam.v1.PolicyDelta policy_delta = 2; +} diff --git a/handwritten/cloud-profiler/google/iam/v1/policy.proto b/handwritten/cloud-profiler/google/iam/v1/policy.proto new file mode 100644 index 00000000000..a09b5443138 --- /dev/null +++ b/handwritten/cloud-profiler/google/iam/v1/policy.proto @@ -0,0 +1,149 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.iam.v1; + +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Iam.V1"; +option go_package = "google.golang.org/genproto/googleapis/iam/v1;iam"; +option java_multiple_files = true; +option java_outer_classname = "PolicyProto"; +option java_package = "com.google.iam.v1"; + + +// Defines an Identity and Access Management (IAM) policy. It is used to +// specify access control policies for Cloud Platform resources. +// +// +// A `Policy` consists of a list of `bindings`. A `Binding` binds a list of +// `members` to a `role`, where the members can be user accounts, Google groups, +// Google domains, and service accounts. A `role` is a named list of permissions +// defined by IAM. +// +// **Example** +// +// { +// "bindings": [ +// { +// "role": "roles/owner", +// "members": [ +// "user:mike@example.com", +// "group:admins@example.com", +// "domain:google.com", +// "serviceAccount:my-other-app@appspot.gserviceaccount.com", +// ] +// }, +// { +// "role": "roles/viewer", +// "members": ["user:sean@example.com"] +// } +// ] +// } +// +// For a description of IAM and its features, see the +// [IAM developer's guide](https://cloud.google.com/iam). +message Policy { + // Version of the `Policy`. The default version is 0. + int32 version = 1; + + // Associates a list of `members` to a `role`. + // Multiple `bindings` must not be specified for the same `role`. + // `bindings` with no members will result in an error. + repeated Binding bindings = 4; + + // `etag` is used for optimistic concurrency control as a way to help + // prevent simultaneous updates of a policy from overwriting each other. + // It is strongly suggested that systems make use of the `etag` in the + // read-modify-write cycle to perform policy updates in order to avoid race + // conditions: An `etag` is returned in the response to `getIamPolicy`, and + // systems are expected to put that etag in the request to `setIamPolicy` to + // ensure that their change will be applied to the same version of the policy. + // + // If no `etag` is provided in the call to `setIamPolicy`, then the existing + // policy is overwritten blindly. + bytes etag = 3; +} + +// Associates `members` with a `role`. +message Binding { + // Role that is assigned to `members`. + // For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + // Required + string role = 1; + + // Specifies the identities requesting access for a Cloud Platform resource. + // `members` can have the following values: + // + // * `allUsers`: A special identifier that represents anyone who is + // on the internet; with or without a Google account. + // + // * `allAuthenticatedUsers`: A special identifier that represents anyone + // who is authenticated with a Google account or a service account. + // + // * `user:{emailid}`: An email address that represents a specific Google + // account. For example, `alice@gmail.com` or `joe@example.com`. + // + // + // * `serviceAccount:{emailid}`: An email address that represents a service + // account. For example, `my-other-app@appspot.gserviceaccount.com`. + // + // * `group:{emailid}`: An email address that represents a Google group. + // For example, `admins@example.com`. + // + // * `domain:{domain}`: A Google Apps domain name that represents all the + // users of that domain. For example, `google.com` or `example.com`. + // + // + repeated string members = 2; +} + +// The difference delta between two policies. +message PolicyDelta { + // The delta for Bindings between two policies. + repeated BindingDelta binding_deltas = 1; +} + +// One delta entry for Binding. Each individual change (only one member in each +// entry) to a binding will be a separate entry. +message BindingDelta { + // The type of action performed on a Binding in a policy. + enum Action { + // Unspecified. + ACTION_UNSPECIFIED = 0; + + // Addition of a Binding. + ADD = 1; + + // Removal of a Binding. + REMOVE = 2; + } + + // The action that was performed on a Binding. + // Required + Action action = 1; + + // Role that is assigned to `members`. + // For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + // Required + string role = 2; + + // A single identity requesting access for a Cloud Platform resource. + // Follows the same format of Binding.members. + // Required + string member = 3; +} diff --git a/handwritten/cloud-profiler/google/logging/README.md b/handwritten/cloud-profiler/google/logging/README.md new file mode 100644 index 00000000000..2f14ba1b9d1 --- /dev/null +++ b/handwritten/cloud-profiler/google/logging/README.md @@ -0,0 +1,3 @@ +# Introduction + +The Stackdriver Logging service. diff --git a/handwritten/cloud-profiler/google/logging/artman_logging.yaml b/handwritten/cloud-profiler/google/logging/artman_logging.yaml new file mode 100644 index 00000000000..4276bdc4cb2 --- /dev/null +++ b/handwritten/cloud-profiler/google/logging/artman_logging.yaml @@ -0,0 +1,114 @@ +common: + api_name: logging + api_version: v2 + organization_name: google-cloud + service_yaml: logging.yaml + gapic_yaml: v2/logging_gapic.yaml + src_proto_paths: + - v2 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + release_level: BETA + publish_targets: + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-logging + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-logging-v2 + - name: grpc + dest: generated/java/grpc-google-cloud-logging-v2 + - name: proto + dest: generated/java/proto-google-cloud-logging-v2 +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + release_level: BETA + package_version: + grpc_dep_lower_bound: 0.91.4 + grpc_dep_upper_bound: 0.92dev + publish_targets: + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: google/cloud/logging_v2 + dest: logging/google/cloud/logging_v2 + - src: tests/unit/gapic/v2 + dest: logging/tests/gapic + - name: grpc + src: google/cloud/proto + dest: logging/google/cloud/proto + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-logging-v2 + - name: grpc + dest: generated/python/proto-google-cloud-logging-v2 +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-logging-v2 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/logging/v2 + dest: google-cloud-logging/lib/google/cloud/logging/v2 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-logging +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-logging-v2/vendor + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: logging/apiv2 +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/logging + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v2 + dest: packages/logging/src/v2 +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/logging/logging.yaml b/handwritten/cloud-profiler/google/logging/logging.yaml new file mode 100644 index 00000000000..66e20881499 --- /dev/null +++ b/handwritten/cloud-profiler/google/logging/logging.yaml @@ -0,0 +1,80 @@ +# Stackdriver Logging API service configuration + +type: google.api.Service +config_version: 2 +name: logging.googleapis.com +title: Stackdriver Logging API + +apis: +- name: google.logging.v2.LoggingServiceV2 +- name: google.logging.v2.ConfigServiceV2 +- name: google.logging.v2.MetricsServiceV2 + +documentation: + summary: + The Stackdriver Logging API lets you write log + entries and manage your logs, log sinks and logs-based metrics. + overview: | + (== suppress_warning versioning-http-version-prefix ==) + +# Auth section +authentication: + rules: + - selector: |- + google.logging.v1.LoggingService.DeleteLog, + google.logging.v1.ConfigService.CreateLogServiceSink, + google.logging.v1.ConfigService.CreateLogSink, + google.logging.v1.ConfigService.CreateSink, + google.logging.v1.ConfigService.DeleteLogServiceSink, + google.logging.v1.ConfigService.DeleteLogSink, + google.logging.v1.ConfigService.DeleteSink, + google.logging.v1.ConfigService.UpdateLogServiceSink, + google.logging.v1.ConfigService.UpdateLogSink, + google.logging.v1.ConfigService.UpdateSink, + google.logging.v2.LoggingServiceV2.DeleteLog, + google.logging.v2.ConfigServiceV2.CreateSink, + google.logging.v2.ConfigServiceV2.DeleteSink, + google.logging.v2.ConfigServiceV2.UpdateSink, + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/logging.admin, + https://www.googleapis.com/auth/cloud-platform + - selector: |- + google.logging.v1.LoggingService.ListLogEntries, + google.logging.v1.LoggingService.ListLogServiceIndexes, + google.logging.v1.LoggingService.ListLogServices, + google.logging.v1.LoggingService.ListLogs, + google.logging.v1.ConfigService.GetLogServiceSink, + google.logging.v1.ConfigService.GetLogSink, + google.logging.v1.ConfigService.GetSink, + google.logging.v1.ConfigService.ListLogServiceSinks, + google.logging.v1.ConfigService.ListLogSinks, + google.logging.v1.ConfigService.ListSinks, + google.logging.v1.MetricsService.GetLogMetric, + google.logging.v1.MetricsService.ListLogMetrics, + google.logging.v2.LoggingServiceV2.ListLogEntries, + google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptors, + google.logging.v2.ConfigServiceV2.GetSink, + google.logging.v2.ConfigServiceV2.ListSinks, + google.logging.v2.MetricsServiceV2.GetLogMetric, + google.logging.v2.MetricsServiceV2.ListLogMetrics + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/logging.read, + https://www.googleapis.com/auth/logging.admin, + https://www.googleapis.com/auth/cloud-platform.read-only, + https://www.googleapis.com/auth/cloud-platform + - selector: |- + google.logging.v1.LoggingService.WriteLogEntries, + google.logging.v1.MetricsService.CreateLogMetric, + google.logging.v1.MetricsService.DeleteLogMetric, + google.logging.v1.MetricsService.UpdateLogMetric, + google.logging.v2.LoggingServiceV2.WriteLogEntries, + google.logging.v2.MetricsServiceV2.CreateLogMetric, + google.logging.v2.MetricsServiceV2.DeleteLogMetric, + google.logging.v2.MetricsServiceV2.UpdateLogMetric + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/logging.write, + https://www.googleapis.com/auth/logging.admin, + https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/logging/type/http_request.proto b/handwritten/cloud-profiler/google/logging/type/http_request.proto new file mode 100644 index 00000000000..c1827a1f9ed --- /dev/null +++ b/handwritten/cloud-profiler/google/logging/type/http_request.proto @@ -0,0 +1,91 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.logging.type; + +import "google/api/annotations.proto"; +import "google/protobuf/duration.proto"; + +option csharp_namespace = "Google.Cloud.Logging.Type"; +option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype"; +option java_multiple_files = true; +option java_outer_classname = "HttpRequestProto"; +option java_package = "com.google.logging.type"; + + +// A common proto for logging HTTP requests. Only contains semantics +// defined by the HTTP specification. Product-specific logging +// information MUST be defined in a separate message. +message HttpRequest { + // The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. + string request_method = 1; + + // The scheme (http, https), the host name, the path and the query + // portion of the URL that was requested. + // Example: `"http://example.com/some/info?color=red"`. + string request_url = 2; + + // The size of the HTTP request message in bytes, including the request + // headers and the request body. + int64 request_size = 3; + + // The response code indicating the status of response. + // Examples: 200, 404. + int32 status = 4; + + // The size of the HTTP response message sent back to the client, in bytes, + // including the response headers and the response body. + int64 response_size = 5; + + // The user agent sent by the client. Example: + // `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)"`. + string user_agent = 6; + + // The IP address (IPv4 or IPv6) of the client that issued the HTTP + // request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. + string remote_ip = 7; + + // The IP address (IPv4 or IPv6) of the origin server that the request was + // sent to. + string server_ip = 13; + + // The referer URL of the request, as defined in + // [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). + string referer = 8; + + // The request processing latency on the server, from the time the request was + // received until the response was sent. + google.protobuf.Duration latency = 14; + + // Whether or not a cache lookup was attempted. + bool cache_lookup = 11; + + // Whether or not an entity was served from cache + // (with or without validation). + bool cache_hit = 9; + + // Whether or not the response was validated with the origin server before + // being served from cache. This field is only meaningful if `cache_hit` is + // True. + bool cache_validated_with_origin_server = 10; + + // The number of HTTP response bytes inserted into cache. Set only when a + // cache fill was attempted. + int64 cache_fill_bytes = 12; + + // Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" + string protocol = 15; +} diff --git a/handwritten/cloud-profiler/google/logging/type/log_severity.proto b/handwritten/cloud-profiler/google/logging/type/log_severity.proto new file mode 100644 index 00000000000..acb924aa76b --- /dev/null +++ b/handwritten/cloud-profiler/google/logging/type/log_severity.proto @@ -0,0 +1,71 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.logging.type; + +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.Logging.Type"; +option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype"; +option java_multiple_files = true; +option java_outer_classname = "LogSeverityProto"; +option java_package = "com.google.logging.type"; + + +// The severity of the event described in a log entry, expressed as one of the +// standard severity levels listed below. For your reference, the levels are +// assigned the listed numeric values. The effect of using numeric values other +// than those listed is undefined. +// +// You can filter for log entries by severity. For example, the following +// filter expression will match log entries with severities `INFO`, `NOTICE`, +// and `WARNING`: +// +// severity > DEBUG AND severity <= WARNING +// +// If you are writing log entries, you should map other severity encodings to +// one of these standard levels. For example, you might map all of Java's FINE, +// FINER, and FINEST levels to `LogSeverity.DEBUG`. You can preserve the +// original severity level in the log entry payload if you wish. +enum LogSeverity { + // (0) The log entry has no assigned severity level. + DEFAULT = 0; + + // (100) Debug or trace information. + DEBUG = 100; + + // (200) Routine information, such as ongoing status or performance. + INFO = 200; + + // (300) Normal but significant events, such as start up, shut down, or + // a configuration change. + NOTICE = 300; + + // (400) Warning events might cause problems. + WARNING = 400; + + // (500) Error events are likely to cause problems. + ERROR = 500; + + // (600) Critical events cause more severe problems or outages. + CRITICAL = 600; + + // (700) A person must take an action immediately. + ALERT = 700; + + // (800) One or more systems are unusable. + EMERGENCY = 800; +} diff --git a/handwritten/cloud-profiler/google/logging/v2/log_entry.proto b/handwritten/cloud-profiler/google/logging/v2/log_entry.proto new file mode 100644 index 00000000000..3cd67b8d29f --- /dev/null +++ b/handwritten/cloud-profiler/google/logging/v2/log_entry.proto @@ -0,0 +1,164 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.logging.v2; + +import "google/api/annotations.proto"; +import "google/api/monitored_resource.proto"; +import "google/logging/type/http_request.proto"; +import "google/logging/type/log_severity.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Logging.V2"; +option go_package = "google.golang.org/genproto/googleapis/logging/v2;logging"; +option java_multiple_files = true; +option java_outer_classname = "LogEntryProto"; +option java_package = "com.google.logging.v2"; + + +// An individual entry in a log. +message LogEntry { + // Required. The resource name of the log to which this log entry belongs: + // + // "projects/[PROJECT_ID]/logs/[LOG_ID]" + // "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" + // "folders/[FOLDER_ID]/logs/[LOG_ID]" + // + // `[LOG_ID]` must be URL-encoded within `log_name`. Example: + // `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`. + // `[LOG_ID]` must be less than 512 characters long and can only include the + // following characters: upper and lower case alphanumeric characters, + // forward-slash, underscore, hyphen, and period. + // + // For backward compatibility, if `log_name` begins with a forward-slash, such + // as `/projects/...`, then the log entry is ingested as usual but the + // forward-slash is removed. Listing the log entry will not show the leading + // slash and filtering for a log name with a leading slash will never return + // any results. + string log_name = 12; + + // Required. The monitored resource associated with this log entry. + // Example: a log entry that reports a database error would be + // associated with the monitored resource designating the particular + // database that reported the error. + google.api.MonitoredResource resource = 8; + + // Optional. The log entry payload, which can be one of multiple types. + oneof payload { + // The log entry payload, represented as a protocol buffer. Some + // Google Cloud Platform services use this field for their log + // entry payloads. + google.protobuf.Any proto_payload = 2; + + // The log entry payload, represented as a Unicode string (UTF-8). + string text_payload = 3; + + // The log entry payload, represented as a structure that is + // expressed as a JSON object. + google.protobuf.Struct json_payload = 6; + } + + // Optional. The time the event described by the log entry occurred. + // This time is used to compute the log entry's age and to enforce + // the logs retention period. If this field is omitted in a new log + // entry, then Stackdriver Logging assigns it the current time. + // + // Incoming log entries should have timestamps that are no more than + // the [logs retention period](/logging/quota-policy) in the past, + // and no more than 24 hours in the future. + // See the `entries.write` API method for more information. + google.protobuf.Timestamp timestamp = 9; + + // Output only. The time the log entry was received by Stackdriver Logging. + google.protobuf.Timestamp receive_timestamp = 24; + + // Optional. The severity of the log entry. The default value is + // `LogSeverity.DEFAULT`. + google.logging.type.LogSeverity severity = 10; + + // Optional. A unique identifier for the log entry. If you provide a value, + // then Stackdriver Logging considers other log entries in the same project, + // with the same `timestamp`, and with the same `insert_id` to be duplicates + // which can be removed. If omitted in new log entries, then Stackdriver + // Logging assigns its own unique identifier. The `insert_id` is also used + // to order log entries that have the same `timestamp` value. + string insert_id = 4; + + // Optional. Information about the HTTP request associated with this + // log entry, if applicable. + google.logging.type.HttpRequest http_request = 7; + + // Optional. A set of user-defined (key, value) data that provides additional + // information about the log entry. + map labels = 11; + + // Optional. Information about an operation associated with the log entry, if + // applicable. + LogEntryOperation operation = 15; + + // Optional. Resource name of the trace associated with the log entry, if any. + // If it contains a relative resource name, the name is assumed to be relative + // to `//tracing.googleapis.com`. Example: + // `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824` + string trace = 22; + + // Optional. Source code location information associated with the log entry, + // if any. + LogEntrySourceLocation source_location = 23; +} + +// Additional information about a potentially long-running operation with which +// a log entry is associated. +message LogEntryOperation { + // Optional. An arbitrary operation identifier. Log entries with the + // same identifier are assumed to be part of the same operation. + string id = 1; + + // Optional. An arbitrary producer identifier. The combination of + // `id` and `producer` must be globally unique. Examples for `producer`: + // `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`. + string producer = 2; + + // Optional. Set this to True if this is the first log entry in the operation. + bool first = 3; + + // Optional. Set this to True if this is the last log entry in the operation. + bool last = 4; +} + +// Additional information about the source code location that produced the log +// entry. +message LogEntrySourceLocation { + // Optional. Source file name. Depending on the runtime environment, this + // might be a simple name or a fully-qualified name. + string file = 1; + + // Optional. Line within the source file. 1-based; 0 indicates no line number + // available. + int64 line = 2; + + // Optional. Human-readable name of the function or method being invoked, with + // optional context such as the class or package name. This information may be + // used in contexts such as the logs viewer, where a file and line number are + // less meaningful. The format can vary by language. For example: + // `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function` + // (Python). + string function = 3; +} diff --git a/handwritten/cloud-profiler/google/logging/v2/logging.proto b/handwritten/cloud-profiler/google/logging/v2/logging.proto new file mode 100644 index 00000000000..8e937d88cc4 --- /dev/null +++ b/handwritten/cloud-profiler/google/logging/v2/logging.proto @@ -0,0 +1,301 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.logging.v2; + +import "google/api/annotations.proto"; +import "google/api/monitored_resource.proto"; +import "google/logging/v2/log_entry.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Logging.V2"; +option go_package = "google.golang.org/genproto/googleapis/logging/v2;logging"; +option java_multiple_files = true; +option java_outer_classname = "LoggingProto"; +option java_package = "com.google.logging.v2"; + + +// Service for ingesting and querying logs. +service LoggingServiceV2 { + // Deletes all the log entries in a log. + // The log reappears if it receives new entries. + // Log entries written shortly before the delete operation might not be + // deleted. + rpc DeleteLog(DeleteLogRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v2beta1/{log_name=projects/*/logs/*}" }; + } + + // ## Log entry resources + // + // Writes log entries to Stackdriver Logging. This API method is the + // only way to send log entries to Stackdriver Logging. This method + // is used, directly or indirectly, by the Stackdriver Logging agent + // (fluentd) and all logging libraries configured to use Stackdriver + // Logging. + rpc WriteLogEntries(WriteLogEntriesRequest) returns (WriteLogEntriesResponse) { + option (google.api.http) = { post: "/v2/entries:write" body: "*" }; + } + + // Lists log entries. Use this method to retrieve log entries from + // Stackdriver Logging. For ways to export log entries, see + // [Exporting Logs](/logging/docs/export). + rpc ListLogEntries(ListLogEntriesRequest) returns (ListLogEntriesResponse) { + option (google.api.http) = { post: "/v2/entries:list" body: "*" }; + } + + // Lists the descriptors for monitored resource types used by Stackdriver + // Logging. + rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) returns (ListMonitoredResourceDescriptorsResponse) { + option (google.api.http) = { get: "/v2/monitoredResourceDescriptors" }; + } + + // Lists the logs in projects, organizations, folders, or billing accounts. + // Only logs that have entries are listed. + rpc ListLogs(ListLogsRequest) returns (ListLogsResponse) { + option (google.api.http) = { get: "/v2/{parent=projects/*}/logs" }; + } +} + +// The parameters to DeleteLog. +message DeleteLogRequest { + // Required. The resource name of the log to delete: + // + // "projects/[PROJECT_ID]/logs/[LOG_ID]" + // "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" + // "folders/[FOLDER_ID]/logs/[LOG_ID]" + // + // `[LOG_ID]` must be URL-encoded. For example, + // `"projects/my-project-id/logs/syslog"`, + // `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`. + // For more information about log names, see + // [LogEntry][google.logging.v2.LogEntry]. + string log_name = 1; +} + +// The parameters to WriteLogEntries. +message WriteLogEntriesRequest { + // Optional. A default log resource name that is assigned to all log entries + // in `entries` that do not specify a value for `log_name`: + // + // "projects/[PROJECT_ID]/logs/[LOG_ID]" + // "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" + // "folders/[FOLDER_ID]/logs/[LOG_ID]" + // + // `[LOG_ID]` must be URL-encoded. For example, + // `"projects/my-project-id/logs/syslog"` or + // `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`. + // For more information about log names, see + // [LogEntry][google.logging.v2.LogEntry]. + string log_name = 1; + + // Optional. A default monitored resource object that is assigned to all log + // entries in `entries` that do not specify a value for `resource`. Example: + // + // { "type": "gce_instance", + // "labels": { + // "zone": "us-central1-a", "instance_id": "00000000000000000000" }} + // + // See [LogEntry][google.logging.v2.LogEntry]. + google.api.MonitoredResource resource = 2; + + // Optional. Default labels that are added to the `labels` field of all log + // entries in `entries`. If a log entry already has a label with the same key + // as a label in this parameter, then the log entry's label is not changed. + // See [LogEntry][google.logging.v2.LogEntry]. + map labels = 3; + + // Required. The log entries to send to Stackdriver Logging. The order of log + // entries in this list does not matter. Values supplied in this method's + // `log_name`, `resource`, and `labels` fields are copied into those log + // entries in this list that do not include values for their corresponding + // fields. For more information, see the [LogEntry][google.logging.v2.LogEntry] type. + // + // If the `timestamp` or `insert_id` fields are missing in log entries, then + // this method supplies the current time or a unique identifier, respectively. + // The supplied values are chosen so that, among the log entries that did not + // supply their own values, the entries earlier in the list will sort before + // the entries later in the list. See the `entries.list` method. + // + // Log entries with timestamps that are more than the + // [logs retention period](/logging/quota-policy) in the past or more than + // 24 hours in the future might be discarded. Discarding does not return + // an error. + // + // To improve throughput and to avoid exceeding the + // [quota limit](/logging/quota-policy) for calls to `entries.write`, + // you should try to include several log entries in this list, + // rather than calling this method for each individual log entry. + repeated LogEntry entries = 4; + + // Optional. Whether valid entries should be written even if some other + // entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any + // entry is not written, then the response status is the error associated + // with one of the failed entries and the response includes error details + // keyed by the entries' zero-based index in the `entries.write` method. + bool partial_success = 5; +} + +// Result returned from WriteLogEntries. +// empty +message WriteLogEntriesResponse { + +} + +// Error details for WriteLogEntries with partial success. +message WriteLogEntriesPartialErrors { + // When `WriteLogEntriesRequest.partial_success` is true, records the error + // status for entries that were not written due to a permanent error, keyed + // by the entry's zero-based index in `WriteLogEntriesRequest.entries`. + // + // Failed requests for which no entries are written will not include + // per-entry errors. + map log_entry_errors = 1; +} + +// The parameters to `ListLogEntries`. +message ListLogEntriesRequest { + // Deprecated. Use `resource_names` instead. One or more project identifiers + // or project numbers from which to retrieve log entries. Example: + // `"my-project-1A"`. If present, these project identifiers are converted to + // resource name format and added to the list of resources in + // `resource_names`. + repeated string project_ids = 1; + + // Required. Names of one or more parent resources from which to + // retrieve log entries: + // + // "projects/[PROJECT_ID]" + // "organizations/[ORGANIZATION_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]" + // "folders/[FOLDER_ID]" + // + // Projects listed in the `project_ids` field are added to this list. + repeated string resource_names = 8; + + // Optional. A filter that chooses which log entries to return. See [Advanced + // Logs Filters](/logging/docs/view/advanced_filters). Only log entries that + // match the filter are returned. An empty filter matches all log entries in + // the resources listed in `resource_names`. Referencing a parent resource + // that is not listed in `resource_names` will cause the filter to return no + // results. + // The maximum length of the filter is 20000 characters. + string filter = 2; + + // Optional. How the results should be sorted. Presently, the only permitted + // values are `"timestamp asc"` (default) and `"timestamp desc"`. The first + // option returns entries in order of increasing values of + // `LogEntry.timestamp` (oldest first), and the second option returns entries + // in order of decreasing timestamps (newest first). Entries with equal + // timestamps are returned in order of their `insert_id` values. + string order_by = 3; + + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `next_page_token` in the + // response indicates that more results might be available. + int32 page_size = 4; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `page_token` must be the value of + // `next_page_token` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 5; +} + +// Result returned from `ListLogEntries`. +message ListLogEntriesResponse { + // A list of log entries. If `entries` is empty, `nextPageToken` may still be + // returned, indicating that more entries may exist. See `nextPageToken` for + // more information. + repeated LogEntry entries = 1; + + // If there might be more results than those appearing in this response, then + // `nextPageToken` is included. To get the next set of results, call this + // method again using the value of `nextPageToken` as `pageToken`. + // + // If a value for `next_page_token` appears and the `entries` field is empty, + // it means that the search found no log entries so far but it did not have + // time to search all the possible log entries. Retry the method with this + // value for `page_token` to continue the search. Alternatively, consider + // speeding up the search by changing your filter to specify a single log name + // or resource type, or to narrow the time range of the search. + string next_page_token = 2; +} + +// The parameters to ListMonitoredResourceDescriptors +message ListMonitoredResourceDescriptorsRequest { + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 1; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 2; +} + +// Result returned from ListMonitoredResourceDescriptors. +message ListMonitoredResourceDescriptorsResponse { + // A list of resource descriptors. + repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1; + + // If there might be more results than those appearing in this response, then + // `nextPageToken` is included. To get the next set of results, call this + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to ListLogs. +message ListLogsRequest { + // Required. The resource name that owns the logs: + // + // "projects/[PROJECT_ID]" + // "organizations/[ORGANIZATION_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]" + // "folders/[FOLDER_ID]" + string parent = 1; + + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 2; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 3; +} + +// Result returned from ListLogs. +message ListLogsResponse { + // A list of log names. For example, + // `"projects/my-project/syslog"` or + // `"organizations/123/cloudresourcemanager.googleapis.com%2Factivity"`. + repeated string log_names = 3; + + // If there might be more results than those appearing in this response, then + // `nextPageToken` is included. To get the next set of results, call this + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} diff --git a/handwritten/cloud-profiler/google/logging/v2/logging_config.proto b/handwritten/cloud-profiler/google/logging/v2/logging_config.proto new file mode 100644 index 00000000000..b17e4a093d4 --- /dev/null +++ b/handwritten/cloud-profiler/google/logging/v2/logging_config.proto @@ -0,0 +1,449 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.logging.v2; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Logging.V2"; +option go_package = "google.golang.org/genproto/googleapis/logging/v2;logging"; +option java_multiple_files = true; +option java_outer_classname = "LoggingConfigProto"; +option java_package = "com.google.logging.v2"; + + +// Service for configuring sinks used to export log entries outside of +// Stackdriver Logging. +service ConfigServiceV2 { + // Lists sinks. + rpc ListSinks(ListSinksRequest) returns (ListSinksResponse) { + option (google.api.http) = { get: "/v2/{parent=projects/*}/sinks" }; + } + + // Gets a sink. + rpc GetSink(GetSinkRequest) returns (LogSink) { + option (google.api.http) = { get: "/v2/{sink_name=projects/*/sinks/*}" }; + } + + // Creates a sink that exports specified log entries to a destination. The + // export of newly-ingested log entries begins immediately, unless the current + // time is outside the sink's start and end times or the sink's + // `writer_identity` is not permitted to write to the destination. A sink can + // export log entries only from the resource owning the sink. + rpc CreateSink(CreateSinkRequest) returns (LogSink) { + option (google.api.http) = { post: "/v2/{parent=projects/*}/sinks" body: "sink" }; + } + + // Updates a sink. This method replaces the following fields in the existing + // sink with values from the new sink: `destination`, `filter`, + // `output_version_format`, `start_time`, and `end_time`. + // The updated sink might also have a new `writer_identity`; see the + // `unique_writer_identity` field. + rpc UpdateSink(UpdateSinkRequest) returns (LogSink) { + option (google.api.http) = { put: "/v2/{sink_name=projects/*/sinks/*}" body: "sink" }; + } + + // Deletes a sink. If the sink has a unique `writer_identity`, then that + // service account is also deleted. + rpc DeleteSink(DeleteSinkRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v2/{sink_name=projects/*/sinks/*}" }; + } + + // Lists all the exclusions in a parent resource. + rpc ListExclusions(ListExclusionsRequest) returns (ListExclusionsResponse) { + option (google.api.http) = { get: "/v2/{parent=projects/*}/exclusions" }; + } + + // Gets the description of an exclusion. + rpc GetExclusion(GetExclusionRequest) returns (LogExclusion) { + option (google.api.http) = { get: "/v2/{name=projects/*/exclusions/*}" }; + } + + // Creates a new exclusion in a specified parent resource. + // Only log entries belonging to that resource can be excluded. + // You can have up to 10 exclusions in a resource. + rpc CreateExclusion(CreateExclusionRequest) returns (LogExclusion) { + option (google.api.http) = { post: "/v2/{parent=projects/*}/exclusions" body: "exclusion" }; + } + + // Changes one or more properties of an existing exclusion. + rpc UpdateExclusion(UpdateExclusionRequest) returns (LogExclusion) { + option (google.api.http) = { patch: "/v2/{name=projects/*/exclusions/*}" body: "exclusion" }; + } + + // Deletes an exclusion. + rpc DeleteExclusion(DeleteExclusionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v2/{name=projects/*/exclusions/*}" }; + } +} + +// Describes a sink used to export log entries to one of the following +// destinations in any project: a Cloud Storage bucket, a BigQuery dataset, or a +// Cloud Pub/Sub topic. A logs filter controls which log entries are +// exported. The sink must be created within a project, organization, billing +// account, or folder. +message LogSink { + // Available log entry formats. Log entries can be written to Stackdriver + // Logging in either format and can be exported in either format. + // Version 2 is the preferred format. + enum VersionFormat { + // An unspecified format version that will default to V2. + VERSION_FORMAT_UNSPECIFIED = 0; + + // `LogEntry` version 2 format. + V2 = 1; + + // `LogEntry` version 1 format. + V1 = 2; + } + + // Required. The client-assigned sink identifier, unique within the + // project. Example: `"my-syslog-errors-to-pubsub"`. Sink identifiers are + // limited to 100 characters and can include only the following characters: + // upper and lower-case alphanumeric characters, underscores, hyphens, and + // periods. + string name = 1; + + // Required. The export destination: + // + // "storage.googleapis.com/[GCS_BUCKET]" + // "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]" + // "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]" + // + // The sink's `writer_identity`, set when the sink is created, must + // have permission to write to the destination or else the log + // entries are not exported. For more information, see + // [Exporting Logs With Sinks](/logging/docs/api/tasks/exporting-logs). + string destination = 3; + + // Optional. + // An [advanced logs filter](/logging/docs/view/advanced_filters). The only + // exported log entries are those that are in the resource owning the sink and + // that match the filter. The filter must use the log entry format specified + // by the `output_version_format` parameter. For example, in the v2 format: + // + // logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR + string filter = 5; + + // Deprecated. The log entry format to use for this sink's exported log + // entries. The v2 format is used by default and cannot be changed. + VersionFormat output_version_format = 6; + + // Output only. An IAM identity—a service account or group—under + // which Stackdriver Logging writes the exported log entries to the sink's + // destination. This field is set by + // [sinks.create](/logging/docs/api/reference/rest/v2/projects.sinks/create) + // and + // [sinks.update](/logging/docs/api/reference/rest/v2/projects.sinks/update), + // based on the setting of `unique_writer_identity` in those methods. + // + // Until you grant this identity write-access to the destination, log entry + // exports from this sink will fail. For more information, + // see [Granting access for a + // resource](/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource). + // Consult the destination service's documentation to determine the + // appropriate IAM roles to assign to the identity. + string writer_identity = 8; + + // Optional. This field applies only to sinks owned by organizations and + // folders. If the field is false, the default, only the logs owned by the + // sink's parent resource are available for export. If the field is true, then + // logs from all the projects, folders, and billing accounts contained in the + // sink's parent resource are also available for export. Whether a particular + // log entry from the children is exported depends on the sink's filter + // expression. For example, if this field is true, then the filter + // `resource.type=gce_instance` would export all Compute Engine VM instance + // log entries from all projects in the sink's parent. To only export entries + // from certain child projects, filter on the project part of the log name: + // + // logName:("projects/test-project1/" OR "projects/test-project2/") AND + // resource.type=gce_instance + bool include_children = 9; + + // Optional. The time at which this sink will begin exporting log entries. + // Log entries are exported only if their timestamp is not earlier than the + // start time. The default value of this field is the time the sink is + // created or updated. + google.protobuf.Timestamp start_time = 10; + + // Optional. The time at which this sink will stop exporting log entries. Log + // entries are exported only if their timestamp is earlier than the end time. + // If this field is not supplied, there is no end time. If both a start time + // and an end time are provided, then the end time must be later than the + // start time. + google.protobuf.Timestamp end_time = 11; +} + +// The parameters to `ListSinks`. +message ListSinksRequest { + // Required. The parent resource whose sinks are to be listed: + // + // "projects/[PROJECT_ID]" + // "organizations/[ORGANIZATION_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]" + // "folders/[FOLDER_ID]" + string parent = 1; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 2; + + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 3; +} + +// Result returned from `ListSinks`. +message ListSinksResponse { + // A list of sinks. + repeated LogSink sinks = 1; + + // If there might be more results than appear in this response, then + // `nextPageToken` is included. To get the next set of results, call the same + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to `GetSink`. +message GetSinkRequest { + // Required. The resource name of the sink: + // + // "projects/[PROJECT_ID]/sinks/[SINK_ID]" + // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + // "folders/[FOLDER_ID]/sinks/[SINK_ID]" + // + // Example: `"projects/my-project-id/sinks/my-sink-id"`. + string sink_name = 1; +} + +// The parameters to `CreateSink`. +message CreateSinkRequest { + // Required. The resource in which to create the sink: + // + // "projects/[PROJECT_ID]" + // "organizations/[ORGANIZATION_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]" + // "folders/[FOLDER_ID]" + // + // Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. + string parent = 1; + + // Required. The new sink, whose `name` parameter is a sink identifier that + // is not already in use. + LogSink sink = 2; + + // Optional. Determines the kind of IAM identity returned as `writer_identity` + // in the new sink. If this value is omitted or set to false, and if the + // sink's parent is a project, then the value returned as `writer_identity` is + // the same group or service account used by Stackdriver Logging before the + // addition of writer identities to this API. The sink's destination must be + // in the same project as the sink itself. + // + // If this field is set to true, or if the sink is owned by a non-project + // resource such as an organization, then the value of `writer_identity` will + // be a unique service account used only for exports from the new sink. For + // more information, see `writer_identity` in [LogSink][google.logging.v2.LogSink]. + bool unique_writer_identity = 3; +} + +// The parameters to `UpdateSink`. +message UpdateSinkRequest { + // Required. The full resource name of the sink to update, including the + // parent resource and the sink identifier: + // + // "projects/[PROJECT_ID]/sinks/[SINK_ID]" + // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + // "folders/[FOLDER_ID]/sinks/[SINK_ID]" + // + // Example: `"projects/my-project-id/sinks/my-sink-id"`. + string sink_name = 1; + + // Required. The updated sink, whose name is the same identifier that appears + // as part of `sink_name`. + LogSink sink = 2; + + // Optional. See + // [sinks.create](/logging/docs/api/reference/rest/v2/projects.sinks/create) + // for a description of this field. When updating a sink, the effect of this + // field on the value of `writer_identity` in the updated sink depends on both + // the old and new values of this field: + // + // + If the old and new values of this field are both false or both true, + // then there is no change to the sink's `writer_identity`. + // + If the old value is false and the new value is true, then + // `writer_identity` is changed to a unique service account. + // + It is an error if the old value is true and the new value is + // set to false or defaulted to false. + bool unique_writer_identity = 3; +} + +// The parameters to `DeleteSink`. +message DeleteSinkRequest { + // Required. The full resource name of the sink to delete, including the + // parent resource and the sink identifier: + // + // "projects/[PROJECT_ID]/sinks/[SINK_ID]" + // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + // "folders/[FOLDER_ID]/sinks/[SINK_ID]" + // + // Example: `"projects/my-project-id/sinks/my-sink-id"`. + string sink_name = 1; +} + +// Specifies a set of log entries that are not to be stored in Stackdriver +// Logging. If your project receives a large volume of logs, you might be able +// to use exclusions to reduce your chargeable logs. Exclusions are processed +// after log sinks, so you can export log entries before they are excluded. +// Audit log entries and log entries from Amazon Web Services are never +// excluded. +message LogExclusion { + // Required. A client-assigned identifier, such as + // `"load-balancer-exclusion"`. Identifiers are limited to 100 characters and + // can include only letters, digits, underscores, hyphens, and periods. + string name = 1; + + // Optional. A description of this exclusion. + string description = 2; + + // Required. + // An [advanced logs filter](/logging/docs/view/advanced_filters) + // that matches the log entries to be excluded. By using the + // [sample function](/logging/docs/view/advanced_filters#sample), + // you can exclude less than 100% of the matching log entries. + // For example, the following filter matches 99% of low-severity log + // entries from load balancers: + // + // "resource.type=http_load_balancer severity=ERROR" + // + // The maximum length of the filter is 20000 characters. + string filter = 3; + + // Optional. The metric descriptor associated with the logs-based metric. + // If unspecified, it uses a default metric descriptor with a DELTA metric + // kind, INT64 value type, with no labels and a unit of "1". Such a metric + // counts the number of log entries matching the `filter` expression. + // + // The `name`, `type`, and `description` fields in the `metric_descriptor` + // are output only, and is constructed using the `name` and `description` + // field in the LogMetric. + // + // To create a logs-based metric that records a distribution of log values, a + // DELTA metric kind with a DISTRIBUTION value type must be used along with + // a `value_extractor` expression in the LogMetric. + // + // Each label in the metric descriptor must have a matching label + // name as the key and an extractor expression as the value in the + // `label_extractors` map. + // + // The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot + // be updated once initially configured. New labels can be added in the + // `metric_descriptor`, but existing labels cannot be modified except for + // their description. + google.api.MetricDescriptor metric_descriptor = 5; + + // Optional. A `value_extractor` is required when using a distribution + // logs-based metric to extract the values to record from a log entry. + // Two functions are supported for value extraction: `EXTRACT(field)` or + // `REGEXP_EXTRACT(field, regex)`. The argument are: + // 1. field: The name of the log entry field from which the value is to be + // extracted. + // 2. regex: A regular expression using the Google RE2 syntax + // (https://github.com/google/re2/wiki/Syntax) with a single capture + // group to extract data from the specified log entry field. The value + // of the field is converted to a string before applying the regex. + // It is an error to specify a regex that does not include exactly one + // capture group. + // + // The result of the extraction must be convertible to a double type, as the + // distribution always records double values. If either the extraction or + // the conversion to double fails, then those values are not recorded in the + // distribution. + // + // Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(\d+).*")` + string value_extractor = 6; + + // Optional. A map from a label key string to an extractor expression which is + // used to extract data from a log entry field and assign as the label value. + // Each label key specified in the LabelDescriptor must have an associated + // extractor expression in this map. The syntax of the extractor expression + // is the same as for the `value_extractor` field. + // + // The extracted value is converted to the type defined in the label + // descriptor. If the either the extraction or the type conversion fails, + // the label will have a default value. The default value for a string + // label is an empty string, for an integer label its 0, and for a boolean + // label its `false`. + // + // Note that there are upper bounds on the maximum number of labels and the + // number of active time series that are allowed in a project. + map label_extractors = 7; + + // Optional. The `bucket_options` are required when the logs-based metric is + // using a DISTRIBUTION value type and it describes the bucket boundaries + // used to create a histogram of the extracted values. + google.api.Distribution.BucketOptions bucket_options = 8; + + // Deprecated. The API version that created or updated this metric. + // The v2 format is used by default and cannot be changed. + ApiVersion version = 4; +} + +// The parameters to ListLogMetrics. +message ListLogMetricsRequest { + // Required. The name of the project containing the metrics: + // + // "projects/[PROJECT_ID]" + string parent = 1; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `pageToken` must be the value of + // `nextPageToken` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 2; + + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `nextPageToken` in the + // response indicates that more results might be available. + int32 page_size = 3; +} + +// Result returned from ListLogMetrics. +message ListLogMetricsResponse { + // A list of logs-based metrics. + repeated LogMetric metrics = 1; + + // If there might be more results than appear in this response, then + // `nextPageToken` is included. To get the next set of results, call this + // method again using the value of `nextPageToken` as `pageToken`. + string next_page_token = 2; +} + +// The parameters to GetLogMetric. +message GetLogMetricRequest { + // The resource name of the desired metric: + // + // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + string metric_name = 1; +} + +// The parameters to CreateLogMetric. +message CreateLogMetricRequest { + // The resource name of the project in which to create the metric: + // + // "projects/[PROJECT_ID]" + // + // The new metric must be provided in the request. + string parent = 1; + + // The new logs-based metric, which must not have an identifier that + // already exists. + LogMetric metric = 2; +} + +// The parameters to UpdateLogMetric. +message UpdateLogMetricRequest { + // The resource name of the metric to update: + // + // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + // + // The updated metric must be provided in the request and it's + // `name` field must be the same as `[METRIC_ID]` If the metric + // does not exist in `[PROJECT_ID]`, then a new metric is created. + string metric_name = 1; + + // The updated metric. + LogMetric metric = 2; +} + +// The parameters to DeleteLogMetric. +message DeleteLogMetricRequest { + // The resource name of the metric to delete: + // + // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + string metric_name = 1; +} diff --git a/handwritten/cloud-profiler/google/longrunning/README.md b/handwritten/cloud-profiler/google/longrunning/README.md new file mode 100644 index 00000000000..905642277f5 --- /dev/null +++ b/handwritten/cloud-profiler/google/longrunning/README.md @@ -0,0 +1,5 @@ +# Google Long Running Operations API + +This package contains the definition of an abstract interface that +manages long running operations with API services. See +[google.longrunning.Operations][] for details. \ No newline at end of file diff --git a/handwritten/cloud-profiler/google/longrunning/artman_longrunning.yaml b/handwritten/cloud-profiler/google/longrunning/artman_longrunning.yaml new file mode 100644 index 00000000000..99915c2b6a2 --- /dev/null +++ b/handwritten/cloud-profiler/google/longrunning/artman_longrunning.yaml @@ -0,0 +1,90 @@ +common: + api_name: longrunning + api_version: v1 + organization_name: google + service_yaml: longrunning.yaml + gapic_yaml: longrunning_gapic.yaml + src_proto_paths: + - . + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: gax + type: GITHUB + location: git@github.com:googleapis/gax-java.git + directory_mappings: + - src: src/main/java/com/google/longrunning + dest: src/main/java/com/google/longrunning + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-longrunning-v1 + - name: grpc + dest: generated/java/grpc-google-longrunning-v1 + - name: proto + dest: generated/java/proto-google-longrunning-v1 +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-longrunning-v1 + - name: grpc + dest: generated/php/google-longrunning-v1/proto + - name: gax + type: GITHUB + location: git@github.com:googleapis/gax-php.git + directory_mappings: + - src: src/Longrunning + dest: src/Longrunning +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: gax + type: GITHUB + location: git@github.com:googleapis/gax-ruby.git + directory_mappings: + - src: lib/google/longrunning + dest: lib/google/longrunning + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-longrunning +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: longrunning/autogen + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-longrunning/vendor +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + publish_targets: + - name: gax + type: GITHUB + location: git@github.com:googleapis/gax-nodejs.git + directory_mappings: + - dest: lib/operation* +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/longrunning/longrunning.yaml b/handwritten/cloud-profiler/google/longrunning/longrunning.yaml new file mode 100644 index 00000000000..74543bc0aa8 --- /dev/null +++ b/handwritten/cloud-profiler/google/longrunning/longrunning.yaml @@ -0,0 +1,12 @@ +type: google.api.Service +config_version: 1 +name: longrunning.googleapis.com +title: Google Long Running Operations API + +apis: +- name: google.longrunning.Operations + +# Documentation section +documentation: + overview: + (== include google/longrunning/README.md ==) diff --git a/handwritten/cloud-profiler/google/longrunning/longrunning_gapic.yaml b/handwritten/cloud-profiler/google/longrunning/longrunning_gapic.yaml new file mode 100644 index 00000000000..56f7593873e --- /dev/null +++ b/handwritten/cloud-profiler/google/longrunning/longrunning_gapic.yaml @@ -0,0 +1,98 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.longrunning + python: + package_name: google.longrunning.gapic + go: + package_name: cloud.google.com/go/longrunning/autogen + domain_layer_location: cloud.google.com/go/longrunning + license_header_override: + license_file: license-header-apache-2.0.txt + csharp: + package_name: Google.LongRunning + ruby: + package_name: Google::Longrunning + php: + package_name: Google\GAX\LongRunning + nodejs: + package_name: longrunning +license_header: + copyright_file: copyright-google.txt + license_file: license-header-bsd-3-clause.txt +interfaces: +- name: google.longrunning.Operations + required_constructor_params: + - service_address + - scopes + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 90000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 90000 + total_timeout_millis: 600000 + methods: + - name: GetOperation + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: ListOperations + flattening: + groups: + - parameters: + - name + - filter + required_fields: + - name + - filter + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: operations + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: CancelOperation + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: DeleteOperation + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 diff --git a/handwritten/cloud-profiler/google/longrunning/operations.proto b/handwritten/cloud-profiler/google/longrunning/operations.proto new file mode 100644 index 00000000000..2fb7a31ad7b --- /dev/null +++ b/handwritten/cloud-profiler/google/longrunning/operations.proto @@ -0,0 +1,159 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.longrunning; + +import "google/api/annotations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/empty.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.LongRunning"; +option go_package = "google.golang.org/genproto/googleapis/longrunning;longrunning"; +option java_multiple_files = true; +option java_outer_classname = "OperationsProto"; +option java_package = "com.google.longrunning"; + + +// Manages long-running operations with an API service. +// +// When an API method normally takes long time to complete, it can be designed +// to return [Operation][google.longrunning.Operation] to the client, and the client can use this +// interface to receive the real response asynchronously by polling the +// operation resource, or pass the operation resource to another API (such as +// Google Cloud Pub/Sub API) to receive the response. Any API service that +// returns long-running operations should implement the `Operations` interface +// so developers can have a consistent client experience. +service Operations { + // Lists operations that match the specified filter in the request. If the + // server doesn't support this method, it returns `UNIMPLEMENTED`. + // + // NOTE: the `name` binding below allows API services to override the binding + // to use different resource name schemes, such as `users/*/operations`. + rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) { + option (google.api.http) = { get: "/v1/{name=operations}" }; + } + + // Gets the latest state of a long-running operation. Clients can use this + // method to poll the operation result at intervals as recommended by the API + // service. + rpc GetOperation(GetOperationRequest) returns (Operation) { + option (google.api.http) = { get: "/v1/{name=operations/**}" }; + } + + // Deletes a long-running operation. This method indicates that the client is + // no longer interested in the operation result. It does not cancel the + // operation. If the server doesn't support this method, it returns + // `google.rpc.Code.UNIMPLEMENTED`. + rpc DeleteOperation(DeleteOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/{name=operations/**}" }; + } + + // Starts asynchronous cancellation on a long-running operation. The server + // makes a best effort to cancel the operation, but success is not + // guaranteed. If the server doesn't support this method, it returns + // `google.rpc.Code.UNIMPLEMENTED`. Clients can use + // [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + // other methods to check whether the cancellation succeeded or whether the + // operation completed despite cancellation. On successful cancellation, + // the operation is not deleted; instead, it becomes an operation with + // an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1/{name=operations/**}:cancel" body: "*" }; + } +} + +// This resource represents a long-running operation that is the result of a +// network API call. +message Operation { + // The server-assigned name, which is only unique within the same service that + // originally returns it. If you use the default HTTP mapping, the + // `name` should have the format of `operations/some/unique/name`. + string name = 1; + + // Service-specific metadata associated with the operation. It typically + // contains progress information and common metadata such as create time. + // Some services might not provide such metadata. Any method that returns a + // long-running operation should document the metadata type, if any. + google.protobuf.Any metadata = 2; + + // If the value is `false`, it means the operation is still in progress. + // If true, the operation is completed, and either `error` or `response` is + // available. + bool done = 3; + + // The operation result, which can be either an `error` or a valid `response`. + // If `done` == `false`, neither `error` nor `response` is set. + // If `done` == `true`, exactly one of `error` or `response` is set. + oneof result { + // The error result of the operation in case of failure or cancellation. + google.rpc.Status error = 4; + + // The normal response of the operation in case of success. If the original + // method returns no data on success, such as `Delete`, the response is + // `google.protobuf.Empty`. If the original method is standard + // `Get`/`Create`/`Update`, the response should be the resource. For other + // methods, the response should have the type `XxxResponse`, where `Xxx` + // is the original method name. For example, if the original method name + // is `TakeSnapshot()`, the inferred response type is + // `TakeSnapshotResponse`. + google.protobuf.Any response = 5; + } +} + +// The request message for [Operations.GetOperation][google.longrunning.Operations.GetOperation]. +message GetOperationRequest { + // The name of the operation resource. + string name = 1; +} + +// The request message for [Operations.ListOperations][google.longrunning.Operations.ListOperations]. +message ListOperationsRequest { + // The name of the operation collection. + string name = 4; + + // The standard list filter. + string filter = 1; + + // The standard list page size. + int32 page_size = 2; + + // The standard list page token. + string page_token = 3; +} + +// The response message for [Operations.ListOperations][google.longrunning.Operations.ListOperations]. +message ListOperationsResponse { + // A list of operations that matches the specified filter in the request. + repeated Operation operations = 1; + + // The standard List next-page token. + string next_page_token = 2; +} + +// The request message for [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]. +message CancelOperationRequest { + // The name of the operation resource to be cancelled. + string name = 1; +} + +// The request message for [Operations.DeleteOperation][google.longrunning.Operations.DeleteOperation]. +message DeleteOperationRequest { + // The name of the operation resource to be deleted. + string name = 1; +} + diff --git a/handwritten/cloud-profiler/google/monitoring/artman_monitoring.yaml b/handwritten/cloud-profiler/google/monitoring/artman_monitoring.yaml new file mode 100644 index 00000000000..9c6b08029f4 --- /dev/null +++ b/handwritten/cloud-profiler/google/monitoring/artman_monitoring.yaml @@ -0,0 +1,112 @@ +common: + api_name: monitoring + api_version: v3 + organization_name: google-cloud + service_yaml: monitoring.yaml + gapic_yaml: v3/monitoring_gapic.yaml + src_proto_paths: + - v3 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-monitoring-v3 + - name: grpc + dest: generated/java/grpc-google-cloud-monitoring-v3 + - name: proto + dest: generated/java/proto-google-cloud-monitoring-v3 + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-monitoring +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: google/cloud/monitoring_v3 + dest: monitoring/google/cloud/monitoring_v3 + - src: tests/unit/gapic/v3 + dest: monitoring/tests/gapic + - name: grpc + src: google/cloud/proto + dest: monitoring/google/cloud/proto + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-monitoring-v3 + - name: grpc + dest: generated/python/proto-google-cloud-monitoring-v3 +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-monitoring-v3 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-monitoring + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/monitoring/v3 + dest: google-cloud-monitoring/lib/google/cloud/monitoring/v3 +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: monitoring/apiv3 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-monitoring-v3/vendor +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + release_level: BETA + package_version: + grpc_dep_lower_bound: 0.3.0 + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/monitoring + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v3 + dest: packages/monitoring/src/v3 +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/monitoring/monitoring.yaml b/handwritten/cloud-profiler/google/monitoring/monitoring.yaml new file mode 100644 index 00000000000..44bd40b1af2 --- /dev/null +++ b/handwritten/cloud-profiler/google/monitoring/monitoring.yaml @@ -0,0 +1,83 @@ +type: google.api.Service +config_version: 2 +name: monitoring.googleapis.com +title: Stackdriver Monitoring API + +apis: +- name: google.monitoring.v3.GroupService +- name: google.monitoring.v3.MetricService + +documentation: + summary: > + 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. + rules: + - selector: google.monitoring.v3.MetricService.ListMonitoredResourceDescriptors + description: > + Lists monitored resource descriptors that match a filter. + This method does not require a Stackdriver account. + - selector: google.monitoring.v3.MetricService.GetMonitoredResourceDescriptor + description: > + Gets a single monitored resource descriptor. + This method does not require a Stackdriver account. + - selector: google.monitoring.v3.MetricService.ListMetricDescriptors + description: > + Lists metric descriptors that match a filter. + This method does not require a Stackdriver account. + - selector: google.monitoring.v3.MetricService.GetMetricDescriptor + description: > + Gets a single metric descriptor. + This method does not require a Stackdriver account. + - selector: google.monitoring.v3.MetricService.ListTimeSeries + description: > + Lists time series that match a filter. + This method does not require a Stackdriver account. + +authentication: + rules: + # Query functions that are also required by publish-only users. + - selector: |- + google.monitoring.v3.MetricService.ListMonitoredResourceDescriptors, + google.monitoring.v3.MetricService.GetMonitoredResourceDescriptor, + google.monitoring.v3.MetricService.ListMetricDescriptors, + google.monitoring.v3.MetricService.GetMetricDescriptor + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/monitoring, + https://www.googleapis.com/auth/monitoring.read, + https://www.googleapis.com/auth/monitoring.write + + # Write operations that are allowed for publish-only users. + - selector: |- + google.monitoring.v3.MetricService.CreateMetricDescriptor, + google.monitoring.v3.MetricService.CreateTimeSeries + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/monitoring, + https://www.googleapis.com/auth/monitoring.write + + # Query operations that are *not* permitted by publish-only users. + - selector: |- + google.monitoring.v3.GroupService.ListGroups, + google.monitoring.v3.GroupService.GetGroup, + google.monitoring.v3.GroupService.ListGroupMembers, + google.monitoring.v3.MetricService.ListTimeSeries + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/monitoring, + https://www.googleapis.com/auth/monitoring.read + + # Operations that require full access. + - selector: |- + google.monitoring.v3.GroupService.CreateGroup, + google.monitoring.v3.GroupService.UpdateGroup, + google.monitoring.v3.GroupService.DeleteGroup, + google.monitoring.v3.MetricService.DeleteMetricDescriptor + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/monitoring diff --git a/handwritten/cloud-profiler/google/monitoring/v3/BUILD b/handwritten/cloud-profiler/google/monitoring/v3/BUILD new file mode 100644 index 00000000000..3d40b4cae4a --- /dev/null +++ b/handwritten/cloud-profiler/google/monitoring/v3/BUILD @@ -0,0 +1,42 @@ + +package(default_visibility = ["//visibility:public"]) + +load("@submodule_grpc//bazel:grpc_build_system.bzl", "grpc_proto_library") + +grpc_proto_library(name = "metric", + srcs = ["metric.proto"], + deps = [ + "//google/api:metric", + "//google/api:monitored_resource", + ":common", + ], + well_known_protos = "@submodule_protobuf//:well_known_protos", + use_external = True, +) + +grpc_proto_library( + name = "common", + srcs = ["common.proto"], + deps = [ + "//google/api:distribution", + "//google/api:annotations", + ], + well_known_protos = "@submodule_protobuf//:well_known_protos", + use_external = True, +) + +grpc_proto_library( + name = "metric_service", + srcs = ["metric_service.proto"], + deps = [ + "//google/api:annotations", + "//google/api:metric", + "//google/api:monitored_resource", + "//google/api:label", + "//google/rpc:status", + ":common", + ":metric", + ], + well_known_protos = "@submodule_protobuf//:well_known_protos", + use_external = True, +) diff --git a/handwritten/cloud-profiler/google/monitoring/v3/common.proto b/handwritten/cloud-profiler/google/monitoring/v3/common.proto new file mode 100644 index 00000000000..c8f701eeaaf --- /dev/null +++ b/handwritten/cloud-profiler/google/monitoring/v3/common.proto @@ -0,0 +1,323 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/distribution.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.monitoring.v3"; + + +// A single strongly-typed value. +message TypedValue { + // The typed value field. + oneof value { + // A Boolean value: `true` or `false`. + bool bool_value = 1; + + // A 64-bit integer. Its range is approximately ±9.2x1018. + int64 int64_value = 2; + + // A 64-bit double-precision floating-point number. Its magnitude + // is approximately ±10±300 and it has 16 + // significant digits of precision. + double double_value = 3; + + // A variable-length string value. + string string_value = 4; + + // A distribution value. + google.api.Distribution distribution_value = 5; + } +} + +// A time interval extending just after a start time through an end time. +// If the start time is the same as the end time, then the interval +// represents a single point in time. +message TimeInterval { + // Required. The end of the time interval. + google.protobuf.Timestamp end_time = 2; + + // Optional. The beginning of the time interval. The default value + // for the start time is the end time. The start time must not be + // later than the end time. + google.protobuf.Timestamp start_time = 1; +} + +// Describes how to combine multiple time series to provide different views of +// the data. Aggregation consists of an alignment step on individual time +// series (`per_series_aligner`) followed by an optional reduction of the data +// across different time series (`cross_series_reducer`). For more details, see +// [Aggregation](/monitoring/api/learn_more#aggregation). +message Aggregation { + // The Aligner describes how to bring the data points in a single + // time series into temporal alignment. + enum Aligner { + // No alignment. Raw data is returned. Not valid if cross-time + // series reduction is requested. The value type of the result is + // the same as the value type of the input. + ALIGN_NONE = 0; + + // Align and convert to delta metric type. This alignment is valid + // for cumulative metrics and delta metrics. Aligning an existing + // delta metric to a delta metric requires that the alignment + // period be increased. The value type of the result is the same + // as the value type of the input. + ALIGN_DELTA = 1; + + // Align and convert to a rate. This alignment is valid for + // cumulative metrics and delta metrics with numeric values. The output is a + // gauge metric with value type + // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. + ALIGN_RATE = 2; + + // Align by interpolating between adjacent points around the + // period boundary. This alignment is valid for gauge + // metrics with numeric values. The value type of the result is the same + // as the value type of the input. + ALIGN_INTERPOLATE = 3; + + // Align by shifting the oldest data point before the period + // boundary to the boundary. This alignment is valid for gauge + // metrics. The value type of the result is the same as the + // value type of the input. + ALIGN_NEXT_OLDER = 4; + + // Align time series via aggregation. The resulting data point in + // the alignment period is the minimum of all data points in the + // period. This alignment is valid for gauge and delta metrics with numeric + // values. The value type of the result is the same as the value + // type of the input. + ALIGN_MIN = 10; + + // Align time series via aggregation. The resulting data point in + // the alignment period is the maximum of all data points in the + // period. This alignment is valid for gauge and delta metrics with numeric + // values. The value type of the result is the same as the value + // type of the input. + ALIGN_MAX = 11; + + // Align time series via aggregation. The resulting data point in + // the alignment period is the average or arithmetic mean of all + // data points in the period. This alignment is valid for gauge and delta + // metrics with numeric values. The value type of the output is + // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. + ALIGN_MEAN = 12; + + // Align time series via aggregation. The resulting data point in + // the alignment period is the count of all data points in the + // period. This alignment is valid for gauge and delta metrics with numeric + // or Boolean values. The value type of the output is + // [INT64][google.api.MetricDescriptor.ValueType.INT64]. + ALIGN_COUNT = 13; + + // Align time series via aggregation. The resulting data point in + // the alignment period is the sum of all data points in the + // period. This alignment is valid for gauge and delta metrics with numeric + // and distribution values. The value type of the output is the + // same as the value type of the input. + ALIGN_SUM = 14; + + // Align time series via aggregation. The resulting data point in + // the alignment period is the standard deviation of all data + // points in the period. This alignment is valid for gauge and delta metrics + // with numeric values. The value type of the output is + // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. + ALIGN_STDDEV = 15; + + // Align time series via aggregation. The resulting data point in + // the alignment period is the count of True-valued data points in the + // period. This alignment is valid for gauge metrics with + // Boolean values. The value type of the output is + // [INT64][google.api.MetricDescriptor.ValueType.INT64]. + ALIGN_COUNT_TRUE = 16; + + // Align time series via aggregation. The resulting data point in + // the alignment period is the fraction of True-valued data points in the + // period. This alignment is valid for gauge metrics with Boolean values. + // The output value is in the range [0, 1] and has value type + // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. + ALIGN_FRACTION_TRUE = 17; + + // Align time series via aggregation. The resulting data point in + // the alignment period is the 99th percentile of all data + // points in the period. This alignment is valid for gauge and delta metrics + // with distribution values. The output is a gauge metric with value type + // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. + ALIGN_PERCENTILE_99 = 18; + + // Align time series via aggregation. The resulting data point in + // the alignment period is the 95th percentile of all data + // points in the period. This alignment is valid for gauge and delta metrics + // with distribution values. The output is a gauge metric with value type + // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. + ALIGN_PERCENTILE_95 = 19; + + // Align time series via aggregation. The resulting data point in + // the alignment period is the 50th percentile of all data + // points in the period. This alignment is valid for gauge and delta metrics + // with distribution values. The output is a gauge metric with value type + // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. + ALIGN_PERCENTILE_50 = 20; + + // Align time series via aggregation. The resulting data point in + // the alignment period is the 5th percentile of all data + // points in the period. This alignment is valid for gauge and delta metrics + // with distribution values. The output is a gauge metric with value type + // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. + ALIGN_PERCENTILE_05 = 21; + } + + // A Reducer describes how to aggregate data points from multiple + // time series into a single time series. + enum Reducer { + // No cross-time series reduction. The output of the aligner is + // returned. + REDUCE_NONE = 0; + + // Reduce by computing the mean across time series for each + // alignment period. This reducer is valid for delta and + // gauge metrics with numeric or distribution values. The value type of the + // output is [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. + REDUCE_MEAN = 1; + + // Reduce by computing the minimum across time series for each + // alignment period. This reducer is valid for delta and + // gauge metrics with numeric values. The value type of the output + // is the same as the value type of the input. + REDUCE_MIN = 2; + + // Reduce by computing the maximum across time series for each + // alignment period. This reducer is valid for delta and + // gauge metrics with numeric values. The value type of the output + // is the same as the value type of the input. + REDUCE_MAX = 3; + + // Reduce by computing the sum across time series for each + // alignment period. This reducer is valid for delta and + // gauge metrics with numeric and distribution values. The value type of + // the output is the same as the value type of the input. + REDUCE_SUM = 4; + + // Reduce by computing the standard deviation across time series + // for each alignment period. This reducer is valid for delta + // and gauge metrics with numeric or distribution values. The value type of + // the output is [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. + REDUCE_STDDEV = 5; + + // Reduce by computing the count of data points across time series + // for each alignment period. This reducer is valid for delta + // and gauge metrics of numeric, Boolean, distribution, and string value + // type. The value type of the output is + // [INT64][google.api.MetricDescriptor.ValueType.INT64]. + REDUCE_COUNT = 6; + + // Reduce by computing the count of True-valued data points across time + // series for each alignment period. This reducer is valid for delta + // and gauge metrics of Boolean value type. The value type of + // the output is [INT64][google.api.MetricDescriptor.ValueType.INT64]. + REDUCE_COUNT_TRUE = 7; + + // Reduce by computing the fraction of True-valued data points across time + // series for each alignment period. This reducer is valid for delta + // and gauge metrics of Boolean value type. The output value is in the + // range [0, 1] and has value type + // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. + REDUCE_FRACTION_TRUE = 8; + + // Reduce by computing 99th percentile of data points across time series + // for each alignment period. This reducer is valid for gauge and delta + // metrics of numeric and distribution type. The value of the output is + // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE] + REDUCE_PERCENTILE_99 = 9; + + // Reduce by computing 95th percentile of data points across time series + // for each alignment period. This reducer is valid for gauge and delta + // metrics of numeric and distribution type. The value of the output is + // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE] + REDUCE_PERCENTILE_95 = 10; + + // Reduce by computing 50th percentile of data points across time series + // for each alignment period. This reducer is valid for gauge and delta + // metrics of numeric and distribution type. The value of the output is + // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE] + REDUCE_PERCENTILE_50 = 11; + + // Reduce by computing 5th percentile of data points across time series + // for each alignment period. This reducer is valid for gauge and delta + // metrics of numeric and distribution type. The value of the output is + // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE] + REDUCE_PERCENTILE_05 = 12; + } + + // The alignment period for per-[time series][google.monitoring.v3.TimeSeries] + // alignment. If present, `alignmentPeriod` must be at least 60 + // seconds. After per-time series alignment, each time series will + // contain data points only on the period boundaries. If + // `perSeriesAligner` is not specified or equals `ALIGN_NONE`, then + // this field is ignored. If `perSeriesAligner` is specified and + // does not equal `ALIGN_NONE`, then this field must be defined; + // otherwise an error is returned. + google.protobuf.Duration alignment_period = 1; + + // The approach to be used to align individual time series. Not all + // alignment functions may be applied to all time series, depending + // on the metric type and value type of the original time + // series. Alignment may change the metric type or the value type of + // the time series. + // + // Time series data must be aligned in order to perform cross-time + // series reduction. If `crossSeriesReducer` is specified, then + // `perSeriesAligner` must be specified and not equal `ALIGN_NONE` + // and `alignmentPeriod` must be specified; otherwise, an error is + // returned. + Aligner per_series_aligner = 2; + + // The approach to be used to combine time series. Not all reducer + // functions may be applied to all time series, depending on the + // metric type and the value type of the original time + // series. Reduction may change the metric type of value type of the + // time series. + // + // Time series data must be aligned in order to perform cross-time + // series reduction. If `crossSeriesReducer` is specified, then + // `perSeriesAligner` must be specified and not equal `ALIGN_NONE` + // and `alignmentPeriod` must be specified; otherwise, an error is + // returned. + Reducer cross_series_reducer = 4; + + // The set of fields to preserve when `crossSeriesReducer` is + // specified. The `groupByFields` determine how the time series are + // partitioned into subsets prior to applying the aggregation + // function. Each subset contains time series that have the same + // value for each of the grouping fields. Each individual time + // series is a member of exactly one subset. The + // `crossSeriesReducer` is applied to each subset of time series. + // It is not possible to reduce across different resource types, so + // this field implicitly contains `resource.type`. Fields not + // specified in `groupByFields` are aggregated away. If + // `groupByFields` is not specified and all the time series have + // the same resource type, then the time series are aggregated into + // a single output time series. If `crossSeriesReducer` is not + // defined, this field is ignored. + repeated string group_by_fields = 5; +} diff --git a/handwritten/cloud-profiler/google/monitoring/v3/group.proto b/handwritten/cloud-profiler/google/monitoring/v3/group.proto new file mode 100644 index 00000000000..b6a6cfc45c0 --- /dev/null +++ b/handwritten/cloud-profiler/google/monitoring/v3/group.proto @@ -0,0 +1,74 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "GroupProto"; +option java_package = "com.google.monitoring.v3"; + + +// The description of a dynamic collection of monitored resources. Each group +// has a filter that is matched against monitored resources and their associated +// metadata. If a group's filter matches an available monitored resource, then +// that resource is a member of that group. Groups can contain any number of +// monitored resources, and each monitored resource can be a member of any +// number of groups. +// +// Groups can be nested in parent-child hierarchies. The `parentName` field +// identifies an optional parent for each group. If a group has a parent, then +// the only monitored resources available to be matched by the group's filter +// are the resources contained in the parent group. In other words, a group +// contains the monitored resources that match its filter and the filters of all +// the group's ancestors. A group without a parent can contain any monitored +// resource. +// +// For example, consider an infrastructure running a set of instances with two +// user-defined tags: `"environment"` and `"role"`. A parent group has a filter, +// `environment="production"`. A child of that parent group has a filter, +// `role="transcoder"`. The parent group contains all instances in the +// production environment, regardless of their roles. The child group contains +// instances that have the transcoder role *and* are in the production +// environment. +// +// The monitored resources contained in a group can change at any moment, +// depending on what resources exist and what filters are associated with the +// group and its ancestors. +message Group { + // Output only. The name of this group. The format is + // `"projects/{project_id_or_number}/groups/{group_id}"`. + // When creating a group, this field is ignored and a new name is created + // consisting of the project specified in the call to `CreateGroup` + // and a unique `{group_id}` that is generated automatically. + string name = 1; + + // A user-assigned name for this group, used only for display purposes. + string display_name = 2; + + // The name of the group's parent, if it has one. + // The format is `"projects/{project_id_or_number}/groups/{group_id}"`. + // For groups with no parent, `parentName` is the empty string, `""`. + string parent_name = 3; + + // The filter used to determine which monitored resources belong to this group. + string filter = 5; + + // If true, the members of this group are considered to be a cluster. + // The system can perform additional analysis on groups that are clusters. + bool is_cluster = 6; +} diff --git a/handwritten/cloud-profiler/google/monitoring/v3/group_service.proto b/handwritten/cloud-profiler/google/monitoring/v3/group_service.proto new file mode 100644 index 00000000000..3450580cd83 --- /dev/null +++ b/handwritten/cloud-profiler/google/monitoring/v3/group_service.proto @@ -0,0 +1,206 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/annotations.proto"; +import "google/api/monitored_resource.proto"; +import "google/monitoring/v3/common.proto"; +import "google/monitoring/v3/group.proto"; +import "google/protobuf/empty.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "GroupServiceProto"; +option java_package = "com.google.monitoring.v3"; + + +// The Group API lets you inspect and manage your +// [groups](google.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. +service GroupService { + // Lists the existing groups. + rpc ListGroups(ListGroupsRequest) returns (ListGroupsResponse) { + option (google.api.http) = { get: "/v3/{name=projects/*}/groups" }; + } + + // Gets a single group. + rpc GetGroup(GetGroupRequest) returns (Group) { + option (google.api.http) = { get: "/v3/{name=projects/*/groups/*}" }; + } + + // Creates a new group. + rpc CreateGroup(CreateGroupRequest) returns (Group) { + option (google.api.http) = { post: "/v3/{name=projects/*}/groups" body: "group" }; + } + + // Updates an existing group. + // You can change any group attributes except `name`. + rpc UpdateGroup(UpdateGroupRequest) returns (Group) { + option (google.api.http) = { put: "/v3/{group.name=projects/*/groups/*}" body: "group" }; + } + + // Deletes an existing group. + rpc DeleteGroup(DeleteGroupRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v3/{name=projects/*/groups/*}" }; + } + + // Lists the monitored resources that are members of a group. + rpc ListGroupMembers(ListGroupMembersRequest) returns (ListGroupMembersResponse) { + option (google.api.http) = { get: "/v3/{name=projects/*/groups/*}/members" }; + } +} + +// The `ListGroup` request. +message ListGroupsRequest { + // The project whose groups are to be listed. The format is + // `"projects/{project_id_or_number}"`. + string name = 7; + + // An optional filter consisting of a single group name. The filters limit the + // groups returned based on their parent-child relationship with the specified + // group. If no filter is specified, all groups are returned. + oneof filter { + // A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. + // Returns groups whose `parentName` field contains the group + // name. If no groups have this parent, the results are empty. + string children_of_group = 2; + + // A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. + // Returns groups that are ancestors of the specified group. + // The groups are returned in order, starting with the immediate parent and + // ending with the most distant ancestor. If the specified group has no + // immediate parent, the results are empty. + string ancestors_of_group = 3; + + // A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. + // Returns the descendants of the specified group. This is a superset of + // the results returned by the `childrenOfGroup` filter, and includes + // children-of-children, and so forth. + string descendants_of_group = 4; + } + + // A positive number that is the maximum number of results to return. + int32 page_size = 5; + + // If this field is not empty then it must contain the `nextPageToken` value + // returned by a previous call to this method. Using this field causes the + // method to return additional results from the previous method call. + string page_token = 6; +} + +// The `ListGroups` response. +message ListGroupsResponse { + // The groups that match the specified filters. + repeated Group group = 1; + + // If there are more results than have been returned, then this field is set + // to a non-empty value. To see the additional results, + // use that value as `pageToken` in the next call to this method. + string next_page_token = 2; +} + +// The `GetGroup` request. +message GetGroupRequest { + // The group to retrieve. The format is + // `"projects/{project_id_or_number}/groups/{group_id}"`. + string name = 3; +} + +// The `CreateGroup` request. +message CreateGroupRequest { + // The project in which to create the group. The format is + // `"projects/{project_id_or_number}"`. + string name = 4; + + // A group definition. It is an error to define the `name` field because + // the system assigns the name. + Group group = 2; + + // If true, validate this request but do not create the group. + bool validate_only = 3; +} + +// The `UpdateGroup` request. +message UpdateGroupRequest { + // The new definition of the group. All fields of the existing group, + // excepting `name`, are replaced with the corresponding fields of this group. + Group group = 2; + + // If true, validate this request but do not update the existing group. + bool validate_only = 3; +} + +// The `DeleteGroup` request. You can only delete a group if it has no children. +message DeleteGroupRequest { + // The group to delete. The format is + // `"projects/{project_id_or_number}/groups/{group_id}"`. + string name = 3; +} + +// The `ListGroupMembers` request. +message ListGroupMembersRequest { + // The group whose members are listed. The format is + // `"projects/{project_id_or_number}/groups/{group_id}"`. + string name = 7; + + // A positive number that is the maximum number of results to return. + int32 page_size = 3; + + // If this field is not empty then it must contain the `nextPageToken` value + // returned by a previous call to this method. Using this field causes the + // method to return additional results from the previous method call. + string page_token = 4; + + // An optional [list filter](/monitoring/api/learn_more#filtering) describing + // the members to be returned. The filter may reference the type, labels, and + // metadata of monitored resources that comprise the group. + // For example, to return only resources representing Compute Engine VM + // instances, use this filter: + // + // resource.type = "gce_instance" + string filter = 5; + + // An optional time interval for which results should be returned. Only + // members that were part of the group during the specified interval are + // included in the response. If no interval is provided then the group + // membership over the last minute is returned. + TimeInterval interval = 6; +} + +// The `ListGroupMembers` response. +message ListGroupMembersResponse { + // A set of monitored resources in the group. + repeated google.api.MonitoredResource members = 1; + + // If there are more results than have been returned, then this field is + // set to a non-empty value. To see the additional results, use that value as + // `pageToken` in the next call to this method. + string next_page_token = 2; + + // The total number of elements matching this request. + int32 total_size = 3; +} diff --git a/handwritten/cloud-profiler/google/monitoring/v3/metric.proto b/handwritten/cloud-profiler/google/monitoring/v3/metric.proto new file mode 100644 index 00000000000..73ae6037493 --- /dev/null +++ b/handwritten/cloud-profiler/google/monitoring/v3/metric.proto @@ -0,0 +1,87 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/metric.proto"; +import "google/api/monitored_resource.proto"; +import "google/monitoring/v3/common.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "MetricProto"; +option java_package = "com.google.monitoring.v3"; + + +// A single data point in a time series. +message Point { + // The time interval to which the data point applies. For GAUGE metrics, only + // the end time of the interval is used. For DELTA metrics, the start and end + // time should specify a non-zero interval, with subsequent points specifying + // contiguous and non-overlapping intervals. For CUMULATIVE metrics, the + // start and end time should specify a non-zero interval, with subsequent + // points specifying the same start time and increasing end times, until an + // event resets the cumulative value to zero and sets a new start time for the + // following points. + TimeInterval interval = 1; + + // The value of the data point. + TypedValue value = 2; +} + +// A collection of data points that describes the time-varying values +// of a metric. A time series is identified by a combination of a +// fully-specified monitored resource and a fully-specified metric. +// This type is used for both listing and creating time series. +message TimeSeries { + // The associated metric. A fully-specified metric used to identify the time + // series. + google.api.Metric metric = 1; + + // The associated resource. A fully-specified monitored resource used to + // identify the time series. + google.api.MonitoredResource resource = 2; + + // The metric kind of the time series. When listing time series, this metric + // kind might be different from the metric kind of the associated metric if + // this time series is an alignment or reduction of other time series. + // + // When creating a time series, this field is optional. If present, it must be + // the same as the metric kind of the associated metric. If the associated + // metric's descriptor must be auto-created, then this field specifies the + // metric kind of the new descriptor and must be either `GAUGE` (the default) + // or `CUMULATIVE`. + google.api.MetricDescriptor.MetricKind metric_kind = 3; + + // The value type of the time series. When listing time series, this value + // type might be different from the value type of the associated metric if + // this time series is an alignment or reduction of other time series. + // + // When creating a time series, this field is optional. If present, it must be + // the same as the type of the data in the `points` field. + google.api.MetricDescriptor.ValueType value_type = 4; + + // The data points of this time series. When listing time series, the order of + // the points is specified by the list method. + // + // When creating a time series, this field must contain exactly one point and + // the point's type must be the same as the value type of the associated + // metric. If the associated metric's descriptor must be auto-created, then + // the value type of the descriptor is determined by the point's type, which + // must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`. + repeated Point points = 5; +} diff --git a/handwritten/cloud-profiler/google/monitoring/v3/metric_service.proto b/handwritten/cloud-profiler/google/monitoring/v3/metric_service.proto new file mode 100644 index 00000000000..0dd0b19d315 --- /dev/null +++ b/handwritten/cloud-profiler/google/monitoring/v3/metric_service.proto @@ -0,0 +1,286 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/annotations.proto"; +import "google/api/metric.proto"; +import "google/api/monitored_resource.proto"; +import "google/monitoring/v3/common.proto"; +import "google/monitoring/v3/metric.proto"; +import "google/protobuf/empty.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "MetricServiceProto"; +option java_package = "com.google.monitoring.v3"; + + +// Manages metric descriptors, monitored resource descriptors, and +// time series data. +service MetricService { + // Lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account. + rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) returns (ListMonitoredResourceDescriptorsResponse) { + option (google.api.http) = { get: "/v3/{name=projects/*}/monitoredResourceDescriptors" }; + } + + // Gets a single monitored resource descriptor. This method does not require a Stackdriver account. + rpc GetMonitoredResourceDescriptor(GetMonitoredResourceDescriptorRequest) returns (google.api.MonitoredResourceDescriptor) { + option (google.api.http) = { get: "/v3/{name=projects/*/monitoredResourceDescriptors/*}" }; + } + + // Lists metric descriptors that match a filter. This method does not require a Stackdriver account. + rpc ListMetricDescriptors(ListMetricDescriptorsRequest) returns (ListMetricDescriptorsResponse) { + option (google.api.http) = { get: "/v3/{name=projects/*}/metricDescriptors" }; + } + + // Gets a single metric descriptor. This method does not require a Stackdriver account. + rpc GetMetricDescriptor(GetMetricDescriptorRequest) returns (google.api.MetricDescriptor) { + option (google.api.http) = { get: "/v3/{name=projects/*/metricDescriptors/**}" }; + } + + // Creates a new metric descriptor. + // User-created metric descriptors define + // [custom metrics](/monitoring/custom-metrics). + rpc CreateMetricDescriptor(CreateMetricDescriptorRequest) returns (google.api.MetricDescriptor) { + option (google.api.http) = { post: "/v3/{name=projects/*}/metricDescriptors" body: "metric_descriptor" }; + } + + // Deletes a metric descriptor. Only user-created + // [custom metrics](/monitoring/custom-metrics) can be deleted. + rpc DeleteMetricDescriptor(DeleteMetricDescriptorRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v3/{name=projects/*/metricDescriptors/**}" }; + } + + // Lists time series that match a filter. This method does not require a Stackdriver account. + rpc ListTimeSeries(ListTimeSeriesRequest) returns (ListTimeSeriesResponse) { + option (google.api.http) = { get: "/v3/{name=projects/*}/timeSeries" }; + } + + // Creates or adds data to one or more time series. + // The response is empty if all time series in the request were written. + // If any time series could not be written, a corresponding failure message is + // included in the error response. + rpc CreateTimeSeries(CreateTimeSeriesRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v3/{name=projects/*}/timeSeries" body: "*" }; + } +} + +// The `ListMonitoredResourceDescriptors` request. +message ListMonitoredResourceDescriptorsRequest { + // The project on which to execute the request. The format is + // `"projects/{project_id_or_number}"`. + string name = 5; + + // An optional [filter](/monitoring/api/v3/filters) describing + // the descriptors to be returned. The filter can reference + // the descriptor's type and labels. For example, the + // following filter returns only Google Compute Engine descriptors + // that have an `id` label: + // + // resource.type = starts_with("gce_") AND resource.label:id + string filter = 2; + + // A positive number that is the maximum number of results to return. + int32 page_size = 3; + + // If this field is not empty then it must contain the `nextPageToken` value + // returned by a previous call to this method. Using this field causes the + // method to return additional results from the previous method call. + string page_token = 4; +} + +// The `ListMonitoredResourcDescriptors` response. +message ListMonitoredResourceDescriptorsResponse { + // The monitored resource descriptors that are available to this project + // and that match `filter`, if present. + repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1; + + // If there are more results than have been returned, then this field is set + // to a non-empty value. To see the additional results, + // use that value as `pageToken` in the next call to this method. + string next_page_token = 2; +} + +// The `GetMonitoredResourceDescriptor` request. +message GetMonitoredResourceDescriptorRequest { + // The monitored resource descriptor to get. The format is + // `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`. + // The `{resource_type}` is a predefined type, such as + // `cloudsql_database`. + string name = 3; +} + +// The `ListMetricDescriptors` request. +message ListMetricDescriptorsRequest { + // The project on which to execute the request. The format is + // `"projects/{project_id_or_number}"`. + string name = 5; + + // If this field is empty, all custom and + // system-defined metric descriptors are returned. + // Otherwise, the [filter](/monitoring/api/v3/filters) + // specifies which metric descriptors are to be + // returned. For example, the following filter matches all + // [custom metrics](/monitoring/custom-metrics): + // + // metric.type = starts_with("custom.googleapis.com/") + string filter = 2; + + // A positive number that is the maximum number of results to return. + int32 page_size = 3; + + // If this field is not empty then it must contain the `nextPageToken` value + // returned by a previous call to this method. Using this field causes the + // method to return additional results from the previous method call. + string page_token = 4; +} + +// The `ListMetricDescriptors` response. +message ListMetricDescriptorsResponse { + // The metric descriptors that are available to the project + // and that match the value of `filter`, if present. + repeated google.api.MetricDescriptor metric_descriptors = 1; + + // If there are more results than have been returned, then this field is set + // to a non-empty value. To see the additional results, + // use that value as `pageToken` in the next call to this method. + string next_page_token = 2; +} + +// The `GetMetricDescriptor` request. +message GetMetricDescriptorRequest { + // The metric descriptor on which to execute the request. The format is + // `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. + // An example value of `{metric_id}` is + // `"compute.googleapis.com/instance/disk/read_bytes_count"`. + string name = 3; +} + +// The `CreateMetricDescriptor` request. +message CreateMetricDescriptorRequest { + // The project on which to execute the request. The format is + // `"projects/{project_id_or_number}"`. + string name = 3; + + // The new [custom metric](/monitoring/custom-metrics) + // descriptor. + google.api.MetricDescriptor metric_descriptor = 2; +} + +// The `DeleteMetricDescriptor` request. +message DeleteMetricDescriptorRequest { + // The metric descriptor on which to execute the request. The format is + // `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. + // An example of `{metric_id}` is: + // `"custom.googleapis.com/my_test_metric"`. + string name = 3; +} + +// The `ListTimeSeries` request. +message ListTimeSeriesRequest { + // Controls which fields are returned by `ListTimeSeries`. + enum TimeSeriesView { + // Returns the identity of the metric(s), the time series, + // and the time series data. + FULL = 0; + + // Returns the identity of the metric and the time series resource, + // but not the time series data. + HEADERS = 1; + } + + // The project on which to execute the request. The format is + // "projects/{project_id_or_number}". + string name = 10; + + // A [monitoring filter](/monitoring/api/v3/filters) that specifies which time + // series should be returned. The filter must specify a single metric type, + // and can additionally specify metric labels and other information. For + // example: + // + // metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + // metric.label.instance_name = "my-instance-name" + string filter = 2; + + // The time interval for which results should be returned. Only time series + // that contain data points in the specified interval are included + // in the response. + TimeInterval interval = 4; + + // By default, the raw time series data is returned. + // Use this field to combine multiple time series for different + // views of the data. + Aggregation aggregation = 5; + + // Specifies the order in which the points of the time series should + // be returned. By default, results are not ordered. Currently, + // this field must be left blank. + string order_by = 6; + + // Specifies which information is returned about the time series. + TimeSeriesView view = 7; + + // A positive number that is the maximum number of results to return. + // When `view` field sets to `FULL`, it limits the number of `Points` server + // will return; if `view` field is `HEADERS`, it limits the number of + // `TimeSeries` server will return. + int32 page_size = 8; + + // If this field is not empty then it must contain the `nextPageToken` value + // returned by a previous call to this method. Using this field causes the + // method to return additional results from the previous method call. + string page_token = 9; +} + +// The `ListTimeSeries` response. +message ListTimeSeriesResponse { + // One or more time series that match the filter included in the request. + repeated TimeSeries time_series = 1; + + // If there are more results than have been returned, then this field is set + // to a non-empty value. To see the additional results, + // use that value as `pageToken` in the next call to this method. + string next_page_token = 2; +} + +// The `CreateTimeSeries` request. +message CreateTimeSeriesRequest { + // The project on which to execute the request. The format is + // `"projects/{project_id_or_number}"`. + string name = 3; + + // The new data to be added to a list of time series. + // Adds at most one data point to each of several time series. The new data + // point must be more recent than any other point in its time series. Each + // `TimeSeries` value must fully specify a unique time series by supplying + // all label values for the metric and the monitored resource. + repeated TimeSeries time_series = 2; +} + +// Describes the result of a failed request to write data to a time series. +message CreateTimeSeriesError { + // The time series, including the `Metric`, `MonitoredResource`, + // and `Point`s (including timestamp and value) that resulted + // in the error. This field provides all of the context that + // would be needed to retry the operation. + TimeSeries time_series = 1; + + // The status of the requested write operation. + google.rpc.Status status = 2; +} diff --git a/handwritten/cloud-profiler/google/monitoring/v3/monitoring_gapic.yaml b/handwritten/cloud-profiler/google/monitoring/v3/monitoring_gapic.yaml new file mode 100644 index 00000000000..88323aa3420 --- /dev/null +++ b/handwritten/cloud-profiler/google/monitoring/v3/monitoring_gapic.yaml @@ -0,0 +1,371 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.monitoring.v3 + python: + package_name: google.cloud.monitoring_v3.gapic + go: + package_name: cloud.google.com/go/monitoring/apiv3 + csharp: + package_name: Google.Cloud.Monitoring.V3 + release_level: GA + ruby: + package_name: Google::Cloud::Monitoring::V3 + php: + package_name: Google\Cloud\Monitoring\V3 + nodejs: + package_name: monitoring.v3 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +collections: +- name_pattern: projects/{project} + entity_name: project +- name_pattern: projects/{project}/metricDescriptors/{metric_descriptor=**} + entity_name: metric_descriptor +- name_pattern: projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor} + entity_name: monitored_resource_descriptor +- name_pattern: projects/{project}/groups/{group} + entity_name: group +interfaces: +- name: google.monitoring.v3.GroupService + collections: + - name_pattern: projects/{project} + entity_name: project + - name_pattern: projects/{project}/groups/{group} + entity_name: group + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + methods: + - name: ListGroups + # Removing flattening until we figure out how to deal with oneof + required_fields: + - name + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: group + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: project + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: GetGroup + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: group + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: CreateGroup + flattening: + groups: + - parameters: + - name + - group + required_fields: + - name + - group + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + name: project + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: UpdateGroup + flattening: + groups: + - parameters: + - group + required_fields: + - group + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + group.name: group + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: DeleteGroup + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: group + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: ListGroupMembers + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: members + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: group + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 +- name: google.monitoring.v3.MetricService + smoke_test: + method: ListMonitoredResourceDescriptors + init_fields: + - name%project=$PROJECT_ID + collections: + - name_pattern: projects/{project} + entity_name: project + - name_pattern: projects/{project}/metricDescriptors/{metric_descriptor=**} + entity_name: metric_descriptor + - name_pattern: projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor} + entity_name: monitored_resource_descriptor + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + methods: + - name: ListMonitoredResourceDescriptors + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: resource_descriptors + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: project + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: GetMonitoredResourceDescriptor + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: monitored_resource_descriptor + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: ListMetricDescriptors + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: metric_descriptors + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: project + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: GetMetricDescriptor + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: metric_descriptor + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: CreateMetricDescriptor + flattening: + groups: + - parameters: + - name + - metric_descriptor + required_fields: + - name + - metric_descriptor + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + name: project + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: DeleteMetricDescriptor + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: metric_descriptor + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: ListTimeSeries + flattening: + groups: + - parameters: + - name + - filter + - interval + - view + required_fields: + - name + - filter + - interval + - view + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: time_series + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: project + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 + - name: CreateTimeSeries + flattening: + groups: + - parameters: + - name + - time_series + required_fields: + - name + - time_series + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + name: project + resource_name_treatment: STATIC_TYPES + timeout_millis: 60000 +resource_name_generation: +- message_name: Group + field_entity_map: + name: group + parent_name: group +- message_name: ListGroupsRequest + field_entity_map: + name: project + children_of_group: group + ancestors_of_group: group + descendants_of_group: group +- message_name: GetGroupRequest + field_entity_map: + name: group +- message_name: CreateGroupRequest + field_entity_map: + name: project +- message_name: DeleteGroupRequest + field_entity_map: + name: group +- message_name: ListGroupMembersRequest + field_entity_map: + name: group +- message_name: ListMonitoredResourceDescriptorsRequest + field_entity_map: + name: project +- message_name: GetMonitoredResourceDescriptorRequest + field_entity_map: + name: monitored_resource_descriptor +- message_name: ListMetricDescriptorsRequest + field_entity_map: + name: project +- message_name: GetMetricDescriptorRequest + field_entity_map: + name: metric_descriptor +- message_name: CreateMetricDescriptorRequest + field_entity_map: + name: project +- message_name: DeleteMetricDescriptorRequest + field_entity_map: + name: metric_descriptor +- message_name: ListTimeSeriesRequest + field_entity_map: + name: project +- message_name: CreateTimeSeriesRequest + field_entity_map: + name: project diff --git a/handwritten/cloud-profiler/google/privacy/dlp/README.md b/handwritten/cloud-profiler/google/privacy/dlp/README.md new file mode 100644 index 00000000000..629d72b89d5 --- /dev/null +++ b/handwritten/cloud-profiler/google/privacy/dlp/README.md @@ -0,0 +1,7 @@ +# Google Data Loss Prevention (DLP) API + +The Google Data Loss Prevention API provides methods for detection +of privacy-sensitive fragments in text, images, and Google Cloud +Platform storage repositories. + +Documentation: https://cloud.google.com/dlp/docs diff --git a/handwritten/cloud-profiler/google/privacy/dlp/artman_dlp.yaml b/handwritten/cloud-profiler/google/privacy/dlp/artman_dlp.yaml new file mode 100644 index 00000000000..c246c897aea --- /dev/null +++ b/handwritten/cloud-profiler/google/privacy/dlp/artman_dlp.yaml @@ -0,0 +1,110 @@ +common: + api_name: dlp + api_version: v2beta1 + organization_name: google-cloud + service_yaml: dlp.yaml + gapic_yaml: v2beta1/dlp_gapic.yaml + src_proto_paths: + - v2beta1 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-dlp-v2beta1 + - name: grpc + dest: generated/java/grpc-google-cloud-dlp-v2beta1 + - name: proto + dest: generated/java/proto-google-cloud-dlp-v2beta1 + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: . + dest: dlp + - name: grpc + src: google/cloud/proto + dest: dlp/google/cloud/proto + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-dlp-v2beta1 + - name: grpc + dest: generated/python/proto-google-cloud-dlp-v2beta1 +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-dlp-v2beta1 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + package_version: + grpc_dep_lower_bound: 0.20.0 + publish_targets: + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/dlp/v2beta1 + dest: google-cloud-dlp/lib/google/cloud/dlp/v2beta1 + - src: test/google/cloud/privacy/dlp/v2beta1 + dest: google-cloud-dlp/test/google/cloud/dlp/v2beta1 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-dlp +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-cloud-dlp-v2beta1/vendor + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: dlp/apiv2beta1 +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + package_version: + grpc_dep_lower_bound: 0.0.0 + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/dlp + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v2beta1 + dest: packages/dlp/src/v2beta1 + - src: test/test.js + dest: packages/dlp/test/gapic-v2beta1.js +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/privacy/dlp/dlp.yaml b/handwritten/cloud-profiler/google/privacy/dlp/dlp.yaml new file mode 100644 index 00000000000..ef510bc9fee --- /dev/null +++ b/handwritten/cloud-profiler/google/privacy/dlp/dlp.yaml @@ -0,0 +1,72 @@ +type: google.api.Service +config_version: 3 +name: dlp.googleapis.com +title: DLP API + +apis: +- name: google.privacy.dlp.v2beta1.DlpService + +types: +- name: google.privacy.dlp.v2beta1.InspectOperationMetadata +- name: google.privacy.dlp.v2beta1.InspectOperationResult +- name: google.privacy.dlp.v2beta1.InfoTypeStatistics +- name: google.privacy.dlp.v2beta1.RiskAnalysisOperationResult +- name: google.privacy.dlp.v2beta1.RiskAnalysisOperationMetadata + +documentation: + summary: |- + The Google Data Loss Prevention API provides methods for detection of + privacy-sensitive fragments in text, images, and Google Cloud Platform + storage repositories. + rules: + - selector: google.longrunning.Operations.CancelOperation + description: |- + Cancels an operation. Use the + [`inspect.operations.get`][/dlp/docs/reference/rest/v2beta1/inspect.operations/get] + to check whether the cancellation succeeded or the operation completed + despite cancellation. + - selector: google.longrunning.Operations.DeleteOperation + description: This method is not supported and the server returns `UNIMPLEMENTED`. + - selector: google.longrunning.Operations.ListOperations + description: Fetches the list of long running operations. + +http: + rules: + - selector: google.longrunning.Operations.ListOperations + get: '/v1/{name=inspect/operations}' + additional_bindings: + - get: '/v2beta1/{name=inspect/operations}' + + - get: '/v2beta1/{name=riskAnalysis/operations}' + + - selector: google.longrunning.Operations.GetOperation + get: '/v1/{name=inspect/operations/*}' + additional_bindings: + - get: '/v2beta1/{name=inspect/operations/*}' + + - get: '/v2beta1/{name=riskAnalysis/operations/*}' + + - selector: google.longrunning.Operations.DeleteOperation + delete: '/v1/{name=inspect/operations/*}' + additional_bindings: + - delete: '/v2beta1/{name=inspect/operations/*}' + + - delete: '/v2beta1/{name=riskAnalysis/operations/*}' + + - selector: google.longrunning.Operations.CancelOperation + post: '/v1/{name=inspect/operations/*}:cancel' + body: '*' + additional_bindings: + - post: '/v2beta1/{name=inspect/operations/*}:cancel' + body: '*' + + - post: '/v2beta1/{name=riskAnalysis/operations/*}:cancel' + body: '*' + + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/privacy/dlp/v2beta1/dlp.proto b/handwritten/cloud-profiler/google/privacy/dlp/v2beta1/dlp.proto new file mode 100644 index 00000000000..cb1e13c4e64 --- /dev/null +++ b/handwritten/cloud-profiler/google/privacy/dlp/v2beta1/dlp.proto @@ -0,0 +1,1325 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.privacy.dlp.v2beta1; + +import "google/api/annotations.proto"; +import "google/longrunning/operations.proto"; +import "google/privacy/dlp/v2beta1/storage.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/date.proto"; +import "google/type/timeofday.proto"; + +option csharp_namespace = "Google.Cloud.Dlp.V2Beta1"; +option go_package = "google.golang.org/genproto/googleapis/privacy/dlp/v2beta1;dlp"; +option java_multiple_files = true; +option java_outer_classname = "DlpProto"; +option java_package = "com.google.privacy.dlp.v2beta1"; + + +// The DLP API is a service that allows clients +// to detect the presence of Personally Identifiable Information (PII) and other +// privacy-sensitive data in user-supplied, unstructured data streams, like text +// blocks or images. +// The service also includes methods for sensitive data redaction and +// scheduling of data scans on Google Cloud Platform based data sets. +service DlpService { + // Finds potentially sensitive info in a list of strings. + // This method has limits on input size, processing time, and output size. + rpc InspectContent(InspectContentRequest) returns (InspectContentResponse) { + option (google.api.http) = { post: "/v2beta1/content:inspect" body: "*" }; + } + + // Redacts potentially sensitive info from a list of strings. + // This method has limits on input size, processing time, and output size. + rpc RedactContent(RedactContentRequest) returns (RedactContentResponse) { + option (google.api.http) = { post: "/v2beta1/content:redact" body: "*" }; + } + + // De-identifies potentially sensitive info from a list of strings. + // This method has limits on input size and output size. + rpc DeidentifyContent(DeidentifyContentRequest) returns (DeidentifyContentResponse) { + option (google.api.http) = { post: "/v2beta1/content:deidentify" body: "*" }; + } + + // Schedules a job scanning content in a Google Cloud Platform data + // repository. + rpc CreateInspectOperation(CreateInspectOperationRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v2beta1/inspect/operations" body: "*" }; + } + + // Schedules a job to compute risk analysis metrics over content in a Google + // Cloud Platform repository. + rpc AnalyzeDataSourceRisk(AnalyzeDataSourceRiskRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v2beta1/dataSource:analyze" body: "*" }; + } + + // Returns list of results for given inspect operation result set id. + rpc ListInspectFindings(ListInspectFindingsRequest) returns (ListInspectFindingsResponse) { + option (google.api.http) = { get: "/v2beta1/{name=inspect/results/*}/findings" }; + } + + // Returns sensitive information types for given category. + rpc ListInfoTypes(ListInfoTypesRequest) returns (ListInfoTypesResponse) { + option (google.api.http) = { get: "/v2beta1/rootCategories/{category=*}/infoTypes" }; + } + + // Returns the list of root categories of sensitive information. + rpc ListRootCategories(ListRootCategoriesRequest) returns (ListRootCategoriesResponse) { + option (google.api.http) = { get: "/v2beta1/rootCategories" }; + } +} + +// Configuration description of the scanning process. +// When used with redactContent only info_types and min_likelihood are currently +// used. +message InspectConfig { + // Max findings configuration per info type, per content item or long running + // operation. + message InfoTypeLimit { + // Type of information the findings limit applies to. Only one limit per + // info_type should be provided. If InfoTypeLimit does not have an + // info_type, the DLP API applies the limit against all info_types that are + // found but not specified in another InfoTypeLimit. + InfoType info_type = 1; + + // Max findings limit for the given infoType. + int32 max_findings = 2; + } + + // Restricts what info_types to look for. The values must correspond to + // InfoType values returned by ListInfoTypes or found in documentation. + // Empty info_types runs all enabled detectors. + repeated InfoType info_types = 1; + + // Only returns findings equal or above this threshold. + Likelihood min_likelihood = 2; + + // Limits the number of findings per content item or long running operation. + int32 max_findings = 3; + + // When true, a contextual quote from the data that triggered a finding is + // included in the response; see Finding.quote. + bool include_quote = 4; + + // When true, excludes type information of the findings. + bool exclude_types = 6; + + // Configuration of findings limit given for specified info types. + repeated InfoTypeLimit info_type_limits = 7; +} + +// Additional configuration for inspect long running operations. +message OperationConfig { + // Max number of findings per file, Datastore entity, or database row. + int64 max_item_findings = 1; +} + +// Container structure for the content to inspect. +message ContentItem { + // Type of the content, as defined in Content-Type HTTP header. + // Supported types are: all "text" types, octet streams, PNG images, + // JPEG images. + string type = 1; + + // Data of the item either in the byte array or UTF-8 string form. + oneof data_item { + // Content data to inspect or redact. + bytes data = 2; + + // String data to inspect or redact. + string value = 3; + + // Structured content for inspection. + Table table = 4; + } +} + +// Structured content to inspect. Up to 50,000 `Value`s per request allowed. +message Table { + message Row { + repeated Value values = 1; + } + + repeated FieldId headers = 1; + + repeated Row rows = 2; +} + +// All the findings for a single scanned item. +message InspectResult { + // List of findings for an item. + repeated Finding findings = 1; + + // If true, then this item might have more findings than were returned, + // and the findings returned are an arbitrary subset of all findings. + // The findings list might be truncated because the input items were too + // large, or because the server reached the maximum amount of resources + // allowed for a single API call. For best results, divide the input into + // smaller batches. + bool findings_truncated = 2; +} + +// Container structure describing a single finding within a string or image. +message Finding { + // The specific string that may be potentially sensitive info. + string quote = 1; + + // The specific type of info the string might be. + InfoType info_type = 2; + + // Estimate of how likely it is that the info_type is correct. + Likelihood likelihood = 3; + + // Location of the info found. + Location location = 4; + + // Timestamp when finding was detected. + google.protobuf.Timestamp create_time = 6; +} + +// Specifies the location of a finding within its source item. +message Location { + // Zero-based byte offsets within a content item. + Range byte_range = 1; + + // Character offsets within a content item, included when content type + // is a text. Default charset assumed to be UTF-8. + Range codepoint_range = 2; + + // Location within an image's pixels. + repeated ImageLocation image_boxes = 3; + + // Key of the finding. + RecordKey record_key = 4; + + // Field id of the field containing the finding. + FieldId field_id = 5; + + // Location within a `ContentItem.Table`. + TableLocation table_location = 6; +} + +// Location of a finding within a `ContentItem.Table`. +message TableLocation { + // The zero-based index of the row where the finding is located. + int64 row_index = 1; +} + +// Generic half-open interval [start, end) +message Range { + // Index of the first character of the range (inclusive). + int64 start = 1; + + // Index of the last character of the range (exclusive). + int64 end = 2; +} + +// Bounding box encompassing detected text within an image. +message ImageLocation { + // Top coordinate of the bounding box. (0,0) is upper left. + int32 top = 1; + + // Left coordinate of the bounding box. (0,0) is upper left. + int32 left = 2; + + // Width of the bounding box in pixels. + int32 width = 3; + + // Height of the bounding box in pixels. + int32 height = 4; +} + +// Request to search for potentially sensitive info in a list of items +// and replace it with a default or provided content. +message RedactContentRequest { + message ReplaceConfig { + // Type of information to replace. Only one ReplaceConfig per info_type + // should be provided. If ReplaceConfig does not have an info_type, the DLP + // API matches it against all info_types that are found but not specified in + // another ReplaceConfig. + InfoType info_type = 1; + + // Content replacing sensitive information of given type. Max 256 chars. + string replace_with = 2; + } + + // Configuration for determing how redaction of images should occur. + message ImageRedactionConfig { + // Type of information to redact from images. + oneof target { + // Only one per info_type should be provided per request. If not + // specified, and redact_all_text is false, the DLP API will redact all + // text that it matches against all info_types that are found, but not + // specified in another ImageRedactionConfig. + InfoType info_type = 1; + + // If true, all text found in the image, regardless whether it matches an + // info_type, is redacted. + bool redact_all_text = 2; + } + + // The color to use when redacting content from an image. If not specified, + // the default is black. + Color redaction_color = 3; + } + + // Configuration for the inspector. + InspectConfig inspect_config = 1; + + // The list of items to inspect. Up to 100 are allowed per request. + repeated ContentItem items = 2; + + // The strings to replace findings text findings with. Must specify at least + // one of these or one ImageRedactionConfig if redacting images. + repeated ReplaceConfig replace_configs = 3; + + // The configuration for specifying what content to redact from images. + repeated ImageRedactionConfig image_redaction_configs = 4; +} + +// Represents a color in the RGB color space. +message Color { + // The amount of red in the color as a value in the interval [0, 1]. + float red = 1; + + // The amount of green in the color as a value in the interval [0, 1]. + float green = 2; + + // The amount of blue in the color as a value in the interval [0, 1]. + float blue = 3; +} + +// Results of redacting a list of items. +message RedactContentResponse { + // The redacted content. + repeated ContentItem items = 1; +} + +// Request to de-identify a list of items. +message DeidentifyContentRequest { + // Configuration for the de-identification of the list of content items. + DeidentifyConfig deidentify_config = 1; + + // Configuration for the inspector. + InspectConfig inspect_config = 2; + + // The list of items to inspect. Up to 100 are allowed per request. + // All items will be treated as text/*. + repeated ContentItem items = 3; +} + +// Results of de-identifying a list of items. +message DeidentifyContentResponse { + repeated ContentItem items = 1; + + // A review of the transformations that took place for each item. + repeated DeidentificationSummary summaries = 2; +} + +// Request to search for potentially sensitive info in a list of items. +message InspectContentRequest { + // Configuration for the inspector. + InspectConfig inspect_config = 1; + + // The list of items to inspect. Items in a single request are + // considered "related" unless inspect_config.independent_inputs is true. + // Up to 100 are allowed per request. + repeated ContentItem items = 2; +} + +// Results of inspecting a list of items. +message InspectContentResponse { + // Each content_item from the request has a result in this list, in the + // same order as the request. + repeated InspectResult results = 1; +} + +// Request for scheduling a scan of a data subset from a Google Platform data +// repository. +message CreateInspectOperationRequest { + // Configuration for the inspector. + InspectConfig inspect_config = 1; + + // Specification of the data set to process. + StorageConfig storage_config = 2; + + // Optional location to store findings. + OutputStorageConfig output_config = 3; + + // Additional configuration settings for long running operations. + OperationConfig operation_config = 5; +} + +// Cloud repository for storing output. +message OutputStorageConfig { + oneof type { + // Store findings in a new table in the dataset. + BigQueryTable table = 1; + + // The path to a Google Cloud Storage location to store output. + // The bucket must already exist and + // the Google APIs service account for DLP must have write permission to + // write to the given bucket. + // Results are split over multiple csv files with each file name matching + // the pattern "[operation_id]_[count].csv", for example + // `3094877188788974909_1.csv`. The `operation_id` matches the + // identifier for the Operation, and the `count` is a counter used for + // tracking the number of files written. + // + // The CSV file(s) contain the following columns regardless of storage type + // scanned: + // - id + // - info_type + // - likelihood + // - byte size of finding + // - quote + // - timestamp + // + // For Cloud Storage the next columns are: + // + // - file_path + // - start_offset + // + // For Cloud Datastore the next columns are: + // + // - project_id + // - namespace_id + // - path + // - column_name + // - offset + // + // For BigQuery the next columns are: + // + // - row_number + // - project_id + // - dataset_id + // - table_id + CloudStoragePath storage_path = 2; + } +} + +// Statistics regarding a specific InfoType. +message InfoTypeStatistics { + // The type of finding this stat is for. + InfoType info_type = 1; + + // Number of findings for this info type. + int64 count = 2; +} + +// Metadata returned within GetOperation for an inspect request. +message InspectOperationMetadata { + // Total size in bytes that were processed. + int64 processed_bytes = 1; + + // Estimate of the number of bytes to process. + int64 total_estimated_bytes = 4; + + repeated InfoTypeStatistics info_type_stats = 2; + + // The time which this request was started. + google.protobuf.Timestamp create_time = 3; + + // The inspect config used to create the Operation. + InspectConfig request_inspect_config = 5; + + // The storage config used to create the Operation. + StorageConfig request_storage_config = 6; + + // Optional location to store findings. + OutputStorageConfig request_output_config = 7; +} + +// The operational data. +message InspectOperationResult { + // The server-assigned name, which is only unique within the same service that + // originally returns it. If you use the default HTTP mapping, the + // `name` should have the format of `inspect/results/{id}`. + string name = 1; +} + +// Request for the list of results in a given inspect operation. +message ListInspectFindingsRequest { + // Identifier of the results set returned as metadata of + // the longrunning operation created by a call to InspectDataSource. + // Should be in the format of `inspect/results/{id}`. + string name = 1; + + // Maximum number of results to return. + // If 0, the implementation selects a reasonable value. + int32 page_size = 2; + + // The value returned by the last `ListInspectFindingsResponse`; indicates + // that this is a continuation of a prior `ListInspectFindings` call, and that + // the system should return the next page of data. + string page_token = 3; + + // Restricts findings to items that match. Supports info_type and likelihood. + // + // Examples: + // + // - info_type=EMAIL_ADDRESS + // - info_type=PHONE_NUMBER,EMAIL_ADDRESS + // - likelihood=VERY_LIKELY + // - likelihood=VERY_LIKELY,LIKELY + // - info_type=EMAIL_ADDRESS,likelihood=VERY_LIKELY,LIKELY + string filter = 4; +} + +// Response to the ListInspectFindings request. +message ListInspectFindingsResponse { + // The results. + InspectResult result = 1; + + // If not empty, indicates that there may be more results that match the + // request; this value should be passed in a new `ListInspectFindingsRequest`. + string next_page_token = 2; +} + +// Description of the information type (infoType). +message InfoTypeDescription { + // Internal name of the infoType. + string name = 1; + + // Human readable form of the infoType name. + string display_name = 2; + + // List of categories this infoType belongs to. + repeated CategoryDescription categories = 3; +} + +// Request for the list of info types belonging to a given category, +// or all supported info types if no category is specified. +message ListInfoTypesRequest { + // Category name as returned by ListRootCategories. + string category = 1; + + // Optional BCP-47 language code for localized info type friendly + // names. If omitted, or if localized strings are not available, + // en-US strings will be returned. + string language_code = 2; +} + +// Response to the ListInfoTypes request. +message ListInfoTypesResponse { + // Set of sensitive info types belonging to a category. + repeated InfoTypeDescription info_types = 1; +} + +// Info Type Category description. +message CategoryDescription { + // Internal name of the category. + string name = 1; + + // Human readable form of the category name. + string display_name = 2; +} + +// Request for root categories of Info Types supported by the API. +// Example values might include "FINANCE", "HEALTH", "FAST", "DEFAULT". +message ListRootCategoriesRequest { + // Optional language code for localized friendly category names. + // If omitted or if localized strings are not available, + // en-US strings will be returned. + string language_code = 1; +} + +// Response for ListRootCategories request. +message ListRootCategoriesResponse { + // List of all into type categories supported by the API. + repeated CategoryDescription categories = 1; +} + +// Request for creating a risk analysis operation. +message AnalyzeDataSourceRiskRequest { + // Privacy metric to compute. + PrivacyMetric privacy_metric = 1; + + // Input dataset to compute metrics over. + BigQueryTable source_table = 3; +} + +// Privacy metric to compute for reidentification risk analysis. +message PrivacyMetric { + // Compute numerical stats over an individual column, including + // min, max, and quantiles. + message NumericalStatsConfig { + // Field to compute numerical stats on. Supported types are + // integer, float, date, datetime, timestamp, time. + FieldId field = 1; + } + + // Compute numerical stats over an individual column, including + // number of distinct values and value count distribution. + message CategoricalStatsConfig { + // Field to compute categorical stats on. All column types are + // supported except for arrays and structs. However, it may be more + // informative to use NumericalStats when the field type is supported, + // depending on the data. + FieldId field = 1; + } + + // k-anonymity metric, used for analysis of reidentification risk. + message KAnonymityConfig { + // Set of fields to compute k-anonymity over. When multiple fields are + // specified, they are considered a single composite key. Structs and + // repeated data types are not supported; however, nested fields are + // supported so long as they are not structs themselves or nested within + // a repeated field. + repeated FieldId quasi_ids = 1; + + // Optional message indicating that each distinct `EntityId` should not + // contribute to the k-anonymity count more than once per equivalence class. + EntityId entity_id = 2; + } + + // l-diversity metric, used for analysis of reidentification risk. + message LDiversityConfig { + // Set of quasi-identifiers indicating how equivalence classes are + // defined for the l-diversity computation. When multiple fields are + // specified, they are considered a single composite key. + repeated FieldId quasi_ids = 1; + + // Sensitive field for computing the l-value. + FieldId sensitive_attribute = 2; + } + + oneof type { + NumericalStatsConfig numerical_stats_config = 1; + + CategoricalStatsConfig categorical_stats_config = 2; + + KAnonymityConfig k_anonymity_config = 3; + + LDiversityConfig l_diversity_config = 4; + } +} + +// Metadata returned within the +// [`riskAnalysis.operations.get`](/dlp/docs/reference/rest/v2beta1/riskAnalysis.operations/get) +// for risk analysis. +message RiskAnalysisOperationMetadata { + // The time which this request was started. + google.protobuf.Timestamp create_time = 1; + + // Privacy metric to compute. + PrivacyMetric requested_privacy_metric = 2; + + // Input dataset to compute metrics over. + BigQueryTable requested_source_table = 3; +} + +// Result of a risk analysis +// [`Operation`](/dlp/docs/reference/rest/v2beta1/inspect.operations) +// request. +message RiskAnalysisOperationResult { + // Result of the numerical stats computation. + message NumericalStatsResult { + // Minimum value appearing in the column. + Value min_value = 1; + + // Maximum value appearing in the column. + Value max_value = 2; + + // List of 99 values that partition the set of field values into 100 equal + // sized buckets. + repeated Value quantile_values = 4; + } + + // Result of the categorical stats computation. + message CategoricalStatsResult { + // Histogram bucket of value frequencies in the column. + message CategoricalStatsHistogramBucket { + // Lower bound on the value frequency of the values in this bucket. + int64 value_frequency_lower_bound = 1; + + // Upper bound on the value frequency of the values in this bucket. + int64 value_frequency_upper_bound = 2; + + // Total number of records in this bucket. + int64 bucket_size = 3; + + // Sample of value frequencies in this bucket. The total number of + // values returned per bucket is capped at 20. + repeated ValueFrequency bucket_values = 4; + } + + // Histogram of value frequencies in the column. + repeated CategoricalStatsHistogramBucket value_frequency_histogram_buckets = 5; + } + + // Result of the k-anonymity computation. + message KAnonymityResult { + // The set of columns' values that share the same k-anonymity value. + message KAnonymityEquivalenceClass { + // Set of values defining the equivalence class. One value per + // quasi-identifier column in the original KAnonymity metric message. + // The order is always the same as the original request. + repeated Value quasi_ids_values = 1; + + // Size of the equivalence class, for example number of rows with the + // above set of values. + int64 equivalence_class_size = 2; + } + + // Histogram bucket of equivalence class sizes in the table. + message KAnonymityHistogramBucket { + // Lower bound on the size of the equivalence classes in this bucket. + int64 equivalence_class_size_lower_bound = 1; + + // Upper bound on the size of the equivalence classes in this bucket. + int64 equivalence_class_size_upper_bound = 2; + + // Total number of records in this bucket. + int64 bucket_size = 3; + + // Sample of equivalence classes in this bucket. The total number of + // classes returned per bucket is capped at 20. + repeated KAnonymityEquivalenceClass bucket_values = 4; + } + + // Histogram of k-anonymity equivalence classes. + repeated KAnonymityHistogramBucket equivalence_class_histogram_buckets = 5; + } + + // Result of the l-diversity computation. + message LDiversityResult { + // The set of columns' values that share the same l-diversity value. + message LDiversityEquivalenceClass { + // Quasi-identifier values defining the k-anonymity equivalence + // class. The order is always the same as the original request. + repeated Value quasi_ids_values = 1; + + // Size of the k-anonymity equivalence class. + int64 equivalence_class_size = 2; + + // Number of distinct sensitive values in this equivalence class. + int64 num_distinct_sensitive_values = 3; + + // Estimated frequencies of top sensitive values. + repeated ValueFrequency top_sensitive_values = 4; + } + + // Histogram bucket of sensitive value frequencies in the table. + message LDiversityHistogramBucket { + // Lower bound on the sensitive value frequencies of the equivalence + // classes in this bucket. + int64 sensitive_value_frequency_lower_bound = 1; + + // Upper bound on the sensitive value frequencies of the equivalence + // classes in this bucket. + int64 sensitive_value_frequency_upper_bound = 2; + + // Total number of records in this bucket. + int64 bucket_size = 3; + + // Sample of equivalence classes in this bucket. The total number of + // classes returned per bucket is capped at 20. + repeated LDiversityEquivalenceClass bucket_values = 4; + } + + // Histogram of l-diversity equivalence class sensitive value frequencies. + repeated LDiversityHistogramBucket sensitive_value_frequency_histogram_buckets = 5; + } + + // Values associated with this metric. + oneof result { + NumericalStatsResult numerical_stats_result = 3; + + CategoricalStatsResult categorical_stats_result = 4; + + KAnonymityResult k_anonymity_result = 5; + + LDiversityResult l_diversity_result = 6; + } +} + +// A value of a field, including its frequency. +message ValueFrequency { + // A value contained in the field in question. + Value value = 1; + + // How many times the value is contained in the field. + int64 count = 2; +} + +// Set of primitive values supported by the system. +message Value { + oneof type { + int64 integer_value = 1; + + double float_value = 2; + + string string_value = 3; + + bool boolean_value = 4; + + google.protobuf.Timestamp timestamp_value = 5; + + google.type.TimeOfDay time_value = 6; + + google.type.Date date_value = 7; + } +} + +// The configuration that controls how the data will change. +message DeidentifyConfig { + oneof transformation { + // Treat the dataset as free-form text and apply the same free text + // transformation everywhere. + InfoTypeTransformations info_type_transformations = 1; + + // Treat the dataset as structured. Transformations can be applied to + // specific locations within structured datasets, such as transforming + // a column within a table. + RecordTransformations record_transformations = 2; + } +} + +// A rule for transforming a value. +message PrimitiveTransformation { + oneof transformation { + ReplaceValueConfig replace_config = 1; + + RedactConfig redact_config = 2; + + CharacterMaskConfig character_mask_config = 3; + + CryptoReplaceFfxFpeConfig crypto_replace_ffx_fpe_config = 4; + + FixedSizeBucketingConfig fixed_size_bucketing_config = 5; + + BucketingConfig bucketing_config = 6; + + ReplaceWithInfoTypeConfig replace_with_info_type_config = 7; + + TimePartConfig time_part_config = 8; + + CryptoHashConfig crypto_hash_config = 9; + } +} + +// For use with `Date`, `Timestamp`, and `TimeOfDay`, extract or preserve a +// portion of the value. +message TimePartConfig { + enum TimePart { + TIME_PART_UNSPECIFIED = 0; + + // [000-9999] + YEAR = 1; + + // [1-12] + MONTH = 2; + + // [1-31] + DAY_OF_MONTH = 3; + + // [1-7] + DAY_OF_WEEK = 4; + + // [1-52] + WEEK_OF_YEAR = 5; + + // [0-24] + HOUR_OF_DAY = 6; + } + + TimePart part_to_extract = 1; +} + +// Pseudonymization method that generates surrogates via cryptographic hashing. +// Uses SHA-256. +// Outputs a 32 byte digest as an uppercase hex string +// (for example, 41D1567F7F99F1DC2A5FAB886DEE5BEE). +// Currently, only string and integer values can be hashed. +message CryptoHashConfig { + // The key used by the hash function. + CryptoKey crypto_key = 1; +} + +// Replace each input value with a given `Value`. +message ReplaceValueConfig { + // Value to replace it with. + Value new_value = 1; +} + +// Replace each matching finding with the name of the info_type. +message ReplaceWithInfoTypeConfig { + +} + +// Redact a given value. For example, if used with an `InfoTypeTransformation` +// transforming PHONE_NUMBER, and input 'My phone number is 206-555-0123', the +// output would be 'My phone number is '. +message RedactConfig { + +} + +// Characters to skip when doing deidentification of a value. These will be left +// alone and skipped. +message CharsToIgnore { + enum CharacterGroup { + CHARACTER_GROUP_UNSPECIFIED = 0; + + // 0-9 + NUMERIC = 1; + + // A-Z + ALPHA_UPPER_CASE = 2; + + // a-z + ALPHA_LOWER_CASE = 3; + + // US Punctuation, one of !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ + PUNCTUATION = 4; + + // Whitespace character, one of [ \t\n\x0B\f\r] + WHITESPACE = 5; + } + + oneof characters { + string characters_to_skip = 1; + + CharacterGroup common_characters_to_ignore = 2; + } +} + +// Partially mask a string by replacing a given number of characters with a +// fixed character. Masking can start from the beginning or end of the string. +// This can be used on data of any type (numbers, longs, and so on) and when +// de-identifying structured data we'll attempt to preserve the original data's +// type. (This allows you to take a long like 123 and modify it to a string like +// **3. +message CharacterMaskConfig { + // Character to mask the sensitive values—for example, "*" for an + // alphabetic string such as name, or "0" for a numeric string such as ZIP + // code or credit card number. String must have length 1. If not supplied, we + // will default to "*" for strings, 0 for digits. + string masking_character = 1; + + // Number of characters to mask. If not set, all matching chars will be + // masked. Skipped characters do not count towards this tally. + int32 number_to_mask = 2; + + // Mask characters in reverse order. For example, if `masking_character` is + // '0', number_to_mask is 14, and `reverse_order` is false, then + // 1234-5678-9012-3456 -> 00000000000000-3456 + // If `masking_character` is '*', `number_to_mask` is 3, and `reverse_order` + // is true, then 12345 -> 12*** + bool reverse_order = 3; + + // When masking a string, items in this list will be skipped when replacing. + // For example, if your string is 555-555-5555 and you ask us to skip `-` and + // mask 5 chars with * we would produce ***-*55-5555. + repeated CharsToIgnore characters_to_ignore = 4; +} + +// Buckets values based on fixed size ranges. The +// Bucketing transformation can provide all of this functionality, +// but requires more configuration. This message is provided as a convenience to +// the user for simple bucketing strategies. +// The resulting value will be a hyphenated string of +// lower_bound-upper_bound. +// This can be used on data of type: double, long. +// If the bound Value type differs from the type of data +// being transformed, we will first attempt converting the type of the data to +// be transformed to match the type of the bound before comparing. +message FixedSizeBucketingConfig { + // Lower bound value of buckets. All values less than `lower_bound` are + // grouped together into a single bucket; for example if `lower_bound` = 10, + // then all values less than 10 are replaced with the value “-10”. [Required]. + Value lower_bound = 1; + + // Upper bound value of buckets. All values greater than upper_bound are + // grouped together into a single bucket; for example if `upper_bound` = 89, + // then all values greater than 89 are replaced with the value “89+”. + // [Required]. + Value upper_bound = 2; + + // Size of each bucket (except for minimum and maximum buckets). So if + // `lower_bound` = 10, `upper_bound` = 89, and `bucket_size` = 10, then the + // following buckets would be used: -10, 10-20, 20-30, 30-40, 40-50, 50-60, + // 60-70, 70-80, 80-89, 89+. Precision up to 2 decimals works. [Required]. + double bucket_size = 3; +} + +// Generalization function that buckets values based on ranges. The ranges and +// replacement values are dynamically provided by the user for custom behavior, +// such as 1-30 -> LOW 31-65 -> MEDIUM 66-100 -> HIGH +// This can be used on +// data of type: number, long, string, timestamp. +// If the bound `Value` type differs from the type of data being transformed, we +// will first attempt converting the type of the data to be transformed to match +// the type of the bound before comparing. +message BucketingConfig { + // Buckets represented as ranges, along with replacement values. Ranges must + // be non-overlapping. + message Bucket { + // Lower bound of the range, inclusive. Type should be the same as max if + // used. + Value min = 1; + + // Upper bound of the range, exclusive; type must match min. + Value max = 2; + + // Replacement value for this bucket. If not provided + // the default behavior will be to hyphenate the min-max range. + Value replacement_value = 3; + } + + repeated Bucket buckets = 1; +} + +// Replaces an identifier with an surrogate using FPE with the FFX +// mode of operation. +// The identifier must be representable by the US-ASCII character set. +// For a given crypto key and context, the same identifier will be +// replaced with the same surrogate. +// Note that a given identifier must be either the empty string or be at +// least two characters long. +message CryptoReplaceFfxFpeConfig { + // These are commonly used subsets of the alphabet that the FFX mode + // natively supports. In the algorithm, the alphabet is selected using + // the "radix". Therefore each corresponds to particular radix. + enum FfxCommonNativeAlphabet { + FFX_COMMON_NATIVE_ALPHABET_UNSPECIFIED = 0; + + // [0-9] (radix of 10) + NUMERIC = 1; + + // [0-9A-F] (radix of 16) + HEXADECIMAL = 2; + + // [0-9A-Z] (radix of 36) + UPPER_CASE_ALPHA_NUMERIC = 3; + + // [0-9A-Za-z] (radix of 62) + ALPHA_NUMERIC = 4; + } + + // The key used by the encryption algorithm. [required] + CryptoKey crypto_key = 1; + + // A context may be used for higher security since the same + // identifier in two different contexts likely will be given a distinct + // surrogate. The principle is that the likeliness is inversely related + // to the ratio of the number of distinct identifiers per context over the + // number of possible surrogates: As long as this ratio is small, the + // likehood is large. + // + // If the context is not set, a default tweak will be used. + // If the context is set but: + // + // 1. there is no record present when transforming a given value or + // 1. the field is not present when transforming a given value, + // + // a default tweak will be used. + // + // Note that case (1) is expected when an `InfoTypeTransformation` is + // applied to both structured and non-structured `ContentItem`s. + // Currently, the referenced field may be of value type integer or string. + // + // The tweak is constructed as a sequence of bytes in big endian byte order + // such that: + // + // - a 64 bit integer is encoded followed by a single byte of value 1 + // - a string is encoded in UTF-8 format followed by a single byte of value 2 + // + // This is also known as the 'tweak', as in tweakable encryption. + FieldId context = 2; + + oneof alphabet { + FfxCommonNativeAlphabet common_alphabet = 4; + + // This is supported by mapping these to the alphanumeric characters + // that the FFX mode natively supports. This happens before/after + // encryption/decryption. + // Each character listed must appear only once. + // Number of characters must be in the range [2, 62]. + // This must be encoded as ASCII. + // The order of characters does not matter. + string custom_alphabet = 5; + + // The native way to select the alphabet. Must be in the range [2, 62]. + int32 radix = 6; + } +} + +// This is a data encryption key (DEK) (as opposed to +// a key encryption key (KEK) stored by KMS). +// When using KMS to wrap/unwrap DEKs, be sure to set an appropriate +// IAM policy on the KMS CryptoKey (KEK) to ensure an attacker cannot +// unwrap the data crypto key. +message CryptoKey { + oneof source { + TransientCryptoKey transient = 1; + + UnwrappedCryptoKey unwrapped = 2; + + KmsWrappedCryptoKey kms_wrapped = 3; + } +} + +// Use this to have a random data crypto key generated. +// It will be discarded after the operation/request finishes. +message TransientCryptoKey { + // Name of the key. [required] + // This is an arbitrary string used to differentiate different keys. + // A unique key is generated per name: two separate `TransientCryptoKey` + // protos share the same generated key if their names are the same. + // When the data crypto key is generated, this name is not used in any way + // (repeating the api call will result in a different key being generated). + string name = 1; +} + +// Using raw keys is prone to security risks due to accidentally +// leaking the key. Choose another type of key if possible. +message UnwrappedCryptoKey { + // The AES 128/192/256 bit key. [required] + bytes key = 1; +} + +// Include to use an existing data crypto key wrapped by KMS. +// Authorization requires the following IAM permissions when sending a request +// to perform a crypto transformation using a kms-wrapped crypto key: +// dlp.kms.encrypt +message KmsWrappedCryptoKey { + // The wrapped data crypto key. [required] + bytes wrapped_key = 1; + + // The resource name of the KMS CryptoKey to use for unwrapping. [required] + string crypto_key_name = 2; +} + +// A type of transformation that will scan unstructured text and +// apply various `PrimitiveTransformation`s to each finding, where the +// transformation is applied to only values that were identified as a specific +// info_type. +message InfoTypeTransformations { + // A transformation to apply to text that is identified as a specific + // info_type. + message InfoTypeTransformation { + // Info types to apply the transformation to. Empty list will match all + // available info types for this transformation. + repeated InfoType info_types = 1; + + // Primitive transformation to apply to the info type. [required] + PrimitiveTransformation primitive_transformation = 2; + } + + // Transformation for each info type. Cannot specify more than one + // for a given info type. [required] + repeated InfoTypeTransformation transformations = 1; +} + +// The transformation to apply to the field. +message FieldTransformation { + // Input field(s) to apply the transformation to. [required] + repeated FieldId fields = 1; + + // Only apply the transformation if the condition evaluates to true for the + // given `RecordCondition`. The conditions are allowed to reference fields + // that are not used in the actual transformation. [optional] + // + // Example Use Cases: + // + // - Apply a different bucket transformation to an age column if the zip code + // column for the same record is within a specific range. + // - Redact a field if the date of birth field is greater than 85. + RecordCondition condition = 3; + + // Transformation to apply. [required] + oneof transformation { + // Apply the transformation to the entire field. + PrimitiveTransformation primitive_transformation = 4; + + // Treat the contents of the field as free text, and selectively + // transform content that matches an `InfoType`. + InfoTypeTransformations info_type_transformations = 5; + } +} + +// A type of transformation that is applied over structured data such as a +// table. +message RecordTransformations { + // Transform the record by applying various field transformations. + repeated FieldTransformation field_transformations = 1; + + // Configuration defining which records get suppressed entirely. Records that + // match any suppression rule are omitted from the output [optional]. + repeated RecordSuppression record_suppressions = 2; +} + +// Configuration to suppress records whose suppression conditions evaluate to +// true. +message RecordSuppression { + RecordCondition condition = 1; +} + +// A condition for determing whether a transformation should be applied to +// a field. +message RecordCondition { + // The field type of `value` and `field` do not need to match to be + // considered equal, but not all comparisons are possible. + // + // A `value` of type: + // + // - `string` can be compared against all other types + // - `boolean` can only be compared against other booleans + // - `integer` can be compared against doubles or a string if the string value + // can be parsed as an integer. + // - `double` can be compared against integers or a string if the string can + // be parsed as a double. + // - `Timestamp` can be compared against strings in RFC 3339 date string + // format. + // - `TimeOfDay` can be compared against timestamps and strings in the format + // of 'HH:mm:ss'. + // + // If we fail to compare do to type mismatch, a warning will be given and + // the condition will evaluate to false. + message Condition { + // Field within the record this condition is evaluated against. [required] + FieldId field = 1; + + // Operator used to compare the field or info type to the value. [required] + RelationalOperator operator = 3; + + // Value to compare against. [Required, except for `EXISTS` tests.] + Value value = 4; + } + + message Conditions { + repeated Condition conditions = 1; + } + + // A collection of expressions + message Expressions { + enum LogicalOperator { + LOGICAL_OPERATOR_UNSPECIFIED = 0; + + AND = 1; + } + + // The operator to apply to the result of conditions. Default and currently + // only supported value is `AND`. + LogicalOperator logical_operator = 1; + + oneof type { + Conditions conditions = 3; + } + } + + Expressions expressions = 3; +} + +// High level summary of deidentification. +message DeidentificationSummary { + // Total size in bytes that were transformed in some way. + int64 transformed_bytes = 2; + + // Transformations applied to the dataset. + repeated TransformationSummary transformation_summaries = 3; +} + +// Summary of a single tranformation. +message TransformationSummary { + // A collection that informs the user the number of times a particular + // `TransformationResultCode` and error details occurred. + message SummaryResult { + int64 count = 1; + + TransformationResultCode code = 2; + + // A place for warnings or errors to show up if a transformation didn't + // work as expected. + string details = 3; + } + + // Possible outcomes of transformations. + enum TransformationResultCode { + TRANSFORMATION_RESULT_CODE_UNSPECIFIED = 0; + + SUCCESS = 1; + + ERROR = 2; + } + + // Set if the transformation was limited to a specific info_type. + InfoType info_type = 1; + + // Set if the transformation was limited to a specific FieldId. + FieldId field = 2; + + // The specific transformation these stats apply to. + PrimitiveTransformation transformation = 3; + + // The field transformation that was applied. This list will contain + // multiple only in the case of errors. + repeated FieldTransformation field_transformations = 5; + + // The specific suppression option these stats apply to. + RecordSuppression record_suppress = 6; + + repeated SummaryResult results = 4; +} + +// Categorization of results based on how likely they are to represent a match, +// based on the number of elements they contain which imply a match. +enum Likelihood { + // Default value; information with all likelihoods is included. + LIKELIHOOD_UNSPECIFIED = 0; + + // Few matching elements. + VERY_UNLIKELY = 1; + + UNLIKELY = 2; + + // Some matching elements. + POSSIBLE = 3; + + LIKELY = 4; + + // Many matching elements. + VERY_LIKELY = 5; +} + +// Operators available for comparing the value of fields. +enum RelationalOperator { + RELATIONAL_OPERATOR_UNSPECIFIED = 0; + + // Equal. + EQUAL_TO = 1; + + // Not equal to. + NOT_EQUAL_TO = 2; + + // Greater than. + GREATER_THAN = 3; + + // Less than. + LESS_THAN = 4; + + // Greater than or equals. + GREATER_THAN_OR_EQUALS = 5; + + // Less than or equals. + LESS_THAN_OR_EQUALS = 6; + + // Exists + EXISTS = 7; +} diff --git a/handwritten/cloud-profiler/google/privacy/dlp/v2beta1/dlp_gapic.yaml b/handwritten/cloud-profiler/google/privacy/dlp/v2beta1/dlp_gapic.yaml new file mode 100644 index 00000000000..92acb1ab457 --- /dev/null +++ b/handwritten/cloud-profiler/google/privacy/dlp/v2beta1/dlp_gapic.yaml @@ -0,0 +1,197 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.dlp.v2beta1 + python: + package_name: google.cloud.dlp_v2beta1.gapic + go: + package_name: cloud.google.com/go/dlp/apiv2beta1 + csharp: + package_name: Google.Cloud.Dlp.V2Beta1 + ruby: + package_name: Google::Cloud::Dlp::V2beta1 + php: + package_name: Google\Cloud\Dlp\V2beta1 + nodejs: + package_name: dlp.v2beta1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.privacy.dlp.v2beta1.DlpService + smoke_test: + method: InspectContent + init_fields: + - inspect_config.min_likelihood=POSSIBLE + - items[0].type="text/plain" + - items[0].value="my phone number is 215-512-1212" + collections: + - name_pattern: inspect/results/{result} + entity_name: result + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + methods: + - name: DeidentifyContent + flattening: + groups: + - parameters: + - deidentify_config + - inspect_config + - items + required_fields: + - deidentify_config + - inspect_config + - items + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: AnalyzeDataSourceRisk + flattening: + groups: + - parameters: + - privacy_metric + - source_table + required_fields: + - privacy_metric + - source_table + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + long_running: + return_type: google.privacy.dlp.v2beta1.RiskAnalysisOperationResult + metadata_type: google.privacy.dlp.v2beta1.RiskAnalysisOperationMetadata + initial_poll_delay_millis: 20000 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 45000 + total_poll_timeout_millis: 86400000 + - name: InspectContent + flattening: + groups: + - parameters: + - inspect_config + - items + required_fields: + - inspect_config + - items + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + sample_code_init_fields: + - inspect_config.info_types[0].name="EMAIL_ADDRESS" + - items[0].type="text/plain" + - items[0].value="My email is example@example.com." + - name: RedactContent + flattening: + groups: + - parameters: + - inspect_config + - items + - replace_configs + required_fields: + - inspect_config + - items + - replace_configs + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + sample_code_init_fields: + - inspect_config.info_types[0].name="EMAIL_ADDRESS" + - items[0].type="text/plain" + - items[0].value="My email is example@example.com." + - replace_configs[0].info_type.name="EMAIL_ADDRESS" + - replace_configs[0].replace_with="REDACTED" + - name: CreateInspectOperation + flattening: + groups: + - parameters: + - inspect_config + - storage_config + - output_config + long_running: + return_type: google.privacy.dlp.v2beta1.InspectOperationResult + metadata_type: google.privacy.dlp.v2beta1.InspectOperationMetadata + initial_poll_delay_millis: 20000 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 45000 + total_poll_timeout_millis: 86400000 + required_fields: + - inspect_config + - storage_config + - output_config + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + sample_code_init_fields: + - inspect_config.info_types[0].name="EMAIL_ADDRESS" + - storage_config.cloud_storage_options.file_set.url="gs://example_bucket/example_file.png" + - name: ListInspectFindings + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: result + timeout_millis: 60000 + - name: ListInfoTypes + flattening: + groups: + - parameters: + - category + - language_code + required_fields: + - category + - language_code + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + sample_code_init_fields: + - category="PII" + - language_code="en" + - name: ListRootCategories + flattening: + groups: + - parameters: + - language_code + required_fields: + - language_code + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + sample_code_init_fields: + - language_code="en" +resource_name_generation: +- message_name: InspectOperationResult + field_entity_map: + name: result +- message_name: ListInspectFindingsRequest + field_entity_map: + name: result diff --git a/handwritten/cloud-profiler/google/privacy/dlp/v2beta1/storage.proto b/handwritten/cloud-profiler/google/privacy/dlp/v2beta1/storage.proto new file mode 100644 index 00000000000..b766fc95c5b --- /dev/null +++ b/handwritten/cloud-profiler/google/privacy/dlp/v2beta1/storage.proto @@ -0,0 +1,228 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.privacy.dlp.v2beta1; + +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Dlp.V2Beta1"; +option go_package = "google.golang.org/genproto/googleapis/privacy/dlp/v2beta1;dlp"; +option java_multiple_files = true; +option java_outer_classname = "DlpStorage"; +option java_package = "com.google.privacy.dlp.v2beta1"; + + +// Type of information detected by the API. +message InfoType { + // Name of the information type. + string name = 1; +} + +// General identifier of a data field in a storage service. +message FieldId { + // Name describing the field. + string column_name = 1; +} + +// Datastore partition ID. +// A partition ID identifies a grouping of entities. The grouping is always +// by project and namespace, however the namespace ID may be empty. +// +// A partition ID contains several dimensions: +// project ID and namespace ID. +message PartitionId { + // The ID of the project to which the entities belong. + string project_id = 2; + + // If not empty, the ID of the namespace to which the entities belong. + string namespace_id = 4; +} + +// A representation of a Datastore kind. +message KindExpression { + // The name of the kind. + string name = 1; +} + +// A reference to a property relative to the Datastore kind expressions. +message PropertyReference { + // The name of the property. + // If name includes "."s, it may be interpreted as a property name path. + string name = 2; +} + +// A representation of a Datastore property in a projection. +message Projection { + // The property to project. + PropertyReference property = 1; +} + +// Options defining a data set within Google Cloud Datastore. +message DatastoreOptions { + // A partition ID identifies a grouping of entities. The grouping is always + // by project and namespace, however the namespace ID may be empty. + PartitionId partition_id = 1; + + // The kind to process. + KindExpression kind = 2; + + // Properties to scan. If none are specified, all properties will be scanned + // by default. + repeated Projection projection = 3; +} + +// Options defining a file or a set of files (path ending with *) within +// a Google Cloud Storage bucket. +message CloudStorageOptions { + // Set of files to scan. + message FileSet { + // The url, in the format `gs:///`. Trailing wildcard in the + // path is allowed. + string url = 1; + } + + FileSet file_set = 1; +} + +// A location in Cloud Storage. +message CloudStoragePath { + // The url, in the format of `gs://bucket/`. + string path = 1; +} + +// Options defining BigQuery table and row identifiers. +message BigQueryOptions { + // Complete BigQuery table reference. + BigQueryTable table_reference = 1; + + // References to fields uniquely identifying rows within the table. + // Nested fields in the format, like `person.birthdate.year`, are allowed. + repeated FieldId identifying_fields = 2; +} + +// Shared message indicating Cloud storage type. +message StorageConfig { + oneof type { + // Google Cloud Datastore options specification. + DatastoreOptions datastore_options = 2; + + // Google Cloud Storage options specification. + CloudStorageOptions cloud_storage_options = 3; + + // BigQuery options specification. + BigQueryOptions big_query_options = 4; + } +} + +// Record key for a finding in a Cloud Storage file. +message CloudStorageKey { + // Path to the file. + string file_path = 1; + + // Byte offset of the referenced data in the file. + int64 start_offset = 2; +} + +// Record key for a finding in Cloud Datastore. +message DatastoreKey { + // Datastore entity key. + Key entity_key = 1; +} + +// A unique identifier for a Datastore entity. +// If a key's partition ID or any of its path kinds or names are +// reserved/read-only, the key is reserved/read-only. +// A reserved/read-only key is forbidden in certain documented contexts. +message Key { + // A (kind, ID/name) pair used to construct a key path. + // + // If either name or ID is set, the element is complete. + // If neither is set, the element is incomplete. + message PathElement { + // The kind of the entity. + // A kind matching regex `__.*__` is reserved/read-only. + // A kind must not contain more than 1500 bytes when UTF-8 encoded. + // Cannot be `""`. + string kind = 1; + + // The type of ID. + oneof id_type { + // The auto-allocated ID of the entity. + // Never equal to zero. Values less than zero are discouraged and may not + // be supported in the future. + int64 id = 2; + + // The name of the entity. + // A name matching regex `__.*__` is reserved/read-only. + // A name must not be more than 1500 bytes when UTF-8 encoded. + // Cannot be `""`. + string name = 3; + } + } + + // Entities are partitioned into subsets, currently identified by a project + // ID and namespace ID. + // Queries are scoped to a single partition. + PartitionId partition_id = 1; + + // The entity path. + // An entity path consists of one or more elements composed of a kind and a + // string or numerical identifier, which identify entities. The first + // element identifies a _root entity_, the second element identifies + // a _child_ of the root entity, the third element identifies a child of the + // second entity, and so forth. The entities identified by all prefixes of + // the path are called the element's _ancestors_. + // + // A path can never be empty, and a path can have at most 100 elements. + repeated PathElement path = 2; +} + +// Message for a unique key indicating a record that contains a finding. +message RecordKey { + oneof type { + CloudStorageKey cloud_storage_key = 1; + + DatastoreKey datastore_key = 2; + } +} + +// Message defining the location of a BigQuery table. A table is uniquely +// identified by its project_id, dataset_id, and table_name. Within a query +// a table is often referenced with a string in the format of: +// `:.` or +// `..`. +message BigQueryTable { + // The Google Cloud Platform project ID of the project containing the table. + // If omitted, project ID is inferred from the API call. + string project_id = 1; + + // Dataset ID of the table. + string dataset_id = 2; + + // Name of the table. + string table_id = 3; +} + +// An entity in a dataset is a field or set of fields that correspond to a +// single person. For example, in medical records the `EntityId` might be +// a patient identifier, or for financial records it might be an account +// identifier. This message is used when generalizations or analysis must be +// consistent across multiple rows pertaining to the same entity. +message EntityId { + // Composite key indicating which field contains the entity identifier. + FieldId field = 1; +} diff --git a/handwritten/cloud-profiler/google/pubsub/artman_pubsub.yaml b/handwritten/cloud-profiler/google/pubsub/artman_pubsub.yaml new file mode 100644 index 00000000000..bbbffb65ef1 --- /dev/null +++ b/handwritten/cloud-profiler/google/pubsub/artman_pubsub.yaml @@ -0,0 +1,112 @@ +common: + api_name: pubsub + api_version: v1 + organization_name: google-cloud + service_yaml: pubsub.yaml + gapic_yaml: v1/pubsub_gapic.yaml + src_proto_paths: + - v1 + proto_deps: + - name: google-common-protos + - name: google-iam-v1 + test_proto_deps: + - name: google-iam-v1 +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-pubsub-v1 + - name: grpc + dest: generated/java/grpc-google-cloud-pubsub-v1 + - name: proto + dest: generated/java/proto-google-cloud-pubsub-v1 + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-pubsub +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-pubsub-v1 + - name: grpc + dest: generated/python/proto-google-cloud-pubsub-v1 + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: google/cloud/pubsub_v1 + dest: pubsub/google/cloud/pubsub_v1 + - src: tests/unit/gapic/v1 + dest: pubsub/tests/gapic + - name: grpc + src: google/cloud/proto + dest: pubsub/google/cloud/proto +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-pubsub-v1 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/pubsub/v1 + dest: google-cloud-pubsub/lib/google/cloud/pubsub/v1 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-pubsub +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-pubsub-v1/vendor + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: pubsub/apiv1 +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/pubsub + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v1 + dest: packages/pubsub/src/v1 +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/pubsub/pubsub.yaml b/handwritten/cloud-profiler/google/pubsub/pubsub.yaml new file mode 100644 index 00000000000..dbe5a49821c --- /dev/null +++ b/handwritten/cloud-profiler/google/pubsub/pubsub.yaml @@ -0,0 +1,42 @@ +# Google Cloud Pub/Sub API service configuration + +type: google.api.Service +config_version: 3 +name: pubsub.googleapis.com + +title: Google Cloud Pub/Sub API + +documentation: + summary: > + Provides reliable, many-to-many, asynchronous messaging between + applications. + rules: + - selector: > + google.pubsub.v1.Topic.name, + description: | + The name of the topic. It must have the format + `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, + and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), + underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent + signs (`%`). It must be between 3 and 255 characters in length, and it + must not start with `"goog"`. + - selector: > + google.pubsub.v1.Subscription.name, + description: | + The name of the subscription. It must have the format + `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must + start with a letter, and contain only letters (`[A-Za-z]`), numbers + (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), + plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters + in length, and it must not start with `"goog"`. + +apis: +- name: google.pubsub.v1.Publisher +- name: google.pubsub.v1.Subscriber + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: https://www.googleapis.com/auth/pubsub, + https://www.googleapis.com/auth/cloud-platform diff --git a/handwritten/cloud-profiler/google/pubsub/v1/pubsub.proto b/handwritten/cloud-profiler/google/pubsub/v1/pubsub.proto new file mode 100644 index 00000000000..b2d4edc65f9 --- /dev/null +++ b/handwritten/cloud-profiler/google/pubsub/v1/pubsub.proto @@ -0,0 +1,790 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.pubsub.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.PubSub.V1"; +option go_package = "google.golang.org/genproto/googleapis/pubsub/v1;pubsub"; +option java_multiple_files = true; +option java_outer_classname = "PubsubProto"; +option java_package = "com.google.pubsub.v1"; + + +// The service that an application uses to manipulate subscriptions and to +// consume messages from a subscription via the `Pull` method. +service Subscriber { + // Creates a subscription to a given topic. + // If the subscription already exists, returns `ALREADY_EXISTS`. + // If the corresponding topic doesn't exist, returns `NOT_FOUND`. + // + // If the name is not provided in the request, the server will assign a random + // name for this subscription on the same project as the topic, conforming + // to the + // [resource name format](https://cloud.google.com/pubsub/docs/overview#names). + // The generated name is populated in the returned Subscription object. + // Note that for REST API requests, you must specify a name in the request. + rpc CreateSubscription(Subscription) returns (Subscription) { + option (google.api.http) = { + put: "/v1/{name=projects/*/subscriptions/*}" + body: "*" }; + } + + // Gets the configuration details of a subscription. + rpc GetSubscription(GetSubscriptionRequest) returns (Subscription) { + option (google.api.http) = { + get: "/v1/{subscription=projects/*/subscriptions/*}" + }; + } + + // Updates an existing subscription. Note that certain properties of a + // subscription, such as its topic, are not modifiable. + // NOTE: The style guide requires body: "subscription" instead of body: "*". + // Keeping the latter for internal consistency in V1, however it should be + // corrected in V2. See + // https://cloud.google.com/apis/design/standard_methods#update for details. + rpc UpdateSubscription(UpdateSubscriptionRequest) returns (Subscription) { + option (google.api.http) = { + patch: "/v1/{subscription.name=projects/*/subscriptions/*}" + body: "*" + }; + } + + // Lists matching subscriptions. + rpc ListSubscriptions(ListSubscriptionsRequest) returns (ListSubscriptionsResponse) { + option (google.api.http) = { + get: "/v1/{project=projects/*}/subscriptions" + }; + } + + // Deletes an existing subscription. All messages retained in the subscription + // are immediately dropped. Calls to `Pull` after deletion will return + // `NOT_FOUND`. After a subscription is deleted, a new one may be created with + // the same name, but the new one has no association with the old + // subscription or its topic unless the same topic is specified. + rpc DeleteSubscription(DeleteSubscriptionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{subscription=projects/*/subscriptions/*}" + }; + } + + // Modifies the ack deadline for a specific message. This method is useful + // to indicate that more time is needed to process a message by the + // subscriber, or to make the message available for redelivery if the + // processing was interrupted. Note that this does not modify the + // subscription-level `ackDeadlineSeconds` used for subsequent messages. + rpc ModifyAckDeadline(ModifyAckDeadlineRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{subscription=projects/*/subscriptions/*}:modifyAckDeadline" + body: "*" + }; + } + + // Acknowledges the messages associated with the `ack_ids` in the + // `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages + // from the subscription. + // + // Acknowledging a message whose ack deadline has expired may succeed, + // but such a message may be redelivered later. Acknowledging a message more + // than once will not result in an error. + rpc Acknowledge(AcknowledgeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{subscription=projects/*/subscriptions/*}:acknowledge" + body: "*" + }; + } + + // Pulls messages from the server. Returns an empty list if there are no + // messages available in the backlog. The server may return `UNAVAILABLE` if + // there are too many concurrent pull requests pending for the given + // subscription. + rpc Pull(PullRequest) returns (PullResponse) { + option (google.api.http) = { + post: "/v1/{subscription=projects/*/subscriptions/*}:pull" + body: "*" + }; + } + + // (EXPERIMENTAL) StreamingPull is an experimental feature. This RPC will + // respond with UNIMPLEMENTED errors unless you have been invited to test + // this feature. Contact cloud-pubsub@google.com with any questions. + // + // Establishes a stream with the server, which sends messages down to the + // client. The client streams acknowledgements and ack deadline modifications + // back to the server. The server will close the stream and return the status + // on any error. The server may close the stream with status `OK` to reassign + // server-side resources, in which case, the client should re-establish the + // stream. `UNAVAILABLE` may also be returned in the case of a transient error + // (e.g., a server restart). These should also be retried by the client. Flow + // control can be achieved by configuring the underlying RPC channel. + rpc StreamingPull(stream StreamingPullRequest) returns (stream StreamingPullResponse); + + // Modifies the `PushConfig` for a specified subscription. + // + // This may be used to change a push subscription to a pull one (signified by + // an empty `PushConfig`) or vice versa, or change the endpoint URL and other + // attributes of a push subscription. Messages will accumulate for delivery + // continuously through the call regardless of changes to the `PushConfig`. + rpc ModifyPushConfig(ModifyPushConfigRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{subscription=projects/*/subscriptions/*}:modifyPushConfig" + body: "*" }; + } + + // Lists the existing snapshots. + rpc ListSnapshots(ListSnapshotsRequest) returns (ListSnapshotsResponse) { + option (google.api.http) = { + get: "/v1/{project=projects/*}/snapshots" + }; + } + + // Creates a snapshot from the requested subscription. + // If the snapshot already exists, returns `ALREADY_EXISTS`. + // If the requested subscription doesn't exist, returns `NOT_FOUND`. + // + // If the name is not provided in the request, the server will assign a random + // name for this snapshot on the same project as the subscription, conforming + // to the + // [resource name format](https://cloud.google.com/pubsub/docs/overview#names). + // The generated name is populated in the returned Snapshot object. + // Note that for REST API requests, you must specify a name in the request. + rpc CreateSnapshot(CreateSnapshotRequest) returns (Snapshot) { + option (google.api.http) = { + put: "/v1/{name=projects/*/snapshots/*}" + body: "*" + }; + } + + // Updates an existing snapshot. Note that certain properties of a snapshot + // are not modifiable. + // NOTE: The style guide requires body: "snapshot" instead of body: "*". + // Keeping the latter for internal consistency in V1, however it should be + // corrected in V2. See + // https://cloud.google.com/apis/design/standard_methods#update for details. + rpc UpdateSnapshot(UpdateSnapshotRequest) returns (Snapshot) { + option (google.api.http) = { + patch: "/v1/{snapshot.name=projects/*/snapshots/*}" + body: "*" }; + } + + // Removes an existing snapshot. All messages retained in the snapshot + // are immediately dropped. After a snapshot is deleted, a new one may be + // created with the same name, but the new one has no association with the old + // snapshot or its subscription, unless the same subscription is specified. + rpc DeleteSnapshot(DeleteSnapshotRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{snapshot=projects/*/snapshots/*}" + }; + } + + // Seeks an existing subscription to a point in time or to a given snapshot, + // whichever is provided in the request. + rpc Seek(SeekRequest) returns (SeekResponse) { + option (google.api.http) = { + post: "/v1/{subscription=projects/*/subscriptions/*}:seek" + body: "*" + }; + } +} + +// The service that an application uses to manipulate topics, and to send +// messages to a topic. +service Publisher { + // Creates the given topic with the given name. + rpc CreateTopic(Topic) returns (Topic) { + option (google.api.http) = { + put: "/v1/{name=projects/*/topics/*}" + body: "*" + }; + } + + // Updates an existing topic. Note that certain properties of a topic are not + // modifiable. Options settings follow the style guide: + // NOTE: The style guide requires body: "topic" instead of body: "*". + // Keeping the latter for internal consistency in V1, however it should be + // corrected in V2. See + // https://cloud.google.com/apis/design/standard_methods#update for details. + rpc UpdateTopic(UpdateTopicRequest) returns (Topic) { + option (google.api.http) = { + patch: "/v1/{topic.name=projects/*/topics/*}" + body: "*" }; + } + + // Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic + // does not exist. The message payload must not be empty; it must contain + // either a non-empty data field, or at least one attribute. + rpc Publish(PublishRequest) returns (PublishResponse) { + option (google.api.http) = { + post: "/v1/{topic=projects/*/topics/*}:publish" + body: "*" + }; + } + + // Gets the configuration of a topic. + rpc GetTopic(GetTopicRequest) returns (Topic) { + option (google.api.http) = { + get: "/v1/{topic=projects/*/topics/*}" + }; + } + + // Lists matching topics. + rpc ListTopics(ListTopicsRequest) returns (ListTopicsResponse) { + option (google.api.http) = { + get: "/v1/{project=projects/*}/topics" + }; + } + + // Lists the name of the subscriptions for this topic. + rpc ListTopicSubscriptions(ListTopicSubscriptionsRequest) returns (ListTopicSubscriptionsResponse) { + option (google.api.http) = { + get: "/v1/{topic=projects/*/topics/*}/subscriptions" + }; + } + + // Deletes the topic with the given name. Returns `NOT_FOUND` if the topic + // does not exist. After a topic is deleted, a new topic may be created with + // the same name; this is an entirely new topic with none of the old + // configuration or subscriptions. Existing subscriptions to this topic are + // not deleted, but their `topic` field is set to `_deleted-topic_`. + rpc DeleteTopic(DeleteTopicRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{topic=projects/*/topics/*}" + }; + } +} + +// A topic resource. +message Topic { + // The name of the topic. It must have the format + // `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, + // and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), + // underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent + // signs (`%`). It must be between 3 and 255 characters in length, and it + // must not start with `"goog"`. + string name = 1; + + // User labels. + map labels = 2; +} + +// A message data and its attributes. The message payload must not be empty; +// it must contain either a non-empty data field, or at least one attribute. +message PubsubMessage { + // The message payload. + bytes data = 1; + + // Optional attributes for this message. + map attributes = 2; + + // ID of this message, assigned by the server when the message is published. + // Guaranteed to be unique within the topic. This value may be read by a + // subscriber that receives a `PubsubMessage` via a `Pull` call or a push + // delivery. It must not be populated by the publisher in a `Publish` call. + string message_id = 3; + + // The time at which the message was published, populated by the server when + // it receives the `Publish` call. It must not be populated by the + // publisher in a `Publish` call. + google.protobuf.Timestamp publish_time = 4; +} + +// Request for the GetTopic method. +message GetTopicRequest { + // The name of the topic to get. + // Format is `projects/{project}/topics/{topic}`. + string topic = 1; +} + +// Request for the UpdateTopic method. +message UpdateTopicRequest { + // The topic to update. + Topic topic = 1; + + // Indicates which fields in the provided topic to update. + // Must be specified and non-empty. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for the Publish method. +message PublishRequest { + // The messages in the request will be published on this topic. + // Format is `projects/{project}/topics/{topic}`. + string topic = 1; + + // The messages to publish. + repeated PubsubMessage messages = 2; +} + +// Response for the `Publish` method. +message PublishResponse { + // The server-assigned ID of each published message, in the same order as + // the messages in the request. IDs are guaranteed to be unique within + // the topic. + repeated string message_ids = 1; +} + +// Request for the `ListTopics` method. +message ListTopicsRequest { + // The name of the cloud project that topics belong to. + // Format is `projects/{project}`. + string project = 1; + + // Maximum number of topics to return. + int32 page_size = 2; + + // The value returned by the last `ListTopicsResponse`; indicates that this is + // a continuation of a prior `ListTopics` call, and that the system should + // return the next page of data. + string page_token = 3; +} + +// Response for the `ListTopics` method. +message ListTopicsResponse { + // The resulting topics. + repeated Topic topics = 1; + + // If not empty, indicates that there may be more topics that match the + // request; this value should be passed in a new `ListTopicsRequest`. + string next_page_token = 2; +} + +// Request for the `ListTopicSubscriptions` method. +message ListTopicSubscriptionsRequest { + // The name of the topic that subscriptions are attached to. + // Format is `projects/{project}/topics/{topic}`. + string topic = 1; + + // Maximum number of subscription names to return. + int32 page_size = 2; + + // The value returned by the last `ListTopicSubscriptionsResponse`; indicates + // that this is a continuation of a prior `ListTopicSubscriptions` call, and + // that the system should return the next page of data. + string page_token = 3; +} + +// Response for the `ListTopicSubscriptions` method. +message ListTopicSubscriptionsResponse { + // The names of the subscriptions that match the request. + repeated string subscriptions = 1; + + // If not empty, indicates that there may be more subscriptions that match + // the request; this value should be passed in a new + // `ListTopicSubscriptionsRequest` to get more subscriptions. + string next_page_token = 2; +} + +// Request for the `DeleteTopic` method. +message DeleteTopicRequest { + // Name of the topic to delete. + // Format is `projects/{project}/topics/{topic}`. + string topic = 1; +} + +// A subscription resource. +message Subscription { + // The name of the subscription. It must have the format + // `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must + // start with a letter, and contain only letters (`[A-Za-z]`), numbers + // (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), + // plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters + // in length, and it must not start with `"goog"`. + string name = 1; + + // The name of the topic from which this subscription is receiving messages. + // Format is `projects/{project}/topics/{topic}`. + // The value of this field will be `_deleted-topic_` if the topic has been + // deleted. + string topic = 2; + + // If push delivery is used with this subscription, this field is + // used to configure it. An empty `pushConfig` signifies that the subscriber + // will pull and ack messages using API methods. + PushConfig push_config = 4; + + // This value is the maximum time after a subscriber receives a message + // before the subscriber should acknowledge the message. After message + // delivery but before the ack deadline expires and before the message is + // acknowledged, it is an outstanding message and will not be delivered + // again during that time (on a best-effort basis). + // + // For pull subscriptions, this value is used as the initial value for the ack + // deadline. To override this value for a given message, call + // `ModifyAckDeadline` with the corresponding `ack_id` if using + // pull. + // The minimum custom deadline you can specify is 10 seconds. + // The maximum custom deadline you can specify is 600 seconds (10 minutes). + // If this parameter is 0, a default value of 10 seconds is used. + // + // For push delivery, this value is also used to set the request timeout for + // the call to the push endpoint. + // + // If the subscriber never acknowledges the message, the Pub/Sub + // system will eventually redeliver the message. + int32 ack_deadline_seconds = 5; + + // Indicates whether to retain acknowledged messages. If true, then + // messages are not expunged from the subscription's backlog, even if they are + // acknowledged, until they fall out of the `message_retention_duration` + // window. + bool retain_acked_messages = 7; + + // How long to retain unacknowledged messages in the subscription's backlog, + // from the moment a message is published. + // If `retain_acked_messages` is true, then this also configures the retention + // of acknowledged messages, and thus configures how far back in time a `Seek` + // can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10 + // minutes. + google.protobuf.Duration message_retention_duration = 8; + + // User labels. + map labels = 9; +} + +// Configuration for a push delivery endpoint. +message PushConfig { + // A URL locating the endpoint to which messages should be pushed. + // For example, a Webhook endpoint might use "https://example.com/push". + string push_endpoint = 1; + + // Endpoint configuration attributes. + // + // Every endpoint has a set of API supported attributes that can be used to + // control different aspects of the message delivery. + // + // The currently supported attribute is `x-goog-version`, which you can + // use to change the format of the pushed message. This attribute + // indicates the version of the data expected by the endpoint. This + // controls the shape of the pushed message (i.e., its fields and metadata). + // The endpoint version is based on the version of the Pub/Sub API. + // + // If not present during the `CreateSubscription` call, it will default to + // the version of the API used to make such call. If not present during a + // `ModifyPushConfig` call, its value will not be changed. `GetSubscription` + // calls will always return a valid version, even if the subscription was + // created without this attribute. + // + // The possible values for this attribute are: + // + // * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. + // * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. + map attributes = 2; +} + +// A message and its corresponding acknowledgment ID. +message ReceivedMessage { + // This ID can be used to acknowledge the received message. + string ack_id = 1; + + // The message. + PubsubMessage message = 2; +} + +// Request for the GetSubscription method. +message GetSubscriptionRequest { + // The name of the subscription to get. + // Format is `projects/{project}/subscriptions/{sub}`. + string subscription = 1; +} + +// Request for the UpdateSubscription method. +message UpdateSubscriptionRequest { + // The updated subscription object. + Subscription subscription = 1; + + // Indicates which fields in the provided subscription to update. + // Must be specified and non-empty. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for the `ListSubscriptions` method. +message ListSubscriptionsRequest { + // The name of the cloud project that subscriptions belong to. + // Format is `projects/{project}`. + string project = 1; + + // Maximum number of subscriptions to return. + int32 page_size = 2; + + // The value returned by the last `ListSubscriptionsResponse`; indicates that + // this is a continuation of a prior `ListSubscriptions` call, and that the + // system should return the next page of data. + string page_token = 3; +} + +// Response for the `ListSubscriptions` method. +message ListSubscriptionsResponse { + // The subscriptions that match the request. + repeated Subscription subscriptions = 1; + + // If not empty, indicates that there may be more subscriptions that match + // the request; this value should be passed in a new + // `ListSubscriptionsRequest` to get more subscriptions. + string next_page_token = 2; +} + +// Request for the DeleteSubscription method. +message DeleteSubscriptionRequest { + // The subscription to delete. + // Format is `projects/{project}/subscriptions/{sub}`. + string subscription = 1; +} + +// Request for the ModifyPushConfig method. +message ModifyPushConfigRequest { + // The name of the subscription. + // Format is `projects/{project}/subscriptions/{sub}`. + string subscription = 1; + + // The push configuration for future deliveries. + // + // An empty `pushConfig` indicates that the Pub/Sub system should + // stop pushing messages from the given subscription and allow + // messages to be pulled and acknowledged - effectively pausing + // the subscription if `Pull` is not called. + PushConfig push_config = 2; +} + +// Request for the `Pull` method. +message PullRequest { + // The subscription from which messages should be pulled. + // Format is `projects/{project}/subscriptions/{sub}`. + string subscription = 1; + + // If this field set to true, the system will respond immediately even if + // it there are no messages available to return in the `Pull` response. + // Otherwise, the system may wait (for a bounded amount of time) until at + // least one message is available, rather than returning no messages. The + // client may cancel the request if it does not wish to wait any longer for + // the response. + bool return_immediately = 2; + + // The maximum number of messages returned for this request. The Pub/Sub + // system may return fewer than the number specified. + int32 max_messages = 3; +} + +// Response for the `Pull` method. +message PullResponse { + // Received Pub/Sub messages. The Pub/Sub system will return zero messages if + // there are no more available in the backlog. The Pub/Sub system may return + // fewer than the `maxMessages` requested even if there are more messages + // available in the backlog. + repeated ReceivedMessage received_messages = 1; +} + +// Request for the ModifyAckDeadline method. +message ModifyAckDeadlineRequest { + // The name of the subscription. + // Format is `projects/{project}/subscriptions/{sub}`. + string subscription = 1; + + // List of acknowledgment IDs. + repeated string ack_ids = 4; + + // The new ack deadline with respect to the time this request was sent to + // the Pub/Sub system. For example, if the value is 10, the new + // ack deadline will expire 10 seconds after the `ModifyAckDeadline` call + // was made. Specifying zero may immediately make the message available for + // another pull request. + // The minimum deadline you can specify is 0 seconds. + // The maximum deadline you can specify is 600 seconds (10 minutes). + int32 ack_deadline_seconds = 3; +} + +// Request for the Acknowledge method. +message AcknowledgeRequest { + // The subscription whose message is being acknowledged. + // Format is `projects/{project}/subscriptions/{sub}`. + string subscription = 1; + + // The acknowledgment ID for the messages being acknowledged that was returned + // by the Pub/Sub system in the `Pull` response. Must not be empty. + repeated string ack_ids = 2; +} + +// Request for the `StreamingPull` streaming RPC method. This request is used to +// establish the initial stream as well as to stream acknowledgements and ack +// deadline modifications from the client to the server. +message StreamingPullRequest { + // The subscription for which to initialize the new stream. This must be + // provided in the first request on the stream, and must not be set in + // subsequent requests from client to server. + // Format is `projects/{project}/subscriptions/{sub}`. + string subscription = 1; + + // List of acknowledgement IDs for acknowledging previously received messages + // (received on this stream or a different stream). If an ack ID has expired, + // the corresponding message may be redelivered later. Acknowledging a message + // more than once will not result in an error. If the acknowledgement ID is + // malformed, the stream will be aborted with status `INVALID_ARGUMENT`. + repeated string ack_ids = 2; + + // The list of new ack deadlines for the IDs listed in + // `modify_deadline_ack_ids`. The size of this list must be the same as the + // size of `modify_deadline_ack_ids`. If it differs the stream will be aborted + // with `INVALID_ARGUMENT`. Each element in this list is applied to the + // element in the same position in `modify_deadline_ack_ids`. The new ack + // deadline is with respect to the time this request was sent to the Pub/Sub + // system. Must be >= 0. For example, if the value is 10, the new ack deadline + // will expire 10 seconds after this request is received. If the value is 0, + // the message is immediately made available for another streaming or + // non-streaming pull request. If the value is < 0 (an error), the stream will + // be aborted with status `INVALID_ARGUMENT`. + repeated int32 modify_deadline_seconds = 3; + + // List of acknowledgement IDs whose deadline will be modified based on the + // corresponding element in `modify_deadline_seconds`. This field can be used + // to indicate that more time is needed to process a message by the + // subscriber, or to make the message available for redelivery if the + // processing was interrupted. + repeated string modify_deadline_ack_ids = 4; + + // The ack deadline to use for the stream. This must be provided in the + // first request on the stream, but it can also be updated on subsequent + // requests from client to server. The minimum deadline you can specify is 10 + // seconds. The maximum deadline you can specify is 600 seconds (10 minutes). + int32 stream_ack_deadline_seconds = 5; +} + +// Response for the `StreamingPull` method. This response is used to stream +// messages from the server to the client. +message StreamingPullResponse { + // Received Pub/Sub messages. This will not be empty. + repeated ReceivedMessage received_messages = 1; +} + +// Request for the `CreateSnapshot` method. +message CreateSnapshotRequest { + // Optional user-provided name for this snapshot. + // If the name is not provided in the request, the server will assign a random + // name for this snapshot on the same project as the subscription. + // Note that for REST API requests, you must specify a name. + // Format is `projects/{project}/snapshots/{snap}`. + string name = 1; + + // The subscription whose backlog the snapshot retains. + // Specifically, the created snapshot is guaranteed to retain: + // (a) The existing backlog on the subscription. More precisely, this is + // defined as the messages in the subscription's backlog that are + // unacknowledged upon the successful completion of the + // `CreateSnapshot` request; as well as: + // (b) Any messages published to the subscription's topic following the + // successful completion of the CreateSnapshot request. + // Format is `projects/{project}/subscriptions/{sub}`. + string subscription = 2; +} + +// Request for the UpdateSnapshot method. +message UpdateSnapshotRequest { + // The updated snpashot object. + Snapshot snapshot = 1; + + // Indicates which fields in the provided snapshot to update. + // Must be specified and non-empty. + google.protobuf.FieldMask update_mask = 2; +} + +// A snapshot resource. +message Snapshot { + // The name of the snapshot. + string name = 1; + + // The name of the topic from which this snapshot is retaining messages. + string topic = 2; + + // The snapshot is guaranteed to exist up until this time. + // A newly-created snapshot expires no later than 7 days from the time of its + // creation. Its exact lifetime is determined at creation by the existing + // backlog in the source subscription. Specifically, the lifetime of the + // snapshot is `7 days - (age of oldest unacked message in the subscription)`. + // For example, consider a subscription whose oldest unacked message is 3 days + // old. If a snapshot is created from this subscription, the snapshot -- which + // will always capture this 3-day-old backlog as long as the snapshot + // exists -- will expire in 4 days. + google.protobuf.Timestamp expire_time = 3; + + // User labels. + map labels = 4; +} + +// Request for the `ListSnapshots` method. +message ListSnapshotsRequest { + // The name of the cloud project that snapshots belong to. + // Format is `projects/{project}`. + string project = 1; + + // Maximum number of snapshots to return. + int32 page_size = 2; + + // The value returned by the last `ListSnapshotsResponse`; indicates that this + // is a continuation of a prior `ListSnapshots` call, and that the system + // should return the next page of data. + string page_token = 3; +} + +// Response for the `ListSnapshots` method. +message ListSnapshotsResponse { + // The resulting snapshots. + repeated Snapshot snapshots = 1; + + // If not empty, indicates that there may be more snapshot that match the + // request; this value should be passed in a new `ListSnapshotsRequest`. + string next_page_token = 2; +} + +// Request for the `DeleteSnapshot` method. +message DeleteSnapshotRequest { + // The name of the snapshot to delete. + // Format is `projects/{project}/snapshots/{snap}`. + string snapshot = 1; +} + +// Request for the `Seek` method. +message SeekRequest { + // The subscription to affect. + string subscription = 1; + + oneof target { + // The time to seek to. + // Messages retained in the subscription that were published before this + // time are marked as acknowledged, and messages retained in the + // subscription that were published after this time are marked as + // unacknowledged. Note that this operation affects only those messages + // retained in the subscription (configured by the combination of + // `message_retention_duration` and `retain_acked_messages`). For example, + // if `time` corresponds to a point before the message retention + // window (or to a point before the system's notion of the subscription + // creation time), only retained messages will be marked as unacknowledged, + // and already-expunged messages will not be restored. + google.protobuf.Timestamp time = 2; + + // The snapshot to seek to. The snapshot's topic must be the same as that of + // the provided subscription. + // Format is `projects/{project}/snapshots/{snap}`. + string snapshot = 3; + } +} + +message SeekResponse { + +} diff --git a/handwritten/cloud-profiler/google/pubsub/v1/pubsub_gapic.yaml b/handwritten/cloud-profiler/google/pubsub/v1/pubsub_gapic.yaml new file mode 100644 index 00000000000..df0e7fe837d --- /dev/null +++ b/handwritten/cloud-profiler/google/pubsub/v1/pubsub_gapic.yaml @@ -0,0 +1,719 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.pubsub.v1 + interface_names: + google.pubsub.v1.Publisher: TopicAdmin + google.pubsub.v1.Subscriber: SubscriptionAdmin + python: + package_name: google.cloud.pubsub_v1.gapic + go: + package_name: cloud.google.com/go/pubsub/apiv1 + domain_layer_location: cloud.google.com/go/pubsub + csharp: + package_name: Google.Cloud.PubSub.V1 + ruby: + package_name: Google::Cloud::Pubsub::V1 + php: + package_name: Google\Cloud\PubSub\V1 + nodejs: + package_name: pubsub.v1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +fixed_resource_name_values: +- entity_name: deleted_topic + fixed_value: _deleted-topic_ +collection_oneofs: +- oneof_name: topic_oneof + collection_names: + - topic + - deleted_topic +interfaces: +- name: google.pubsub.v1.Subscriber + lang_doc: + java: To retrieve messages from a subscription, see the Subscriber class. + collections: + - name_pattern: projects/{project} + entity_name: project + - name_pattern: projects/{project}/snapshots/{snapshot} + entity_name: snapshot + - name_pattern: projects/{project}/subscriptions/{subscription} + entity_name: subscription + - name_pattern: projects/{project}/topics/{topic} + entity_name: topic + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + - name: pull + retry_codes: + - DEADLINE_EXCEEDED + - INTERNAL + - CANCELLED + - RESOURCE_EXHAUSTED + - UNAVAILABLE + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 # 60 seconds + initial_rpc_timeout_millis: 60000 # 60 seconds + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 60000 # 60 seconds + total_timeout_millis: 600000 # 10 minutes + - name: messaging + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 # 60 seconds + initial_rpc_timeout_millis: 12000 # 12 seconds + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 12000 # 12 seconds + total_timeout_millis: 600000 # 10 minutes + - name: streaming_messaging + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 # 60 seconds + initial_rpc_timeout_millis: 600000 # 10 minutes + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 600000 # 10 minutes + total_timeout_millis: 600000 # 10 minutes + experimental_features: + iam_resources: + - type: google.pubsub.v1.Subscription + field: name + - type: google.pubsub.v1.Topic + field: name + methods: + - name: CreateSubscription + flattening: + groups: + - parameters: + - name + - topic + - push_config + - ack_deadline_seconds + required_fields: + - name + - topic + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: subscription + topic: topic + timeout_millis: 60000 + - name: GetSubscription + flattening: + groups: + - parameters: + - subscription + required_fields: + - subscription + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + subscription: subscription + timeout_millis: 60000 + - name: UpdateSubscription + required_fields: + - subscription + - update_mask + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + surface_treatments: + - include_languages: + - java + visibility: PACKAGE + - include_languages: + - php + visibility: DISABLED + - name: ListSubscriptions + flattening: + groups: + - parameters: + - project + required_fields: + - project + request_object_method: true + resource_name_treatment: STATIC_TYPES + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: subscriptions + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + project: project + timeout_millis: 60000 + - name: DeleteSubscription + flattening: + groups: + - parameters: + - subscription + required_fields: + - subscription + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + subscription: subscription + timeout_millis: 60000 + - name: ModifyAckDeadline + flattening: + groups: + - parameters: + - subscription + - ack_ids + - ack_deadline_seconds + required_fields: + - subscription + - ack_ids + - ack_deadline_seconds + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + subscription: subscription + timeout_millis: 60000 + surface_treatments: + - include_languages: + - java + visibility: PACKAGE + - name: Acknowledge + flattening: + groups: + - parameters: + - subscription + - ack_ids + required_fields: + - subscription + - ack_ids + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: non_idempotent + retry_params_name: messaging + field_name_patterns: + subscription: subscription + timeout_millis: 60000 + surface_treatments: + - include_languages: + - java + visibility: PACKAGE + - name: Pull + flattening: + groups: + - parameters: + - subscription + - return_immediately + - max_messages + required_fields: + - subscription + - max_messages + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: pull + retry_params_name: messaging + field_name_patterns: + subscription: subscription + timeout_millis: 60000 + surface_treatments: + - include_languages: + - java + visibility: PACKAGE + - name: StreamingPull + required_fields: + - subscription + - stream_ack_deadline_seconds + grpc_streaming: + response: + resources_field: received_messages + resource_name_treatment: STATIC_TYPES + retry_codes_name: pull + retry_params_name: streaming_messaging + field_name_patterns: + subscription: subscription + timeout_millis: 60000 + surface_treatments: + - include_languages: + - java + visibility: PACKAGE + - name: ModifyPushConfig + flattening: + groups: + - parameters: + - subscription + - push_config + required_fields: + - subscription + - push_config + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + subscription: subscription + timeout_millis: 60000 + - name: ListSnapshots + flattening: + groups: + - parameters: + - project + required_fields: + - project + request_object_method: true + resource_name_treatment: STATIC_TYPES + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: snapshots + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + project: project + timeout_millis: 60000 + - name: CreateSnapshot + flattening: + groups: + - parameters: + - name + - subscription + required_fields: + - name + - subscription + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: snapshot + subscription: subscription + timeout_millis: 60000 + - name: UpdateSnapshot + required_fields: + - snapshot + - update_mask + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + surface_treatments: + - include_languages: + - java + visibility: PACKAGE + - include_languages: + - php + visibility: DISABLED + - name: DeleteSnapshot + flattening: + groups: + - parameters: + - snapshot + required_fields: + - snapshot + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + snapshot: snapshot + timeout_millis: 60000 + - name: Seek + # Not including flattening until oneof support. + # https://github.com/googleapis/toolkit/issues/1057 + required_fields: + - subscription + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + subscription: subscription + timeout_millis: 60000 + - name: SetIamPolicy + flattening: + groups: + - parameters: + - resource + - policy + required_fields: + - resource + - policy + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + resource: subscription + timeout_millis: 60000 + reroute_to_grpc_interface: google.iam.v1.IAMPolicy + surface_treatments: + - include_languages: + - go + visibility: DISABLED + - name: GetIamPolicy + flattening: + groups: + - parameters: + - resource + required_fields: + - resource + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + resource: subscription + timeout_millis: 60000 + reroute_to_grpc_interface: google.iam.v1.IAMPolicy + surface_treatments: + - include_languages: + - go + visibility: DISABLED + - name: TestIamPermissions + flattening: + groups: + - parameters: + - resource + - permissions + required_fields: + - resource + - permissions + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + resource: subscription + timeout_millis: 60000 + reroute_to_grpc_interface: google.iam.v1.IAMPolicy + surface_treatments: + - include_languages: + - go + visibility: DISABLED +- name: google.pubsub.v1.Publisher + lang_doc: + java: To publish messages to a topic, see the Publisher class. + smoke_test: + method: ListTopics + init_fields: + - project%project=$PROJECT_ID + collections: + - name_pattern: projects/{project} + entity_name: project + - name_pattern: projects/{project}/topics/{topic} + entity_name: topic + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: one_plus_delivery + retry_codes: + - ABORTED + - CANCELLED + - INTERNAL + - RESOURCE_EXHAUSTED + - UNKNOWN + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 # 60 seconds + initial_rpc_timeout_millis: 60000 # 60 seconds + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 60000 # 60 seconds + total_timeout_millis: 600000 # 10 minutes + - name: messaging + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 # 60 seconds + initial_rpc_timeout_millis: 12000 # 12 seconds + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 30000 # 30 seconds + total_timeout_millis: 600000 # 10 minutes + experimental_features: + iam_resources: + - type: google.pubsub.v1.Subscription + field: name + - type: google.pubsub.v1.Topic + field: name + methods: + - name: CreateTopic + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: topic + timeout_millis: 60000 + - name: UpdateTopic + required_fields: + - topic + - update_mask + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + surface_treatments: + - include_languages: + - java + visibility: PACKAGE + - include_languages: + - php + visibility: DISABLED + - name: Publish + flattening: + groups: + - parameters: + - topic + - messages + required_fields: + - topic + - messages + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: one_plus_delivery + retry_params_name: messaging + batching: + thresholds: + element_count_threshold: 10 + element_count_limit: 1000 # TO BE REMOVED LATER + request_byte_threshold: 1024 # 1 Kb + request_byte_limit: 10485760 # TO BE REMOVED LATER + delay_threshold_millis: 10 + batch_descriptor: + batched_field: messages + discriminator_fields: + - topic + subresponse_field: message_ids + field_name_patterns: + topic: topic + sample_code_init_fields: + - messages[0].data + timeout_millis: 60000 + surface_treatments: + - include_languages: + - java + visibility: PACKAGE + - name: GetTopic + flattening: + groups: + - parameters: + - topic + required_fields: + - topic + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + topic: topic + timeout_millis: 60000 + - name: ListTopics + flattening: + groups: + - parameters: + - project + required_fields: + - project + request_object_method: true + resource_name_treatment: STATIC_TYPES + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: topics + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + project: project + timeout_millis: 60000 + - name: ListTopicSubscriptions + flattening: + groups: + - parameters: + - topic + required_fields: + - topic + request_object_method: true + resource_name_treatment: STATIC_TYPES + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: subscriptions + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + topic: topic + timeout_millis: 60000 + - name: DeleteTopic + flattening: + groups: + - parameters: + - topic + required_fields: + - topic + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + topic: topic + timeout_millis: 60000 + - name: SetIamPolicy + flattening: + groups: + - parameters: + - resource + - policy + required_fields: + - resource + - policy + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + resource: topic + timeout_millis: 60000 + reroute_to_grpc_interface: google.iam.v1.IAMPolicy + surface_treatments: + - include_languages: + - go + visibility: DISABLED + - name: GetIamPolicy + flattening: + groups: + - parameters: + - resource + required_fields: + - resource + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + resource: topic + timeout_millis: 60000 + reroute_to_grpc_interface: google.iam.v1.IAMPolicy + surface_treatments: + - include_languages: + - go + visibility: DISABLED + - name: TestIamPermissions + flattening: + groups: + - parameters: + - resource + - permissions + required_fields: + - resource + - permissions + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + resource: topic + timeout_millis: 60000 + reroute_to_grpc_interface: google.iam.v1.IAMPolicy + surface_treatments: + - include_languages: + - go + visibility: DISABLED +resource_name_generation: +- message_name: Topic + field_entity_map: + name: topic +- message_name: GetTopicRequest + field_entity_map: + topic: topic +- message_name: PublishRequest + field_entity_map: + topic: topic +- message_name: ListTopicsRequest + field_entity_map: + project: project +- message_name: ListTopicSubscriptionsRequest + field_entity_map: + topic: topic +- message_name: ListTopicSubscriptionsResponse + field_entity_map: + subscriptions: subscription +- message_name: DeleteTopicRequest + field_entity_map: + topic: topic +- message_name: Subscription + field_entity_map: + name: subscription + topic: topic_oneof +- message_name: GetSubscriptionRequest + field_entity_map: + subscription: subscription +- message_name: ListSubscriptionsRequest + field_entity_map: + project: project +- message_name: DeleteSubscriptionRequest + field_entity_map: + subscription: subscription +- message_name: ModifyPushConfigRequest + field_entity_map: + subscription: subscription +- message_name: PullRequest + field_entity_map: + subscription: subscription +- message_name: ModifyAckDeadlineRequest + field_entity_map: + subscription: subscription +- message_name: AcknowledgeRequest + field_entity_map: + subscription: subscription +- message_name: StreamingPullRequest + field_entity_map: + subscription: subscription +- message_name: Snapshot + field_entity_map: + name: snapshot + topic: topic +- message_name: CreateSnapshotRequest + field_entity_map: + name: snapshot + subscription: subscription +- message_name: ListSnapshotsRequest + field_entity_map: + project: project +- message_name: DeleteSnapshotRequest + field_entity_map: + snapshot: snapshot +- message_name: SeekRequest + field_entity_map: + subscription: subscription + snapshot: snapshot diff --git a/handwritten/cloud-profiler/google/pubsub/v1beta2/README.md b/handwritten/cloud-profiler/google/pubsub/v1beta2/README.md new file mode 100644 index 00000000000..bc2f60378b1 --- /dev/null +++ b/handwritten/cloud-profiler/google/pubsub/v1beta2/README.md @@ -0,0 +1,136 @@ +## Overview +This file describes an API for a Pub/Sub (Publish/Subscribe) system. This system +provides a reliable many-to-many communication mechanism between independently +written publishers and subscribers where the publisher publishes messages to +*topics* and each subscriber creates a *subscription* and consumes *messages* +from it. + +1. The Pub/Sub system maintains bindings between topics and subscriptions. +2. A publisher publishes messages into a topic. +3. The Pub/Sub system delivers messages from topics into attached + subscriptions. +4. A subscriber receives pending messages from its subscription and + acknowledges each one to the Pub/Sub system. +5. The Pub/Sub system removes acknowledged messages from that subscription. + +## Data Model +The data model consists of the following: + +* **Topic**: A topic is a resource to which messages are published by + publishers. Topics are named, and the name of the topic is unique within the + Pub/Sub system. + +* **Subscription**: A subscription records the subscriber's interest in a + topic. The Pub/Sub system maintains those messages which still need + to be delivered and acknowledged so that they can retried as needed. + The set of messages that have not been acknowledged is called the + subscription backlog. + +* **Message**: A message is a unit of data that flows in the system. It + contains opaque data from the publisher along with its *attributes*. + +* **Message Attributes** (optional): A set of opaque key-value pairs assigned + by the publisher to a message. Attributes are delivered unmodified to + subscribers together with the message data, if there's any. + +## Publisher Flow +A publisher publishes messages to the topic using the `Publish` call: + +```data +PubsubMessage message; +message.set_data("...."); +message.attributes.put("key1", "value1"); +PublishRequest request; +request.set_topic("topicName"); +request.add_message(message); +Publisher.Publish(request); +``` + +## Subscriber Flow +The subscriber part of the API is richer than the publisher part and has a +number of concepts for subscription creation and use: + +1. A subscriber (user or process) creates a subscription using the + `CreateSubscription` call. + +2. A subscriber receives messages in one of two ways: via pull or push. + + * To receive messages via pull, a subscriber calls the `Pull` method on the + `Subscriber` to get messages from the subscription. For each individual + message, the subscriber may use the `ack_id` received in the + `PullResponse` to `Acknowledge` the message, or modify the *ack deadline* + with `ModifyAckDeadline`. See the `Subscription.ack_deadline_seconds` + field documentation for details on the ack deadline behavior. Messages + must be acknowledged or they will be redelivered in a future `Pull` call. + + **Note:** Messages may be consumed in parallel by multiple processes + making `Pull` calls to the same subscription; this will result in the set + of messages from the subscription being split among the processes, each + process receiving a subset of the messages. + + * To receive messages via push, the `PushConfig` field must be specified in + the `Subscription` parameter when creating a subscription, or set with + `ModifyPushConfig`. The PushConfig specifies an endpoint at which the + subscriber exposes the `PushEndpointService` or some other handler, + depending on the endpoint. Messages are received via the + `ProcessPushMessage` method. The push subscriber responds to the method + with a result code that indicates one of three things: `Acknowledge` (the + message has been successfully processed and the Pub/Sub system may delete + it), `Nack` (the message has been rejected and the Pub/Sub system should + resend it at a later time). + + **Note:** The endpoint may be a load balancer for better scalability, so + that multiple processes may handle the message processing load. + +Subscription creation: + +```data +Subscription subscription; +subscription.set_topic("topicName"); +subscription.set_name("subscriptionName"); +subscription.push_config().set_push_endpoint("machinename:8888"); +Subscriber.CreateSubscription(subscription); +``` + +Consuming messages via pull: + +```data +// The subscription must be created without setting the push_config field. + +PullRequest pull_request; +pull_request.set_subscription("subscriptionName"); +pull_request.set_return_immediately(false); +pull_request.set_max_messages(10); +while (true) { + PullResponse pull_response; + AcknowledgeRequest ack_request; + ackRequest.set_subscription("subscriptionName"); + if (Subscriber.Pull(pull_request, pull_response) == OK) { + for (ReceivedMessage received in pull_response.received_messages()) { + Process(received.message().data()); + ackRequest.add_ack_id(received.ack_id()); + } + } + if (ackRequest.ack_ids().size() > 0) { + Subscriber.Acknowledge(ack_request); + } +} +``` + +## Reliability Semantics +When a subscriber successfully creates a subscription using +`Subscriber.CreateSubscription`, it establishes a "subscription point" for +that subscription, no later than the time that `Subscriber.CreateSubscription` +returns. The subscriber is guaranteed to receive any message published after +this subscription point. Note that messages published before the subscription +point may or may not be delivered. + +Messages are not delivered in any particular order by the Pub/Sub system. +Furthermore, the system guarantees *at-least-once* delivery of each message +until acknowledged. + +## Deletion +Both topics and subscriptions may be deleted. + +When a subscription is deleted, all messages are immediately dropped. If it +is a pull subscriber, future pull requests will return NOT_FOUND. diff --git a/handwritten/cloud-profiler/google/pubsub/v1beta2/pubsub.proto b/handwritten/cloud-profiler/google/pubsub/v1beta2/pubsub.proto new file mode 100644 index 00000000000..70dd1556a28 --- /dev/null +++ b/handwritten/cloud-profiler/google/pubsub/v1beta2/pubsub.proto @@ -0,0 +1,384 @@ +// Copyright (c) 2015, Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.pubsub.v1beta2; + +import "google/protobuf/empty.proto"; + +option go_package = "google.golang.org/genproto/googleapis/pubsub/v1beta2;pubsub"; +option java_multiple_files = true; +option java_outer_classname = "PubsubProto"; +option java_package = "com.google.pubsub.v1beta2"; + + +// The service that an application uses to manipulate subscriptions and to +// consume messages from a subscription via the Pull method. +service Subscriber { + // Creates a subscription to a given topic for a given subscriber. + // If the subscription already exists, returns ALREADY_EXISTS. + // If the corresponding topic doesn't exist, returns NOT_FOUND. + // + // If the name is not provided in the request, the server will assign a random + // name for this subscription on the same project as the topic. + rpc CreateSubscription(Subscription) returns (Subscription); + + // Gets the configuration details of a subscription. + rpc GetSubscription(GetSubscriptionRequest) returns (Subscription); + + // Lists matching subscriptions. + rpc ListSubscriptions(ListSubscriptionsRequest) returns (ListSubscriptionsResponse); + + // Deletes an existing subscription. All pending messages in the subscription + // are immediately dropped. Calls to Pull after deletion will return + // NOT_FOUND. After a subscription is deleted, a new one may be created with + // the same name, but the new one has no association with the old + // subscription, or its topic unless the same topic is specified. + rpc DeleteSubscription(DeleteSubscriptionRequest) returns (google.protobuf.Empty); + + // Modifies the ack deadline for a specific message. This method is useful to + // indicate that more time is needed to process a message by the subscriber, + // or to make the message available for redelivery if the processing was + // interrupted. + rpc ModifyAckDeadline(ModifyAckDeadlineRequest) returns (google.protobuf.Empty); + + // Acknowledges the messages associated with the ack tokens in the + // AcknowledgeRequest. The Pub/Sub system can remove the relevant messages + // from the subscription. + // + // Acknowledging a message whose ack deadline has expired may succeed, + // but such a message may be redelivered later. Acknowledging a message more + // than once will not result in an error. + rpc Acknowledge(AcknowledgeRequest) returns (google.protobuf.Empty); + + // Pulls messages from the server. Returns an empty list if there are no + // messages available in the backlog. The server may return UNAVAILABLE if + // there are too many concurrent pull requests pending for the given + // subscription. + rpc Pull(PullRequest) returns (PullResponse); + + // Modifies the PushConfig for a specified subscription. + // + // This may be used to change a push subscription to a pull one (signified + // by an empty PushConfig) or vice versa, or change the endpoint URL and other + // attributes of a push subscription. Messages will accumulate for + // delivery continuously through the call regardless of changes to the + // PushConfig. + rpc ModifyPushConfig(ModifyPushConfigRequest) returns (google.protobuf.Empty); +} + +// The service that an application uses to manipulate topics, and to send +// messages to a topic. +service Publisher { + // Creates the given topic with the given name. + rpc CreateTopic(Topic) returns (Topic); + + // Adds one or more messages to the topic. Returns NOT_FOUND if the topic does + // not exist. + rpc Publish(PublishRequest) returns (PublishResponse); + + // Gets the configuration of a topic. + rpc GetTopic(GetTopicRequest) returns (Topic); + + // Lists matching topics. + rpc ListTopics(ListTopicsRequest) returns (ListTopicsResponse); + + // Lists the name of the subscriptions for this topic. + rpc ListTopicSubscriptions(ListTopicSubscriptionsRequest) returns (ListTopicSubscriptionsResponse); + + // Deletes the topic with the given name. Returns NOT_FOUND if the topic does + // not exist. After a topic is deleted, a new topic may be created with the + // same name; this is an entirely new topic with none of the old + // configuration or subscriptions. Existing subscriptions to this topic are + // not deleted. + rpc DeleteTopic(DeleteTopicRequest) returns (google.protobuf.Empty); +} + +// A topic resource. +message Topic { + // Name of the topic. + string name = 1; +} + +// A message data and its attributes. +message PubsubMessage { + // The message payload. For JSON requests, the value of this field must be + // base64-encoded. + bytes data = 1; + + // Optional attributes for this message. + map attributes = 2; + + // ID of this message assigned by the server at publication time. Guaranteed + // to be unique within the topic. This value may be read by a subscriber + // that receives a PubsubMessage via a Pull call or a push delivery. It must + // not be populated by a publisher in a Publish call. + string message_id = 3; +} + +// Request for the GetTopic method. +message GetTopicRequest { + // The name of the topic to get. + string topic = 1; +} + +// Request for the Publish method. +message PublishRequest { + // The messages in the request will be published on this topic. + string topic = 1; + + // The messages to publish. + repeated PubsubMessage messages = 2; +} + +// Response for the Publish method. +message PublishResponse { + // The server-assigned ID of each published message, in the same order as + // the messages in the request. IDs are guaranteed to be unique within + // the topic. + repeated string message_ids = 1; +} + +// Request for the ListTopics method. +message ListTopicsRequest { + // The name of the cloud project that topics belong to. + string project = 1; + + // Maximum number of topics to return. + int32 page_size = 2; + + // The value returned by the last ListTopicsResponse; indicates that this is + // a continuation of a prior ListTopics call, and that the system should + // return the next page of data. + string page_token = 3; +} + +// Response for the ListTopics method. +message ListTopicsResponse { + // The resulting topics. + repeated Topic topics = 1; + + // If not empty, indicates that there may be more topics that match the + // request; this value should be passed in a new ListTopicsRequest. + string next_page_token = 2; +} + +// Request for the ListTopicSubscriptions method. +message ListTopicSubscriptionsRequest { + // The name of the topic that subscriptions are attached to. + string topic = 1; + + // Maximum number of subscription names to return. + int32 page_size = 2; + + // The value returned by the last ListTopicSubscriptionsResponse; indicates + // that this is a continuation of a prior ListTopicSubscriptions call, and + // that the system should return the next page of data. + string page_token = 3; +} + +// Response for the ListTopicSubscriptions method. +message ListTopicSubscriptionsResponse { + // The names of the subscriptions that match the request. + repeated string subscriptions = 1; + + // If not empty, indicates that there may be more subscriptions that match + // the request; this value should be passed in a new + // ListTopicSubscriptionsRequest to get more subscriptions. + string next_page_token = 2; +} + +// Request for the DeleteTopic method. +message DeleteTopicRequest { + // Name of the topic to delete. + string topic = 1; +} + +// A subscription resource. +message Subscription { + // Name of the subscription. + string name = 1; + + // The name of the topic from which this subscription is receiving messages. + // This will be present if and only if the subscription has not been detached + // from its topic. + string topic = 2; + + // If push delivery is used with this subscription, this field is + // used to configure it. An empty pushConfig signifies that the subscriber + // will pull and ack messages using API methods. + PushConfig push_config = 4; + + // This value is the maximum time after a subscriber receives a message + // before the subscriber should acknowledge the message. After message + // delivery but before the ack deadline expires and before the message is + // acknowledged, it is an outstanding message and will not be delivered + // again during that time (on a best-effort basis). + // + // For pull delivery this value + // is used as the initial value for the ack deadline. It may be overridden + // for a specific message by calling ModifyAckDeadline. + // + // For push delivery, this value is also used to set the request timeout for + // the call to the push endpoint. + // + // If the subscriber never acknowledges the message, the Pub/Sub + // system will eventually redeliver the message. + int32 ack_deadline_seconds = 5; +} + +// Configuration for a push delivery endpoint. +message PushConfig { + // A URL locating the endpoint to which messages should be pushed. + // For example, a Webhook endpoint might use "https://example.com/push". + string push_endpoint = 1; + + // Endpoint configuration attributes. + // + // Every endpoint has a set of API supported attributes that can be used to + // control different aspects of the message delivery. + // + // The currently supported attribute is `x-goog-version`, which you can + // use to change the format of the push message. This attribute + // indicates the version of the data expected by the endpoint. This + // controls the shape of the envelope (i.e. its fields and metadata). + // The endpoint version is based on the version of the Pub/Sub + // API. + // + // If not present during the CreateSubscription call, it will default to + // the version of the API used to make such call. If not present during a + // ModifyPushConfig call, its value will not be changed. GetSubscription + // calls will always return a valid version, even if the subscription was + // created without this attribute. + // + // The possible values for this attribute are: + // + // * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. + // * `v1beta2`: uses the push format defined in the v1beta2 Pub/Sub API. + // + map attributes = 2; +} + +// A message and its corresponding acknowledgment ID. +message ReceivedMessage { + // This ID can be used to acknowledge the received message. + string ack_id = 1; + + // The message. + PubsubMessage message = 2; +} + +// Request for the GetSubscription method. +message GetSubscriptionRequest { + // The name of the subscription to get. + string subscription = 1; +} + +// Request for the ListSubscriptions method. +message ListSubscriptionsRequest { + // The name of the cloud project that subscriptions belong to. + string project = 1; + + // Maximum number of subscriptions to return. + int32 page_size = 2; + + // The value returned by the last ListSubscriptionsResponse; indicates that + // this is a continuation of a prior ListSubscriptions call, and that the + // system should return the next page of data. + string page_token = 3; +} + +// Response for the ListSubscriptions method. +message ListSubscriptionsResponse { + // The subscriptions that match the request. + repeated Subscription subscriptions = 1; + + // If not empty, indicates that there may be more subscriptions that match + // the request; this value should be passed in a new ListSubscriptionsRequest + // to get more subscriptions. + string next_page_token = 2; +} + +// Request for the DeleteSubscription method. +message DeleteSubscriptionRequest { + // The subscription to delete. + string subscription = 1; +} + +// Request for the ModifyPushConfig method. +message ModifyPushConfigRequest { + // The name of the subscription. + string subscription = 1; + + // The push configuration for future deliveries. + // + // An empty pushConfig indicates that the Pub/Sub system should + // stop pushing messages from the given subscription and allow + // messages to be pulled and acknowledged - effectively pausing + // the subscription if Pull is not called. + PushConfig push_config = 2; +} + +// Request for the Pull method. +message PullRequest { + // The subscription from which messages should be pulled. + string subscription = 1; + + // If this is specified as true the system will respond immediately even if + // it is not able to return a message in the Pull response. Otherwise the + // system is allowed to wait until at least one message is available rather + // than returning no messages. The client may cancel the request if it does + // not wish to wait any longer for the response. + bool return_immediately = 2; + + // The maximum number of messages returned for this request. The Pub/Sub + // system may return fewer than the number specified. + int32 max_messages = 3; +} + +// Response for the Pull method. +message PullResponse { + // Received Pub/Sub messages. The Pub/Sub system will return zero messages if + // there are no more available in the backlog. The Pub/Sub system may return + // fewer than the maxMessages requested even if there are more messages + // available in the backlog. + repeated ReceivedMessage received_messages = 1; +} + +// Request for the ModifyAckDeadline method. +message ModifyAckDeadlineRequest { + // The name of the subscription. + string subscription = 1; + + // The acknowledgment ID. + string ack_id = 2; + + // The new ack deadline with respect to the time this request was sent to the + // Pub/Sub system. Must be >= 0. For example, if the value is 10, the new ack + // deadline will expire 10 seconds after the ModifyAckDeadline call was made. + // Specifying zero may immediately make the message available for another pull + // request. + int32 ack_deadline_seconds = 3; +} + +// Request for the Acknowledge method. +message AcknowledgeRequest { + // The subscription whose message is being acknowledged. + string subscription = 1; + + // The acknowledgment ID for the messages being acknowledged that was returned + // by the Pub/Sub system in the Pull response. Must not be empty. + repeated string ack_ids = 2; +} diff --git a/handwritten/cloud-profiler/google/rpc/README.md b/handwritten/cloud-profiler/google/rpc/README.md new file mode 100644 index 00000000000..509881429df --- /dev/null +++ b/handwritten/cloud-profiler/google/rpc/README.md @@ -0,0 +1,5 @@ +# Google RPC + +This package contains type definitions for general RPC systems. While +[gRPC](https://github.com/grpc) is using these defintions, they +are not designed specifically to support gRPC. diff --git a/handwritten/cloud-profiler/google/rpc/code.proto b/handwritten/cloud-profiler/google/rpc/code.proto new file mode 100644 index 00000000000..8fef411705b --- /dev/null +++ b/handwritten/cloud-profiler/google/rpc/code.proto @@ -0,0 +1,186 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.rpc; + +option go_package = "google.golang.org/genproto/googleapis/rpc/code;code"; +option java_multiple_files = true; +option java_outer_classname = "CodeProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + + +// The canonical error codes for Google APIs. +// +// +// Sometimes multiple error codes may apply. Services should return +// the most specific error code that applies. For example, prefer +// `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply. +// Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`. +enum Code { + // Not an error; returned on success + // + // HTTP Mapping: 200 OK + OK = 0; + + // The operation was cancelled, typically by the caller. + // + // HTTP Mapping: 499 Client Closed Request + CANCELLED = 1; + + // Unknown error. For example, this error may be returned when + // a `Status` value received from another address space belongs to + // an error space that is not known in this address space. Also + // errors raised by APIs that do not return enough error information + // may be converted to this error. + // + // HTTP Mapping: 500 Internal Server Error + UNKNOWN = 2; + + // The client specified an invalid argument. Note that this differs + // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments + // that are problematic regardless of the state of the system + // (e.g., a malformed file name). + // + // HTTP Mapping: 400 Bad Request + INVALID_ARGUMENT = 3; + + // The deadline expired before the operation could complete. For operations + // that change the state of the system, this error may be returned + // even if the operation has completed successfully. For example, a + // successful response from a server could have been delayed long + // enough for the deadline to expire. + // + // HTTP Mapping: 504 Gateway Timeout + DEADLINE_EXCEEDED = 4; + + // Some requested entity (e.g., file or directory) was not found. + // + // Note to server developers: if a request is denied for an entire class + // of users, such as gradual feature rollout or undocumented whitelist, + // `NOT_FOUND` may be used. If a request is denied for some users within + // a class of users, such as user-based access control, `PERMISSION_DENIED` + // must be used. + // + // HTTP Mapping: 404 Not Found + NOT_FOUND = 5; + + // The entity that a client attempted to create (e.g., file or directory) + // already exists. + // + // HTTP Mapping: 409 Conflict + ALREADY_EXISTS = 6; + + // The caller does not have permission to execute the specified + // operation. `PERMISSION_DENIED` must not be used for rejections + // caused by exhausting some resource (use `RESOURCE_EXHAUSTED` + // instead for those errors). `PERMISSION_DENIED` must not be + // used if the caller can not be identified (use `UNAUTHENTICATED` + // instead for those errors). This error code does not imply the + // request is valid or the requested entity exists or satisfies + // other pre-conditions. + // + // HTTP Mapping: 403 Forbidden + PERMISSION_DENIED = 7; + + // The request does not have valid authentication credentials for the + // operation. + // + // HTTP Mapping: 401 Unauthorized + UNAUTHENTICATED = 16; + + // Some resource has been exhausted, perhaps a per-user quota, or + // perhaps the entire file system is out of space. + // + // HTTP Mapping: 429 Too Many Requests + RESOURCE_EXHAUSTED = 8; + + // The operation was rejected because the system is not in a state + // required for the operation's execution. For example, the directory + // to be deleted is non-empty, an rmdir operation is applied to + // a non-directory, etc. + // + // Service implementors can use the following guidelines to decide + // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: + // (a) Use `UNAVAILABLE` if the client can retry just the failing call. + // (b) Use `ABORTED` if the client should retry at a higher level + // (e.g., when a client-specified test-and-set fails, indicating the + // client should restart a read-modify-write sequence). + // (c) Use `FAILED_PRECONDITION` if the client should not retry until + // the system state has been explicitly fixed. E.g., if an "rmdir" + // fails because the directory is non-empty, `FAILED_PRECONDITION` + // should be returned since the client should not retry unless + // the files are deleted from the directory. + // + // HTTP Mapping: 400 Bad Request + FAILED_PRECONDITION = 9; + + // The operation was aborted, typically due to a concurrency issue such as + // a sequencer check failure or transaction abort. + // + // See the guidelines above for deciding between `FAILED_PRECONDITION`, + // `ABORTED`, and `UNAVAILABLE`. + // + // HTTP Mapping: 409 Conflict + ABORTED = 10; + + // The operation was attempted past the valid range. E.g., seeking or + // reading past end-of-file. + // + // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may + // be fixed if the system state changes. For example, a 32-bit file + // system will generate `INVALID_ARGUMENT` if asked to read at an + // offset that is not in the range [0,2^32-1], but it will generate + // `OUT_OF_RANGE` if asked to read from an offset past the current + // file size. + // + // There is a fair bit of overlap between `FAILED_PRECONDITION` and + // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific + // error) when it applies so that callers who are iterating through + // a space can easily look for an `OUT_OF_RANGE` error to detect when + // they are done. + // + // HTTP Mapping: 400 Bad Request + OUT_OF_RANGE = 11; + + // The operation is not implemented or is not supported/enabled in this + // service. + // + // HTTP Mapping: 501 Not Implemented + UNIMPLEMENTED = 12; + + // Internal errors. This means that some invariants expected by the + // underlying system have been broken. This error code is reserved + // for serious errors. + // + // HTTP Mapping: 500 Internal Server Error + INTERNAL = 13; + + // The service is currently unavailable. This is most likely a + // transient condition, which can be corrected by retrying with + // a backoff. + // + // See the guidelines above for deciding between `FAILED_PRECONDITION`, + // `ABORTED`, and `UNAVAILABLE`. + // + // HTTP Mapping: 503 Service Unavailable + UNAVAILABLE = 14; + + // Unrecoverable data loss or corruption. + // + // HTTP Mapping: 500 Internal Server Error + DATA_LOSS = 15; +} diff --git a/handwritten/cloud-profiler/google/rpc/error_details.proto b/handwritten/cloud-profiler/google/rpc/error_details.proto new file mode 100644 index 00000000000..f24ae00999b --- /dev/null +++ b/handwritten/cloud-profiler/google/rpc/error_details.proto @@ -0,0 +1,200 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.rpc; + +import "google/protobuf/duration.proto"; + +option go_package = "google.golang.org/genproto/googleapis/rpc/errdetails;errdetails"; +option java_multiple_files = true; +option java_outer_classname = "ErrorDetailsProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + + +// Describes when the clients can retry a failed request. Clients could ignore +// the recommendation here or retry when this information is missing from error +// responses. +// +// It's always recommended that clients should use exponential backoff when +// retrying. +// +// Clients should wait until `retry_delay` amount of time has passed since +// receiving the error response before retrying. If retrying requests also +// fail, clients should use an exponential backoff scheme to gradually increase +// the delay between retries based on `retry_delay`, until either a maximum +// number of retires have been reached or a maximum retry delay cap has been +// reached. +message RetryInfo { + // Clients should wait at least this long between retrying the same request. + google.protobuf.Duration retry_delay = 1; +} + +// Describes additional debugging info. +message DebugInfo { + // The stack trace entries indicating where the error occurred. + repeated string stack_entries = 1; + + // Additional debugging information provided by the server. + string detail = 2; +} + +// Describes how a quota check failed. +// +// For example if a daily limit was exceeded for the calling project, +// a service could respond with a QuotaFailure detail containing the project +// id and the description of the quota limit that was exceeded. If the +// calling project hasn't enabled the service in the developer console, then +// a service could respond with the project id and set `service_disabled` +// to true. +// +// Also see RetryDetail and Help types for other details about handling a +// quota failure. +message QuotaFailure { + // A message type used to describe a single quota violation. For example, a + // daily quota or a custom quota that was exceeded. + message Violation { + // The subject on which the quota check failed. + // For example, "clientip:" or "project:". + string subject = 1; + + // A description of how the quota check failed. Clients can use this + // description to find more about the quota configuration in the service's + // public documentation, or find the relevant quota limit to adjust through + // developer console. + // + // For example: "Service disabled" or "Daily Limit for read operations + // exceeded". + string description = 2; + } + + // Describes all quota violations. + repeated Violation violations = 1; +} + +// Describes what preconditions have failed. +// +// For example, if an RPC failed because it required the Terms of Service to be +// acknowledged, it could list the terms of service violation in the +// PreconditionFailure message. +message PreconditionFailure { + // A message type used to describe a single precondition failure. + message Violation { + // The type of PreconditionFailure. We recommend using a service-specific + // enum type to define the supported precondition violation types. For + // example, "TOS" for "Terms of Service violation". + string type = 1; + + // The subject, relative to the type, that failed. + // For example, "google.com/cloud" relative to the "TOS" type would + // indicate which terms of service is being referenced. + string subject = 2; + + // A description of how the precondition failed. Developers can use this + // description to understand how to fix the failure. + // + // For example: "Terms of service not accepted". + string description = 3; + } + + // Describes all precondition violations. + repeated Violation violations = 1; +} + +// Describes violations in a client request. This error type focuses on the +// syntactic aspects of the request. +message BadRequest { + // A message type used to describe a single bad request field. + message FieldViolation { + // A path leading to a field in the request body. The value will be a + // sequence of dot-separated identifiers that identify a protocol buffer + // field. E.g., "field_violations.field" would identify this field. + string field = 1; + + // A description of why the request element is bad. + string description = 2; + } + + // Describes all violations in a client request. + repeated FieldViolation field_violations = 1; +} + +// Contains metadata about the request that clients can attach when filing a bug +// or providing other forms of feedback. +message RequestInfo { + // An opaque string that should only be interpreted by the service generating + // it. For example, it can be used to identify requests in the service's logs. + string request_id = 1; + + // Any data that was used to serve this request. For example, an encrypted + // stack trace that can be sent back to the service provider for debugging. + string serving_data = 2; +} + +// Describes the resource that is being accessed. +message ResourceInfo { + // A name for the type of resource being accessed, e.g. "sql table", + // "cloud storage bucket", "file", "Google calendar"; or the type URL + // of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". + string resource_type = 1; + + // The name of the resource being accessed. For example, a shared calendar + // name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current + // error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. + string resource_name = 2; + + // The owner of the resource (optional). + // For example, "user:" or "project:". + string owner = 3; + + // Describes what error is encountered when accessing this resource. + // For example, updating a cloud project may require the `writer` permission + // on the developer console project. + string description = 4; +} + +// Provides links to documentation or for performing an out of band action. +// +// For example, if a quota check failed with an error indicating the calling +// project hasn't enabled the accessed service, this can contain a URL pointing +// directly to the right place in the developer console to flip the bit. +message Help { + // Describes a URL link. + message Link { + // Describes what the link offers. + string description = 1; + + // The URL of the link. + string url = 2; + } + + // URL(s) pointing to additional information on handling the current error. + repeated Link links = 1; +} + +// Provides a localized error message that is safe to return to the user +// which can be attached to an RPC error. +message LocalizedMessage { + // The locale used following the specification defined at + // http://www.rfc-editor.org/rfc/bcp/bcp47.txt. + // Examples are: "en-US", "fr-CH", "es-MX" + string locale = 1; + + // The localized error message in the above locale. + string message = 2; +} diff --git a/handwritten/cloud-profiler/google/rpc/rpc_publish.yaml b/handwritten/cloud-profiler/google/rpc/rpc_publish.yaml new file mode 100644 index 00000000000..ea91204fbbf --- /dev/null +++ b/handwritten/cloud-profiler/google/rpc/rpc_publish.yaml @@ -0,0 +1,28 @@ +type: google.api.Service +config_version: 0 +name: rpc.googleapis.com +title: Google RPC Types + +types: +- name: google.rpc.Status +- name: google.rpc.RetryInfo +- name: google.rpc.DebugInfo +- name: google.rpc.QuotaFailure +- name: google.rpc.BadRequest +- name: google.rpc.PreconditionFailure +- name: google.rpc.RequestInfo +- name: google.rpc.ResourceInfo +- name: google.rpc.Help +- name: google.rpc.LocalizedMessage + +enums: +- name: google.rpc.Code + +documentation: + summary: Defines RPC types. + overview: |- + # Google RPC + + This package contains type definitions for general RPC systems. While + [gRPC](https://github.com/grpc) is using these defintions, they are not + designed specifically to support gRPC. diff --git a/handwritten/cloud-profiler/google/rpc/status.proto b/handwritten/cloud-profiler/google/rpc/status.proto new file mode 100644 index 00000000000..0839ee9666a --- /dev/null +++ b/handwritten/cloud-profiler/google/rpc/status.proto @@ -0,0 +1,92 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.rpc; + +import "google/protobuf/any.proto"; + +option go_package = "google.golang.org/genproto/googleapis/rpc/status;status"; +option java_multiple_files = true; +option java_outer_classname = "StatusProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + + +// The `Status` type defines a logical error model that is suitable for different +// programming environments, including REST APIs and RPC APIs. It is used by +// [gRPC](https://github.com/grpc). The error model is designed to be: +// +// - Simple to use and understand for most users +// - Flexible enough to meet unexpected needs +// +// # Overview +// +// The `Status` message contains three pieces of data: error code, error message, +// and error details. The error code should be an enum value of +// [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The +// error message should be a developer-facing English message that helps +// developers *understand* and *resolve* the error. If a localized user-facing +// error message is needed, put the localized message in the error details or +// localize it in the client. The optional error details may contain arbitrary +// information about the error. There is a predefined set of error detail types +// in the package `google.rpc` that can be used for common error conditions. +// +// # Language mapping +// +// The `Status` message is the logical representation of the error model, but it +// is not necessarily the actual wire format. When the `Status` message is +// exposed in different client libraries and different wire protocols, it can be +// mapped differently. For example, it will likely be mapped to some exceptions +// in Java, but more likely mapped to some error codes in C. +// +// # Other uses +// +// The error model and the `Status` message can be used in a variety of +// environments, either with or without APIs, to provide a +// consistent developer experience across different environments. +// +// Example uses of this error model include: +// +// - Partial errors. If a service needs to return partial errors to the client, +// it may embed the `Status` in the normal response to indicate the partial +// errors. +// +// - Workflow errors. A typical workflow has multiple steps. Each step may +// have a `Status` message for error reporting. +// +// - Batch operations. If a client uses batch request and batch response, the +// `Status` message should be used directly inside batch response, one for +// each error sub-response. +// +// - Asynchronous operations. If an API call embeds asynchronous operation +// results in its response, the status of those operations should be +// represented directly using the `Status` message. +// +// - Logging. If some API errors are stored in logs, the message `Status` could +// be used directly after any stripping needed for security/privacy reasons. +message Status { + // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. + int32 code = 1; + + // A developer-facing error message, which should be in English. Any + // user-facing error message should be localized and sent in the + // [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. + string message = 2; + + // A list of messages that carry the error details. There is a common set of + // message types for APIs to use. + repeated google.protobuf.Any details = 3; +} diff --git a/handwritten/cloud-profiler/google/spanner/admin/database/artman_spanner_admin_database.yaml b/handwritten/cloud-profiler/google/spanner/admin/database/artman_spanner_admin_database.yaml new file mode 100644 index 00000000000..4639a996416 --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/admin/database/artman_spanner_admin_database.yaml @@ -0,0 +1,94 @@ +common: + api_name: spanner-admin-database + api_version: v1 + organization_name: google-cloud + service_yaml: spanner_admin_database.yaml + gapic_yaml: v1/spanner_admin_database_gapic.yaml + src_proto_paths: + - v1 + proto_deps: + - name: google-common-protos + - name: google-iam-v1 +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-spanner-admin-database-v1 + - name: grpc + dest: generated/java/grpc-google-cloud-spanner-admin-database-v1 + - name: proto + dest: generated/java/proto-google-cloud-spanner-admin-database-v1 +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-spanner-admin-database-v1 + - name: grpc + dest: generated/python/proto-google-cloud-spanner-admin-database-v1 +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-spanner-admin-database-v1 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/spanner-admin-database + dest: google-cloud-spanner/lib/google/cloud/spanner/admin/database + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-spanner-admin-database +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: spanner/admin/database/apiv1 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-spanner-admin-database-v1/vendor +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/spanner-admin-database + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src + dest: packages/spanner/src/admin/database +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/spanner/admin/database/spanner_admin_database.yaml b/handwritten/cloud-profiler/google/spanner/admin/database/spanner_admin_database.yaml new file mode 100644 index 00000000000..2f0860a669b --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/admin/database/spanner_admin_database.yaml @@ -0,0 +1,41 @@ +type: google.api.Service +config_version: 3 +name: spanner.googleapis.com +title: Cloud Spanner Database Admin API + +apis: + - name: google.spanner.admin.database.v1.DatabaseAdmin + mixins: + - name: google.iam.v1.IAMPolicy + +types: + - name: google.spanner.admin.database.v1.CreateDatabaseMetadata + - name: google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata + +authentication: + rules: + - selector: google.spanner.admin.database.v1.DatabaseAdmin.*, + google.iam.v1.IAMPolicy.*, + google.longrunning.Operations.* + oauth: + canonical_scopes: https://www.googleapis.com/auth/spanner.admin, + https://www.googleapis.com/auth/cloud-platform + +http: + rules: + - selector: google.longrunning.Operations.GetOperation + get: '/v1/{name=projects/*/instances/*/databases/*/operations/*}' + additional_bindings: + - get: '/v1/{name=projects/*/instances/*/operations/*}' + - selector: google.longrunning.Operations.ListOperations + get: '/v1/{name=projects/*/instances/*/databases/*/operations}' + additional_bindings: + - get: '/v1/{name=projects/*/instances/*/operations}' + - selector: google.longrunning.Operations.CancelOperation + post: '/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel' + additional_bindings: + - post: '/v1/{name=projects/*/instances/*/operations/*}:cancel' + - selector: google.longrunning.Operations.DeleteOperation + delete: '/v1/{name=projects/*/instances/*/databases/*/operations/*}' + additional_bindings: + - delete: '/v1/{name=projects/*/instances/*/operations/*}' diff --git a/handwritten/cloud-profiler/google/spanner/admin/database/v1/spanner_admin_database_gapic.yaml b/handwritten/cloud-profiler/google/spanner/admin/database/v1/spanner_admin_database_gapic.yaml new file mode 100644 index 00000000000..5b7f9097a68 --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/admin/database/v1/spanner_admin_database_gapic.yaml @@ -0,0 +1,222 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.spanner.admin.database.v1 + python: + package_name: google.cloud.spanner_admin_database_v1.gapic + go: + package_name: cloud.google.com/go/spanner/admin/database/apiv1 + csharp: + package_name: Google.Cloud.Spanner.Admin.Database.V1 + ruby: + package_name: Google::Cloud::Spanner::Admin::Database::V1 + php: + package_name: Google\Cloud\Spanner\Admin\Database\V1 + nodejs: + package_name: spanner.v1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.spanner.admin.database.v1.DatabaseAdmin + collections: + - name_pattern: projects/{project}/instances/{instance} + entity_name: instance + - name_pattern: projects/{project}/instances/{instance}/databases/{database} + entity_name: database + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 1000 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 32000 + initial_rpc_timeout_millis: 60000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 60000 + total_timeout_millis: 600000 + methods: + - name: ListDatabases + flattening: + groups: + - parameters: + - parent + required_fields: + - parent + request_object_method: false + resource_name_treatment: STATIC_TYPES + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: databases + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + parent: instance + timeout_millis: 30000 + - name: CreateDatabase + flattening: + groups: + - parameters: + - parent + - create_statement + required_fields: + - parent + - create_statement + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + parent: instance + timeout_millis: 30000 + long_running: + return_type: google.spanner.admin.database.v1.Database + metadata_type: google.spanner.admin.database.v1.CreateDatabaseMetadata + initial_poll_delay_millis: 20000 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 45000 + total_poll_timeout_millis: 86400000 + - name: GetDatabase + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: database + timeout_millis: 30000 + - name: UpdateDatabaseDdl + flattening: + groups: + - parameters: + - database + - statements + required_fields: + - database + - statements + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + database: database + timeout_millis: 30000 + long_running: + return_type: google.protobuf.Empty + metadata_type: google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata + initial_poll_delay_millis: 20000 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 45000 + total_poll_timeout_millis: 86400000 + - name: DropDatabase + flattening: + groups: + - parameters: + - database + required_fields: + - database + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + database: database + timeout_millis: 30000 + - name: GetDatabaseDdl + flattening: + groups: + - parameters: + - database + required_fields: + - database + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + database: database + timeout_millis: 30000 + - name: SetIamPolicy + flattening: + groups: + - parameters: + - resource + - policy + required_fields: + - resource + - policy + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + resource: database + timeout_millis: 30000 + - name: GetIamPolicy + flattening: + groups: + - parameters: + - resource + required_fields: + - resource + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + resource: database + timeout_millis: 30000 + - name: TestIamPermissions + flattening: + groups: + - parameters: + - resource + - permissions + required_fields: + - resource + - permissions + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + resource: database + timeout_millis: 30000 +resource_name_generation: +- message_name: ListDatabasesRequest + field_entity_map: + parent: instance +- message_name: CreateDatabaseRequest + field_entity_map: + parent: instance +- message_name: CreateDatabaseMetadata + field_entity_map: + database: database +- message_name: GetDatabaseRequest + field_entity_map: + name: database +- message_name: UpdateDatabaseDdlRequest + field_entity_map: + database: database +- message_name: UpdateDatabaseDdlMetadata + field_entity_map: + database: database +- message_name: DropDatabaseRequest + field_entity_map: + database: database +- message_name: GetDatabaseDdlRequest + field_entity_map: + database: database diff --git a/handwritten/cloud-profiler/google/spanner/admin/database/v1/spanner_database_admin.proto b/handwritten/cloud-profiler/google/spanner/admin/database/v1/spanner_database_admin.proto new file mode 100644 index 00000000000..0949ea7026e --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/admin/database/v1/spanner_database_admin.proto @@ -0,0 +1,278 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.spanner.admin.database.v1; + +import "google/api/annotations.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Spanner.Admin.Database.V1"; +option go_package = "google.golang.org/genproto/googleapis/spanner/admin/database/v1;database"; +option java_multiple_files = true; +option java_outer_classname = "SpannerDatabaseAdminProto"; +option java_package = "com.google.spanner.admin.database.v1"; + + +// Cloud Spanner Database Admin API +// +// The Cloud Spanner Database Admin API can be used to create, drop, and +// list databases. It also enables updating the schema of pre-existing +// databases. +service DatabaseAdmin { + // Lists Cloud Spanner databases. + rpc ListDatabases(ListDatabasesRequest) returns (ListDatabasesResponse) { + option (google.api.http) = { get: "/v1/{parent=projects/*/instances/*}/databases" }; + } + + // Creates a new Cloud Spanner database and starts to prepare it for serving. + // The returned [long-running operation][google.longrunning.Operation] will + // have a name of the format `/operations/` and + // can be used to track preparation of the database. The + // [metadata][google.longrunning.Operation.metadata] field type is + // [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. The + // [response][google.longrunning.Operation.response] field type is + // [Database][google.spanner.admin.database.v1.Database], if successful. + rpc CreateDatabase(CreateDatabaseRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/{parent=projects/*/instances/*}/databases" body: "*" }; + } + + // Gets the state of a Cloud Spanner database. + rpc GetDatabase(GetDatabaseRequest) returns (Database) { + option (google.api.http) = { get: "/v1/{name=projects/*/instances/*/databases/*}" }; + } + + // Updates the schema of a Cloud Spanner database by + // creating/altering/dropping tables, columns, indexes, etc. The returned + // [long-running operation][google.longrunning.Operation] will have a name of + // the format `/operations/` and can be used to + // track execution of the schema change(s). The + // [metadata][google.longrunning.Operation.metadata] field type is + // [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. The operation has no response. + rpc UpdateDatabaseDdl(UpdateDatabaseDdlRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { patch: "/v1/{database=projects/*/instances/*/databases/*}/ddl" body: "*" }; + } + + // Drops (aka deletes) a Cloud Spanner database. + rpc DropDatabase(DropDatabaseRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/{database=projects/*/instances/*/databases/*}" }; + } + + // Returns the schema of a Cloud Spanner database as a list of formatted + // DDL statements. This method does not show pending schema updates, those may + // be queried using the [Operations][google.longrunning.Operations] API. + rpc GetDatabaseDdl(GetDatabaseDdlRequest) returns (GetDatabaseDdlResponse) { + option (google.api.http) = { get: "/v1/{database=projects/*/instances/*/databases/*}/ddl" }; + } + + // Sets the access control policy on a database resource. Replaces any + // existing policy. + // + // Authorization requires `spanner.databases.setIamPolicy` permission on + // [resource][google.iam.v1.SetIamPolicyRequest.resource]. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { post: "/v1/{resource=projects/*/instances/*/databases/*}:setIamPolicy" body: "*" }; + } + + // Gets the access control policy for a database resource. Returns an empty + // policy if a database exists but does not have a policy set. + // + // Authorization requires `spanner.databases.getIamPolicy` permission on + // [resource][google.iam.v1.GetIamPolicyRequest.resource]. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { post: "/v1/{resource=projects/*/instances/*/databases/*}:getIamPolicy" body: "*" }; + } + + // Returns permissions that the caller has on the specified database resource. + // + // Attempting this RPC on a non-existent Cloud Spanner database will result in + // a NOT_FOUND error if the user has `spanner.databases.list` permission on + // the containing Cloud Spanner instance. Otherwise returns an empty set of + // permissions. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { post: "/v1/{resource=projects/*/instances/*/databases/*}:testIamPermissions" body: "*" }; + } +} + +// A Cloud Spanner database. +message Database { + // Indicates the current state of the database. + enum State { + // Not specified. + STATE_UNSPECIFIED = 0; + + // The database is still being created. Operations on the database may fail + // with `FAILED_PRECONDITION` in this state. + CREATING = 1; + + // The database is fully created and ready for use. + READY = 2; + } + + // Required. The name of the database. Values are of the form + // `projects//instances//databases/`, + // where `` is as specified in the `CREATE DATABASE` + // statement. This name can be passed to other API methods to + // identify the database. + string name = 1; + + // Output only. The current database state. + State state = 2; +} + +// The request for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases]. +message ListDatabasesRequest { + // Required. The instance whose databases should be listed. + // Values are of the form `projects//instances/`. + string parent = 1; + + // Number of databases to be returned in the response. If 0 or less, + // defaults to the server's maximum allowed page size. + int32 page_size = 3; + + // If non-empty, `page_token` should contain a + // [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token] from a + // previous [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse]. + string page_token = 4; +} + +// The response for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases]. +message ListDatabasesResponse { + // Databases that matched the request. + repeated Database databases = 1; + + // `next_page_token` can be sent in a subsequent + // [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases] call to fetch more + // of the matching databases. + string next_page_token = 2; +} + +// The request for [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase]. +message CreateDatabaseRequest { + // Required. The name of the instance that will serve the new database. + // Values are of the form `projects//instances/`. + string parent = 1; + + // Required. A `CREATE DATABASE` statement, which specifies the ID of the + // new database. The database ID must conform to the regular expression + // `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. + // If the database ID is a reserved word or if it contains a hyphen, the + // database ID must be enclosed in backticks (`` ` ``). + string create_statement = 2; + + // An optional list of DDL statements to run inside the newly created + // database. Statements can create tables, indexes, etc. These + // statements execute atomically with the creation of the database: + // if there is an error in any statement, the database is not created. + repeated string extra_statements = 3; +} + +// Metadata type for the operation returned by +// [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase]. +message CreateDatabaseMetadata { + // The database being created. + string database = 1; +} + +// The request for [GetDatabase][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabase]. +message GetDatabaseRequest { + // Required. The name of the requested database. Values are of the form + // `projects//instances//databases/`. + string name = 1; +} + +// Enqueues the given DDL statements to be applied, in order but not +// necessarily all at once, to the database schema at some point (or +// points) in the future. The server checks that the statements +// are executable (syntactically valid, name tables that exist, etc.) +// before enqueueing them, but they may still fail upon +// later execution (e.g., if a statement from another batch of +// statements is applied first and it conflicts in some way, or if +// there is some data-related problem like a `NULL` value in a column to +// which `NOT NULL` would be added). If a statement fails, all +// subsequent statements in the batch are automatically cancelled. +// +// Each batch of statements is assigned a name which can be used with +// the [Operations][google.longrunning.Operations] API to monitor +// progress. See the +// [operation_id][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.operation_id] field for more +// details. +message UpdateDatabaseDdlRequest { + // Required. The database to update. + string database = 1; + + // DDL statements to be applied to the database. + repeated string statements = 2; + + // If empty, the new update request is assigned an + // automatically-generated operation ID. Otherwise, `operation_id` + // is used to construct the name of the resulting + // [Operation][google.longrunning.Operation]. + // + // Specifying an explicit operation ID simplifies determining + // whether the statements were executed in the event that the + // [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] call is replayed, + // or the return value is otherwise lost: the [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] and + // `operation_id` fields can be combined to form the + // [name][google.longrunning.Operation.name] of the resulting + // [longrunning.Operation][google.longrunning.Operation]: `/operations/`. + // + // `operation_id` should be unique within the database, and must be + // a valid identifier: `[a-z][a-z0-9_]*`. Note that + // automatically-generated operation IDs always begin with an + // underscore. If the named operation already exists, + // [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] returns + // `ALREADY_EXISTS`. + string operation_id = 3; +} + +// Metadata type for the operation returned by +// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]. +message UpdateDatabaseDdlMetadata { + // The database being modified. + string database = 1; + + // For an update this list contains all the statements. For an + // individual statement, this list contains only that statement. + repeated string statements = 2; + + // Reports the commit timestamps of all statements that have + // succeeded so far, where `commit_timestamps[i]` is the commit + // timestamp for the statement `statements[i]`. + repeated google.protobuf.Timestamp commit_timestamps = 3; +} + +// The request for [DropDatabase][google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase]. +message DropDatabaseRequest { + // Required. The database to be dropped. + string database = 1; +} + +// The request for [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl]. +message GetDatabaseDdlRequest { + // Required. The database whose schema we wish to get. + string database = 1; +} + +// The response for [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl]. +message GetDatabaseDdlResponse { + // A list of formatted DDL statements defining the schema of the database + // specified in the request. + repeated string statements = 1; +} diff --git a/handwritten/cloud-profiler/google/spanner/admin/instance/artman_spanner_admin_instance.yaml b/handwritten/cloud-profiler/google/spanner/admin/instance/artman_spanner_admin_instance.yaml new file mode 100644 index 00000000000..f09b5098bf1 --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/admin/instance/artman_spanner_admin_instance.yaml @@ -0,0 +1,94 @@ +common: + api_name: spanner-admin-instance + api_version: v1 + organization_name: google-cloud + service_yaml: spanner_admin_instance.yaml + gapic_yaml: v1/spanner_admin_instance_gapic.yaml + src_proto_paths: + - v1 + proto_deps: + - name: google-common-protos + - name: google-iam-v1 +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-spanner-admin-instance-v1 + - name: grpc + dest: generated/java/grpc-google-cloud-spanner-admin-instance-v1 + - name: proto + dest: generated/java/proto-google-cloud-spanner-admin-instance-v1 +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-spanner-admin-instance-v1 + - name: grpc + dest: generated/python/proto-google-cloud-spanner-admin-instance-v1 +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-spanner-admin-instance-v1 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/spanner-admin-instance + dest: google-cloud-spanner/lib/google/cloud/spanner/admin/instance + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-spanner-admin-instance +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: spanner/admin/instance/apiv1 + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-spanner-admin-instance-v1/vendor +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/spanner-admin-instance + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src + dest: packages/spanner/src/admin/instance +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/spanner/admin/instance/spanner_admin_instance.yaml b/handwritten/cloud-profiler/google/spanner/admin/instance/spanner_admin_instance.yaml new file mode 100644 index 00000000000..39091826fb2 --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/admin/instance/spanner_admin_instance.yaml @@ -0,0 +1,41 @@ +type: google.api.Service +config_version: 3 +name: spanner.googleapis.com +title: Cloud Spanner Instance Admin API + +apis: + - name: google.spanner.admin.instance.v1.InstanceAdmin + mixins: + - name: google.iam.v1.IAMPolicy + +types: + - name: google.spanner.admin.instance.v1.CreateInstanceMetadata + - name: google.spanner.admin.instance.v1.UpdateInstanceMetadata + +authentication: + rules: + - selector: google.spanner.admin.instance.v1.InstanceAdmin.*, + google.iam.v1.IAMPolicy.*, + google.longrunning.Operations.* + oauth: + canonical_scopes: https://www.googleapis.com/auth/spanner.admin, + https://www.googleapis.com/auth/cloud-platform + +http: + rules: + - selector: google.longrunning.Operations.GetOperation + get: '/v1/{name=projects/*/instances/*/databases/*/operations/*}' + additional_bindings: + - get: '/v1/{name=projects/*/instances/*/operations/*}' + - selector: google.longrunning.Operations.ListOperations + get: '/v1/{name=projects/*/instances/*/databases/*/operations}' + additional_bindings: + - get: '/v1/{name=projects/*/instances/*/operations}' + - selector: google.longrunning.Operations.CancelOperation + post: '/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel' + additional_bindings: + - post: '/v1/{name=projects/*/instances/*/operations/*}:cancel' + - selector: google.longrunning.Operations.DeleteOperation + delete: '/v1/{name=projects/*/instances/*/databases/*/operations/*}' + additional_bindings: + - delete: '/v1/{name=projects/*/instances/*/operations/*}' diff --git a/handwritten/cloud-profiler/google/spanner/admin/instance/v1/spanner_admin_instance_gapic.yaml b/handwritten/cloud-profiler/google/spanner/admin/instance/v1/spanner_admin_instance_gapic.yaml new file mode 100644 index 00000000000..000c0b462a1 --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/admin/instance/v1/spanner_admin_instance_gapic.yaml @@ -0,0 +1,249 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.spanner.admin.instance.v1 + python: + package_name: google.cloud.spanner_admin_instance_v1.gapic + go: + package_name: cloud.google.com/go/spanner/admin/instance/apiv1 + csharp: + package_name: Google.Cloud.Spanner.Admin.Instance.V1 + ruby: + package_name: Google::Cloud::Spanner::Admin::Instance::V1 + php: + package_name: Google\Cloud\Spanner\Admin\Instance\V1 + nodejs: + package_name: spanner.v1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.spanner.admin.instance.v1.InstanceAdmin + collections: + - name_pattern: projects/{project} + entity_name: project + - name_pattern: projects/{project}/instanceConfigs/{instance_config} + entity_name: instance_config + - name_pattern: projects/{project}/instances/{instance} + entity_name: instance + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 1000 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 32000 + initial_rpc_timeout_millis: 60000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 60000 + total_timeout_millis: 600000 + methods: + - name: ListInstanceConfigs + flattening: + groups: + - parameters: + - parent + required_fields: + - parent + request_object_method: false + resource_name_treatment: STATIC_TYPES + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: instance_configs + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + parent: project + timeout_millis: 30000 + - name: GetInstanceConfig + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: instance_config + timeout_millis: 30000 + - name: ListInstances + flattening: + groups: + - parameters: + - parent + required_fields: + - parent + request_object_method: true + resource_name_treatment: STATIC_TYPES + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: instances + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + parent: project + timeout_millis: 30000 + - name: GetInstance + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: instance + timeout_millis: 30000 + - name: CreateInstance + flattening: + groups: + - parameters: + - parent + - instance_id + - instance + required_fields: + - parent + - instance_id + - instance + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + parent: project + timeout_millis: 30000 + long_running: + return_type: google.spanner.admin.instance.v1.Instance + metadata_type: google.spanner.admin.instance.v1.CreateInstanceMetadata + initial_poll_delay_millis: 20000 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 45000 + total_poll_timeout_millis: 86400000 + - name: UpdateInstance + flattening: + groups: + - parameters: + - instance + - field_mask + required_fields: + - instance + - field_mask + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + instance.name: instance + timeout_millis: 30000 + long_running: + return_type: google.spanner.admin.instance.v1.Instance + metadata_type: google.spanner.admin.instance.v1.UpdateInstanceMetadata + initial_poll_delay_millis: 20000 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 45000 + total_poll_timeout_millis: 86400000 + - name: DeleteInstance + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: instance + timeout_millis: 30000 + - name: SetIamPolicy + flattening: + groups: + - parameters: + - resource + - policy + required_fields: + - resource + - policy + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + resource: instance + timeout_millis: 30000 + - name: GetIamPolicy + flattening: + groups: + - parameters: + - resource + required_fields: + - resource + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + resource: instance + timeout_millis: 30000 + - name: TestIamPermissions + flattening: + groups: + - parameters: + - resource + - permissions + required_fields: + - resource + - permissions + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + resource: instance + timeout_millis: 30000 +resource_name_generation: +- message_name: InstanceConfig + field_entity_map: + name: instance_config +- message_name: Instance + field_entity_map: + name: instance + config: instance_config +- message_name: ListInstanceConfigsRequest + field_entity_map: + parent: project +- message_name: GetInstanceConfigRequest + field_entity_map: + name: instance_config +- message_name: GetInstanceRequest + field_entity_map: + name: instance +- message_name: CreateInstanceRequest + field_entity_map: + parent: project + instance_id: instance +- message_name: ListInstancesRequest + field_entity_map: + parent: project +- message_name: DeleteInstanceRequest + field_entity_map: + name: instance diff --git a/handwritten/cloud-profiler/google/spanner/admin/instance/v1/spanner_instance_admin.proto b/handwritten/cloud-profiler/google/spanner/admin/instance/v1/spanner_instance_admin.proto new file mode 100644 index 00000000000..82fc5349cf3 --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/admin/instance/v1/spanner_instance_admin.proto @@ -0,0 +1,449 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.spanner.admin.instance.v1; + +import "google/api/annotations.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Spanner.Admin.Instance.V1"; +option go_package = "google.golang.org/genproto/googleapis/spanner/admin/instance/v1;instance"; +option java_multiple_files = true; +option java_outer_classname = "SpannerInstanceAdminProto"; +option java_package = "com.google.spanner.admin.instance.v1"; + + +// Cloud Spanner Instance Admin API +// +// The Cloud Spanner Instance Admin API can be used to create, delete, +// modify and list instances. Instances are dedicated Cloud Spanner serving +// and storage resources to be used by Cloud Spanner databases. +// +// Each instance has a "configuration", which dictates where the +// serving resources for the Cloud Spanner instance are located (e.g., +// US-central, Europe). Configurations are created by Google based on +// resource availability. +// +// Cloud Spanner billing is based on the instances that exist and their +// sizes. After an instance exists, there are no additional +// per-database or per-operation charges for use of the instance +// (though there may be additional network bandwidth charges). +// Instances offer isolation: problems with databases in one instance +// will not affect other instances. However, within an instance +// databases can affect each other. For example, if one database in an +// instance receives a lot of requests and consumes most of the +// instance resources, fewer resources are available for other +// databases in that instance, and their performance may suffer. +service InstanceAdmin { + // Lists the supported instance configurations for a given project. + rpc ListInstanceConfigs(ListInstanceConfigsRequest) returns (ListInstanceConfigsResponse) { + option (google.api.http) = { get: "/v1/{parent=projects/*}/instanceConfigs" }; + } + + // Gets information about a particular instance configuration. + rpc GetInstanceConfig(GetInstanceConfigRequest) returns (InstanceConfig) { + option (google.api.http) = { get: "/v1/{name=projects/*/instanceConfigs/*}" }; + } + + // Lists all instances in the given project. + rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { + option (google.api.http) = { get: "/v1/{parent=projects/*}/instances" }; + } + + // Gets information about a particular instance. + rpc GetInstance(GetInstanceRequest) returns (Instance) { + option (google.api.http) = { get: "/v1/{name=projects/*/instances/*}" }; + } + + // Creates an instance and begins preparing it to begin serving. The + // returned [long-running operation][google.longrunning.Operation] + // can be used to track the progress of preparing the new + // instance. The instance name is assigned by the caller. If the + // named instance already exists, `CreateInstance` returns + // `ALREADY_EXISTS`. + // + // Immediately upon completion of this request: + // + // * The instance is readable via the API, with all requested attributes + // but no allocated resources. Its state is `CREATING`. + // + // Until completion of the returned operation: + // + // * Cancelling the operation renders the instance immediately unreadable + // via the API. + // * The instance can be deleted. + // * All other attempts to modify the instance are rejected. + // + // Upon completion of the returned operation: + // + // * Billing for all successfully-allocated resources begins (some types + // may have lower than the requested levels). + // * Databases can be created in the instance. + // * The instance's allocated resource levels are readable via the API. + // * The instance's state becomes `READY`. + // + // The returned [long-running operation][google.longrunning.Operation] will + // have a name of the format `/operations/` and + // can be used to track creation of the instance. The + // [metadata][google.longrunning.Operation.metadata] field type is + // [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. + // The [response][google.longrunning.Operation.response] field type is + // [Instance][google.spanner.admin.instance.v1.Instance], if successful. + rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { post: "/v1/{parent=projects/*}/instances" body: "*" }; + } + + // Updates an instance, and begins allocating or releasing resources + // as requested. The returned [long-running + // operation][google.longrunning.Operation] can be used to track the + // progress of updating the instance. If the named instance does not + // exist, returns `NOT_FOUND`. + // + // Immediately upon completion of this request: + // + // * For resource types for which a decrease in the instance's allocation + // has been requested, billing is based on the newly-requested level. + // + // Until completion of the returned operation: + // + // * Cancelling the operation sets its metadata's + // [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time], and begins + // restoring resources to their pre-request values. The operation + // is guaranteed to succeed at undoing all resource changes, + // after which point it terminates with a `CANCELLED` status. + // * All other attempts to modify the instance are rejected. + // * Reading the instance via the API continues to give the pre-request + // resource levels. + // + // Upon completion of the returned operation: + // + // * Billing begins for all successfully-allocated resources (some types + // may have lower than the requested levels). + // * All newly-reserved resources are available for serving the instance's + // tables. + // * The instance's new resource levels are readable via the API. + // + // The returned [long-running operation][google.longrunning.Operation] will + // have a name of the format `/operations/` and + // can be used to track the instance modification. The + // [metadata][google.longrunning.Operation.metadata] field type is + // [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. + // The [response][google.longrunning.Operation.response] field type is + // [Instance][google.spanner.admin.instance.v1.Instance], if successful. + // + // Authorization requires `spanner.instances.update` permission on + // resource [name][google.spanner.admin.instance.v1.Instance.name]. + rpc UpdateInstance(UpdateInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { patch: "/v1/{instance.name=projects/*/instances/*}" body: "*" }; + } + + // Deletes an instance. + // + // Immediately upon completion of the request: + // + // * Billing ceases for all of the instance's reserved resources. + // + // Soon afterward: + // + // * The instance and *all of its databases* immediately and + // irrevocably disappear from the API. All data in the databases + // is permanently deleted. + rpc DeleteInstance(DeleteInstanceRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/{name=projects/*/instances/*}" }; + } + + // Sets the access control policy on an instance resource. Replaces any + // existing policy. + // + // Authorization requires `spanner.instances.setIamPolicy` on + // [resource][google.iam.v1.SetIamPolicyRequest.resource]. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { post: "/v1/{resource=projects/*/instances/*}:setIamPolicy" body: "*" }; + } + + // Gets the access control policy for an instance resource. Returns an empty + // policy if an instance exists but does not have a policy set. + // + // Authorization requires `spanner.instances.getIamPolicy` on + // [resource][google.iam.v1.GetIamPolicyRequest.resource]. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { post: "/v1/{resource=projects/*/instances/*}:getIamPolicy" body: "*" }; + } + + // Returns permissions that the caller has on the specified instance resource. + // + // Attempting this RPC on a non-existent Cloud Spanner instance resource will + // result in a NOT_FOUND error if the user has `spanner.instances.list` + // permission on the containing Google Cloud Project. Otherwise returns an + // empty set of permissions. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { post: "/v1/{resource=projects/*/instances/*}:testIamPermissions" body: "*" }; + } +} + +// A possible configuration for a Cloud Spanner instance. Configurations +// define the geographic placement of nodes and their replication. +message InstanceConfig { + // A unique identifier for the instance configuration. Values + // are of the form + // `projects//instanceConfigs/[a-z][-a-z0-9]*` + string name = 1; + + // The name of this instance configuration as it appears in UIs. + string display_name = 2; +} + +// An isolated set of Cloud Spanner resources on which databases can be hosted. +message Instance { + // Indicates the current state of the instance. + enum State { + // Not specified. + STATE_UNSPECIFIED = 0; + + // The instance is still being created. Resources may not be + // available yet, and operations such as database creation may not + // work. + CREATING = 1; + + // The instance is fully created and ready to do work such as + // creating databases. + READY = 2; + } + + // Required. A unique identifier for the instance, which cannot be changed + // after the instance is created. Values are of the form + // `projects//instances/[a-z][-a-z0-9]*[a-z0-9]`. The final + // segment of the name must be between 6 and 30 characters in length. + string name = 1; + + // Required. The name of the instance's configuration. Values are of the form + // `projects//instanceConfigs/`. See + // also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and + // [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. + string config = 2; + + // Required. The descriptive name for this instance as it appears in UIs. + // Must be unique per project and between 4 and 30 characters in length. + string display_name = 3; + + // Required. The number of nodes allocated to this instance. This may be zero + // in API responses for instances that are not yet in state `READY`. + // + // See [the documentation](https://cloud.google.com/spanner/docs/instances#node_count) + // for more information about nodes. + int32 node_count = 5; + + // Output only. The current instance state. For + // [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance], the state must be + // either omitted or set to `CREATING`. For + // [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance], the state must be + // either omitted or set to `READY`. + State state = 6; + + // Cloud Labels are a flexible and lightweight mechanism for organizing cloud + // resources into groups that reflect a customer's organizational needs and + // deployment strategies. Cloud Labels can be used to filter collections of + // resources. They can be used to control how resource metrics are aggregated. + // And they can be used as arguments to policy management rules (e.g. route, + // firewall, load balancing, etc.). + // + // * Label keys must be between 1 and 63 characters long and must conform to + // the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. + // * Label values must be between 0 and 63 characters long and must conform + // to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + // * No more than 64 labels can be associated with a given resource. + // + // See https://goo.gl/xmQnxf for more information on and examples of labels. + // + // If you plan to use labels in your own code, please note that additional + // characters may be allowed in the future. And so you are advised to use an + // internal label representation, such as JSON, which doesn't rely upon + // specific characters being disallowed. For example, representing labels + // as the string: name + "_" + value would prove problematic if we were to + // allow "_" in a future release. + map labels = 7; +} + +// The request for [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. +message ListInstanceConfigsRequest { + // Required. The name of the project for which a list of supported instance + // configurations is requested. Values are of the form + // `projects/`. + string parent = 1; + + // Number of instance configurations to be returned in the response. If 0 or + // less, defaults to the server's maximum allowed page size. + int32 page_size = 2; + + // If non-empty, `page_token` should contain a + // [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token] + // from a previous [ListInstanceConfigsResponse][google.spanner.admin.instance.v1.ListInstanceConfigsResponse]. + string page_token = 3; +} + +// The response for [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. +message ListInstanceConfigsResponse { + // The list of requested instance configurations. + repeated InstanceConfig instance_configs = 1; + + // `next_page_token` can be sent in a subsequent + // [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs] call to + // fetch more of the matching instance configurations. + string next_page_token = 2; +} + +// The request for +// [GetInstanceConfigRequest][google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig]. +message GetInstanceConfigRequest { + // Required. The name of the requested instance configuration. Values are of + // the form `projects//instanceConfigs/`. + string name = 1; +} + +// The request for [GetInstance][google.spanner.admin.instance.v1.InstanceAdmin.GetInstance]. +message GetInstanceRequest { + // Required. The name of the requested instance. Values are of the form + // `projects//instances/`. + string name = 1; +} + +// The request for [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]. +message CreateInstanceRequest { + // Required. The name of the project in which to create the instance. Values + // are of the form `projects/`. + string parent = 1; + + // Required. The ID of the instance to create. Valid identifiers are of the + // form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 6 and 30 characters in + // length. + string instance_id = 2; + + // Required. The instance to create. The name may be omitted, but if + // specified must be `/instances/`. + Instance instance = 3; +} + +// The request for [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances]. +message ListInstancesRequest { + // Required. The name of the project for which a list of instances is + // requested. Values are of the form `projects/`. + string parent = 1; + + // Number of instances to be returned in the response. If 0 or less, defaults + // to the server's maximum allowed page size. + int32 page_size = 2; + + // If non-empty, `page_token` should contain a + // [next_page_token][google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token] from a + // previous [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. + string page_token = 3; + + // An expression for filtering the results of the request. Filter rules are + // case insensitive. The fields eligible for filtering are: + // + // * `name` + // * `display_name` + // * `labels.key` where key is the name of a label + // + // Some examples of using filters are: + // + // * `name:*` --> The instance has a name. + // * `name:Howl` --> The instance's name contains the string "howl". + // * `name:HOWL` --> Equivalent to above. + // * `NAME:howl` --> Equivalent to above. + // * `labels.env:*` --> The instance has the label "env". + // * `labels.env:dev` --> The instance has the label "env" and the value of + // the label contains the string "dev". + // * `name:howl labels.env:dev` --> The instance's name contains "howl" and + // it has the label "env" with its value + // containing "dev". + string filter = 4; +} + +// The response for [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances]. +message ListInstancesResponse { + // The list of requested instances. + repeated Instance instances = 1; + + // `next_page_token` can be sent in a subsequent + // [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances] call to fetch more + // of the matching instances. + string next_page_token = 2; +} + +// The request for [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]. +message UpdateInstanceRequest { + // Required. The instance to update, which must always include the instance + // name. Otherwise, only fields mentioned in [][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] need be included. + Instance instance = 1; + + // Required. A mask specifying which fields in [][google.spanner.admin.instance.v1.UpdateInstanceRequest.instance] should be updated. + // The field mask must always be specified; this prevents any future fields in + // [][google.spanner.admin.instance.v1.Instance] from being erased accidentally by clients that do not know + // about them. + google.protobuf.FieldMask field_mask = 2; +} + +// The request for [DeleteInstance][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstance]. +message DeleteInstanceRequest { + // Required. The name of the instance to be deleted. Values are of the form + // `projects//instances/` + string name = 1; +} + +// Metadata type for the operation returned by +// [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]. +message CreateInstanceMetadata { + // The instance being created. + Instance instance = 1; + + // The time at which the + // [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance] request was + // received. + google.protobuf.Timestamp start_time = 2; + + // The time at which this operation was cancelled. If set, this operation is + // in the process of undoing itself (which is guaranteed to succeed) and + // cannot be cancelled again. + google.protobuf.Timestamp cancel_time = 3; + + // The time at which this operation failed or was completed successfully. + google.protobuf.Timestamp end_time = 4; +} + +// Metadata type for the operation returned by +// [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]. +message UpdateInstanceMetadata { + // The desired end state of the update. + Instance instance = 1; + + // The time at which [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance] + // request was received. + google.protobuf.Timestamp start_time = 2; + + // The time at which this operation was cancelled. If set, this operation is + // in the process of undoing itself (which is guaranteed to succeed) and + // cannot be cancelled again. + google.protobuf.Timestamp cancel_time = 3; + + // The time at which this operation failed or was completed successfully. + google.protobuf.Timestamp end_time = 4; +} diff --git a/handwritten/cloud-profiler/google/spanner/artman_spanner.yaml b/handwritten/cloud-profiler/google/spanner/artman_spanner.yaml new file mode 100644 index 00000000000..b4af36f7bf3 --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/artman_spanner.yaml @@ -0,0 +1,109 @@ +common: + api_name: spanner + api_version: v1 + organization_name: google-cloud + service_yaml: spanner.yaml + gapic_yaml: v1/spanner_gapic.yaml + src_proto_paths: + - v1 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA + publish_targets: + - name: java + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-java.git + directory_mappings: + - dest: google-cloud-spanner + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/java/gapic-google-cloud-spanner-v1 + - name: grpc + dest: generated/java/grpc-google-cloud-spanner-v1 + - name: proto + dest: generated/java/proto-google-cloud-spanner-v1 +- name: python_gapic + type: GAPIC_ONLY + language: PYTHON + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/python/gapic-google-cloud-spanner-v1 + - name: grpc + dest: generated/python/proto-google-cloud-spanner-v1 + - name: python + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-python.git + directory_mappings: + - src: google/cloud/spanner_v1 + dest: spanner/google/cloud/spanner_v1 + - src: tests/unit/gapic/v1 + dest: spanner/tests/gapic + - name: grpc + src: google/cloud/proto + dest: spanner/google/cloud/proto +- name: php_gapic + type: GAPIC_ONLY + language: PHP + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/php/google-cloud-spanner-v1 +- name: ruby_gapic + type: GAPIC_ONLY + language: RUBY + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/ruby/google-cloud-spanner + - name: ruby + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-ruby.git + directory_mappings: + - src: lib/google/cloud/spanner/v1 + dest: google-cloud-spanner/lib/google/cloud/spanner/v1 +- name: go_gapic + type: GAPIC_ONLY + language: GO + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/go/vendor/cloud.google.com/go/google-spanner-v1/vendor + - name: go + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-go.git + directory_mappings: + - dest: spanner/apiv1 +- name: csharp_gapic + type: GAPIC_ONLY + language: CSHARP +- name: nodejs_gapic + type: GAPIC_ONLY + language: NODEJS + publish_targets: + - name: staging + type: GITHUB + location: git@github.com:googleapis/api-client-staging.git + directory_mappings: + - dest: generated/nodejs/spanner + - name: nodejs + type: GITHUB + location: git@github.com:GoogleCloudPlatform/google-cloud-node.git + directory_mappings: + - src: src/v1 + dest: packages/spanner/src/v1 +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/spanner/spanner.yaml b/handwritten/cloud-profiler/google/spanner/spanner.yaml new file mode 100644 index 00000000000..99fe5149e35 --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/spanner.yaml @@ -0,0 +1,56 @@ +# This service config is currently set for generating client libraries for the +# non-admin API. Use the spanner_admin_*.yaml service configs to generate admin +# client libraries. + +type: google.api.Service +config_version: 3 +name: spanner.googleapis.com +title: Cloud Spanner API + +apis: + - name: google.spanner.v1.Spanner + +authentication: + rules: + - selector: google.spanner.v1.Spanner.* + oauth: + canonical_scopes: https://www.googleapis.com/auth/spanner.data, + https://www.googleapis.com/auth/cloud-platform + +http: + rules: + - selector: google.longrunning.Operations.GetOperation + get: '/v1/{name=projects/*/instances/*/databases/*/operations/*}' + additional_bindings: + - get: '/v1/{name=projects/*/instances/*/operations/*}' + - selector: google.longrunning.Operations.ListOperations + get: '/v1/{name=projects/*/instances/*/databases/*/operations}' + additional_bindings: + - get: '/v1/{name=projects/*/instances/*/operations}' + - selector: google.longrunning.Operations.CancelOperation + post: '/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel' + additional_bindings: + - post: '/v1/{name=projects/*/instances/*/operations/*}:cancel' + - selector: google.longrunning.Operations.DeleteOperation + delete: '/v1/{name=projects/*/instances/*/databases/*/operations/*}' + additional_bindings: + - delete: '/v1/{name=projects/*/instances/*/operations/*}' + +documentation: + summary: + Cloud Spanner is a managed, mission-critical, globally consistent and scalable relational database service. + + rules: + - selector: google.iam.v1.SetIamPolicyRequest.resource + description: | + REQUIRED: The Cloud Spanner resource for which the policy is being set. The format is `projects//instances/` for instance resources and `projects//instances//databases/` for databases resources. + - selector: google.iam.v1.GetIamPolicyRequest.resource + description: | + REQUIRED: The Cloud Spanner resource for which the policy is being retrieved. The format is `projects//instances/` for instance resources and `projects//instances//databases/` for database resources. + - selector: google.iam.v1.TestIamPermissionsRequest.resource + description: | + REQUIRED: The Cloud Spanner resource for which permissions are being tested. The format is `projects//instances/` for instance resources and `projects//instances//databases/` for database resources. + - selector: google.iam.v1.TestIamPermissionsRequest.permissions + description: | + REQUIRED: The set of permissions to check for 'resource'. + Permissions with wildcards (such as '*', 'spanner.*', 'spanner.instances.*') are not allowed. diff --git a/handwritten/cloud-profiler/google/spanner/v1/keys.proto b/handwritten/cloud-profiler/google/spanner/v1/keys.proto new file mode 100644 index 00000000000..2bfae6314de --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/v1/keys.proto @@ -0,0 +1,162 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.spanner.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/struct.proto"; + +option csharp_namespace = "Google.Cloud.Spanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner"; +option java_multiple_files = true; +option java_outer_classname = "KeysProto"; +option java_package = "com.google.spanner.v1"; + + +// KeyRange represents a range of rows in a table or index. +// +// A range has a start key and an end key. These keys can be open or +// closed, indicating if the range includes rows with that key. +// +// Keys are represented by lists, where the ith value in the list +// corresponds to the ith component of the table or index primary key. +// Individual values are encoded as described [here][google.spanner.v1.TypeCode]. +// +// For example, consider the following table definition: +// +// CREATE TABLE UserEvents ( +// UserName STRING(MAX), +// EventDate STRING(10) +// ) PRIMARY KEY(UserName, EventDate); +// +// The following keys name rows in this table: +// +// ["Bob", "2014-09-23"] +// ["Alfred", "2015-06-12"] +// +// Since the `UserEvents` table's `PRIMARY KEY` clause names two +// columns, each `UserEvents` key has two elements; the first is the +// `UserName`, and the second is the `EventDate`. +// +// Key ranges with multiple components are interpreted +// lexicographically by component using the table or index key's declared +// sort order. For example, the following range returns all events for +// user `"Bob"` that occurred in the year 2015: +// +// "start_closed": ["Bob", "2015-01-01"] +// "end_closed": ["Bob", "2015-12-31"] +// +// Start and end keys can omit trailing key components. This affects the +// inclusion and exclusion of rows that exactly match the provided key +// components: if the key is closed, then rows that exactly match the +// provided components are included; if the key is open, then rows +// that exactly match are not included. +// +// For example, the following range includes all events for `"Bob"` that +// occurred during and after the year 2000: +// +// "start_closed": ["Bob", "2000-01-01"] +// "end_closed": ["Bob"] +// +// The next example retrieves all events for `"Bob"`: +// +// "start_closed": ["Bob"] +// "end_closed": ["Bob"] +// +// To retrieve events before the year 2000: +// +// "start_closed": ["Bob"] +// "end_open": ["Bob", "2000-01-01"] +// +// The following range includes all rows in the table: +// +// "start_closed": [] +// "end_closed": [] +// +// This range returns all users whose `UserName` begins with any +// character from A to C: +// +// "start_closed": ["A"] +// "end_open": ["D"] +// +// This range returns all users whose `UserName` begins with B: +// +// "start_closed": ["B"] +// "end_open": ["C"] +// +// Key ranges honor column sort order. For example, suppose a table is +// defined as follows: +// +// CREATE TABLE DescendingSortedTable { +// Key INT64, +// ... +// ) PRIMARY KEY(Key DESC); +// +// The following range retrieves all rows with key values between 1 +// and 100 inclusive: +// +// "start_closed": ["100"] +// "end_closed": ["1"] +// +// Note that 100 is passed as the start, and 1 is passed as the end, +// because `Key` is a descending column in the schema. +message KeyRange { + // The start key must be provided. It can be either closed or open. + oneof start_key_type { + // If the start is closed, then the range includes all rows whose + // first `len(start_closed)` key columns exactly match `start_closed`. + google.protobuf.ListValue start_closed = 1; + + // If the start is open, then the range excludes rows whose first + // `len(start_open)` key columns exactly match `start_open`. + google.protobuf.ListValue start_open = 2; + } + + // The end key must be provided. It can be either closed or open. + oneof end_key_type { + // If the end is closed, then the range includes all rows whose + // first `len(end_closed)` key columns exactly match `end_closed`. + google.protobuf.ListValue end_closed = 3; + + // If the end is open, then the range excludes rows whose first + // `len(end_open)` key columns exactly match `end_open`. + google.protobuf.ListValue end_open = 4; + } +} + +// `KeySet` defines a collection of Cloud Spanner keys and/or key ranges. All +// the keys are expected to be in the same table or index. The keys need +// not be sorted in any particular way. +// +// If the same key is specified multiple times in the set (for example +// if two ranges, two keys, or a key and a range overlap), Cloud Spanner +// behaves as if the key were only specified once. +message KeySet { + // A list of specific keys. Entries in `keys` should have exactly as + // many elements as there are columns in the primary or index key + // with which this `KeySet` is used. Individual key values are + // encoded as described [here][google.spanner.v1.TypeCode]. + repeated google.protobuf.ListValue keys = 1; + + // A list of key ranges. See [KeyRange][google.spanner.v1.KeyRange] for more information about + // key range specifications. + repeated KeyRange ranges = 2; + + // For convenience `all` can be set to `true` to indicate that this + // `KeySet` matches all keys in the table or index. Note that any keys + // specified in `keys` or `ranges` are only yielded once. + bool all = 3; +} diff --git a/handwritten/cloud-profiler/google/spanner/v1/mutation.proto b/handwritten/cloud-profiler/google/spanner/v1/mutation.proto new file mode 100644 index 00000000000..737af54ad1a --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/v1/mutation.proto @@ -0,0 +1,92 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.spanner.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/struct.proto"; +import "google/spanner/v1/keys.proto"; + +option csharp_namespace = "Google.Cloud.Spanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner"; +option java_multiple_files = true; +option java_outer_classname = "MutationProto"; +option java_package = "com.google.spanner.v1"; + + +// A modification to one or more Cloud Spanner rows. Mutations can be +// applied to a Cloud Spanner database by sending them in a +// [Commit][google.spanner.v1.Spanner.Commit] call. +message Mutation { + // Arguments to [insert][google.spanner.v1.Mutation.insert], [update][google.spanner.v1.Mutation.update], [insert_or_update][google.spanner.v1.Mutation.insert_or_update], and + // [replace][google.spanner.v1.Mutation.replace] operations. + message Write { + // Required. The table whose rows will be written. + string table = 1; + + // The names of the columns in [table][google.spanner.v1.Mutation.Write.table] to be written. + // + // The list of columns must contain enough columns to allow + // Cloud Spanner to derive values for all primary key columns in the + // row(s) to be modified. + repeated string columns = 2; + + // The values to be written. `values` can contain more than one + // list of values. If it does, then multiple rows are written, one + // for each entry in `values`. Each list in `values` must have + // exactly as many entries as there are entries in [columns][google.spanner.v1.Mutation.Write.columns] + // above. Sending multiple lists is equivalent to sending multiple + // `Mutation`s, each containing one `values` entry and repeating + // [table][google.spanner.v1.Mutation.Write.table] and [columns][google.spanner.v1.Mutation.Write.columns]. Individual values in each list are + // encoded as described [here][google.spanner.v1.TypeCode]. + repeated google.protobuf.ListValue values = 3; + } + + // Arguments to [delete][google.spanner.v1.Mutation.delete] operations. + message Delete { + // Required. The table whose rows will be deleted. + string table = 1; + + // Required. The primary keys of the rows within [table][google.spanner.v1.Mutation.Delete.table] to delete. + KeySet key_set = 2; + } + + // Required. The operation to perform. + oneof operation { + // Insert new rows in a table. If any of the rows already exist, + // the write or transaction fails with error `ALREADY_EXISTS`. + Write insert = 1; + + // Update existing rows in a table. If any of the rows does not + // already exist, the transaction fails with error `NOT_FOUND`. + Write update = 2; + + // Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, then + // its column values are overwritten with the ones provided. Any + // column values not explicitly written are preserved. + Write insert_or_update = 3; + + // Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, it is + // deleted, and the column values provided are inserted + // instead. Unlike [insert_or_update][google.spanner.v1.Mutation.insert_or_update], this means any values not + // explicitly written become `NULL`. + Write replace = 4; + + // Delete rows from a table. Succeeds whether or not the named + // rows were present. + Delete delete = 5; + } +} diff --git a/handwritten/cloud-profiler/google/spanner/v1/query_plan.proto b/handwritten/cloud-profiler/google/spanner/v1/query_plan.proto new file mode 100644 index 00000000000..b855a8ec1b5 --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/v1/query_plan.proto @@ -0,0 +1,128 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.spanner.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/struct.proto"; + +option csharp_namespace = "Google.Cloud.Spanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner"; +option java_multiple_files = true; +option java_outer_classname = "QueryPlanProto"; +option java_package = "com.google.spanner.v1"; + + +// Node information for nodes appearing in a [QueryPlan.plan_nodes][google.spanner.v1.QueryPlan.plan_nodes]. +message PlanNode { + // Metadata associated with a parent-child relationship appearing in a + // [PlanNode][google.spanner.v1.PlanNode]. + message ChildLink { + // The node to which the link points. + int32 child_index = 1; + + // The type of the link. For example, in Hash Joins this could be used to + // distinguish between the build child and the probe child, or in the case + // of the child being an output variable, to represent the tag associated + // with the output variable. + string type = 2; + + // Only present if the child node is [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] and corresponds + // to an output variable of the parent node. The field carries the name of + // the output variable. + // For example, a `TableScan` operator that reads rows from a table will + // have child links to the `SCALAR` nodes representing the output variables + // created for each column that is read by the operator. The corresponding + // `variable` fields will be set to the variable names assigned to the + // columns. + string variable = 3; + } + + // Condensed representation of a node and its subtree. Only present for + // `SCALAR` [PlanNode(s)][google.spanner.v1.PlanNode]. + message ShortRepresentation { + // A string representation of the expression subtree rooted at this node. + string description = 1; + + // A mapping of (subquery variable name) -> (subquery node id) for cases + // where the `description` string of this node references a `SCALAR` + // subquery contained in the expression subtree rooted at this node. The + // referenced `SCALAR` subquery may not necessarily be a direct child of + // this node. + map subqueries = 2; + } + + // The kind of [PlanNode][google.spanner.v1.PlanNode]. Distinguishes between the two different kinds of + // nodes that can appear in a query plan. + enum Kind { + // Not specified. + KIND_UNSPECIFIED = 0; + + // Denotes a Relational operator node in the expression tree. Relational + // operators represent iterative processing of rows during query execution. + // For example, a `TableScan` operation that reads rows from a table. + RELATIONAL = 1; + + // Denotes a Scalar node in the expression tree. Scalar nodes represent + // non-iterable entities in the query plan. For example, constants or + // arithmetic operators appearing inside predicate expressions or references + // to column names. + SCALAR = 2; + } + + // The `PlanNode`'s index in [node list][google.spanner.v1.QueryPlan.plan_nodes]. + int32 index = 1; + + // Used to determine the type of node. May be needed for visualizing + // different kinds of nodes differently. For example, If the node is a + // [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] node, it will have a condensed representation + // which can be used to directly embed a description of the node in its + // parent. + Kind kind = 2; + + // The display name for the node. + string display_name = 3; + + // List of child node `index`es and their relationship to this parent. + repeated ChildLink child_links = 4; + + // Condensed representation for [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] nodes. + ShortRepresentation short_representation = 5; + + // Attributes relevant to the node contained in a group of key-value pairs. + // For example, a Parameter Reference node could have the following + // information in its metadata: + // + // { + // "parameter_reference": "param1", + // "parameter_type": "array" + // } + google.protobuf.Struct metadata = 6; + + // The execution statistics associated with the node, contained in a group of + // key-value pairs. Only present if the plan was returned as a result of a + // profile query. For example, number of executions, number of rows/time per + // execution etc. + google.protobuf.Struct execution_stats = 7; +} + +// Contains an ordered list of nodes appearing in the query plan. +message QueryPlan { + // The nodes in the query plan. Plan nodes are returned in pre-order starting + // with the plan root. Each [PlanNode][google.spanner.v1.PlanNode]'s `id` corresponds to its index in + // `plan_nodes`. + repeated PlanNode plan_nodes = 1; +} diff --git a/handwritten/cloud-profiler/google/spanner/v1/result_set.proto b/handwritten/cloud-profiler/google/spanner/v1/result_set.proto new file mode 100644 index 00000000000..4abd2c46b6b --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/v1/result_set.proto @@ -0,0 +1,187 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.spanner.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/struct.proto"; +import "google/spanner/v1/query_plan.proto"; +import "google/spanner/v1/transaction.proto"; +import "google/spanner/v1/type.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Spanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner"; +option java_multiple_files = true; +option java_outer_classname = "ResultSetProto"; +option java_package = "com.google.spanner.v1"; + + +// Results from [Read][google.spanner.v1.Spanner.Read] or +// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. +message ResultSet { + // Metadata about the result set, such as row type information. + ResultSetMetadata metadata = 1; + + // Each element in `rows` is a row whose format is defined by + // [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. The ith element + // in each row matches the ith field in + // [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. Elements are + // encoded based on type as described + // [here][google.spanner.v1.TypeCode]. + repeated google.protobuf.ListValue rows = 2; + + // Query plan and execution statistics for the query that produced this + // result set. These can be requested by setting + // [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. + ResultSetStats stats = 3; +} + +// Partial results from a streaming read or SQL query. Streaming reads and +// SQL queries better tolerate large result sets, large rows, and large +// values, but are a little trickier to consume. +message PartialResultSet { + // Metadata about the result set, such as row type information. + // Only present in the first response. + ResultSetMetadata metadata = 1; + + // A streamed result set consists of a stream of values, which might + // be split into many `PartialResultSet` messages to accommodate + // large rows and/or large values. Every N complete values defines a + // row, where N is equal to the number of entries in + // [metadata.row_type.fields][google.spanner.v1.StructType.fields]. + // + // Most values are encoded based on type as described + // [here][google.spanner.v1.TypeCode]. + // + // It is possible that the last value in values is "chunked", + // meaning that the rest of the value is sent in subsequent + // `PartialResultSet`(s). This is denoted by the [chunked_value][google.spanner.v1.PartialResultSet.chunked_value] + // field. Two or more chunked values can be merged to form a + // complete value as follows: + // + // * `bool/number/null`: cannot be chunked + // * `string`: concatenate the strings + // * `list`: concatenate the lists. If the last element in a list is a + // `string`, `list`, or `object`, merge it with the first element in + // the next list by applying these rules recursively. + // * `object`: concatenate the (field name, field value) pairs. If a + // field name is duplicated, then apply these rules recursively + // to merge the field values. + // + // Some examples of merging: + // + // # Strings are concatenated. + // "foo", "bar" => "foobar" + // + // # Lists of non-strings are concatenated. + // [2, 3], [4] => [2, 3, 4] + // + // # Lists are concatenated, but the last and first elements are merged + // # because they are strings. + // ["a", "b"], ["c", "d"] => ["a", "bc", "d"] + // + // # Lists are concatenated, but the last and first elements are merged + // # because they are lists. Recursively, the last and first elements + // # of the inner lists are merged because they are strings. + // ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"] + // + // # Non-overlapping object fields are combined. + // {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"} + // + // # Overlapping object fields are merged. + // {"a": "1"}, {"a": "2"} => {"a": "12"} + // + // # Examples of merging objects containing lists of strings. + // {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]} + // + // For a more complete example, suppose a streaming SQL query is + // yielding a result set whose rows contain a single string + // field. The following `PartialResultSet`s might be yielded: + // + // { + // "metadata": { ... } + // "values": ["Hello", "W"] + // "chunked_value": true + // "resume_token": "Af65..." + // } + // { + // "values": ["orl"] + // "chunked_value": true + // "resume_token": "Bqp2..." + // } + // { + // "values": ["d"] + // "resume_token": "Zx1B..." + // } + // + // This sequence of `PartialResultSet`s encodes two rows, one + // containing the field value `"Hello"`, and a second containing the + // field value `"World" = "W" + "orl" + "d"`. + repeated google.protobuf.Value values = 2; + + // If true, then the final value in [values][google.spanner.v1.PartialResultSet.values] is chunked, and must + // be combined with more values from subsequent `PartialResultSet`s + // to obtain a complete field value. + bool chunked_value = 3; + + // Streaming calls might be interrupted for a variety of reasons, such + // as TCP connection loss. If this occurs, the stream of results can + // be resumed by re-sending the original request and including + // `resume_token`. Note that executing any other transaction in the + // same session invalidates the token. + bytes resume_token = 4; + + // Query plan and execution statistics for the query that produced this + // streaming result set. These can be requested by setting + // [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] and are sent + // only once with the last response in the stream. + ResultSetStats stats = 5; +} + +// Metadata about a [ResultSet][google.spanner.v1.ResultSet] or [PartialResultSet][google.spanner.v1.PartialResultSet]. +message ResultSetMetadata { + // Indicates the field names and types for the rows in the result + // set. For example, a SQL query like `"SELECT UserId, UserName FROM + // Users"` could return a `row_type` value like: + // + // "fields": [ + // { "name": "UserId", "type": { "code": "INT64" } }, + // { "name": "UserName", "type": { "code": "STRING" } }, + // ] + StructType row_type = 1; + + // If the read or SQL query began a transaction as a side-effect, the + // information about the new transaction is yielded here. + Transaction transaction = 2; +} + +// Additional statistics about a [ResultSet][google.spanner.v1.ResultSet] or [PartialResultSet][google.spanner.v1.PartialResultSet]. +message ResultSetStats { + // [QueryPlan][google.spanner.v1.QueryPlan] for the query associated with this result. + QueryPlan query_plan = 1; + + // Aggregated statistics from the execution of the query. Only present when + // the query is profiled. For example, a query could return the statistics as + // follows: + // + // { + // "rows_returned": "3", + // "elapsed_time": "1.22 secs", + // "cpu_time": "1.19 secs" + // } + google.protobuf.Struct query_stats = 2; +} diff --git a/handwritten/cloud-profiler/google/spanner/v1/spanner.proto b/handwritten/cloud-profiler/google/spanner/v1/spanner.proto new file mode 100644 index 00000000000..95d315427d8 --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/v1/spanner.proto @@ -0,0 +1,412 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.spanner.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/spanner/v1/keys.proto"; +import "google/spanner/v1/mutation.proto"; +import "google/spanner/v1/result_set.proto"; +import "google/spanner/v1/transaction.proto"; +import "google/spanner/v1/type.proto"; + +option csharp_namespace = "Google.Cloud.Spanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner"; +option java_multiple_files = true; +option java_outer_classname = "SpannerProto"; +option java_package = "com.google.spanner.v1"; + + +// Cloud Spanner API +// +// The Cloud Spanner API can be used to manage sessions and execute +// transactions on data stored in Cloud Spanner databases. +service Spanner { + // Creates a new session. A session can be used to perform + // transactions that read and/or modify data in a Cloud Spanner database. + // Sessions are meant to be reused for many consecutive + // transactions. + // + // Sessions can only execute one transaction at a time. To execute + // multiple concurrent read-write/write-only transactions, create + // multiple sessions. Note that standalone reads and queries use a + // transaction internally, and count toward the one transaction + // limit. + // + // Cloud Spanner limits the number of sessions that can exist at any given + // time; thus, it is a good idea to delete idle and/or unneeded sessions. + // Aside from explicit deletes, Cloud Spanner can delete sessions for which no + // operations are sent for more than an hour. If a session is deleted, + // requests to it return `NOT_FOUND`. + // + // Idle sessions can be kept alive by sending a trivial SQL query + // periodically, e.g., `"SELECT 1"`. + rpc CreateSession(CreateSessionRequest) returns (Session) { + option (google.api.http) = { post: "/v1/{database=projects/*/instances/*/databases/*}/sessions" body: "*" }; + } + + // Gets a session. Returns `NOT_FOUND` if the session does not exist. + // This is mainly useful for determining whether a session is still + // alive. + rpc GetSession(GetSessionRequest) returns (Session) { + option (google.api.http) = { get: "/v1/{name=projects/*/instances/*/databases/*/sessions/*}" }; + } + + // Lists all sessions in a given database. + rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse) { + option (google.api.http) = { get: "/v1/{database=projects/*/instances/*/databases/*}/sessions" }; + } + + // Ends a session, releasing server resources associated with it. + rpc DeleteSession(DeleteSessionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/{name=projects/*/instances/*/databases/*/sessions/*}" }; + } + + // Executes an SQL query, returning all rows in a single reply. This + // method cannot be used to return a result set larger than 10 MiB; + // if the query yields more data than that, the query fails with + // a `FAILED_PRECONDITION` error. + // + // Queries inside read-write transactions might return `ABORTED`. If + // this occurs, the application should restart the transaction from + // the beginning. See [Transaction][google.spanner.v1.Transaction] for more details. + // + // Larger result sets can be fetched in streaming fashion by calling + // [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] instead. + rpc ExecuteSql(ExecuteSqlRequest) returns (ResultSet) { + option (google.api.http) = { post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeSql" body: "*" }; + } + + // Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the result + // set as a stream. Unlike [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there + // is no limit on the size of the returned result set. However, no + // individual row in the result set can exceed 100 MiB, and no + // column value can exceed 10 MiB. + rpc ExecuteStreamingSql(ExecuteSqlRequest) returns (stream PartialResultSet) { + option (google.api.http) = { post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeStreamingSql" body: "*" }; + } + + // Reads rows from the database using key lookups and scans, as a + // simple key/value style alternative to + // [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be used to + // return a result set larger than 10 MiB; if the read matches more + // data than that, the read fails with a `FAILED_PRECONDITION` + // error. + // + // Reads inside read-write transactions might return `ABORTED`. If + // this occurs, the application should restart the transaction from + // the beginning. See [Transaction][google.spanner.v1.Transaction] for more details. + // + // Larger result sets can be yielded in streaming fashion by calling + // [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead. + rpc Read(ReadRequest) returns (ResultSet) { + option (google.api.http) = { post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:read" body: "*" }; + } + + // Like [Read][google.spanner.v1.Spanner.Read], except returns the result set as a + // stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no limit on the + // size of the returned result set. However, no individual row in + // the result set can exceed 100 MiB, and no column value can exceed + // 10 MiB. + rpc StreamingRead(ReadRequest) returns (stream PartialResultSet) { + option (google.api.http) = { post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:streamingRead" body: "*" }; + } + + // Begins a new transaction. This step can often be skipped: + // [Read][google.spanner.v1.Spanner.Read], [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and + // [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a + // side-effect. + rpc BeginTransaction(BeginTransactionRequest) returns (Transaction) { + option (google.api.http) = { post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:beginTransaction" body: "*" }; + } + + // Commits a transaction. The request includes the mutations to be + // applied to rows in the database. + // + // `Commit` might return an `ABORTED` error. This can occur at any time; + // commonly, the cause is conflicts with concurrent + // transactions. However, it can also happen for a variety of other + // reasons. If `Commit` returns `ABORTED`, the caller should re-attempt + // the transaction from the beginning, re-using the same session. + rpc Commit(CommitRequest) returns (CommitResponse) { + option (google.api.http) = { post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:commit" body: "*" }; + } + + // Rolls back a transaction, releasing any locks it holds. It is a good + // idea to call this for any transaction that includes one or more + // [Read][google.spanner.v1.Spanner.Read] or [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and + // ultimately decides not to commit. + // + // `Rollback` returns `OK` if it successfully aborts the transaction, the + // transaction was already aborted, or the transaction is not + // found. `Rollback` never returns `ABORTED`. + rpc Rollback(RollbackRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:rollback" body: "*" }; + } +} + +// The request for [CreateSession][google.spanner.v1.Spanner.CreateSession]. +message CreateSessionRequest { + // Required. The database in which the new session is created. + string database = 1; + + // The session to create. + Session session = 2; +} + +// A session in the Cloud Spanner API. +message Session { + // The name of the session. This is always system-assigned; values provided + // when creating a session are ignored. + string name = 1; + + // The labels for the session. + // + // * Label keys must be between 1 and 63 characters long and must conform to + // the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. + // * Label values must be between 0 and 63 characters long and must conform + // to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + // * No more than 64 labels can be associated with a given session. + // + // See https://goo.gl/xmQnxf for more information on and examples of labels. + map labels = 2; + + // Output only. The timestamp when the session is created. + google.protobuf.Timestamp create_time = 3; + + // Output only. The approximate timestamp when the session is last used. It is + // typically earlier than the actual last use time. + google.protobuf.Timestamp approximate_last_use_time = 4; +} + +// The request for [GetSession][google.spanner.v1.Spanner.GetSession]. +message GetSessionRequest { + // Required. The name of the session to retrieve. + string name = 1; +} + +// The request for [ListSessions][google.spanner.v1.Spanner.ListSessions]. +message ListSessionsRequest { + // Required. The database in which to list sessions. + string database = 1; + + // Number of sessions to be returned in the response. If 0 or less, defaults + // to the server's maximum allowed page size. + int32 page_size = 2; + + // If non-empty, `page_token` should contain a + // [next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token] from a previous + // [ListSessionsResponse][google.spanner.v1.ListSessionsResponse]. + string page_token = 3; + + // An expression for filtering the results of the request. Filter rules are + // case insensitive. The fields eligible for filtering are: + // + // * `labels.key` where key is the name of a label + // + // Some examples of using filters are: + // + // * `labels.env:*` --> The session has the label "env". + // * `labels.env:dev` --> The session has the label "env" and the value of + // the label contains the string "dev". + string filter = 4; +} + +// The response for [ListSessions][google.spanner.v1.Spanner.ListSessions]. +message ListSessionsResponse { + // The list of requested sessions. + repeated Session sessions = 1; + + // `next_page_token` can be sent in a subsequent + // [ListSessions][google.spanner.v1.Spanner.ListSessions] call to fetch more of the matching + // sessions. + string next_page_token = 2; +} + +// The request for [DeleteSession][google.spanner.v1.Spanner.DeleteSession]. +message DeleteSessionRequest { + // Required. The name of the session to delete. + string name = 1; +} + +// The request for [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and +// [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql]. +message ExecuteSqlRequest { + // Mode in which the query must be processed. + enum QueryMode { + // The default mode where only the query result, without any information + // about the query plan is returned. + NORMAL = 0; + + // This mode returns only the query plan, without any result rows or + // execution statistics information. + PLAN = 1; + + // This mode returns both the query plan and the execution statistics along + // with the result rows. + PROFILE = 2; + } + + // Required. The session in which the SQL query should be performed. + string session = 1; + + // The transaction to use. If none is provided, the default is a + // temporary read-only transaction with strong concurrency. + TransactionSelector transaction = 2; + + // Required. The SQL query string. + string sql = 3; + + // The SQL query string can contain parameter placeholders. A parameter + // placeholder consists of `'@'` followed by the parameter + // name. Parameter names consist of any combination of letters, + // numbers, and underscores. + // + // Parameters can appear anywhere that a literal value is expected. The same + // parameter name can be used more than once, for example: + // `"WHERE id > @msg_id AND id < @msg_id + 100"` + // + // It is an error to execute an SQL query with unbound parameters. + // + // Parameter values are specified using `params`, which is a JSON + // object whose keys are parameter names, and whose values are the + // corresponding parameter values. + google.protobuf.Struct params = 4; + + // It is not always possible for Cloud Spanner to infer the right SQL type + // from a JSON value. For example, values of type `BYTES` and values + // of type `STRING` both appear in [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. + // + // In these cases, `param_types` can be used to specify the exact + // SQL type for some or all of the SQL query parameters. See the + // definition of [Type][google.spanner.v1.Type] for more information + // about SQL types. + map param_types = 5; + + // If this request is resuming a previously interrupted SQL query + // execution, `resume_token` should be copied from the last + // [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the interruption. Doing this + // enables the new SQL query execution to resume where the last one left + // off. The rest of the request parameters must exactly match the + // request that yielded this token. + bytes resume_token = 6; + + // Used to control the amount of debugging information returned in + // [ResultSetStats][google.spanner.v1.ResultSetStats]. + QueryMode query_mode = 7; +} + +// The request for [Read][google.spanner.v1.Spanner.Read] and +// [StreamingRead][google.spanner.v1.Spanner.StreamingRead]. +message ReadRequest { + // Required. The session in which the read should be performed. + string session = 1; + + // The transaction to use. If none is provided, the default is a + // temporary read-only transaction with strong concurrency. + TransactionSelector transaction = 2; + + // Required. The name of the table in the database to be read. + string table = 3; + + // If non-empty, the name of an index on [table][google.spanner.v1.ReadRequest.table]. This index is + // used instead of the table primary key when interpreting [key_set][google.spanner.v1.ReadRequest.key_set] + // and sorting result rows. See [key_set][google.spanner.v1.ReadRequest.key_set] for further information. + string index = 4; + + // The columns of [table][google.spanner.v1.ReadRequest.table] to be returned for each row matching + // this request. + repeated string columns = 5; + + // Required. `key_set` identifies the rows to be yielded. `key_set` names the + // primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to be yielded, unless [index][google.spanner.v1.ReadRequest.index] + // is present. If [index][google.spanner.v1.ReadRequest.index] is present, then [key_set][google.spanner.v1.ReadRequest.key_set] instead names + // index keys in [index][google.spanner.v1.ReadRequest.index]. + // + // Rows are yielded in table primary key order (if [index][google.spanner.v1.ReadRequest.index] is empty) + // or index key order (if [index][google.spanner.v1.ReadRequest.index] is non-empty). + // + // It is not an error for the `key_set` to name rows that do not + // exist in the database. Read yields nothing for nonexistent rows. + KeySet key_set = 6; + + // If greater than zero, only the first `limit` rows are yielded. If `limit` + // is zero, the default is no limit. + int64 limit = 8; + + // If this request is resuming a previously interrupted read, + // `resume_token` should be copied from the last + // [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the interruption. Doing this + // enables the new read to resume where the last read left off. The + // rest of the request parameters must exactly match the request + // that yielded this token. + bytes resume_token = 9; +} + +// The request for [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction]. +message BeginTransactionRequest { + // Required. The session in which the transaction runs. + string session = 1; + + // Required. Options for the new transaction. + TransactionOptions options = 2; +} + +// The request for [Commit][google.spanner.v1.Spanner.Commit]. +message CommitRequest { + // Required. The session in which the transaction to be committed is running. + string session = 1; + + // Required. The transaction in which to commit. + oneof transaction { + // Commit a previously-started transaction. + bytes transaction_id = 2; + + // Execute mutations in a temporary transaction. Note that unlike + // commit of a previously-started transaction, commit with a + // temporary transaction is non-idempotent. That is, if the + // `CommitRequest` is sent to Cloud Spanner more than once (for + // instance, due to retries in the application, or in the + // transport library), it is possible that the mutations are + // executed more than once. If this is undesirable, use + // [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction] and + // [Commit][google.spanner.v1.Spanner.Commit] instead. + TransactionOptions single_use_transaction = 3; + } + + // The mutations to be executed when this transaction commits. All + // mutations are applied atomically, in the order they appear in + // this list. + repeated Mutation mutations = 4; +} + +// The response for [Commit][google.spanner.v1.Spanner.Commit]. +message CommitResponse { + // The Cloud Spanner timestamp at which the transaction committed. + google.protobuf.Timestamp commit_timestamp = 1; +} + +// The request for [Rollback][google.spanner.v1.Spanner.Rollback]. +message RollbackRequest { + // Required. The session in which the transaction to roll back is running. + string session = 1; + + // Required. The transaction to roll back. + bytes transaction_id = 2; +} diff --git a/handwritten/cloud-profiler/google/spanner/v1/spanner_gapic.yaml b/handwritten/cloud-profiler/google/spanner/v1/spanner_gapic.yaml new file mode 100644 index 00000000000..0682d6045dc --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/v1/spanner_gapic.yaml @@ -0,0 +1,248 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.spanner.v1 + python: + package_name: google.cloud.spanner_v1.gapic + go: + package_name: cloud.google.com/go/spanner/apiv1 + domain_layer_location: cloud.google.com/go/spanner + csharp: + package_name: Google.Cloud.Spanner.V1 + ruby: + package_name: Google::Cloud::Spanner::V1 + php: + package_name: Google\Cloud\Spanner\V1 + nodejs: + package_name: spanner.v1 + domain_layer_location: google-cloud +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.spanner.v1.Spanner + collections: + - name_pattern: projects/{project}/instances/{instance}/databases/{database} + entity_name: database + - name_pattern: projects/{project}/instances/{instance}/databases/{database}/sessions/{session} + entity_name: session + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + - name: long_running + retry_codes: + - UNAVAILABLE + retry_params_def: + - name: default + initial_retry_delay_millis: 1000 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 32000 + initial_rpc_timeout_millis: 60000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 60000 + total_timeout_millis: 600000 + - name: long_running + initial_retry_delay_millis: 1000 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 32000 + initial_rpc_timeout_millis: 3600000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 3600000 + total_timeout_millis: 3600000 + methods: + - name: CreateSession + flattening: + groups: + - parameters: + - database + required_fields: + - database + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + database: database + timeout_millis: 30000 + - name: GetSession + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: session + timeout_millis: 30000 + - name: ListSessions + flattening: + groups: + - parameters: + - database + required_fields: + - database + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: sessions + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + database: database + timeout_millis: 30000 + - name: DeleteSession + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: session + timeout_millis: 30000 + - name: ExecuteSql + required_fields: + - session + - sql + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + session: session + timeout_millis: 30000 + - name: ExecuteStreamingSql + required_fields: + - session + - sql + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + session: session + timeout_millis: 3600000 + - name: Read + required_fields: + - session + - table + - columns + - key_set + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + session: session + timeout_millis: 30000 + - name: StreamingRead + required_fields: + - session + - table + - columns + - key_set + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + session: session + timeout_millis: 3600000 + - name: BeginTransaction + flattening: + groups: + - parameters: + - session + - options + required_fields: + - session + - options + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + session: session + timeout_millis: 30000 + - name: Commit + flattening: + groups: + - parameters: + - session + - transaction_id + - mutations + - parameters: + - session + - single_use_transaction + - mutations + required_fields: + - session + - mutations + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: long_running + retry_params_name: long_running + field_name_patterns: + session: session + timeout_millis: 3600000 + - name: Rollback + flattening: + groups: + - parameters: + - session + - transaction_id + required_fields: + - session + - transaction_id + request_object_method: true + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + session: session + timeout_millis: 30000 +resource_name_generation: +- message_name: CreateSessionRequest + field_entity_map: + database: database +- message_name: Session + field_entity_map: + name: session +- message_name: GetSessionRequest + field_entity_map: + name: session +- message_name: DeleteSessionRequest + field_entity_map: + name: session +- message_name: ExecuteSqlRequest + field_entity_map: + session: session +- message_name: ReadRequest + field_entity_map: + session: session +- message_name: BeginTransactionRequest + field_entity_map: + session: session +- message_name: CommitRequest + field_entity_map: + session: session +- message_name: RollbackRequest + field_entity_map: + session: session diff --git a/handwritten/cloud-profiler/google/spanner/v1/transaction.proto b/handwritten/cloud-profiler/google/spanner/v1/transaction.proto new file mode 100644 index 00000000000..aa7fafd58d1 --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/v1/transaction.proto @@ -0,0 +1,383 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.spanner.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Spanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner"; +option java_multiple_files = true; +option java_outer_classname = "TransactionProto"; +option java_package = "com.google.spanner.v1"; + + +// # Transactions +// +// +// Each session can have at most one active transaction at a time. After the +// active transaction is completed, the session can immediately be +// re-used for the next transaction. It is not necessary to create a +// new session for each transaction. +// +// # Transaction Modes +// +// Cloud Spanner supports two transaction modes: +// +// 1. Locking read-write. This type of transaction is the only way +// to write data into Cloud Spanner. These transactions rely on +// pessimistic locking and, if necessary, two-phase commit. +// Locking read-write transactions may abort, requiring the +// application to retry. +// +// 2. Snapshot read-only. This transaction type provides guaranteed +// consistency across several reads, but does not allow +// writes. Snapshot read-only transactions can be configured to +// read at timestamps in the past. Snapshot read-only +// transactions do not need to be committed. +// +// For transactions that only read, snapshot read-only transactions +// provide simpler semantics and are almost always faster. In +// particular, read-only transactions do not take locks, so they do +// not conflict with read-write transactions. As a consequence of not +// taking locks, they also do not abort, so retry loops are not needed. +// +// Transactions may only read/write data in a single database. They +// may, however, read/write data in different tables within that +// database. +// +// ## Locking Read-Write Transactions +// +// Locking transactions may be used to atomically read-modify-write +// data anywhere in a database. This type of transaction is externally +// consistent. +// +// Clients should attempt to minimize the amount of time a transaction +// is active. Faster transactions commit with higher probability +// and cause less contention. Cloud Spanner attempts to keep read locks +// active as long as the transaction continues to do reads, and the +// transaction has not been terminated by +// [Commit][google.spanner.v1.Spanner.Commit] or +// [Rollback][google.spanner.v1.Spanner.Rollback]. Long periods of +// inactivity at the client may cause Cloud Spanner to release a +// transaction's locks and abort it. +// +// Reads performed within a transaction acquire locks on the data +// being read. Writes can only be done at commit time, after all reads +// have been completed. +// Conceptually, a read-write transaction consists of zero or more +// reads or SQL queries followed by +// [Commit][google.spanner.v1.Spanner.Commit]. At any time before +// [Commit][google.spanner.v1.Spanner.Commit], the client can send a +// [Rollback][google.spanner.v1.Spanner.Rollback] request to abort the +// transaction. +// +// ### Semantics +// +// Cloud Spanner can commit the transaction if all read locks it acquired +// are still valid at commit time, and it is able to acquire write +// locks for all writes. Cloud Spanner can abort the transaction for any +// reason. If a commit attempt returns `ABORTED`, Cloud Spanner guarantees +// that the transaction has not modified any user data in Cloud Spanner. +// +// Unless the transaction commits, Cloud Spanner makes no guarantees about +// how long the transaction's locks were held for. It is an error to +// use Cloud Spanner locks for any sort of mutual exclusion other than +// between Cloud Spanner transactions themselves. +// +// ### Retrying Aborted Transactions +// +// When a transaction aborts, the application can choose to retry the +// whole transaction again. To maximize the chances of successfully +// committing the retry, the client should execute the retry in the +// same session as the original attempt. The original session's lock +// priority increases with each consecutive abort, meaning that each +// attempt has a slightly better chance of success than the previous. +// +// Under some circumstances (e.g., many transactions attempting to +// modify the same row(s)), a transaction can abort many times in a +// short period before successfully committing. Thus, it is not a good +// idea to cap the number of retries a transaction can attempt; +// instead, it is better to limit the total amount of wall time spent +// retrying. +// +// ### Idle Transactions +// +// A transaction is considered idle if it has no outstanding reads or +// SQL queries and has not started a read or SQL query within the last 10 +// seconds. Idle transactions can be aborted by Cloud Spanner so that they +// don't hold on to locks indefinitely. In that case, the commit will +// fail with error `ABORTED`. +// +// If this behavior is undesirable, periodically executing a simple +// SQL query in the transaction (e.g., `SELECT 1`) prevents the +// transaction from becoming idle. +// +// ## Snapshot Read-Only Transactions +// +// Snapshot read-only transactions provides a simpler method than +// locking read-write transactions for doing several consistent +// reads. However, this type of transaction does not support writes. +// +// Snapshot transactions do not take locks. Instead, they work by +// choosing a Cloud Spanner timestamp, then executing all reads at that +// timestamp. Since they do not acquire locks, they do not block +// concurrent read-write transactions. +// +// Unlike locking read-write transactions, snapshot read-only +// transactions never abort. They can fail if the chosen read +// timestamp is garbage collected; however, the default garbage +// collection policy is generous enough that most applications do not +// need to worry about this in practice. +// +// Snapshot read-only transactions do not need to call +// [Commit][google.spanner.v1.Spanner.Commit] or +// [Rollback][google.spanner.v1.Spanner.Rollback] (and in fact are not +// permitted to do so). +// +// To execute a snapshot transaction, the client specifies a timestamp +// bound, which tells Cloud Spanner how to choose a read timestamp. +// +// The types of timestamp bound are: +// +// - Strong (the default). +// - Bounded staleness. +// - Exact staleness. +// +// If the Cloud Spanner database to be read is geographically distributed, +// stale read-only transactions can execute more quickly than strong +// or read-write transaction, because they are able to execute far +// from the leader replica. +// +// Each type of timestamp bound is discussed in detail below. +// +// ### Strong +// +// Strong reads are guaranteed to see the effects of all transactions +// that have committed before the start of the read. Furthermore, all +// rows yielded by a single read are consistent with each other -- if +// any part of the read observes a transaction, all parts of the read +// see the transaction. +// +// Strong reads are not repeatable: two consecutive strong read-only +// transactions might return inconsistent results if there are +// concurrent writes. If consistency across reads is required, the +// reads should be executed within a transaction or at an exact read +// timestamp. +// +// See [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong]. +// +// ### Exact Staleness +// +// These timestamp bounds execute reads at a user-specified +// timestamp. Reads at a timestamp are guaranteed to see a consistent +// prefix of the global transaction history: they observe +// modifications done by all transactions with a commit timestamp <= +// the read timestamp, and observe none of the modifications done by +// transactions with a larger commit timestamp. They will block until +// all conflicting transactions that may be assigned commit timestamps +// <= the read timestamp have finished. +// +// The timestamp can either be expressed as an absolute Cloud Spanner commit +// timestamp or a staleness relative to the current time. +// +// These modes do not require a "negotiation phase" to pick a +// timestamp. As a result, they execute slightly faster than the +// equivalent boundedly stale concurrency modes. On the other hand, +// boundedly stale reads usually return fresher results. +// +// See [TransactionOptions.ReadOnly.read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.read_timestamp] and +// [TransactionOptions.ReadOnly.exact_staleness][google.spanner.v1.TransactionOptions.ReadOnly.exact_staleness]. +// +// ### Bounded Staleness +// +// Bounded staleness modes allow Cloud Spanner to pick the read timestamp, +// subject to a user-provided staleness bound. Cloud Spanner chooses the +// newest timestamp within the staleness bound that allows execution +// of the reads at the closest available replica without blocking. +// +// All rows yielded are consistent with each other -- if any part of +// the read observes a transaction, all parts of the read see the +// transaction. Boundedly stale reads are not repeatable: two stale +// reads, even if they use the same staleness bound, can execute at +// different timestamps and thus return inconsistent results. +// +// Boundedly stale reads execute in two phases: the first phase +// negotiates a timestamp among all replicas needed to serve the +// read. In the second phase, reads are executed at the negotiated +// timestamp. +// +// As a result of the two phase execution, bounded staleness reads are +// usually a little slower than comparable exact staleness +// reads. However, they are typically able to return fresher +// results, and are more likely to execute at the closest replica. +// +// Because the timestamp negotiation requires up-front knowledge of +// which rows will be read, it can only be used with single-use +// read-only transactions. +// +// See [TransactionOptions.ReadOnly.max_staleness][google.spanner.v1.TransactionOptions.ReadOnly.max_staleness] and +// [TransactionOptions.ReadOnly.min_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.min_read_timestamp]. +// +// ### Old Read Timestamps and Garbage Collection +// +// Cloud Spanner continuously garbage collects deleted and overwritten data +// in the background to reclaim storage space. This process is known +// as "version GC". By default, version GC reclaims versions after they +// are one hour old. Because of this, Cloud Spanner cannot perform reads +// at read timestamps more than one hour in the past. This +// restriction also applies to in-progress reads and/or SQL queries whose +// timestamp become too old while executing. Reads and SQL queries with +// too-old read timestamps fail with the error `FAILED_PRECONDITION`. +message TransactionOptions { + // Message type to initiate a read-write transaction. Currently this + // transaction type has no options. + message ReadWrite { + + } + + // Message type to initiate a read-only transaction. + message ReadOnly { + // How to choose the timestamp for the read-only transaction. + oneof timestamp_bound { + // Read at a timestamp where all previously committed transactions + // are visible. + bool strong = 1; + + // Executes all reads at a timestamp >= `min_read_timestamp`. + // + // This is useful for requesting fresher data than some previous + // read, or data that is fresh enough to observe the effects of some + // previously committed transaction whose timestamp is known. + // + // Note that this option can only be used in single-use transactions. + // + // A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. + // Example: `"2014-10-02T15:01:23.045123456Z"`. + google.protobuf.Timestamp min_read_timestamp = 2; + + // Read data at a timestamp >= `NOW - max_staleness` + // seconds. Guarantees that all writes that have committed more + // than the specified number of seconds ago are visible. Because + // Cloud Spanner chooses the exact timestamp, this mode works even if + // the client's local clock is substantially skewed from Cloud Spanner + // commit timestamps. + // + // Useful for reading the freshest data available at a nearby + // replica, while bounding the possible staleness if the local + // replica has fallen behind. + // + // Note that this option can only be used in single-use + // transactions. + google.protobuf.Duration max_staleness = 3; + + // Executes all reads at the given timestamp. Unlike other modes, + // reads at a specific timestamp are repeatable; the same read at + // the same timestamp always returns the same data. If the + // timestamp is in the future, the read will block until the + // specified timestamp, modulo the read's deadline. + // + // Useful for large scale consistent reads such as mapreduces, or + // for coordinating many reads against a consistent snapshot of the + // data. + // + // A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. + // Example: `"2014-10-02T15:01:23.045123456Z"`. + google.protobuf.Timestamp read_timestamp = 4; + + // Executes all reads at a timestamp that is `exact_staleness` + // old. The timestamp is chosen soon after the read is started. + // + // Guarantees that all writes that have committed more than the + // specified number of seconds ago are visible. Because Cloud Spanner + // chooses the exact timestamp, this mode works even if the client's + // local clock is substantially skewed from Cloud Spanner commit + // timestamps. + // + // Useful for reading at nearby replicas without the distributed + // timestamp negotiation overhead of `max_staleness`. + google.protobuf.Duration exact_staleness = 5; + } + + // If true, the Cloud Spanner-selected read timestamp is included in + // the [Transaction][google.spanner.v1.Transaction] message that describes the transaction. + bool return_read_timestamp = 6; + } + + // Required. The type of transaction. + oneof mode { + // Transaction may write. + // + // Authorization to begin a read-write transaction requires + // `spanner.databases.beginOrRollbackReadWriteTransaction` permission + // on the `session` resource. + ReadWrite read_write = 1; + + // Transaction will not write. + // + // Authorization to begin a read-only transaction requires + // `spanner.databases.beginReadOnlyTransaction` permission + // on the `session` resource. + ReadOnly read_only = 2; + } +} + +// A transaction. +message Transaction { + // `id` may be used to identify the transaction in subsequent + // [Read][google.spanner.v1.Spanner.Read], + // [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], + // [Commit][google.spanner.v1.Spanner.Commit], or + // [Rollback][google.spanner.v1.Spanner.Rollback] calls. + // + // Single-use read-only transactions do not have IDs, because + // single-use transactions do not support multiple requests. + bytes id = 1; + + // For snapshot read-only transactions, the read timestamp chosen + // for the transaction. Not returned by default: see + // [TransactionOptions.ReadOnly.return_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.return_read_timestamp]. + // + // A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. + // Example: `"2014-10-02T15:01:23.045123456Z"`. + google.protobuf.Timestamp read_timestamp = 2; +} + +// This message is used to select the transaction in which a +// [Read][google.spanner.v1.Spanner.Read] or +// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] call runs. +// +// See [TransactionOptions][google.spanner.v1.TransactionOptions] for more information about transactions. +message TransactionSelector { + // If no fields are set, the default is a single use transaction + // with strong concurrency. + oneof selector { + // Execute the read or SQL query in a temporary transaction. + // This is the most efficient way to execute a transaction that + // consists of a single SQL query. + TransactionOptions single_use = 1; + + // Execute the read or SQL query in a previously-started transaction. + bytes id = 2; + + // Begin a new transaction and execute this read or SQL query in + // it. The transaction ID of the new transaction is returned in + // [ResultSetMetadata.transaction][google.spanner.v1.ResultSetMetadata.transaction], which is a [Transaction][google.spanner.v1.Transaction]. + TransactionOptions begin = 3; + } +} diff --git a/handwritten/cloud-profiler/google/spanner/v1/type.proto b/handwritten/cloud-profiler/google/spanner/v1/type.proto new file mode 100644 index 00000000000..76a941ff74d --- /dev/null +++ b/handwritten/cloud-profiler/google/spanner/v1/type.proto @@ -0,0 +1,111 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.spanner.v1; + +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.Spanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner"; +option java_multiple_files = true; +option java_outer_classname = "TypeProto"; +option java_package = "com.google.spanner.v1"; + + +// `Type` indicates the type of a Cloud Spanner value, as might be stored in a +// table cell or returned from an SQL query. +message Type { + // Required. The [TypeCode][google.spanner.v1.TypeCode] for this type. + TypeCode code = 1; + + // If [code][google.spanner.v1.Type.code] == [ARRAY][google.spanner.v1.TypeCode.ARRAY], then `array_element_type` + // is the type of the array elements. + Type array_element_type = 2; + + // If [code][google.spanner.v1.Type.code] == [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type` + // provides type information for the struct's fields. + StructType struct_type = 3; +} + +// `StructType` defines the fields of a [STRUCT][google.spanner.v1.TypeCode.STRUCT] type. +message StructType { + // Message representing a single field of a struct. + message Field { + // The name of the field. For reads, this is the column name. For + // SQL queries, it is the column alias (e.g., `"Word"` in the + // query `"SELECT 'hello' AS Word"`), or the column name (e.g., + // `"ColName"` in the query `"SELECT ColName FROM Table"`). Some + // columns might have an empty name (e.g., !"SELECT + // UPPER(ColName)"`). Note that a query result can contain + // multiple fields with the same name. + string name = 1; + + // The type of the field. + Type type = 2; + } + + // The list of fields that make up this struct. Order is + // significant, because values of this struct type are represented as + // lists, where the order of field values matches the order of + // fields in the [StructType][google.spanner.v1.StructType]. In turn, the order of fields + // matches the order of columns in a read request, or the order of + // fields in the `SELECT` clause of a query. + repeated Field fields = 1; +} + +// `TypeCode` is used as part of [Type][google.spanner.v1.Type] to +// indicate the type of a Cloud Spanner value. +// +// Each legal value of a type can be encoded to or decoded from a JSON +// value, using the encodings described below. All Cloud Spanner values can +// be `null`, regardless of type; `null`s are always encoded as a JSON +// `null`. +enum TypeCode { + // Not specified. + TYPE_CODE_UNSPECIFIED = 0; + + // Encoded as JSON `true` or `false`. + BOOL = 1; + + // Encoded as `string`, in decimal format. + INT64 = 2; + + // Encoded as `number`, or the strings `"NaN"`, `"Infinity"`, or + // `"-Infinity"`. + FLOAT64 = 3; + + // Encoded as `string` in RFC 3339 timestamp format. The time zone + // must be present, and must be `"Z"`. + TIMESTAMP = 4; + + // Encoded as `string` in RFC 3339 date format. + DATE = 5; + + // Encoded as `string`. + STRING = 6; + + // Encoded as a base64-encoded `string`, as described in RFC 4648, + // section 4. + BYTES = 7; + + // Encoded as `list`, where the list elements are represented + // according to [array_element_type][google.spanner.v1.Type.array_element_type]. + ARRAY = 8; + + // Encoded as `list`, where list element `i` is represented according + // to [struct_type.fields[i]][google.spanner.v1.StructType.fields]. + STRUCT = 9; +} diff --git a/handwritten/cloud-profiler/google/storagetransfer/v1/transfer.proto b/handwritten/cloud-profiler/google/storagetransfer/v1/transfer.proto new file mode 100644 index 00000000000..5b11438dd2e --- /dev/null +++ b/handwritten/cloud-profiler/google/storagetransfer/v1/transfer.proto @@ -0,0 +1,168 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.storagetransfer.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/storagetransfer/v1/transfer_types.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/storagetransfer/v1;storagetransfer"; +option java_outer_classname = "TransferProto"; +option java_package = "com.google.storagetransfer.v1.proto"; + + +// Transfers data between between Google Cloud Storage buckets or from a data +// source external to Google to a Cloud Storage bucket. +service StorageTransferService { + // Returns the Google service account that is used by Storage Transfer + // Service to access buckets in the project where transfers + // run or in other projects. Each Google service account is associated + // with one Google Cloud Platform Console project. Users + // should add this service account to the Google Cloud Storage bucket + // ACLs to grant access to Storage Transfer Service. This service + // account is created and owned by Storage Transfer Service and can + // only be used by Storage Transfer Service. + rpc GetGoogleServiceAccount(GetGoogleServiceAccountRequest) returns (GoogleServiceAccount) { + option (google.api.http) = { get: "/v1/googleServiceAccounts/{project_id}" }; + } + + // Creates a transfer job that runs periodically. + rpc CreateTransferJob(CreateTransferJobRequest) returns (TransferJob) { + option (google.api.http) = { post: "/v1/transferJobs" body: "transfer_job" }; + } + + // Updates a transfer job. Updating a job's transfer spec does not affect + // transfer operations that are running already. Updating the scheduling + // of a job is not allowed. + rpc UpdateTransferJob(UpdateTransferJobRequest) returns (TransferJob) { + option (google.api.http) = { patch: "/v1/{job_name=transferJobs/**}" body: "*" }; + } + + // Gets a transfer job. + rpc GetTransferJob(GetTransferJobRequest) returns (TransferJob) { + option (google.api.http) = { get: "/v1/{job_name=transferJobs/**}" }; + } + + // Lists transfer jobs. + rpc ListTransferJobs(ListTransferJobsRequest) returns (ListTransferJobsResponse) { + option (google.api.http) = { get: "/v1/transferJobs" }; + } + + // Pauses a transfer operation. + rpc PauseTransferOperation(PauseTransferOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1/{name=transferOperations/**}:pause" body: "*" }; + } + + // Resumes a transfer operation that is paused. + rpc ResumeTransferOperation(ResumeTransferOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1/{name=transferOperations/**}:resume" body: "*" }; + } +} + +// Request passed to GetGoogleServiceAccount. +message GetGoogleServiceAccountRequest { + // The ID of the Google Cloud Platform Console project that the Google service + // account is associated with. + // Required. + string project_id = 1; +} + +// Request passed to CreateTransferJob. +message CreateTransferJobRequest { + // The job to create. + // Required. + TransferJob transfer_job = 1; +} + +// Request passed to UpdateTransferJob. +message UpdateTransferJobRequest { + // The name of job to update. + // Required. + string job_name = 1; + + // The ID of the Google Cloud Platform Console project that owns the job. + // Required. + string project_id = 2; + + // The job to update. + // Required. + TransferJob transfer_job = 3; + + // The field mask of the fields in `transferJob` that are to be updated in + // this request. Fields in `transferJob` that can be updated are: + // `description`, `transferSpec`, and `status`. To update the `transferSpec` + // of the job, a complete transfer specification has to be provided. An + // incomplete specification which misses any required fields will be rejected + // with the error `INVALID_ARGUMENT`. + google.protobuf.FieldMask update_transfer_job_field_mask = 4; +} + +// Request passed to GetTransferJob. +message GetTransferJobRequest { + // The job to get. + // Required. + string job_name = 1; + + // The ID of the Google Cloud Platform Console project that owns the job. + // Required. + string project_id = 2; +} + +// `project_id`, `job_names`, and `job_statuses` are query parameters that can +// be specified when listing transfer jobs. +message ListTransferJobsRequest { + // A list of query parameters specified as JSON text in the form of + // {"project_id":"my_project_id", + // "job_names":["jobid1","jobid2",...], + // "job_statuses":["status1","status2",...]}. + // Since `job_names` and `job_statuses` support multiple values, their values + // must be specified with array notation. `project_id` is required. `job_names` + // and `job_statuses` are optional. The valid values for `job_statuses` are + // case-insensitive: `ENABLED`, `DISABLED`, and `DELETED`. + string filter = 1; + + // The list page size. The max allowed value is 256. + int32 page_size = 4; + + // The list page token. + string page_token = 5; +} + +// Response from ListTransferJobs. +message ListTransferJobsResponse { + // A list of transfer jobs. + repeated TransferJob transfer_jobs = 1; + + // The list next page token. + string next_page_token = 2; +} + +// Request passed to PauseTransferOperation. +message PauseTransferOperationRequest { + // The name of the transfer operation. + // Required. + string name = 1; +} + +// Request passed to ResumeTransferOperation. +message ResumeTransferOperationRequest { + // The name of the transfer operation. + // Required. + string name = 1; +} diff --git a/handwritten/cloud-profiler/google/storagetransfer/v1/transfer_types.proto b/handwritten/cloud-profiler/google/storagetransfer/v1/transfer_types.proto new file mode 100644 index 00000000000..eca7686c4b7 --- /dev/null +++ b/handwritten/cloud-profiler/google/storagetransfer/v1/transfer_types.proto @@ -0,0 +1,443 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.storagetransfer.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/code.proto"; +import "google/type/date.proto"; +import "google/type/timeofday.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/storagetransfer/v1;storagetransfer"; +option java_outer_classname = "TransferTypes"; +option java_package = "com.google.storagetransfer.v1.proto"; + + +// Google service account +message GoogleServiceAccount { + // Required. + string account_email = 1; +} + +// AWS access key (see +// [AWS Security Credentials](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html)). +message AwsAccessKey { + // AWS access key ID. + // Required. + string access_key_id = 1; + + // AWS secret access key. This field is not returned in RPC responses. + // Required. + string secret_access_key = 2; +} + +// Conditions that determine which objects will be transferred. +message ObjectConditions { + // If unspecified, `minTimeElapsedSinceLastModification` takes a zero value + // and `maxTimeElapsedSinceLastModification` takes the maximum possible + // value of Duration. Objects that satisfy the object conditions + // must either have a `lastModificationTime` greater or equal to + // `NOW` - `maxTimeElapsedSinceLastModification` and less than + // `NOW` - `minTimeElapsedSinceLastModification`, or not have a + // `lastModificationTime`. + google.protobuf.Duration min_time_elapsed_since_last_modification = 1; + + // `maxTimeElapsedSinceLastModification` is the complement to + // `minTimeElapsedSinceLastModification`. + google.protobuf.Duration max_time_elapsed_since_last_modification = 2; + + // If `includePrefixes` is specified, objects that satisfy the object + // conditions must have names that start with one of the `includePrefixes` + // and that do not start with any of the `excludePrefixes`. If `includePrefixes` + // is not specified, all objects except those that have names starting with + // one of the `excludePrefixes` must satisfy the object conditions. + // + // Requirements: + // + // * Each include-prefix and exclude-prefix can contain any sequence of + // Unicode characters, of max length 1024 bytes when UTF8-encoded, and + // must not contain Carriage Return or Line Feed characters. Wildcard + // matching and regular expression matching are not supported. + // + // * Each include-prefix and exclude-prefix must omit the leading slash. + // For example, to include the `requests.gz` object in a transfer from + // `s3://my-aws-bucket/logs/y=2015/requests.gz`, specify the include + // prefix as `logs/y=2015/requests.gz`. + // + // * None of the include-prefix or the exclude-prefix values can be empty, + // if specified. + // + // * Each include-prefix must include a distinct portion of the object + // namespace, i.e., no include-prefix may be a prefix of another + // include-prefix. + // + // * Each exclude-prefix must exclude a distinct portion of the object + // namespace, i.e., no exclude-prefix may be a prefix of another + // exclude-prefix. + // + // * If `includePrefixes` is specified, then each exclude-prefix must start + // with the value of a path explicitly included by `includePrefixes`. + // + // The max size of `includePrefixes` is 20. + repeated string include_prefixes = 3; + + // `excludePrefixes` must follow the requirements described for + // `includePrefixes`. + // + // The max size of `excludePrefixes` is 20. + repeated string exclude_prefixes = 4; +} + +// In a GcsData, an object's name is the Google Cloud Storage object's name and +// its `lastModificationTime` refers to the object's updated time, which changes +// when the content or the metadata of the object is updated. +message GcsData { + // Google Cloud Storage bucket name (see + // [Bucket Name Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + // Required. + string bucket_name = 1; +} + +// An AwsS3Data can be a data source, but not a data sink. +// In an AwsS3Data, an object's name is the S3 object's key name. +message AwsS3Data { + // S3 Bucket name (see + // [Creating a bucket](http://docs.aws.amazon.com/AmazonS3/latest/dev/create-bucket-get-location-example.html)). + // Required. + string bucket_name = 1; + + // AWS access key used to sign the API requests to the AWS S3 bucket. + // Permissions on the bucket must be granted to the access ID of the + // AWS access key. + // Required. + AwsAccessKey aws_access_key = 2; +} + +// An HttpData specifies a list of objects on the web to be transferred over +// HTTP. The information of the objects to be transferred is contained in a +// file referenced by a URL. The first line in the file must be +// "TsvHttpData-1.0", which specifies the format of the file. Subsequent lines +// specify the information of the list of objects, one object per list entry. +// Each entry has the following tab-delimited fields: +// +// * HTTP URL - The location of the object. +// +// * Length - The size of the object in bytes. +// +// * MD5 - The base64-encoded MD5 hash of the object. +// +// For an example of a valid TSV file, see +// [Transferring data from URLs](https://cloud.google.com/storage/transfer/#urls) +// +// When transferring data based on a URL list, keep the following in mind: +// +// * When an object located at `http(s)://hostname:port/` is transferred +// to a data sink, the name of the object at the data sink is +// `/`. +// +// * If the specified size of an object does not match the actual size of the +// object fetched, the object will not be transferred. +// +// * If the specified MD5 does not match the MD5 computed from the transferred +// bytes, the object transfer will fail. For more information, see +// [Generating MD5 hashes](https://cloud.google.com/storage/transfer/#md5) +// +// * Ensure that each URL you specify is publicly accessible. For +// example, in Google Cloud Storage you can +// [share an object publicly] +// (https://cloud.google.com/storage/docs/cloud-console#_sharingdata) and get +// a link to it. +// +// * Storage Transfer Service obeys `robots.txt` rules and requires the source +// HTTP server to support `Range` requests and to return a `Content-Length` +// header in each response. +// +// * [ObjectConditions](#ObjectConditions) have no effect when filtering objects +// to transfer. +message HttpData { + // The URL that points to the file that stores the object list entries. + // This file must allow public access. Currently, only URLs with HTTP and + // HTTPS schemes are supported. + // Required. + string list_url = 1; +} + +// TransferOptions uses three boolean parameters to define the actions +// to be performed on objects in a transfer. +message TransferOptions { + // Whether overwriting objects that already exist in the sink is allowed. + bool overwrite_objects_already_existing_in_sink = 1; + + // Whether objects that exist only in the sink should be deleted. + bool delete_objects_unique_in_sink = 2; + + // Whether objects should be deleted from the source after they are + // transferred to the sink. + bool delete_objects_from_source_after_transfer = 3; +} + +// Configuration for running a transfer. +message TransferSpec { + // The read source of the data. + oneof data_source { + // A Google Cloud Storage data source. + GcsData gcs_data_source = 1; + + // An AWS S3 data source. + AwsS3Data aws_s3_data_source = 2; + + // An HTTP URL data source. + HttpData http_data_source = 3; + } + + // The write sink for the data. + oneof data_sink { + // A Google Cloud Storage data sink. + GcsData gcs_data_sink = 4; + } + + // Only objects that satisfy these object conditions are included in the set + // of data source and data sink objects. Object conditions based on + // objects' `lastModificationTime` do not exclude objects in a data sink. + ObjectConditions object_conditions = 5; + + // If the option `deleteObjectsUniqueInSink` is `true`, object conditions + // based on objects' `lastModificationTime` are ignored and do not exclude + // objects in a data source or a data sink. + TransferOptions transfer_options = 6; +} + +// Transfers can be scheduled to recur or to run just once. +message Schedule { + // The first day the recurring transfer is scheduled to run. If + // `scheduleStartDate` is in the past, the transfer will run for the first + // time on the following day. + // Required. + google.type.Date schedule_start_date = 1; + + // The last day the recurring transfer will be run. If `scheduleEndDate` + // is the same as `scheduleStartDate`, the transfer will be executed only + // once. + google.type.Date schedule_end_date = 2; + + // The time in UTC at which the transfer will be scheduled to start in a day. + // Transfers may start later than this time. If not specified, recurring and + // one-time transfers that are scheduled to run today will run immediately; + // recurring transfers that are scheduled to run on a future date will start + // at approximately midnight UTC on that date. Note that when configuring a + // transfer with the Cloud Platform Console, the transfer's start time in a + // day is specified in your local timezone. + google.type.TimeOfDay start_time_of_day = 3; +} + +// This resource represents the configuration of a transfer job that runs +// periodically. +message TransferJob { + // The status of the transfer job. + enum Status { + // Zero is an illegal value. + STATUS_UNSPECIFIED = 0; + + // New transfers will be performed based on the schedule. + ENABLED = 1; + + // New transfers will not be scheduled. + DISABLED = 2; + + // This is a soft delete state. After a transfer job is set to this + // state, the job and all the transfer executions are subject to + // garbage collection. + DELETED = 3; + } + + // A globally unique name assigned by Storage Transfer Service when the + // job is created. This field should be left empty in requests to create a new + // transfer job; otherwise, the requests result in an `INVALID_ARGUMENT` + // error. + string name = 1; + + // A description provided by the user for the job. Its max length is 1024 + // bytes when Unicode-encoded. + string description = 2; + + // The ID of the Google Cloud Platform Console project that owns the job. + // Required. + string project_id = 3; + + // Transfer specification. + // Required. + TransferSpec transfer_spec = 4; + + // Schedule specification. + // Required. + Schedule schedule = 5; + + // Status of the job. This value MUST be specified for + // `CreateTransferJobRequests`. + // + // NOTE: The effect of the new job status takes place during a subsequent job + // run. For example, if you change the job status from `ENABLED` to + // `DISABLED`, and an operation spawned by the transfer is running, the status + // change would not affect the current operation. + Status status = 6; + + // This field cannot be changed by user requests. + google.protobuf.Timestamp creation_time = 7; + + // This field cannot be changed by user requests. + google.protobuf.Timestamp last_modification_time = 8; + + // This field cannot be changed by user requests. + google.protobuf.Timestamp deletion_time = 9; +} + +// An entry describing an error that has occurred. +message ErrorLogEntry { + // A URL that refers to the target (a data source, a data sink, + // or an object) with which the error is associated. + // Required. + string url = 1; + + // A list of messages that carry the error details. + repeated string error_details = 3; +} + +// A summary of errors by error code, plus a count and sample error log +// entries. +message ErrorSummary { + // Required. + google.rpc.Code error_code = 1; + + // Count of this type of error. + // Required. + int64 error_count = 2; + + // Error samples. + repeated ErrorLogEntry error_log_entries = 3; +} + +// A collection of counters that report the progress of a transfer operation. +message TransferCounters { + // Objects found in the data source that are scheduled to be transferred, + // which will be copied, excluded based on conditions, or skipped due to + // failures. + int64 objects_found_from_source = 1; + + // Bytes found in the data source that are scheduled to be transferred, + // which will be copied, excluded based on conditions, or skipped due to + // failures. + int64 bytes_found_from_source = 2; + + // Objects found only in the data sink that are scheduled to be deleted. + int64 objects_found_only_from_sink = 3; + + // Bytes found only in the data sink that are scheduled to be deleted. + int64 bytes_found_only_from_sink = 4; + + // Objects in the data source that are not transferred because they already + // exist in the data sink. + int64 objects_from_source_skipped_by_sync = 5; + + // Bytes in the data source that are not transferred because they already + // exist in the data sink. + int64 bytes_from_source_skipped_by_sync = 6; + + // Objects that are copied to the data sink. + int64 objects_copied_to_sink = 7; + + // Bytes that are copied to the data sink. + int64 bytes_copied_to_sink = 8; + + // Objects that are deleted from the data source. + int64 objects_deleted_from_source = 9; + + // Bytes that are deleted from the data source. + int64 bytes_deleted_from_source = 10; + + // Objects that are deleted from the data sink. + int64 objects_deleted_from_sink = 11; + + // Bytes that are deleted from the data sink. + int64 bytes_deleted_from_sink = 12; + + // Objects in the data source that failed during the transfer. + int64 objects_from_source_failed = 13; + + // Bytes in the data source that failed during the transfer. + int64 bytes_from_source_failed = 14; + + // Objects that failed to be deleted from the data sink. + int64 objects_failed_to_delete_from_sink = 15; + + // Bytes that failed to be deleted from the data sink. + int64 bytes_failed_to_delete_from_sink = 16; +} + +// A description of the execution of a transfer. +message TransferOperation { + // The status of a TransferOperation. + enum Status { + // Zero is an illegal value. + STATUS_UNSPECIFIED = 0; + + // In progress. + IN_PROGRESS = 1; + + // Paused. + PAUSED = 2; + + // Completed successfully. + SUCCESS = 3; + + // Terminated due to an unrecoverable failure. + FAILED = 4; + + // Aborted by the user. + ABORTED = 5; + } + + // A globally unique ID assigned by the system. + string name = 1; + + // The ID of the Google Cloud Platform Console project that owns the operation. + // Required. + string project_id = 2; + + // Transfer specification. + // Required. + TransferSpec transfer_spec = 3; + + // Start time of this transfer execution. + google.protobuf.Timestamp start_time = 4; + + // End time of this transfer execution. + google.protobuf.Timestamp end_time = 5; + + // Status of the transfer operation. + Status status = 6; + + // Information about the progress of the transfer operation. + TransferCounters counters = 7; + + // Summarizes errors encountered with sample error log entries. + repeated ErrorSummary error_breakdowns = 8; + + // The name of the transfer job that triggers this transfer operation. + string transfer_job_name = 9; +} diff --git a/handwritten/cloud-profiler/google/streetview/publish/README.md b/handwritten/cloud-profiler/google/streetview/publish/README.md new file mode 100644 index 00000000000..d8f3534bdfc --- /dev/null +++ b/handwritten/cloud-profiler/google/streetview/publish/README.md @@ -0,0 +1 @@ +An API to contribute 360 photos to Google Street View. The API also allows the users to connect photos, update metadata of the photos, generate photo collections, and delete photos. \ No newline at end of file diff --git a/handwritten/cloud-profiler/google/streetview/publish/artman_streetview_publish.yaml b/handwritten/cloud-profiler/google/streetview/publish/artman_streetview_publish.yaml new file mode 100644 index 00000000000..574ef522885 --- /dev/null +++ b/handwritten/cloud-profiler/google/streetview/publish/artman_streetview_publish.yaml @@ -0,0 +1,27 @@ +common: + api_name: streetview_publish + api_version: v1 + organization_name: google-maps + service_yaml: streetview_publish.yaml + gapic_yaml: streetview_publish_gapic.yaml + src_proto_paths: + - v1 + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + language: JAVA +- name: python_gapic + language: PYTHON +- name: php_gapic + language: PHP +- name: ruby_gapic + language: RUBY +- name: go_gapic + language: GO +- name: csharp_gapic + language: CSHARP +- name: nodejs_gapic + language: NODEJS +- name: gapic_config + type: GAPIC_CONFIG diff --git a/handwritten/cloud-profiler/google/streetview/publish/streetview_publish.yaml b/handwritten/cloud-profiler/google/streetview/publish/streetview_publish.yaml new file mode 100644 index 00000000000..5a75cf8e792 --- /dev/null +++ b/handwritten/cloud-profiler/google/streetview/publish/streetview_publish.yaml @@ -0,0 +1,27 @@ + +type: google.api.Service +config_version: 3 +name: streetviewpublish.googleapis.com +title: Street View Publish API + +apis: +- name: google.streetview.publish.v1.StreetViewPublishService + +documentation: + summary: |- + The Street View Publish API allows your application to publish 360 photos to + Google Maps, along with image metadata that specifies the position, + orientation, and connectivity of each photo. With this API, any app can + offer an interface for positioning, connecting, and uploading user-generated + Street View images. + overview: |- + An API to contribute 360 photos to Google Street View. The API also allows + the users to connect photos, update metadata of the photos, generate photo + collections, and delete photos. + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: >- + https://www.googleapis.com/auth/streetviewpublish diff --git a/handwritten/cloud-profiler/google/streetview/publish/streetview_publish_gapic.yaml b/handwritten/cloud-profiler/google/streetview/publish/streetview_publish_gapic.yaml new file mode 100644 index 00000000000..1f67df36a3c --- /dev/null +++ b/handwritten/cloud-profiler/google/streetview/publish/streetview_publish_gapic.yaml @@ -0,0 +1,152 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.streetview.publish.v1 + python: + package_name: google.streetview.publish_v1.gapic + go: + # Seems to match other formats, e.g. + # https://github.com/google/google-api-go-client/blob/master/examples/youtube.go + package_name: google.golang.org/api/streetviewpublish/v1 + csharp: + package_name: Google.Streetview.Publish.V1 + ruby: + package_name: Google::Streetview::Publish::V1 + php: + package_name: Google\Streetview\Publish\V1 + nodejs: + package_name: google.streetview.publish.v1 +license_header: + copyright_file: copyright-google.txt + license_file: license-header-apache-2.0.txt +interfaces: +- name: google.streetview.publish.v1.StreetViewPublishService + smoke_test: + method: CreatePhoto + collections: [] + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + methods: + - name: StartUpload + request_object_method: false + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: CreatePhoto + flattening: + groups: + - parameters: + - photo + required_fields: + - photo + request_object_method: false + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: GetPhoto + flattening: + groups: + - parameters: + - photo_id + - view + required_fields: + - photo_id + - view + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: BatchGetPhotos + flattening: + groups: + - parameters: + - photo_ids + - view + required_fields: + - photo_ids + - view + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: ListPhotos + flattening: + groups: + - parameters: + - view + - filter + required_fields: + - view + - filter + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: photos + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: UpdatePhoto + flattening: + groups: + - parameters: + - photo + - update_mask + required_fields: + - photo + - update_mask + request_object_method: true + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: BatchUpdatePhotos + flattening: + groups: + - parameters: + - update_photo_requests + required_fields: + - update_photo_requests + request_object_method: false + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: DeletePhoto + flattening: + groups: + - parameters: + - photo_id + required_fields: + - photo_id + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: BatchDeletePhotos + flattening: + groups: + - parameters: + - photo_ids + required_fields: + - photo_ids + request_object_method: false + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 diff --git a/handwritten/cloud-profiler/google/streetview/publish/v1/resources.proto b/handwritten/cloud-profiler/google/streetview/publish/v1/resources.proto new file mode 100644 index 00000000000..69a75f5efba --- /dev/null +++ b/handwritten/cloud-profiler/google/streetview/publish/v1/resources.proto @@ -0,0 +1,144 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.streetview.publish.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/latlng.proto"; + +option go_package = "google.golang.org/genproto/googleapis/streetview/publish/v1;publish"; +option java_outer_classname = "StreetViewPublishResources"; +option java_package = "com.google.geo.ugc.streetview.publish.v1"; + + +// Upload reference for media files. +message UploadRef { + // Required. An upload reference should be unique for each user. It follows + // the form: + // "https://streetviewpublish.googleapis.com/media/user//photo/" + string upload_url = 1; +} + +// Identifier for a photo. +message PhotoId { + // Required. A base64 encoded identifier. + string id = 1; +} + +// Level information containing level number and its corresponding name. +message Level { + // Floor number, used for ordering. 0 indicates the ground level, 1 indicates + // the first level above ground level, -1 indicates the first level under + // ground level. Non-integer values are OK. + double number = 1; + + // Required. A name assigned to this Level, restricted to 3 characters. + // Consider how the elevator buttons would be labeled for this level if there + // was an elevator. + string name = 2; +} + +// Raw pose measurement for an entity. +message Pose { + // Latitude and longitude pair of the pose, as explained here: + // https://cloud.google.com/datastore/docs/reference/rest/Shared.Types/LatLng + // When creating a photo, if the latitude and longitude pair are not provided + // here, the geolocation from the exif header will be used. + // If the latitude and longitude pair is not provided and cannot be found in + // the exif header, the create photo process will fail. + google.type.LatLng lat_lng_pair = 1; + + // Altitude of the pose in meters above ground level (as defined by WGS84). + // NaN indicates an unmeasured quantity. + double altitude = 2; + + // The following pose parameters pertain to the center of the photo. They + // match https://developers.google.com/streetview/spherical-metadata. + + // Compass heading, measured at the center of the photo in degrees clockwise + // from North. Value must be >=0 and <360. + // NaN indicates an unmeasured quantity. + double heading = 3; + + // Pitch, measured at the center of the photo in degrees. Value must be >=-90 + // and <= 90. A value of -90 means looking directly down, and a value of 90 + // means looking directly up. + // NaN indicates an unmeasured quantity. + double pitch = 4; + + // Roll, measured in degrees. Value must be >= 0 and <360. A value of 0 + // means level with the horizon. + // NaN indicates an unmeasured quantity. + double roll = 5; + + // Level (the floor in a building) used to configure vertical navigation. + Level level = 7; +} + +// Place metadata for an entity. +message Place { + // Required. Place identifier, as described in + // https://developers.google.com/places/place-id. + string place_id = 1; +} + +// A connection is the link from a source photo to a destination photo. +message Connection { + // Required. The destination of the connection from the containing photo to + // another photo. + PhotoId target = 1; +} + +// Photo is used to store 360 photos along with photo metadata. +message Photo { + // Output only. Identifier for the photo, which is unique among all photos in + // Google. + PhotoId photo_id = 1; + + // Required (when creating photo). Input only. The resource URL where the + // photo bytes are uploaded to. + UploadRef upload_reference = 2; + + // Output only. The download URL for the photo bytes. This field is set only + // when the `view` parameter in a `GetPhotoRequest` is set to + // `INCLUDE_DOWNLOAD_URL`. + string download_url = 3; + + // Output only. The thumbnail URL for showing a preview of the given photo. + string thumbnail_url = 9; + + // Output only. The share link for the photo. + string share_link = 11; + + // Pose of the photo. + Pose pose = 4; + + // Connections to other photos. A connection represents the link from this + // photo to another photo. + repeated Connection connections = 5; + + // Absolute time when the photo was captured. + // When the photo has no exif timestamp, this is used to set a timestamp in + // the photo metadata. + google.protobuf.Timestamp capture_time = 6; + + // Places where this photo belongs. + repeated Place places = 7; + + // Output only. View count of the photo. + int64 view_count = 10; +} diff --git a/handwritten/cloud-profiler/google/streetview/publish/v1/rpcmessages.proto b/handwritten/cloud-profiler/google/streetview/publish/v1/rpcmessages.proto new file mode 100644 index 00000000000..1467e9e75b7 --- /dev/null +++ b/handwritten/cloud-profiler/google/streetview/publish/v1/rpcmessages.proto @@ -0,0 +1,199 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.streetview.publish.v1; + +import "google/protobuf/field_mask.proto"; +import "google/rpc/status.proto"; +import "google/streetview/publish/v1/resources.proto"; + +option go_package = "google.golang.org/genproto/googleapis/streetview/publish/v1;publish"; +option java_outer_classname = "StreetViewPublishRpcMessages"; +option java_package = "com.google.geo.ugc.streetview.publish.v1"; + + +// Request to create a photo. +message CreatePhotoRequest { + // Required. Photo to create. + Photo photo = 1; +} + +// Request to get a photo. +// +// By default +// - does not return the download URL for the photo bytes. +// +// Parameters: +// - 'view' controls if the download URL for the photo bytes will be returned. +message GetPhotoRequest { + // Required. ID of the photo. + string photo_id = 1; + + // Specifies if a download URL for the photo bytes should be returned in the + // Photo response. + PhotoView view = 2; +} + +// Request to get one or more photos. +// By default +// - does not return the download URL for the photo bytes. +// +// Parameters: +// - 'view' controls if the download URL for the photo bytes will be returned. +message BatchGetPhotosRequest { + // Required. IDs of the photos. + repeated string photo_ids = 1; + + // Specifies if a download URL for the photo bytes should be returned in the + // Photo response. + PhotoView view = 2; +} + +// Response to batch get of photos. +message BatchGetPhotosResponse { + // List of results for each individual photo requested, in the same order as + // the request. + repeated PhotoResponse results = 1; +} + +// Response payload for a single `Photo` in batch operations including +// `BatchGetPhotosRequest` and `BatchUpdatePhotosRequest`. +message PhotoResponse { + // The status for the operation to get or update a single photo in the batch + // request. + google.rpc.Status status = 1; + + // The photo resource, if the request was successful. + Photo photo = 2; +} + +// Request to list all photos that belong to the user sending the request. +// +// By default +// - does not return the download URL for the photo bytes. +// +// Parameters: +// - 'view' controls if the download URL for the photo bytes will be returned. +// - 'page_size' determines the maximum number of photos to return. +// - 'page_token' is the next page token value returned from a previous List +// request, if any. +message ListPhotosRequest { + // Specifies if a download URL for the photos bytes should be returned in the + // Photos response. + PhotoView view = 1; + + // The maximum number of photos to return. + // `page_size` must be non-negative. If `page_size` is zero or is not + // provided, the default page size of 100 will be used. + // The number of photos returned in the response may be less than `page_size` + // if the number of photos that belong to the user is less than `page_size`. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; + + // The filter expression. + // Example: `placeId=ChIJj61dQgK6j4AR4GeTYWZsKWw` + string filter = 4; +} + +// Response to list all photos that belong to a user. +message ListPhotosResponse { + // List of photos. There will be a maximum number of items returned based on + // the page_size field in the request. + repeated Photo photos = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request to update the metadata of a photo. +// Updating the pixels of a photo is not supported. +message UpdatePhotoRequest { + // Required. Photo object containing the new metadata. Only the fields + // specified in `update_mask` are used. If `update_mask` is not present, the + // update applies to all fields. + // **Note:** To update `pose.altitude`, `pose.latlngpair` has to be filled as + // well. Otherwise, the request will fail. + Photo photo = 1; + + // Mask that identifies fields on the photo metadata to update. + // If not present, the old Photo metadata will be entirely replaced with the + // new Photo metadata in this request. The update fails if invalid fields are + // specified. Multiple fields can be specified in a comma-delimited list. + // + // The following fields are valid: + // + // * `pose.heading` + // * `pose.latlngpair` + // * `pose.pitch` + // * `pose.roll` + // * `pose.level` + // * `pose.altitude` + // * `connections` + // * `places` + // + // + // **Note:** Repeated fields in `update_mask` mean the entire set of repeated + // values will be replaced with the new contents. For example, if + // `UpdatePhotoRequest.photo.update_mask` contains `connections` and + // `UpdatePhotoRequest.photo.connections` is empty, all connections will be + // removed. + google.protobuf.FieldMask update_mask = 2; +} + +// Request to update the metadata of photos. +// Updating the pixels of photos is not supported. +message BatchUpdatePhotosRequest { + // Required. List of update photo requests. + repeated UpdatePhotoRequest update_photo_requests = 1; +} + +// Response to batch update of metadata of one or more photos. +message BatchUpdatePhotosResponse { + // List of results for each individual photo updated, in the same order as + // the request. + repeated PhotoResponse results = 1; +} + +// Request to delete a photo. +message DeletePhotoRequest { + // Required. ID of the photo. + string photo_id = 1; +} + +// Request to delete multiple photos. +message BatchDeletePhotosRequest { + // Required. List of delete photo requests. + repeated string photo_ids = 1; +} + +// Response to batch delete of one or more photos. +message BatchDeletePhotosResponse { + // The status for the operation to delete a single photo in the batch request. + repeated google.rpc.Status status = 1; +} + +// Specifies which view of the `Photo` should be included in the response. +enum PhotoView { + // Server reponses do not include the download URL for the photo bytes. + // The default value. + BASIC = 0; + + // Server responses include the download URL for the photo bytes. + INCLUDE_DOWNLOAD_URL = 1; +} diff --git a/handwritten/cloud-profiler/google/streetview/publish/v1/streetview_publish.proto b/handwritten/cloud-profiler/google/streetview/publish/v1/streetview_publish.proto new file mode 100644 index 00000000000..e473dda29e3 --- /dev/null +++ b/handwritten/cloud-profiler/google/streetview/publish/v1/streetview_publish.proto @@ -0,0 +1,132 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.streetview.publish.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "google/streetview/publish/v1/resources.proto"; +import "google/streetview/publish/v1/rpcmessages.proto"; + +option go_package = "google.golang.org/genproto/googleapis/streetview/publish/v1;publish"; +option java_outer_classname = "StreetViewPublish"; +option java_package = "com.google.geo.ugc.streetview.publish.v1"; + +// Definition of the service that backs the Street View Publish API. + + + +// Publishes and connects user-contributed photos on Street View. +service StreetViewPublishService { + // Creates an upload session to start uploading photo data. The upload URL of + // the returned `UploadRef` is used to upload the data for the photo. + // + // After the upload is complete, the `UploadRef` is used with + // `StreetViewPublishService:CreatePhoto()` to create the `Photo` object + // entry. + rpc StartUpload(google.protobuf.Empty) returns (UploadRef) { + option (google.api.http) = { post: "/v1/photo:startUpload" body: "*" }; + } + + // After the client finishes uploading the photo with the returned + // `UploadRef`, `photo.create` publishes the uploaded photo to Street View on + // Google Maps. + // + // This method returns the following error codes: + // + // * `INVALID_ARGUMENT` if the request is malformed. + // * `NOT_FOUND` if the upload reference does not exist. + rpc CreatePhoto(CreatePhotoRequest) returns (Photo) { + option (google.api.http) = { post: "/v1/photo" body: "photo" }; + } + + // Gets the metadata of the specified `Photo`. + // + // This method returns the following error codes: + // + // * `PERMISSION_DENIED` if the requesting user did not create the requested + // photo. + // * `NOT_FOUND` if the requested photo does not exist. + rpc GetPhoto(GetPhotoRequest) returns (Photo) { + option (google.api.http) = { get: "/v1/photo/{photo_id}" }; + } + + // Gets the metadata of the specified `Photo` batch. + // + // Note that if `photos.batchGet` fails, either critical fields are + // missing or there was an authentication error. + // Even if `photos.batchGet` succeeds, there may have been failures + // for single photos in the batch. These failures will be specified in + // `BatchGetPhotosResponse.results.status`. + // See `photo.get` for specific failures that will occur per photo. + rpc BatchGetPhotos(BatchGetPhotosRequest) returns (BatchGetPhotosResponse) { + option (google.api.http) = { get: "/v1/photos:batchGet" }; + } + + // Lists all the photos that belong to the user. + rpc ListPhotos(ListPhotosRequest) returns (ListPhotosResponse) { + option (google.api.http) = { get: "/v1/photos" }; + } + + // Updates the metadata of a photo, such as pose, place association, etc. + // Changing the pixels of a photo is not supported. + // + // This method returns the following error codes: + // + // * `PERMISSION_DENIED` if the requesting user did not create the requested + // photo. + // * `INVALID_ARGUMENT` if the request is malformed. + // * `NOT_FOUND` if the photo ID does not exist. + rpc UpdatePhoto(UpdatePhotoRequest) returns (Photo) { + option (google.api.http) = { put: "/v1/photo/{photo.photo_id.id}" body: "photo" }; + } + + // Updates the metadata of photos, such as pose, place association, etc. + // Changing the pixels of a photo is not supported. + // + // Note that if `photos.batchUpdate` fails, either critical fields + // are missing or there was an authentication error. + // Even if `photos.batchUpdate` succeeds, there may have been + // failures for single photos in the batch. These failures will be specified + // in `BatchUpdatePhotosResponse.results.status`. + // See `UpdatePhoto` for specific failures that will occur per photo. + rpc BatchUpdatePhotos(BatchUpdatePhotosRequest) returns (BatchUpdatePhotosResponse) { + option (google.api.http) = { post: "/v1/photos:batchUpdate" body: "*" }; + } + + // Deletes a photo and its metadata. + // + // This method returns the following error codes: + // + // * `PERMISSION_DENIED` if the requesting user did not create the requested + // photo. + // * `NOT_FOUND` if the photo ID does not exist. + rpc DeletePhoto(DeletePhotoRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/photo/{photo_id}" }; + } + + // Deletes a list of photos and their metadata. + // + // Note that if `photos.batchDelete` fails, either critical fields + // are missing or there was an authentication error. + // Even if `photos.batchDelete` succeeds, there may have been + // failures for single photos in the batch. These failures will be specified + // in `BatchDeletePhotosResponse.status`. + // See `photo.update` for specific failures that will occur per photo. + rpc BatchDeletePhotos(BatchDeletePhotosRequest) returns (BatchDeletePhotosResponse) { + option (google.api.http) = { post: "/v1/photos:batchDelete" body: "*" }; + } +} diff --git a/handwritten/cloud-profiler/google/tracing/trace.proto b/handwritten/cloud-profiler/google/tracing/trace.proto new file mode 100644 index 00000000000..dc10a90e58b --- /dev/null +++ b/handwritten/cloud-profiler/google/tracing/trace.proto @@ -0,0 +1,247 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.tracing.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option go_package = "google.golang.org/genproto/googleapis/tracing/v1;tracing"; +option java_multiple_files = true; +option java_outer_classname = "TraceProto"; +option java_package = "com.google.tracing.v1"; + + +// A TraceId uniquely identifies a Trace. It is conceptually a 128-bit value, +// represented as a string, containing the hex-encoded value. +message TraceId { + // Trace ID specified as a hex-encoded string. *Must* be 32 bytes long. + string hex_encoded = 1; +} + +message Module { + // Binary module. + // E.g. main binary, kernel modules, and dynamic libraries + // such as libc.so, sharedlib.so + string module = 1; + + // Build_id is a unique identifier for the module, + // probably a hash of its contents + string build_id = 2; +} + +message StackTrace { + // Presents a single stack frame in a stack trace. + message StackFrame { + // Fully qualified names which uniquely identify function/method/etc. + string function_name = 1; + + // Used when function name is ‘mangled’. Not guaranteed to be fully + // qualified but usually it is. + string orig_function_name = 2; + + // File name of the frame. + string file_name = 3; + + // Line number of the frame. + int64 line_number = 4; + + // Column number is important in JavaScript(anonymous functions), + // Might not be available in some languages. + int64 column_number = 5; + + // Binary module the code is loaded from. + Module load_module = 6; + + // source_version is deployment specific. It might be + // better to be stored in deployment metadata. + // However, in distributed tracing, it’s hard to keep track of + // source/binary versions at one place for all spans. + string source_version = 7; + } + + // Stack frames of this stack trace. + repeated StackFrame stack_frame = 1; + + // User can choose to use his own hash function to hash large labels to save + // network bandwidth and storage. + // Typical usage is to pass both initially to inform the storage of the + // mapping. And in subsequent calls, pass in stack_trace_hash_id only. + // User shall verify the hash value is successfully stored. + uint64 stack_trace_hash_id = 2; +} + +// Allowed label values. +message LabelValue { + // The value of the label. + oneof value { + // A string value. + string string_value = 1; + + // An integer value. + int64 int_value = 2; + + // A boolean value. + bool bool_value = 3; + } +} + +// A span represents a single operation within a trace. Spans can be nested +// and form a trace tree. Often, a trace contains a root span that describes the +// end-to-end latency and, optionally, one or more subspans for +// its sub-operations. Spans do not need to be contiguous. There may be gaps +// between spans in a trace. +message Span { + // A time-stamped annotation in the Span. + message TimeEvent { + // Text annotation with a set of labels. + message Annotation { + // A user-supplied message describing the event. + string description = 1; + + // A set of labels on the annotation. + map labels = 2; + } + + // An event describing an RPC message sent/received on the network. + message NetworkEvent { + // The type of the network event. SENT or RECV event. + enum Type { + UNSPECIFIED = 0; + + SENT = 1; + + RECV = 2; + } + + // If available, this is the kernel time: + // For sent messages, this is the time at which the first bit was sent. + // For received messages, this is the time at which the last bit was + // received. + google.protobuf.Timestamp kernel_time = 1; + + Type type = 2; + + // Every message has an identifier, that must be different from all the + // network messages in this span. + // This is very important when the request/response are streamed. + uint64 message_id = 3; + + // Number of bytes send/receive. + uint64 message_size = 4; + } + + // The local machine absolute timestamp when this event happened. + google.protobuf.Timestamp local_time = 1; + + oneof value { + // Optional field for user supplied map + Annotation annotation = 2; + + // Optional field that can be used only for network events. + NetworkEvent network_event = 3; + } + } + + // Link one span with another which may be in a different Trace. Used (for + // example) in batching operations, where a single batch handler processes + // multiple requests from different traces. + message Link { + // The type of the link. + enum Type { + UNSPECIFIED = 0; + + CHILD = 1; + + PARENT = 2; + } + + // The trace and span identifier of the linked span. + TraceId trace_id = 1; + + fixed64 span_id = 2; + + Type type = 3; + } + + // Identifier for the span. Must be a 64-bit integer other than 0 and + // unique within a trace. + fixed64 id = 1; + + // Name of the span. The span name is sanitized and displayed in the + // Stackdriver Trace tool in the {% dynamic print site_values.console_name %}. + // The name may be a method name or some other per-call site name. + // For the same executable and the same call point, a best practice is + // to use a consistent name, which makes it easier to correlate + // cross-trace spans. + string name = 2; + + // ID of parent span. 0 or missing if this is a root span. + fixed64 parent_id = 3; + + // Local machine clock in nanoseconds from the UNIX epoch, + // at which span execution started. + // On the server side these are the times when the server application + // handler starts running. + google.protobuf.Timestamp local_start_time = 4; + + // Local machine clock in nanoseconds from the UNIX epoch, + // at which span execution ended. + // On the server side these are the times when the server application + // handler finishes running. + google.protobuf.Timestamp local_end_time = 5; + + // Properties of a span. Labels at the span level. + // E.g. + // "/instance_id": "my-instance" + // "/zone": "us-central1-a" + // "/grpc/peer_address": "ip:port" (dns, etc.) + // "/grpc/deadline": "Duration" + // "/http/user_agent" + // "/http/request_bytes": 300 + // "/http/response_bytes": 1200 + // "/http/url": google.com/apis + // "/pid" + // "abc.com/mylabel": "my label value" + map labels = 6; + + // Stack trace captured at the start of the span. This is optional. + StackTrace stack_trace = 7; + + // A collection of time-stamped events. + repeated TimeEvent time_events = 8; + + // A collection of links. + repeated Link links = 9; + + // The final status of the Span. This is optional. + google.rpc.Status status = 10; + + // True if this Span has a remote parent (is an RPC server Span). + bool has_remote_parent = 11; +} + +// A trace describes how long it takes for an application to perform some +// operations. It consists of a tree of spans, each of which contains details +// about an operation with time information and operation details. +message Trace { + // Globally unique identifier for the trace. Common to all the spans. + TraceId trace_id = 1; + + // Collection of spans in the trace. The root span has parent_id == 0. + repeated Span spans = 2; +} diff --git a/handwritten/cloud-profiler/google/type/README.md b/handwritten/cloud-profiler/google/type/README.md new file mode 100644 index 00000000000..6caf02cf1f5 --- /dev/null +++ b/handwritten/cloud-profiler/google/type/README.md @@ -0,0 +1,16 @@ +# Google Common Types + +This package contains definitions of common types for Google APIs. +All types defined in this package are suitable for different APIs to +exchange data, and will never break binary compatibility. They should +have design quality comparable to major programming languages like +Java and C#. + +NOTE: Some common types are defined in the package `google.protobuf` +as they are directly supported by Protocol Buffers compiler and +runtime. Those types are called Well-Known Types. + +## Java Utilities + +A set of Java utilities for the Common Types are provided in the +`//java/com/google/type/util/` package. \ No newline at end of file diff --git a/handwritten/cloud-profiler/google/type/color.proto b/handwritten/cloud-profiler/google/type/color.proto new file mode 100644 index 00000000000..2856ce91ee8 --- /dev/null +++ b/handwritten/cloud-profiler/google/type/color.proto @@ -0,0 +1,164 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.type; + +import "google/protobuf/wrappers.proto"; + +option go_package = "google.golang.org/genproto/googleapis/type/color;color"; +option java_multiple_files = true; +option java_outer_classname = "ColorProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + + +// Represents a color in the RGBA color space. This representation is designed +// for simplicity of conversion to/from color representations in various +// languages over compactness; for example, the fields of this representation +// can be trivially provided to the constructor of "java.awt.Color" in Java; it +// can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" +// method in iOS; and, with just a little work, it can be easily formatted into +// a CSS "rgba()" string in JavaScript, as well. Here are some examples: +// +// Example (Java): +// +// import com.google.type.Color; +// +// // ... +// public static java.awt.Color fromProto(Color protocolor) { +// float alpha = protocolor.hasAlpha() +// ? protocolor.getAlpha().getValue() +// : 1.0; +// +// return new java.awt.Color( +// protocolor.getRed(), +// protocolor.getGreen(), +// protocolor.getBlue(), +// alpha); +// } +// +// public static Color toProto(java.awt.Color color) { +// float red = (float) color.getRed(); +// float green = (float) color.getGreen(); +// float blue = (float) color.getBlue(); +// float denominator = 255.0; +// Color.Builder resultBuilder = +// Color +// .newBuilder() +// .setRed(red / denominator) +// .setGreen(green / denominator) +// .setBlue(blue / denominator); +// int alpha = color.getAlpha(); +// if (alpha != 255) { +// result.setAlpha( +// FloatValue +// .newBuilder() +// .setValue(((float) alpha) / denominator) +// .build()); +// } +// return resultBuilder.build(); +// } +// // ... +// +// Example (iOS / Obj-C): +// +// // ... +// static UIColor* fromProto(Color* protocolor) { +// float red = [protocolor red]; +// float green = [protocolor green]; +// float blue = [protocolor blue]; +// FloatValue* alpha_wrapper = [protocolor alpha]; +// float alpha = 1.0; +// if (alpha_wrapper != nil) { +// alpha = [alpha_wrapper value]; +// } +// return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; +// } +// +// static Color* toProto(UIColor* color) { +// CGFloat red, green, blue, alpha; +// if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { +// return nil; +// } +// Color* result = [Color alloc] init]; +// [result setRed:red]; +// [result setGreen:green]; +// [result setBlue:blue]; +// if (alpha <= 0.9999) { +// [result setAlpha:floatWrapperWithValue(alpha)]; +// } +// [result autorelease]; +// return result; +// } +// // ... +// +// Example (JavaScript): +// +// // ... +// +// var protoToCssColor = function(rgb_color) { +// var redFrac = rgb_color.red || 0.0; +// var greenFrac = rgb_color.green || 0.0; +// var blueFrac = rgb_color.blue || 0.0; +// var red = Math.floor(redFrac * 255); +// var green = Math.floor(greenFrac * 255); +// var blue = Math.floor(blueFrac * 255); +// +// if (!('alpha' in rgb_color)) { +// return rgbToCssColor_(red, green, blue); +// } +// +// var alphaFrac = rgb_color.alpha.value || 0.0; +// var rgbParams = [red, green, blue].join(','); +// return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); +// }; +// +// var rgbToCssColor_ = function(red, green, blue) { +// var rgbNumber = new Number((red << 16) | (green << 8) | blue); +// var hexString = rgbNumber.toString(16); +// var missingZeros = 6 - hexString.length; +// var resultBuilder = ['#']; +// for (var i = 0; i < missingZeros; i++) { +// resultBuilder.push('0'); +// } +// resultBuilder.push(hexString); +// return resultBuilder.join(''); +// }; +// +// // ... +message Color { + // The amount of red in the color as a value in the interval [0, 1]. + float red = 1; + + // The amount of green in the color as a value in the interval [0, 1]. + float green = 2; + + // The amount of blue in the color as a value in the interval [0, 1]. + float blue = 3; + + // The fraction of this color that should be applied to the pixel. That is, + // the final pixel color is defined by the equation: + // + // pixel color = alpha * (this color) + (1.0 - alpha) * (background color) + // + // This means that a value of 1.0 corresponds to a solid color, whereas + // a value of 0.0 corresponds to a completely transparent color. This + // uses a wrapper message rather than a simple float scalar so that it is + // possible to distinguish between a default value and the value being unset. + // If omitted, this color object is to be rendered as a solid color + // (as if the alpha value had been explicitly given with a value of 1.0). + google.protobuf.FloatValue alpha = 4; +} diff --git a/handwritten/cloud-profiler/google/type/date.proto b/handwritten/cloud-profiler/google/type/date.proto new file mode 100644 index 00000000000..d873ed462f8 --- /dev/null +++ b/handwritten/cloud-profiler/google/type/date.proto @@ -0,0 +1,45 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.type; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/type/date;date"; +option java_multiple_files = true; +option java_outer_classname = "DateProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + + +// Represents a whole calendar date, e.g. date of birth. The time of day and +// time zone are either specified elsewhere or are not significant. The date +// is relative to the Proleptic Gregorian Calendar. The day may be 0 to +// represent a year and month where the day is not significant, e.g. credit card +// expiration date. The year may be 0 to represent a month and day independent +// of year, e.g. anniversary date. Related types are [google.type.TimeOfDay][google.type.TimeOfDay] +// and `google.protobuf.Timestamp`. +message Date { + // Year of date. Must be from 1 to 9999, or 0 if specifying a date without + // a year. + int32 year = 1; + + // Month of year. Must be from 1 to 12. + int32 month = 2; + + // Day of month. Must be from 1 to 31 and valid for the year and month, or 0 + // if specifying a year/month where the day is not significant. + int32 day = 3; +} diff --git a/handwritten/cloud-profiler/google/type/dayofweek.proto b/handwritten/cloud-profiler/google/type/dayofweek.proto new file mode 100644 index 00000000000..4eaa9e729f7 --- /dev/null +++ b/handwritten/cloud-profiler/google/type/dayofweek.proto @@ -0,0 +1,51 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.type; + +option go_package = "google.golang.org/genproto/googleapis/type/dayofweek;dayofweek"; +option java_multiple_files = true; +option java_outer_classname = "DayOfWeekProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + + +// Represents a day of week. +enum DayOfWeek { + // The unspecified day-of-week. + DAY_OF_WEEK_UNSPECIFIED = 0; + + // The day-of-week of Monday. + MONDAY = 1; + + // The day-of-week of Tuesday. + TUESDAY = 2; + + // The day-of-week of Wednesday. + WEDNESDAY = 3; + + // The day-of-week of Thursday. + THURSDAY = 4; + + // The day-of-week of Friday. + FRIDAY = 5; + + // The day-of-week of Saturday. + SATURDAY = 6; + + // The day-of-week of Sunday. + SUNDAY = 7; +} diff --git a/handwritten/cloud-profiler/google/type/latlng.proto b/handwritten/cloud-profiler/google/type/latlng.proto new file mode 100644 index 00000000000..4e8c65d227a --- /dev/null +++ b/handwritten/cloud-profiler/google/type/latlng.proto @@ -0,0 +1,71 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.type; + +option go_package = "google.golang.org/genproto/googleapis/type/latlng;latlng"; +option java_multiple_files = true; +option java_outer_classname = "LatLngProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + + +// An object representing a latitude/longitude pair. This is expressed as a pair +// of doubles representing degrees latitude and degrees longitude. Unless +// specified otherwise, this must conform to the +// WGS84 +// standard. Values must be within normalized ranges. +// +// Example of normalization code in Python: +// +// def NormalizeLongitude(longitude): +// """Wraps decimal degrees longitude to [-180.0, 180.0].""" +// q, r = divmod(longitude, 360.0) +// if r > 180.0 or (r == 180.0 and q <= -1.0): +// return r - 360.0 +// return r +// +// def NormalizeLatLng(latitude, longitude): +// """Wraps decimal degrees latitude and longitude to +// [-90.0, 90.0] and [-180.0, 180.0], respectively.""" +// r = latitude % 360.0 +// if r <= 90.0: +// return r, NormalizeLongitude(longitude) +// elif r >= 270.0: +// return r - 360, NormalizeLongitude(longitude) +// else: +// return 180 - r, NormalizeLongitude(longitude + 180.0) +// +// assert 180.0 == NormalizeLongitude(180.0) +// assert -180.0 == NormalizeLongitude(-180.0) +// assert -179.0 == NormalizeLongitude(181.0) +// assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0) +// assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0) +// assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0) +// assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0) +// assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0) +// assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0) +// assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0) +// assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0) +// assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0) +// assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0) +message LatLng { + // The latitude in degrees. It must be in the range [-90.0, +90.0]. + double latitude = 1; + + // The longitude in degrees. It must be in the range [-180.0, +180.0]. + double longitude = 2; +} diff --git a/handwritten/cloud-profiler/google/type/money.proto b/handwritten/cloud-profiler/google/type/money.proto new file mode 100644 index 00000000000..154acc9f295 --- /dev/null +++ b/handwritten/cloud-profiler/google/type/money.proto @@ -0,0 +1,42 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.type; + +option go_package = "google.golang.org/genproto/googleapis/type/money;money"; +option java_multiple_files = true; +option java_outer_classname = "MoneyProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + + +// Represents an amount of money with its currency type. +message Money { + // The 3-letter currency code defined in ISO 4217. + string currency_code = 1; + + // The whole units of the amount. + // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + int64 units = 2; + + // Number of nano (10^-9) units of the amount. + // The value must be between -999,999,999 and +999,999,999 inclusive. + // If `units` is positive, `nanos` must be positive or zero. + // If `units` is zero, `nanos` can be positive, zero, or negative. + // If `units` is negative, `nanos` must be negative or zero. + // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + int32 nanos = 3; +} diff --git a/handwritten/cloud-profiler/google/type/postal_address.proto b/handwritten/cloud-profiler/google/type/postal_address.proto new file mode 100644 index 00000000000..b08b61726ac --- /dev/null +++ b/handwritten/cloud-profiler/google/type/postal_address.proto @@ -0,0 +1,132 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.type; + +option go_package = "google.golang.org/genproto/googleapis/type/postaladdress;postaladdress"; +option java_multiple_files = true; +option java_outer_classname = "PostalAddressProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + + +// Represents a postal address, e.g. for postal delivery or payments addresses. +// Given a postal address, a postal service can deliver items to a premise, P.O. +// Box or similar. +// It is not intended to model geographical locations (roads, towns, +// mountains). +// +// In typical usage an address would be created via user input or from importing +// existing data, depending on the type of process. +// +// Advice on address input / editing: +// - Use an i18n-ready address widget such as +// https://github.com/googlei18n/libaddressinput) +// - Users should not be presented with UI elements for input or editing of +// fields outside countries where that field is used. +// +// For more guidance on how to use this schema, please see: +// https://support.google.com/business/answer/6397478 +message PostalAddress { + // The schema revision of the `PostalAddress`. + // All new revisions **must** be backward compatible with old revisions. + int32 revision = 1; + + // Required. CLDR region code of the country/region of the address. This + // is never inferred and it is up to the user to ensure the value is + // correct. See http://cldr.unicode.org/ and + // http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html + // for details. Example: "CH" for Switzerland. + string region_code = 2; + + // Optional. BCP-47 language code of the contents of this address (if + // known). This is often the UI language of the input form or is expected + // to match one of the languages used in the address' country/region, or their + // transliterated equivalents. + // This can affect formatting in certain countries, but is not critical + // to the correctness of the data and will never affect any validation or + // other non-formatting related operations. + // + // If this value is not known, it should be omitted (rather than specifying a + // possibly incorrect default). + // + // Examples: "zh-Hant", "ja", "ja-Latn", "en". + string language_code = 3; + + // Optional. Postal code of the address. Not all countries use or require + // postal codes to be present, but where they are used, they may trigger + // additional validation with other parts of the address (e.g. state/zip + // validation in the U.S.A.). + string postal_code = 4; + + // Optional. Additional, country-specific, sorting code. This is not used + // in most regions. Where it is used, the value is either a string like + // "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number + // alone, representing the "sector code" (Jamaica), "delivery area indicator" + // (Malawi) or "post office indicator" (e.g. Côte d'Ivoire). + string sorting_code = 5; + + // Optional. Highest administrative subdivision which is used for postal + // addresses of a country or region. + // For example, this can be a state, a province, an oblast, or a prefecture. + // Specifically, for Spain this is the province and not the autonomous + // community (e.g. "Barcelona" and not "Catalonia"). + // Many countries don't use an administrative area in postal addresses. E.g. + // in Switzerland this should be left unpopulated. + string administrative_area = 6; + + // Optional. Generally refers to the city/town portion of the address. + // Examples: US city, IT comune, UK post town. + // In regions of the world where localities are not well defined or do not fit + // into this structure well, leave locality empty and use address_lines. + string locality = 7; + + // Optional. Sublocality of the address. + // For example, this can be neighborhoods, boroughs, districts. + string sublocality = 8; + + // Unstructured address lines describing the lower levels of an address. + // + // Because values in address_lines do not have type information and may + // sometimes contain multiple values in a single field (e.g. + // "Austin, TX"), it is important that the line order is clear. The order of + // address lines should be "envelope order" for the country/region of the + // address. In places where this can vary (e.g. Japan), address_language is + // used to make it explicit (e.g. "ja" for large-to-small ordering and + // "ja-Latn" or "en" for small-to-large). This way, the most specific line of + // an address can be selected based on the language. + // + // The minimum permitted structural representation of an address consists + // of a region_code with all remaining information placed in the + // address_lines. It would be possible to format such an address very + // approximately without geocoding, but no semantic reasoning could be + // made about any of the address components until it was at least + // partially resolved. + // + // Creating an address only containing a region_code and address_lines, and + // then geocoding is the recommended way to handle completely unstructured + // addresses (as opposed to guessing which parts of the address should be + // localities or administrative areas). + repeated string address_lines = 9; + + // Optional. The recipient at the address. + // This field may, under certain circumstances, contain multiline information. + // For example, it might contain "care of" information. + repeated string recipients = 10; + + // Optional. The name of the organization at the address. + string organization = 11; +} diff --git a/handwritten/cloud-profiler/google/type/timeofday.proto b/handwritten/cloud-profiler/google/type/timeofday.proto new file mode 100644 index 00000000000..b130256e223 --- /dev/null +++ b/handwritten/cloud-profiler/google/type/timeofday.proto @@ -0,0 +1,43 @@ +// Copyright 2016 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.type; + +option go_package = "google.golang.org/genproto/googleapis/type/timeofday;timeofday"; +option java_multiple_files = true; +option java_outer_classname = "TimeOfDayProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + + +// Represents a time of day. The date and time zone are either not significant +// or are specified elsewhere. An API may chose to allow leap seconds. Related +// types are [google.type.Date][google.type.Date] and `google.protobuf.Timestamp`. +message TimeOfDay { + // Hours of day in 24 hour format. Should be from 0 to 23. An API may choose + // to allow the value "24:00:00" for scenarios like business closing time. + int32 hours = 1; + + // Minutes of hour of day. Must be from 0 to 59. + int32 minutes = 2; + + // Seconds of minutes of the time. Must normally be from 0 to 59. An API may + // allow the value 60 if it allows leap-seconds. + int32 seconds = 3; + + // Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. + int32 nanos = 4; +} diff --git a/handwritten/cloud-profiler/google/watcher/v1/watch.proto b/handwritten/cloud-profiler/google/watcher/v1/watch.proto new file mode 100644 index 00000000000..b7d1a0bfcd7 --- /dev/null +++ b/handwritten/cloud-profiler/google/watcher/v1/watch.proto @@ -0,0 +1,284 @@ +// Copyright 2017 Google Inc. +// +// 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. + +syntax = "proto3"; + +package google.watcher.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/empty.proto"; + +option go_package = "google.golang.org/genproto/googleapis/watcher/v1;watcher"; +option java_multiple_files = true; +option java_outer_classname = "WatchProto"; +option java_package = "com.google.watcher.v1"; + +// ## API Overview +// +// [Watcher][] lets a client watch for updates to a named entity, such as a +// directory or database table. For each watched entity, the client receives a +// reliable stream of watch events, without re-ordering. +// +// Watching is done by sending an RPC to a service that implements the API. The +// argument to the RPC contains the name of the entity. The result stream +// consists of a sequence of Change messages that the service continues to +// send until the call fails or is cancelled. +// +// ## Data model +// +// This API assumes that each *entity* has a name and a +// set of *elements*, where each element has a name and a value. The +// entity's name must be a unique identifier within the service, such as +// a resource name. What constitutes an entity or element is +// implementation-specific: for example, a file system implementation +// might define an entity as either a directory or a file, and elements would be +// child files or directories of that entity. +// +// The Watch API allows a client to watch an entity E's immediate +// elements or the whole tree rooted at E. Elements are organized into +// a hierarchy ("" at the top; the rest follows the natural hierarchy of the +// namespace of elements that is being watched). For example, when +// recursively watching a filesystem namespace, X is an ancestor of +// X/Y and X/Y/Z). +// +// ## Watch request +// +// When a client makes a request to watch an entity, it can indicate +// whether it wants to receive the initial state of the entity, just +// new changes to the entity, or resume watching from a particular +// point in a previous watch stream, specified with a `resume_marker` value. +// It can also indicate whether it wants to watch only one entity or all +// entities in the subtree rooted at a particular entity's name. +// +// On receiving a watch request for an entity, the server sends one or more +// messages to the client. The first message informs the client that the server +// has registered the client's request: the instant of time when the +// client receives the event is referred to as the client's "watch +// point" for that entity. +// +// ## Atomic delivery +// +// The response stream consists of a sequence of Change messages. Each +// message contains an `continued` bit. A sub-sequence of Change messages with +// `continued=true` followed by a Change message with `continued=false` forms an +// *atomic group*. Systems that support multi-element atomic updates may +// guarantee that all changes resulting from a single atomic +// update are delivered in the same atomic group. It is up to the +// documentation of a particular system that implements the Watch API to +// document whether or not it supports such grouping. We expect that most +// callers will ignore the notion of atomic delivery and the `continued` bit, +// i.e., they will just process each Change message as it is received. +// +// ## Batching +// +// Multiple Change messages may be grouped into a single ChangeBatch message +// to reduce message transfer overhead. A single ChangeBatch may contain many +// atomic groups, or a single atomic group may be split across many +// ChangeBatch messages. +// +// ## Initial State +// +// The first atomic group delivered by a watch call is special. It is +// delivered as soon as possible and contains the initial state of the +// entity being watched. The client should consider itself caught up +// after processing this first atomic group. +// +// The messages in the first atomic group will either refer to the +// entity itself (`Change.element` == "") or to elements inside the +// entity (`Change.element` != ""). Here are the cases to consider: +// +// 1. `resume_marker` is "" or not specified: For every element P +// (including the entity itself) that exists, there will be at least +// one message delivered with element == P and the last such message +// will contain the current state of P. For every element Q +// (including the entity itself) that does not exist, either no +// message will be delivered, or the last message for Q will have +// state == DOES_NOT_EXIST. At least one message for element="" will +// be delivered. +// +// 2. `resume_marker` == "now": there will be exactly one message with +// element = "" and state INITIAL_STATE_SKIPPED. The client cannot +// assume whether or not the entity exists after receiving this +// message. +// +// 3. `resume_marker` has a value R from a preceding watch call on this +// entity: The same messages as described in (1) will be delivered to +// the client, except that any information implied by messages received +// on the preceding call up to and including R may not be +// delivered. The expectation is that the client will start with state +// it had built up from the preceding watch call, apply the changes +// received from this call, and build an up-to-date view of the entity +// without having to fetch a potentially large amount of information +// that has not changed. Note that some information that had already +// been delivered by the preceding call might be delivered again. +// +// ## Ordering and Reliability +// +// The Change messages that apply to a particular element of the entity are +// delivered eventually in order without loss for the duration of the RPC. Note +// however that if multiple Changes apply to the same element, the +// implementation is free to suppress them and deliver just the last one. The +// underlying system must provide the guarantee that any relevant update +// received for an entity E after a client's watch point for E MUST be delivered +// to that client. +// +// These tight guarantees allow for the following simplifications in the client: +// +// 1. The client does not need to have a separate polling loop to make up for +// missed updates. +// +// 2. The client does not need to manage timestamps/versions manually; the +// last update delivered corresponds to the eventual state of the entity. +// +// Example: a calendar entry may have elements named { "starttime", "endtime", +// "attendees" } with corresponding values or it may have a single element name +// "entry" with a serialized proto for the calendar entry. +// +// ## Ordering constraints for parents/descendants +// +// The Watch API provides guarantees regarding the order in which +// messages for a parent and its descendants are delivered: +// +// 1. The creation of an ancestor (i.e., the first EXISTS message for +// the ancestor) is reported before the creation of any of its +// descendants. +// +// 2. The deletion of an ancestor (via a DOES_NOT_EXIST message) +// implies the deletion of all its descendants. The service will +// not deliver any messages for the descendants until the parent +// has been recreated. + + +// The service that a client uses to connect to the watcher system. +// The errors returned by the service are in the canonical error space, +// see [google.rpc.Code][]. +service Watcher { + // Start a streaming RPC to get watch information from the server. + rpc Watch(Request) returns (stream ChangeBatch) { + option (google.api.http) = { get: "/v1/watch" }; + } +} + +// The message used by the client to register interest in an entity. +message Request { + // The `target` value **must** be a valid URL path pointing to an entity + // to watch. Note that the service name **must** be + // removed from the target field (e.g., the target field must say + // "/foo/bar", not "myservice.googleapis.com/foo/bar"). A client is + // also allowed to pass system-specific parameters in the URL that + // are only obeyed by some implementations. Some parameters will be + // implementation-specific. However, some have predefined meaning + // and are listed here: + // + // * recursive = true|false [default=false] + // If set to true, indicates that the client wants to watch all elements + // of entities in the subtree rooted at the entity's name in `target`. For + // descendants that are not the immediate children of the target, the + // `Change.element` will contain slashes. + // + // Note that some namespaces and entities will not support recursive + // watching. When watching such an entity, a client must not set recursive + // to true. Otherwise, it will receive an `UNIMPLEMENTED` error. + // + // Normal URL encoding must be used inside `target`. For example, if a query + // parameter name or value, or the non-query parameter portion of `target` + // contains a special character, it must be %-encoded. We recommend that + // clients and servers use their runtime's URL library to produce and consume + // target values. + string target = 1; + + // The `resume_marker` specifies how much of the existing underlying state is + // delivered to the client when the watch request is received by the + // system. The client can set this marker in one of the following ways to get + // different semantics: + // + // * Parameter is not specified or has the value "". + // Semantics: Fetch initial state. + // The client wants the entity's initial state to be delivered. See the + // description in "Initial State". + // + // * Parameter is set to the string "now" (UTF-8 encoding). + // Semantics: Fetch new changes only. + // The client just wants to get the changes received by the system after + // the watch point. The system may deliver changes from before the watch + // point as well. + // + // * Parameter is set to a value received in an earlier + // `Change.resume_marker` field while watching the same entity. + // Semantics: Resume from a specific point. + // The client wants to receive the changes from a specific point; this + // value must correspond to a value received in the `Change.resume_marker` + // field. The system may deliver changes from before the `resume_marker` + // as well. If the system cannot resume the stream from this point (e.g., + // if it is too far behind in the stream), it can raise the + // `FAILED_PRECONDITION` error. + // + // An implementation MUST support an unspecified parameter and the + // empty string "" marker (initial state fetching) and the "now" marker. + // It need not support resuming from a specific point. + bytes resume_marker = 2; +} + +// A batch of Change messages. +message ChangeBatch { + // A list of Change messages. + repeated Change changes = 1; +} + +// A Change indicates the most recent state of an element. +message Change { + // A reported value can be in one of the following states: + enum State { + // The element exists and its full value is included in data. + EXISTS = 0; + + // The element does not exist. + DOES_NOT_EXIST = 1; + + // Element may or may not exist. Used only for initial state delivery when + // the client is not interested in fetching the initial state. See the + // "Initial State" section above. + INITIAL_STATE_SKIPPED = 2; + + // The element may exist, but some error has occurred. More information is + // available in the data field - the value is a serialized Status + // proto (from [google.rpc.Status][]) + ERROR = 3; + } + + // Name of the element, interpreted relative to the entity's actual + // name. "" refers to the entity itself. The element name is a valid + // UTF-8 string. + string element = 1; + + // The state of the `element`. + State state = 2; + + // The actual change data. This field is present only when `state() == EXISTS` + // or `state() == ERROR`. Please see [google.protobuf.Any][google.protobuf.Any] about how to use + // the Any type. + google.protobuf.Any data = 6; + + // If present, provides a compact representation of all the messages that have + // been received by the caller for the given entity, e.g., it could be a + // sequence number or a multi-part timestamp/version vector. This marker can + // be provided in the Request message, allowing the caller to resume the stream + // watching at a specific point without fetching the initial state. + bytes resume_marker = 4; + + // If true, this Change is followed by more Changes that are in the same group + // as this Change. + bool continued = 5; +} diff --git a/handwritten/cloud-profiler/google/watcher/v1/watcher.yaml b/handwritten/cloud-profiler/google/watcher/v1/watcher.yaml new file mode 100644 index 00000000000..61dbfda7dd0 --- /dev/null +++ b/handwritten/cloud-profiler/google/watcher/v1/watcher.yaml @@ -0,0 +1,7 @@ +type: google.api.Service +config_version: 3 +name: watcher.googleapis.com +title: Google Watcher API + +apis: +- name: google.watcher.v1.Watcher diff --git a/third_party/boringssl-with-bazel b/third_party/boringssl-with-bazel new file mode 160000 index 00000000000..886e7d75368 --- /dev/null +++ b/third_party/boringssl-with-bazel @@ -0,0 +1 @@ +Subproject commit 886e7d75368e3f4fab3f4d0d3584e4abfc557755 diff --git a/third_party/nanopb b/third_party/nanopb new file mode 160000 index 00000000000..ac6405b4b8c --- /dev/null +++ b/third_party/nanopb @@ -0,0 +1 @@ +Subproject commit ac6405b4b8c7b3f449bd19bc3f8b84e6bc9fff77 diff --git a/third_party/protobuf b/third_party/protobuf new file mode 160000 index 00000000000..593e917c176 --- /dev/null +++ b/third_party/protobuf @@ -0,0 +1 @@ +Subproject commit 593e917c176b5bc5aafa57bf9f6030d749d91cd5 diff --git a/third_party/zlib b/third_party/zlib new file mode 160000 index 00000000000..8003d572d7a --- /dev/null +++ b/third_party/zlib @@ -0,0 +1 @@ +Subproject commit 8003d572d7a41438a37e58af14302c2c5928cdd5 From 0494662e701fec201cd9ea38da2daca7b53ad26a Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Sat, 28 Oct 2017 09:14:25 -0700 Subject: [PATCH 018/632] chore: add README.google to third_party/googleapis --- .../third_party/googleapis/.gitignore | 1 - .../third_party/googleapis/README.google | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 handwritten/cloud-profiler/third_party/googleapis/README.google diff --git a/handwritten/cloud-profiler/third_party/googleapis/.gitignore b/handwritten/cloud-profiler/third_party/googleapis/.gitignore index 359b2818f49..ddb043ed8e3 100644 --- a/handwritten/cloud-profiler/third_party/googleapis/.gitignore +++ b/handwritten/cloud-profiler/third_party/googleapis/.gitignore @@ -1,5 +1,4 @@ OWNERS -README.google google/internal google/protobuf .project diff --git a/handwritten/cloud-profiler/third_party/googleapis/README.google b/handwritten/cloud-profiler/third_party/googleapis/README.google new file mode 100644 index 00000000000..921b034899d --- /dev/null +++ b/handwritten/cloud-profiler/third_party/googleapis/README.google @@ -0,0 +1,18 @@ +URL: https://github.com/googleapis/googleapis/commit/95496dc69e37580425a78920633006b14ca154bb +Version: https://github.com/googleapis/googleapis/commit/95496dc69e37580425a78920633006b14ca154bb +License: Apache 2.0 +License File: # LICENSE +Description: + Interface definitions for a small (but growing) set of Google APIs +Local Modifications: + README.google was removed from .gitignore. + Remote submodules were not imported. + + Imported as a git-subtree. + + $ git remote add -f googleapis https://github.com/googleapis/googleapis + $ git subtree add --prefix third_party/googleapis googleapis master --squash + + To update from remote on an ongoing basis: + $ git fetch googleapis + $ git subtree pull --prefix third_party/googleapis googleapis master --squash From b3a39d811320aa76e149e2bb650a9d63d3b13f5f Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Mon, 30 Oct 2017 21:06:13 -0700 Subject: [PATCH 019/632] fix: remove build/ from nyc exclude (#33) Coverage reporting regressed by #29 which added build/ to nyc.exclude configuration. --- handwritten/cloud-profiler/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 638dc2f6c40..59bd02a88b0 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -60,7 +60,6 @@ ], "nyc": { "exclude": [ - "build", "proto" ] } From cfed55cd30d1ced04dcb9802a783abfc3940f5c2 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Mon, 30 Oct 2017 21:36:54 -0700 Subject: [PATCH 020/632] chore: generate js/d.ts from profiler.proto (#32) Fixes: https://github.com/GoogleCloudPlatform/cloud-profiler-nodejs/issues/27 --- handwritten/cloud-profiler/package.json | 4 +- .../cloud-profiler/proto/profiler.d.ts | 3874 ++++++ handwritten/cloud-profiler/proto/profiler.js | 10254 ++++++++++++++++ 3 files changed, 14131 insertions(+), 1 deletion(-) create mode 100644 handwritten/cloud-profiler/proto/profiler.d.ts create mode 100644 handwritten/cloud-profiler/proto/profiler.js diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 59bd02a88b0..5ba9f38ea61 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -14,7 +14,9 @@ "prepare": "npm run compile", "pretest": "npm run compile", "posttest": "npm run check", - "proto:profile": "mkdir -p proto && pbjs -t static-module -w commonjs -o proto/profile.js third_party/proto/profile.proto && pbts -o proto/profile.d.ts proto/profile.js" + "proto": "npm run proto:profile && npm run proto:profiler", + "proto:profile": "mkdir -p proto && pbjs -t static-module -w commonjs -o proto/profile.js third_party/proto/profile.proto && pbts -o proto/profile.d.ts proto/profile.js", + "proto:profiler": "mkdir -p proto && pbjs -t static-module -w commonjs -o proto/profiler.js third_party/googleapis/google/devtools/cloudprofiler/v2/profiler.proto && pbts -o proto/profiler.d.ts proto/profiler.js" }, "author": { "name": "Google Inc." diff --git a/handwritten/cloud-profiler/proto/profiler.d.ts b/handwritten/cloud-profiler/proto/profiler.d.ts new file mode 100644 index 00000000000..c7962cb3b04 --- /dev/null +++ b/handwritten/cloud-profiler/proto/profiler.d.ts @@ -0,0 +1,3874 @@ +import * as $protobuf from "protobufjs"; + +/** Namespace google. */ +export namespace google { + + /** Namespace devtools. */ + namespace devtools { + + /** Namespace cloudprofiler. */ + namespace cloudprofiler { + + /** Namespace v2. */ + namespace v2 { + + /** Represents a ProfilerService */ + class ProfilerService extends $protobuf.rpc.Service { + + /** + * Constructs a new ProfilerService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new ProfilerService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProfilerService; + + /** + * Calls CreateProfile. + * @param request CreateProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Profile + */ + public createProfile(request: google.devtools.cloudprofiler.v2.ICreateProfileRequest, callback: google.devtools.cloudprofiler.v2.ProfilerService.CreateProfileCallback): void; + + /** + * Calls CreateProfile. + * @param request CreateProfileRequest message or plain object + * @returns Promise + */ + public createProfile(request: google.devtools.cloudprofiler.v2.ICreateProfileRequest): Promise; + + /** + * Calls UpdateProfile. + * @param request UpdateProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Profile + */ + public updateProfile(request: google.devtools.cloudprofiler.v2.IUpdateProfileRequest, callback: google.devtools.cloudprofiler.v2.ProfilerService.UpdateProfileCallback): void; + + /** + * Calls UpdateProfile. + * @param request UpdateProfileRequest message or plain object + * @returns Promise + */ + public updateProfile(request: google.devtools.cloudprofiler.v2.IUpdateProfileRequest): Promise; + } + + namespace ProfilerService { + + /** + * Callback as used by {@link google.devtools.cloudprofiler.v2.ProfilerService#createProfile}. + * @param error Error, if any + * @param [response] Profile + */ + type CreateProfileCallback = (error: (Error|null), response?: google.devtools.cloudprofiler.v2.Profile) => void; + + /** + * Callback as used by {@link google.devtools.cloudprofiler.v2.ProfilerService#updateProfile}. + * @param error Error, if any + * @param [response] Profile + */ + type UpdateProfileCallback = (error: (Error|null), response?: google.devtools.cloudprofiler.v2.Profile) => void; + } + + /** Properties of a CreateProfileRequest. */ + interface ICreateProfileRequest { + + /** CreateProfileRequest deployment */ + deployment?: google.devtools.cloudprofiler.v2.IDeployment; + + /** CreateProfileRequest profileType */ + profileType?: google.devtools.cloudprofiler.v2.ProfileType[]; + + /** CreateProfileRequest profile */ + profile?: google.devtools.cloudprofiler.v2.IProfile; + } + + /** Represents a CreateProfileRequest. */ + class CreateProfileRequest { + + /** + * Constructs a new CreateProfileRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.devtools.cloudprofiler.v2.ICreateProfileRequest); + + /** CreateProfileRequest deployment. */ + public deployment?: (google.devtools.cloudprofiler.v2.IDeployment|null); + + /** CreateProfileRequest profileType. */ + public profileType: google.devtools.cloudprofiler.v2.ProfileType[]; + + /** CreateProfileRequest profile. */ + public profile?: (google.devtools.cloudprofiler.v2.IProfile|null); + + /** + * Creates a new CreateProfileRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateProfileRequest instance + */ + public static create(properties?: google.devtools.cloudprofiler.v2.ICreateProfileRequest): google.devtools.cloudprofiler.v2.CreateProfileRequest; + + /** + * Encodes the specified CreateProfileRequest message. Does not implicitly {@link google.devtools.cloudprofiler.v2.CreateProfileRequest.verify|verify} messages. + * @param message CreateProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devtools.cloudprofiler.v2.ICreateProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateProfileRequest message, length delimited. Does not implicitly {@link google.devtools.cloudprofiler.v2.CreateProfileRequest.verify|verify} messages. + * @param message CreateProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devtools.cloudprofiler.v2.ICreateProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateProfileRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devtools.cloudprofiler.v2.CreateProfileRequest; + + /** + * Decodes a CreateProfileRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devtools.cloudprofiler.v2.CreateProfileRequest; + + /** + * Verifies a CreateProfileRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateProfileRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateProfileRequest + */ + public static fromObject(object: { [k: string]: any }): google.devtools.cloudprofiler.v2.CreateProfileRequest; + + /** + * Creates a plain object from a CreateProfileRequest message. Also converts values to other types if specified. + * @param message CreateProfileRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devtools.cloudprofiler.v2.CreateProfileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateProfileRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateProfileRequest. */ + interface IUpdateProfileRequest { + + /** UpdateProfileRequest profile */ + profile?: google.devtools.cloudprofiler.v2.IProfile; + } + + /** Represents an UpdateProfileRequest. */ + class UpdateProfileRequest { + + /** + * Constructs a new UpdateProfileRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.devtools.cloudprofiler.v2.IUpdateProfileRequest); + + /** UpdateProfileRequest profile. */ + public profile?: (google.devtools.cloudprofiler.v2.IProfile|null); + + /** + * Creates a new UpdateProfileRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateProfileRequest instance + */ + public static create(properties?: google.devtools.cloudprofiler.v2.IUpdateProfileRequest): google.devtools.cloudprofiler.v2.UpdateProfileRequest; + + /** + * Encodes the specified UpdateProfileRequest message. Does not implicitly {@link google.devtools.cloudprofiler.v2.UpdateProfileRequest.verify|verify} messages. + * @param message UpdateProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devtools.cloudprofiler.v2.IUpdateProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateProfileRequest message, length delimited. Does not implicitly {@link google.devtools.cloudprofiler.v2.UpdateProfileRequest.verify|verify} messages. + * @param message UpdateProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devtools.cloudprofiler.v2.IUpdateProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateProfileRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devtools.cloudprofiler.v2.UpdateProfileRequest; + + /** + * Decodes an UpdateProfileRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devtools.cloudprofiler.v2.UpdateProfileRequest; + + /** + * Verifies an UpdateProfileRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateProfileRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateProfileRequest + */ + public static fromObject(object: { [k: string]: any }): google.devtools.cloudprofiler.v2.UpdateProfileRequest; + + /** + * Creates a plain object from an UpdateProfileRequest message. Also converts values to other types if specified. + * @param message UpdateProfileRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devtools.cloudprofiler.v2.UpdateProfileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateProfileRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Profile. */ + interface IProfile { + + /** Profile name */ + name?: string; + + /** Profile profileType */ + profileType?: google.devtools.cloudprofiler.v2.ProfileType; + + /** Profile deployment */ + deployment?: google.devtools.cloudprofiler.v2.IDeployment; + + /** Profile duration */ + duration?: google.protobuf.IDuration; + + /** Profile profileBytes */ + profileBytes?: Uint8Array; + + /** Profile labels */ + labels?: { [k: string]: string }; + } + + /** Represents a Profile. */ + class Profile { + + /** + * Constructs a new Profile. + * @param [properties] Properties to set + */ + constructor(properties?: google.devtools.cloudprofiler.v2.IProfile); + + /** Profile name. */ + public name: string; + + /** Profile profileType. */ + public profileType: google.devtools.cloudprofiler.v2.ProfileType; + + /** Profile deployment. */ + public deployment?: (google.devtools.cloudprofiler.v2.IDeployment|null); + + /** Profile duration. */ + public duration?: (google.protobuf.IDuration|null); + + /** Profile profileBytes. */ + public profileBytes: Uint8Array; + + /** Profile labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new Profile instance using the specified properties. + * @param [properties] Properties to set + * @returns Profile instance + */ + public static create(properties?: google.devtools.cloudprofiler.v2.IProfile): google.devtools.cloudprofiler.v2.Profile; + + /** + * Encodes the specified Profile message. Does not implicitly {@link google.devtools.cloudprofiler.v2.Profile.verify|verify} messages. + * @param message Profile message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devtools.cloudprofiler.v2.IProfile, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Profile message, length delimited. Does not implicitly {@link google.devtools.cloudprofiler.v2.Profile.verify|verify} messages. + * @param message Profile message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devtools.cloudprofiler.v2.IProfile, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Profile message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Profile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devtools.cloudprofiler.v2.Profile; + + /** + * Decodes a Profile message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Profile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devtools.cloudprofiler.v2.Profile; + + /** + * Verifies a Profile message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Profile message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Profile + */ + public static fromObject(object: { [k: string]: any }): google.devtools.cloudprofiler.v2.Profile; + + /** + * Creates a plain object from a Profile message. Also converts values to other types if specified. + * @param message Profile + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devtools.cloudprofiler.v2.Profile, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Profile to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Deployment. */ + interface IDeployment { + + /** Deployment projectId */ + projectId?: string; + + /** Deployment target */ + target?: string; + + /** Deployment labels */ + labels?: { [k: string]: string }; + } + + /** Represents a Deployment. */ + class Deployment { + + /** + * Constructs a new Deployment. + * @param [properties] Properties to set + */ + constructor(properties?: google.devtools.cloudprofiler.v2.IDeployment); + + /** Deployment projectId. */ + public projectId: string; + + /** Deployment target. */ + public target: string; + + /** Deployment labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new Deployment instance using the specified properties. + * @param [properties] Properties to set + * @returns Deployment instance + */ + public static create(properties?: google.devtools.cloudprofiler.v2.IDeployment): google.devtools.cloudprofiler.v2.Deployment; + + /** + * Encodes the specified Deployment message. Does not implicitly {@link google.devtools.cloudprofiler.v2.Deployment.verify|verify} messages. + * @param message Deployment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devtools.cloudprofiler.v2.IDeployment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Deployment message, length delimited. Does not implicitly {@link google.devtools.cloudprofiler.v2.Deployment.verify|verify} messages. + * @param message Deployment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devtools.cloudprofiler.v2.IDeployment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Deployment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Deployment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devtools.cloudprofiler.v2.Deployment; + + /** + * Decodes a Deployment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Deployment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devtools.cloudprofiler.v2.Deployment; + + /** + * Verifies a Deployment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Deployment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Deployment + */ + public static fromObject(object: { [k: string]: any }): google.devtools.cloudprofiler.v2.Deployment; + + /** + * Creates a plain object from a Deployment message. Also converts values to other types if specified. + * @param message Deployment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devtools.cloudprofiler.v2.Deployment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Deployment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** ProfileType enum. */ + enum ProfileType { + PROFILE_TYPE_UNSPECIFIED = 0, + CPU = 1, + WALL = 2, + HEAP = 3, + THREADS = 4, + CONTENTION = 5 + } + } + } + } + + /** Namespace api. */ + namespace api { + + /** Properties of a Http. */ + interface IHttp { + + /** Http rules */ + rules?: google.api.IHttpRule[]; + } + + /** Represents a Http. */ + class Http { + + /** + * Constructs a new Http. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttp); + + /** Http rules. */ + public rules: google.api.IHttpRule[]; + + /** + * Creates a new Http instance using the specified properties. + * @param [properties] Properties to set + * @returns Http instance + */ + public static create(properties?: google.api.IHttp): google.api.Http; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Http message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.Http; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.Http; + + /** + * Verifies a Http message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Http + */ + public static fromObject(object: { [k: string]: any }): google.api.Http; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @param message Http + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Http, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Http to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a HttpRule. */ + interface IHttpRule { + + /** HttpRule get */ + get?: string; + + /** HttpRule put */ + put?: string; + + /** HttpRule post */ + post?: string; + + /** HttpRule delete */ + "delete"?: string; + + /** HttpRule patch */ + patch?: string; + + /** HttpRule custom */ + custom?: google.api.ICustomHttpPattern; + + /** HttpRule selector */ + selector?: string; + + /** HttpRule body */ + body?: string; + + /** HttpRule additionalBindings */ + additionalBindings?: google.api.IHttpRule[]; + } + + /** Represents a HttpRule. */ + class HttpRule { + + /** + * Constructs a new HttpRule. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttpRule); + + /** HttpRule get. */ + public get: string; + + /** HttpRule put. */ + public put: string; + + /** HttpRule post. */ + public post: string; + + /** HttpRule delete. */ + public delete_: string; + + /** HttpRule patch. */ + public patch: string; + + /** HttpRule custom. */ + public custom?: (google.api.ICustomHttpPattern|null); + + /** HttpRule selector. */ + public selector: string; + + /** HttpRule body. */ + public body: string; + + /** HttpRule additionalBindings. */ + public additionalBindings: google.api.IHttpRule[]; + + /** HttpRule pattern. */ + public pattern?: string; + + /** + * Creates a new HttpRule instance using the specified properties. + * @param [properties] Properties to set + * @returns HttpRule instance + */ + public static create(properties?: google.api.IHttpRule): google.api.HttpRule; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.HttpRule; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.HttpRule; + + /** + * Verifies a HttpRule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HttpRule + */ + public static fromObject(object: { [k: string]: any }): google.api.HttpRule; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @param message HttpRule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.HttpRule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HttpRule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CustomHttpPattern. */ + interface ICustomHttpPattern { + + /** CustomHttpPattern kind */ + kind?: string; + + /** CustomHttpPattern path */ + path?: string; + } + + /** Represents a CustomHttpPattern. */ + class CustomHttpPattern { + + /** + * Constructs a new CustomHttpPattern. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ICustomHttpPattern); + + /** CustomHttpPattern kind. */ + public kind: string; + + /** CustomHttpPattern path. */ + public path: string; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomHttpPattern instance + */ + public static create(properties?: google.api.ICustomHttpPattern): google.api.CustomHttpPattern; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.CustomHttpPattern; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.CustomHttpPattern; + + /** + * Verifies a CustomHttpPattern message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomHttpPattern + */ + public static fromObject(object: { [k: string]: any }): google.api.CustomHttpPattern; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @param message CustomHttpPattern + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.CustomHttpPattern, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomHttpPattern to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Namespace protobuf. */ + namespace protobuf { + + /** Properties of a FileDescriptorSet. */ + interface IFileDescriptorSet { + + /** FileDescriptorSet file */ + file?: google.protobuf.IFileDescriptorProto[]; + } + + /** Represents a FileDescriptorSet. */ + class FileDescriptorSet { + + /** + * Constructs a new FileDescriptorSet. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorSet); + + /** FileDescriptorSet file. */ + public file: google.protobuf.IFileDescriptorProto[]; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorSet instance + */ + public static create(properties?: google.protobuf.IFileDescriptorSet): google.protobuf.FileDescriptorSet; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorSet; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorSet; + + /** + * Verifies a FileDescriptorSet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorSet + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorSet; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @param message FileDescriptorSet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorSet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FileDescriptorProto. */ + interface IFileDescriptorProto { + + /** FileDescriptorProto name */ + name?: string; + + /** FileDescriptorProto package */ + "package"?: string; + + /** FileDescriptorProto dependency */ + dependency?: string[]; + + /** FileDescriptorProto publicDependency */ + publicDependency?: number[]; + + /** FileDescriptorProto weakDependency */ + weakDependency?: number[]; + + /** FileDescriptorProto messageType */ + messageType?: google.protobuf.IDescriptorProto[]; + + /** FileDescriptorProto enumType */ + enumType?: google.protobuf.IEnumDescriptorProto[]; + + /** FileDescriptorProto service */ + service?: google.protobuf.IServiceDescriptorProto[]; + + /** FileDescriptorProto extension */ + extension?: google.protobuf.IFieldDescriptorProto[]; + + /** FileDescriptorProto options */ + options?: google.protobuf.IFileOptions; + + /** FileDescriptorProto sourceCodeInfo */ + sourceCodeInfo?: google.protobuf.ISourceCodeInfo; + + /** FileDescriptorProto syntax */ + syntax?: string; + } + + /** Represents a FileDescriptorProto. */ + class FileDescriptorProto { + + /** + * Constructs a new FileDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorProto); + + /** FileDescriptorProto name. */ + public name: string; + + /** FileDescriptorProto package. */ + public package_: string; + + /** FileDescriptorProto dependency. */ + public dependency: string[]; + + /** FileDescriptorProto publicDependency. */ + public publicDependency: number[]; + + /** FileDescriptorProto weakDependency. */ + public weakDependency: number[]; + + /** FileDescriptorProto messageType. */ + public messageType: google.protobuf.IDescriptorProto[]; + + /** FileDescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** FileDescriptorProto service. */ + public service: google.protobuf.IServiceDescriptorProto[]; + + /** FileDescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** FileDescriptorProto options. */ + public options?: (google.protobuf.IFileOptions|null); + + /** FileDescriptorProto sourceCodeInfo. */ + public sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); + + /** FileDescriptorProto syntax. */ + public syntax: string; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFileDescriptorProto): google.protobuf.FileDescriptorProto; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorProto; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorProto; + + /** + * Verifies a FileDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorProto; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @param message FileDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DescriptorProto. */ + interface IDescriptorProto { + + /** DescriptorProto name */ + name?: string; + + /** DescriptorProto field */ + field?: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto extension */ + extension?: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto nestedType */ + nestedType?: google.protobuf.IDescriptorProto[]; + + /** DescriptorProto enumType */ + enumType?: google.protobuf.IEnumDescriptorProto[]; + + /** DescriptorProto extensionRange */ + extensionRange?: google.protobuf.DescriptorProto.IExtensionRange[]; + + /** DescriptorProto oneofDecl */ + oneofDecl?: google.protobuf.IOneofDescriptorProto[]; + + /** DescriptorProto options */ + options?: google.protobuf.IMessageOptions; + + /** DescriptorProto reservedRange */ + reservedRange?: google.protobuf.DescriptorProto.IReservedRange[]; + + /** DescriptorProto reservedName */ + reservedName?: string[]; + } + + /** Represents a DescriptorProto. */ + class DescriptorProto { + + /** + * Constructs a new DescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDescriptorProto); + + /** DescriptorProto name. */ + public name: string; + + /** DescriptorProto field. */ + public field: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto nestedType. */ + public nestedType: google.protobuf.IDescriptorProto[]; + + /** DescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** DescriptorProto extensionRange. */ + public extensionRange: google.protobuf.DescriptorProto.IExtensionRange[]; + + /** DescriptorProto oneofDecl. */ + public oneofDecl: google.protobuf.IOneofDescriptorProto[]; + + /** DescriptorProto options. */ + public options?: (google.protobuf.IMessageOptions|null); + + /** DescriptorProto reservedRange. */ + public reservedRange: google.protobuf.DescriptorProto.IReservedRange[]; + + /** DescriptorProto reservedName. */ + public reservedName: string[]; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns DescriptorProto instance + */ + public static create(properties?: google.protobuf.IDescriptorProto): google.protobuf.DescriptorProto; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto; + + /** + * Verifies a DescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @param message DescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DescriptorProto { + + /** Properties of an ExtensionRange. */ + interface IExtensionRange { + + /** ExtensionRange start */ + start?: number; + + /** ExtensionRange end */ + end?: number; + } + + /** Represents an ExtensionRange. */ + class ExtensionRange { + + /** + * Constructs a new ExtensionRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IExtensionRange); + + /** ExtensionRange start. */ + public start: number; + + /** ExtensionRange end. */ + public end: number; + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtensionRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IExtensionRange): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Verifies an ExtensionRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtensionRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @param message ExtensionRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ExtensionRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtensionRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ReservedRange. */ + interface IReservedRange { + + /** ReservedRange start */ + start?: number; + + /** ReservedRange end */ + end?: number; + } + + /** Represents a ReservedRange. */ + class ReservedRange { + + /** + * Constructs a new ReservedRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IReservedRange); + + /** ReservedRange start. */ + public start: number; + + /** ReservedRange end. */ + public end: number; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ReservedRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IReservedRange): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Verifies a ReservedRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReservedRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @param message ReservedRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReservedRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a FieldDescriptorProto. */ + interface IFieldDescriptorProto { + + /** FieldDescriptorProto name */ + name?: string; + + /** FieldDescriptorProto number */ + number?: number; + + /** FieldDescriptorProto label */ + label?: google.protobuf.FieldDescriptorProto.Label; + + /** FieldDescriptorProto type */ + type?: google.protobuf.FieldDescriptorProto.Type; + + /** FieldDescriptorProto typeName */ + typeName?: string; + + /** FieldDescriptorProto extendee */ + extendee?: string; + + /** FieldDescriptorProto defaultValue */ + defaultValue?: string; + + /** FieldDescriptorProto oneofIndex */ + oneofIndex?: number; + + /** FieldDescriptorProto jsonName */ + jsonName?: string; + + /** FieldDescriptorProto options */ + options?: google.protobuf.IFieldOptions; + } + + /** Represents a FieldDescriptorProto. */ + class FieldDescriptorProto { + + /** + * Constructs a new FieldDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldDescriptorProto); + + /** FieldDescriptorProto name. */ + public name: string; + + /** FieldDescriptorProto number. */ + public number: number; + + /** FieldDescriptorProto label. */ + public label: google.protobuf.FieldDescriptorProto.Label; + + /** FieldDescriptorProto type. */ + public type: google.protobuf.FieldDescriptorProto.Type; + + /** FieldDescriptorProto typeName. */ + public typeName: string; + + /** FieldDescriptorProto extendee. */ + public extendee: string; + + /** FieldDescriptorProto defaultValue. */ + public defaultValue: string; + + /** FieldDescriptorProto oneofIndex. */ + public oneofIndex: number; + + /** FieldDescriptorProto jsonName. */ + public jsonName: string; + + /** FieldDescriptorProto options. */ + public options?: (google.protobuf.IFieldOptions|null); + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFieldDescriptorProto): google.protobuf.FieldDescriptorProto; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldDescriptorProto; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldDescriptorProto; + + /** + * Verifies a FieldDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldDescriptorProto; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @param message FieldDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FieldDescriptorProto { + + /** Type enum. */ + enum Type { + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + TYPE_GROUP = 10, + TYPE_MESSAGE = 11, + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + TYPE_SINT32 = 17, + TYPE_SINT64 = 18 + } + + /** Label enum. */ + enum Label { + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3 + } + } + + /** Properties of an OneofDescriptorProto. */ + interface IOneofDescriptorProto { + + /** OneofDescriptorProto name */ + name?: string; + + /** OneofDescriptorProto options */ + options?: google.protobuf.IOneofOptions; + } + + /** Represents an OneofDescriptorProto. */ + class OneofDescriptorProto { + + /** + * Constructs a new OneofDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofDescriptorProto); + + /** OneofDescriptorProto name. */ + public name: string; + + /** OneofDescriptorProto options. */ + public options?: (google.protobuf.IOneofOptions|null); + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofDescriptorProto instance + */ + public static create(properties?: google.protobuf.IOneofDescriptorProto): google.protobuf.OneofDescriptorProto; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofDescriptorProto; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofDescriptorProto; + + /** + * Verifies an OneofDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofDescriptorProto; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @param message OneofDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnumDescriptorProto. */ + interface IEnumDescriptorProto { + + /** EnumDescriptorProto name */ + name?: string; + + /** EnumDescriptorProto value */ + value?: google.protobuf.IEnumValueDescriptorProto[]; + + /** EnumDescriptorProto options */ + options?: google.protobuf.IEnumOptions; + } + + /** Represents an EnumDescriptorProto. */ + class EnumDescriptorProto { + + /** + * Constructs a new EnumDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumDescriptorProto); + + /** EnumDescriptorProto name. */ + public name: string; + + /** EnumDescriptorProto value. */ + public value: google.protobuf.IEnumValueDescriptorProto[]; + + /** EnumDescriptorProto options. */ + public options?: (google.protobuf.IEnumOptions|null); + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumDescriptorProto): google.protobuf.EnumDescriptorProto; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto; + + /** + * Verifies an EnumDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @param message EnumDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnumValueDescriptorProto. */ + interface IEnumValueDescriptorProto { + + /** EnumValueDescriptorProto name */ + name?: string; + + /** EnumValueDescriptorProto number */ + number?: number; + + /** EnumValueDescriptorProto options */ + options?: google.protobuf.IEnumValueOptions; + } + + /** Represents an EnumValueDescriptorProto. */ + class EnumValueDescriptorProto { + + /** + * Constructs a new EnumValueDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueDescriptorProto); + + /** EnumValueDescriptorProto name. */ + public name: string; + + /** EnumValueDescriptorProto number. */ + public number: number; + + /** EnumValueDescriptorProto options. */ + public options?: (google.protobuf.IEnumValueOptions|null); + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumValueDescriptorProto): google.protobuf.EnumValueDescriptorProto; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueDescriptorProto; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueDescriptorProto; + + /** + * Verifies an EnumValueDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueDescriptorProto; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @param message EnumValueDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ServiceDescriptorProto. */ + interface IServiceDescriptorProto { + + /** ServiceDescriptorProto name */ + name?: string; + + /** ServiceDescriptorProto method */ + method?: google.protobuf.IMethodDescriptorProto[]; + + /** ServiceDescriptorProto options */ + options?: google.protobuf.IServiceOptions; + } + + /** Represents a ServiceDescriptorProto. */ + class ServiceDescriptorProto { + + /** + * Constructs a new ServiceDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceDescriptorProto); + + /** ServiceDescriptorProto name. */ + public name: string; + + /** ServiceDescriptorProto method. */ + public method: google.protobuf.IMethodDescriptorProto[]; + + /** ServiceDescriptorProto options. */ + public options?: (google.protobuf.IServiceOptions|null); + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceDescriptorProto instance + */ + public static create(properties?: google.protobuf.IServiceDescriptorProto): google.protobuf.ServiceDescriptorProto; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceDescriptorProto; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceDescriptorProto; + + /** + * Verifies a ServiceDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceDescriptorProto; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @param message ServiceDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MethodDescriptorProto. */ + interface IMethodDescriptorProto { + + /** MethodDescriptorProto name */ + name?: string; + + /** MethodDescriptorProto inputType */ + inputType?: string; + + /** MethodDescriptorProto outputType */ + outputType?: string; + + /** MethodDescriptorProto options */ + options?: google.protobuf.IMethodOptions; + + /** MethodDescriptorProto clientStreaming */ + clientStreaming?: boolean; + + /** MethodDescriptorProto serverStreaming */ + serverStreaming?: boolean; + } + + /** Represents a MethodDescriptorProto. */ + class MethodDescriptorProto { + + /** + * Constructs a new MethodDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodDescriptorProto); + + /** MethodDescriptorProto name. */ + public name: string; + + /** MethodDescriptorProto inputType. */ + public inputType: string; + + /** MethodDescriptorProto outputType. */ + public outputType: string; + + /** MethodDescriptorProto options. */ + public options?: (google.protobuf.IMethodOptions|null); + + /** MethodDescriptorProto clientStreaming. */ + public clientStreaming: boolean; + + /** MethodDescriptorProto serverStreaming. */ + public serverStreaming: boolean; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodDescriptorProto instance + */ + public static create(properties?: google.protobuf.IMethodDescriptorProto): google.protobuf.MethodDescriptorProto; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodDescriptorProto; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodDescriptorProto; + + /** + * Verifies a MethodDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodDescriptorProto; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @param message MethodDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FileOptions. */ + interface IFileOptions { + + /** FileOptions javaPackage */ + javaPackage?: string; + + /** FileOptions javaOuterClassname */ + javaOuterClassname?: string; + + /** FileOptions javaMultipleFiles */ + javaMultipleFiles?: boolean; + + /** FileOptions javaGenerateEqualsAndHash */ + javaGenerateEqualsAndHash?: boolean; + + /** FileOptions javaStringCheckUtf8 */ + javaStringCheckUtf8?: boolean; + + /** FileOptions optimizeFor */ + optimizeFor?: google.protobuf.FileOptions.OptimizeMode; + + /** FileOptions goPackage */ + goPackage?: string; + + /** FileOptions ccGenericServices */ + ccGenericServices?: boolean; + + /** FileOptions javaGenericServices */ + javaGenericServices?: boolean; + + /** FileOptions pyGenericServices */ + pyGenericServices?: boolean; + + /** FileOptions deprecated */ + deprecated?: boolean; + + /** FileOptions ccEnableArenas */ + ccEnableArenas?: boolean; + + /** FileOptions objcClassPrefix */ + objcClassPrefix?: string; + + /** FileOptions csharpNamespace */ + csharpNamespace?: string; + + /** FileOptions uninterpretedOption */ + uninterpretedOption?: google.protobuf.IUninterpretedOption[]; + } + + /** Represents a FileOptions. */ + class FileOptions { + + /** + * Constructs a new FileOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileOptions); + + /** FileOptions javaPackage. */ + public javaPackage: string; + + /** FileOptions javaOuterClassname. */ + public javaOuterClassname: string; + + /** FileOptions javaMultipleFiles. */ + public javaMultipleFiles: boolean; + + /** FileOptions javaGenerateEqualsAndHash. */ + public javaGenerateEqualsAndHash: boolean; + + /** FileOptions javaStringCheckUtf8. */ + public javaStringCheckUtf8: boolean; + + /** FileOptions optimizeFor. */ + public optimizeFor: google.protobuf.FileOptions.OptimizeMode; + + /** FileOptions goPackage. */ + public goPackage: string; + + /** FileOptions ccGenericServices. */ + public ccGenericServices: boolean; + + /** FileOptions javaGenericServices. */ + public javaGenericServices: boolean; + + /** FileOptions pyGenericServices. */ + public pyGenericServices: boolean; + + /** FileOptions deprecated. */ + public deprecated: boolean; + + /** FileOptions ccEnableArenas. */ + public ccEnableArenas: boolean; + + /** FileOptions objcClassPrefix. */ + public objcClassPrefix: string; + + /** FileOptions csharpNamespace. */ + public csharpNamespace: string; + + /** FileOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FileOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FileOptions instance + */ + public static create(properties?: google.protobuf.IFileOptions): google.protobuf.FileOptions; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileOptions; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileOptions; + + /** + * Verifies a FileOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileOptions; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @param message FileOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FileOptions { + + /** OptimizeMode enum. */ + enum OptimizeMode { + SPEED = 1, + CODE_SIZE = 2, + LITE_RUNTIME = 3 + } + } + + /** Properties of a MessageOptions. */ + interface IMessageOptions { + + /** MessageOptions messageSetWireFormat */ + messageSetWireFormat?: boolean; + + /** MessageOptions noStandardDescriptorAccessor */ + noStandardDescriptorAccessor?: boolean; + + /** MessageOptions deprecated */ + deprecated?: boolean; + + /** MessageOptions mapEntry */ + mapEntry?: boolean; + + /** MessageOptions uninterpretedOption */ + uninterpretedOption?: google.protobuf.IUninterpretedOption[]; + } + + /** Represents a MessageOptions. */ + class MessageOptions { + + /** + * Constructs a new MessageOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMessageOptions); + + /** MessageOptions messageSetWireFormat. */ + public messageSetWireFormat: boolean; + + /** MessageOptions noStandardDescriptorAccessor. */ + public noStandardDescriptorAccessor: boolean; + + /** MessageOptions deprecated. */ + public deprecated: boolean; + + /** MessageOptions mapEntry. */ + public mapEntry: boolean; + + /** MessageOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageOptions instance + */ + public static create(properties?: google.protobuf.IMessageOptions): google.protobuf.MessageOptions; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MessageOptions; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MessageOptions; + + /** + * Verifies a MessageOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MessageOptions; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @param message MessageOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MessageOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FieldOptions. */ + interface IFieldOptions { + + /** FieldOptions ctype */ + ctype?: google.protobuf.FieldOptions.CType; + + /** FieldOptions packed */ + packed?: boolean; + + /** FieldOptions jstype */ + jstype?: google.protobuf.FieldOptions.JSType; + + /** FieldOptions lazy */ + lazy?: boolean; + + /** FieldOptions deprecated */ + deprecated?: boolean; + + /** FieldOptions weak */ + weak?: boolean; + + /** FieldOptions uninterpretedOption */ + uninterpretedOption?: google.protobuf.IUninterpretedOption[]; + } + + /** Represents a FieldOptions. */ + class FieldOptions { + + /** + * Constructs a new FieldOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldOptions); + + /** FieldOptions ctype. */ + public ctype: google.protobuf.FieldOptions.CType; + + /** FieldOptions packed. */ + public packed: boolean; + + /** FieldOptions jstype. */ + public jstype: google.protobuf.FieldOptions.JSType; + + /** FieldOptions lazy. */ + public lazy: boolean; + + /** FieldOptions deprecated. */ + public deprecated: boolean; + + /** FieldOptions weak. */ + public weak: boolean; + + /** FieldOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldOptions instance + */ + public static create(properties?: google.protobuf.IFieldOptions): google.protobuf.FieldOptions; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions; + + /** + * Verifies a FieldOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @param message FieldOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FieldOptions { + + /** CType enum. */ + enum CType { + STRING = 0, + CORD = 1, + STRING_PIECE = 2 + } + + /** JSType enum. */ + enum JSType { + JS_NORMAL = 0, + JS_STRING = 1, + JS_NUMBER = 2 + } + } + + /** Properties of an OneofOptions. */ + interface IOneofOptions { + + /** OneofOptions uninterpretedOption */ + uninterpretedOption?: google.protobuf.IUninterpretedOption[]; + } + + /** Represents an OneofOptions. */ + class OneofOptions { + + /** + * Constructs a new OneofOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofOptions); + + /** OneofOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofOptions instance + */ + public static create(properties?: google.protobuf.IOneofOptions): google.protobuf.OneofOptions; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofOptions; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofOptions; + + /** + * Verifies an OneofOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofOptions; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @param message OneofOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnumOptions. */ + interface IEnumOptions { + + /** EnumOptions allowAlias */ + allowAlias?: boolean; + + /** EnumOptions deprecated */ + deprecated?: boolean; + + /** EnumOptions uninterpretedOption */ + uninterpretedOption?: google.protobuf.IUninterpretedOption[]; + } + + /** Represents an EnumOptions. */ + class EnumOptions { + + /** + * Constructs a new EnumOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumOptions); + + /** EnumOptions allowAlias. */ + public allowAlias: boolean; + + /** EnumOptions deprecated. */ + public deprecated: boolean; + + /** EnumOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumOptions instance + */ + public static create(properties?: google.protobuf.IEnumOptions): google.protobuf.EnumOptions; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumOptions; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumOptions; + + /** + * Verifies an EnumOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumOptions; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @param message EnumOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnumValueOptions. */ + interface IEnumValueOptions { + + /** EnumValueOptions deprecated */ + deprecated?: boolean; + + /** EnumValueOptions uninterpretedOption */ + uninterpretedOption?: google.protobuf.IUninterpretedOption[]; + } + + /** Represents an EnumValueOptions. */ + class EnumValueOptions { + + /** + * Constructs a new EnumValueOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueOptions); + + /** EnumValueOptions deprecated. */ + public deprecated: boolean; + + /** EnumValueOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueOptions instance + */ + public static create(properties?: google.protobuf.IEnumValueOptions): google.protobuf.EnumValueOptions; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueOptions; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueOptions; + + /** + * Verifies an EnumValueOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueOptions; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @param message EnumValueOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ServiceOptions. */ + interface IServiceOptions { + + /** ServiceOptions deprecated */ + deprecated?: boolean; + + /** ServiceOptions uninterpretedOption */ + uninterpretedOption?: google.protobuf.IUninterpretedOption[]; + } + + /** Represents a ServiceOptions. */ + class ServiceOptions { + + /** + * Constructs a new ServiceOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceOptions); + + /** ServiceOptions deprecated. */ + public deprecated: boolean; + + /** ServiceOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceOptions instance + */ + public static create(properties?: google.protobuf.IServiceOptions): google.protobuf.ServiceOptions; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceOptions; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceOptions; + + /** + * Verifies a ServiceOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceOptions; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @param message ServiceOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MethodOptions. */ + interface IMethodOptions { + + /** MethodOptions deprecated */ + deprecated?: boolean; + + /** MethodOptions uninterpretedOption */ + uninterpretedOption?: google.protobuf.IUninterpretedOption[]; + + /** MethodOptions .google.api.http */ + ".google.api.http"?: google.api.IHttpRule; + } + + /** Represents a MethodOptions. */ + class MethodOptions { + + /** + * Constructs a new MethodOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodOptions); + + /** MethodOptions deprecated. */ + public deprecated: boolean; + + /** MethodOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodOptions instance + */ + public static create(properties?: google.protobuf.IMethodOptions): google.protobuf.MethodOptions; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodOptions; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodOptions; + + /** + * Verifies a MethodOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodOptions; + + /** + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @param message MethodOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UninterpretedOption. */ + interface IUninterpretedOption { + + /** UninterpretedOption name */ + name?: google.protobuf.UninterpretedOption.INamePart[]; + + /** UninterpretedOption identifierValue */ + identifierValue?: string; + + /** UninterpretedOption positiveIntValue */ + positiveIntValue?: (number|Long); + + /** UninterpretedOption negativeIntValue */ + negativeIntValue?: (number|Long); + + /** UninterpretedOption doubleValue */ + doubleValue?: number; + + /** UninterpretedOption stringValue */ + stringValue?: Uint8Array; + + /** UninterpretedOption aggregateValue */ + aggregateValue?: string; + } + + /** Represents an UninterpretedOption. */ + class UninterpretedOption { + + /** + * Constructs a new UninterpretedOption. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUninterpretedOption); + + /** UninterpretedOption name. */ + public name: google.protobuf.UninterpretedOption.INamePart[]; + + /** UninterpretedOption identifierValue. */ + public identifierValue: string; + + /** UninterpretedOption positiveIntValue. */ + public positiveIntValue: (number|Long); + + /** UninterpretedOption negativeIntValue. */ + public negativeIntValue: (number|Long); + + /** UninterpretedOption doubleValue. */ + public doubleValue: number; + + /** UninterpretedOption stringValue. */ + public stringValue: Uint8Array; + + /** UninterpretedOption aggregateValue. */ + public aggregateValue: string; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @param [properties] Properties to set + * @returns UninterpretedOption instance + */ + public static create(properties?: google.protobuf.IUninterpretedOption): google.protobuf.UninterpretedOption; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption; + + /** + * Verifies an UninterpretedOption message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UninterpretedOption + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @param message UninterpretedOption + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UninterpretedOption to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace UninterpretedOption { + + /** Properties of a NamePart. */ + interface INamePart { + + /** NamePart namePart */ + namePart: string; + + /** NamePart isExtension */ + isExtension: boolean; + } + + /** Represents a NamePart. */ + class NamePart { + + /** + * Constructs a new NamePart. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.UninterpretedOption.INamePart); + + /** NamePart namePart. */ + public namePart: string; + + /** NamePart isExtension. */ + public isExtension: boolean; + + /** + * Creates a new NamePart instance using the specified properties. + * @param [properties] Properties to set + * @returns NamePart instance + */ + public static create(properties?: google.protobuf.UninterpretedOption.INamePart): google.protobuf.UninterpretedOption.NamePart; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption.NamePart; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption.NamePart; + + /** + * Verifies a NamePart message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NamePart + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption.NamePart; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @param message NamePart + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption.NamePart, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NamePart to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a SourceCodeInfo. */ + interface ISourceCodeInfo { + + /** SourceCodeInfo location */ + location?: google.protobuf.SourceCodeInfo.ILocation[]; + } + + /** Represents a SourceCodeInfo. */ + class SourceCodeInfo { + + /** + * Constructs a new SourceCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ISourceCodeInfo); + + /** SourceCodeInfo location. */ + public location: google.protobuf.SourceCodeInfo.ILocation[]; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns SourceCodeInfo instance + */ + public static create(properties?: google.protobuf.ISourceCodeInfo): google.protobuf.SourceCodeInfo; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo; + + /** + * Verifies a SourceCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SourceCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @param message SourceCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SourceCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SourceCodeInfo { + + /** Properties of a Location. */ + interface ILocation { + + /** Location path */ + path?: number[]; + + /** Location span */ + span?: number[]; + + /** Location leadingComments */ + leadingComments?: string; + + /** Location trailingComments */ + trailingComments?: string; + + /** Location leadingDetachedComments */ + leadingDetachedComments?: string[]; + } + + /** Represents a Location. */ + class Location { + + /** + * Constructs a new Location. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.SourceCodeInfo.ILocation); + + /** Location path. */ + public path: number[]; + + /** Location span. */ + public span: number[]; + + /** Location leadingComments. */ + public leadingComments: string; + + /** Location trailingComments. */ + public trailingComments: string; + + /** Location leadingDetachedComments. */ + public leadingDetachedComments: string[]; + + /** + * Creates a new Location instance using the specified properties. + * @param [properties] Properties to set + * @returns Location instance + */ + public static create(properties?: google.protobuf.SourceCodeInfo.ILocation): google.protobuf.SourceCodeInfo.Location; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Location message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo.Location; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo.Location; + + /** + * Verifies a Location message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Location + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo.Location; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @param message Location + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo.Location, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Location to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a GeneratedCodeInfo. */ + interface IGeneratedCodeInfo { + + /** GeneratedCodeInfo annotation */ + annotation?: google.protobuf.GeneratedCodeInfo.IAnnotation[]; + } + + /** Represents a GeneratedCodeInfo. */ + class GeneratedCodeInfo { + + /** + * Constructs a new GeneratedCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IGeneratedCodeInfo); + + /** GeneratedCodeInfo annotation. */ + public annotation: google.protobuf.GeneratedCodeInfo.IAnnotation[]; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns GeneratedCodeInfo instance + */ + public static create(properties?: google.protobuf.IGeneratedCodeInfo): google.protobuf.GeneratedCodeInfo; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo; + + /** + * Verifies a GeneratedCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GeneratedCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @param message GeneratedCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace GeneratedCodeInfo { + + /** Properties of an Annotation. */ + interface IAnnotation { + + /** Annotation path */ + path?: number[]; + + /** Annotation sourceFile */ + sourceFile?: string; + + /** Annotation begin */ + begin?: number; + + /** Annotation end */ + end?: number; + } + + /** Represents an Annotation. */ + class Annotation { + + /** + * Constructs a new Annotation. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation); + + /** Annotation path. */ + public path: number[]; + + /** Annotation sourceFile. */ + public sourceFile: string; + + /** Annotation begin. */ + public begin: number; + + /** Annotation end. */ + public end: number; + + /** + * Creates a new Annotation instance using the specified properties. + * @param [properties] Properties to set + * @returns Annotation instance + */ + public static create(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Verifies an Annotation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Annotation + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @param message Annotation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo.Annotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Annotation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a Duration. */ + interface IDuration { + + /** Duration seconds */ + seconds?: (number|Long); + + /** Duration nanos */ + nanos?: number; + } + + /** Represents a Duration. */ + class Duration { + + /** + * Constructs a new Duration. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDuration); + + /** Duration seconds. */ + public seconds: (number|Long); + + /** Duration nanos. */ + public nanos: number; + + /** + * Creates a new Duration instance using the specified properties. + * @param [properties] Properties to set + * @returns Duration instance + */ + public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Duration; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Duration; + + /** + * Verifies a Duration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Duration + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @param message Duration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Duration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Timestamp. */ + interface ITimestamp { + + /** Timestamp seconds */ + seconds?: (number|Long); + + /** Timestamp nanos */ + nanos?: number; + } + + /** Represents a Timestamp. */ + class Timestamp { + + /** + * Constructs a new Timestamp. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ITimestamp); + + /** Timestamp seconds. */ + public seconds: (number|Long); + + /** Timestamp nanos. */ + public nanos: number; + + /** + * Creates a new Timestamp instance using the specified properties. + * @param [properties] Properties to set + * @returns Timestamp instance + */ + public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; + + /** + * Verifies a Timestamp message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Timestamp + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @param message Timestamp + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Timestamp to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } +} diff --git a/handwritten/cloud-profiler/proto/profiler.js b/handwritten/cloud-profiler/proto/profiler.js new file mode 100644 index 00000000000..8210433ffb7 --- /dev/null +++ b/handwritten/cloud-profiler/proto/profiler.js @@ -0,0 +1,10254 @@ +/*eslint-disable block-scoped-var, no-redeclare, no-control-regex, no-prototype-builtins*/ +"use strict"; + +var $protobuf = require("protobufjs/minimal"); + +// Common aliases +var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + +// Exported root namespace +var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + +$root.google = (function() { + + /** + * Namespace google. + * @exports google + * @namespace + */ + var google = {}; + + google.devtools = (function() { + + /** + * Namespace devtools. + * @memberof google + * @namespace + */ + var devtools = {}; + + devtools.cloudprofiler = (function() { + + /** + * Namespace cloudprofiler. + * @memberof google.devtools + * @namespace + */ + var cloudprofiler = {}; + + cloudprofiler.v2 = (function() { + + /** + * Namespace v2. + * @memberof google.devtools.cloudprofiler + * @namespace + */ + var v2 = {}; + + v2.ProfilerService = (function() { + + /** + * Constructs a new ProfilerService service. + * @memberof google.devtools.cloudprofiler.v2 + * @classdesc Represents a ProfilerService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ProfilerService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ProfilerService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProfilerService; + + /** + * Creates new ProfilerService service using the specified rpc implementation. + * @function create + * @memberof google.devtools.cloudprofiler.v2.ProfilerService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ProfilerService} RPC service. Useful where requests and/or responses are streamed. + */ + ProfilerService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.devtools.cloudprofiler.v2.ProfilerService#createProfile}. + * @memberof google.devtools.cloudprofiler.v2.ProfilerService + * @typedef CreateProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.devtools.cloudprofiler.v2.Profile} [response] Profile + */ + + /** + * Calls CreateProfile. + * @function .createProfile + * @memberof google.devtools.cloudprofiler.v2.ProfilerService + * @instance + * @param {google.devtools.cloudprofiler.v2.ICreateProfileRequest} request CreateProfileRequest message or plain object + * @param {google.devtools.cloudprofiler.v2.ProfilerService.CreateProfileCallback} callback Node-style callback called with the error, if any, and Profile + * @returns {undefined} + * @variation 1 + */ + ProfilerService.prototype.createProfile = function createProfile(request, callback) { + return this.rpcCall(createProfile, $root.google.devtools.cloudprofiler.v2.CreateProfileRequest, $root.google.devtools.cloudprofiler.v2.Profile, request, callback); + }; + + /** + * Calls CreateProfile. + * @function createProfile + * @memberof google.devtools.cloudprofiler.v2.ProfilerService + * @instance + * @param {google.devtools.cloudprofiler.v2.ICreateProfileRequest} request CreateProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.devtools.cloudprofiler.v2.ProfilerService#updateProfile}. + * @memberof google.devtools.cloudprofiler.v2.ProfilerService + * @typedef UpdateProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.devtools.cloudprofiler.v2.Profile} [response] Profile + */ + + /** + * Calls UpdateProfile. + * @function .updateProfile + * @memberof google.devtools.cloudprofiler.v2.ProfilerService + * @instance + * @param {google.devtools.cloudprofiler.v2.IUpdateProfileRequest} request UpdateProfileRequest message or plain object + * @param {google.devtools.cloudprofiler.v2.ProfilerService.UpdateProfileCallback} callback Node-style callback called with the error, if any, and Profile + * @returns {undefined} + * @variation 1 + */ + ProfilerService.prototype.updateProfile = function updateProfile(request, callback) { + return this.rpcCall(updateProfile, $root.google.devtools.cloudprofiler.v2.UpdateProfileRequest, $root.google.devtools.cloudprofiler.v2.Profile, request, callback); + }; + + /** + * Calls UpdateProfile. + * @function updateProfile + * @memberof google.devtools.cloudprofiler.v2.ProfilerService + * @instance + * @param {google.devtools.cloudprofiler.v2.IUpdateProfileRequest} request UpdateProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ProfilerService; + })(); + + v2.CreateProfileRequest = (function() { + + /** + * Properties of a CreateProfileRequest. + * @memberof google.devtools.cloudprofiler.v2 + * @interface ICreateProfileRequest + * @property {google.devtools.cloudprofiler.v2.IDeployment} [deployment] CreateProfileRequest deployment + * @property {Array.} [profileType] CreateProfileRequest profileType + * @property {google.devtools.cloudprofiler.v2.IProfile} [profile] CreateProfileRequest profile + */ + + /** + * Constructs a new CreateProfileRequest. + * @memberof google.devtools.cloudprofiler.v2 + * @classdesc Represents a CreateProfileRequest. + * @constructor + * @param {google.devtools.cloudprofiler.v2.ICreateProfileRequest=} [properties] Properties to set + */ + function CreateProfileRequest(properties) { + this.profileType = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateProfileRequest deployment. + * @member {(google.devtools.cloudprofiler.v2.IDeployment|null|undefined)}deployment + * @memberof google.devtools.cloudprofiler.v2.CreateProfileRequest + * @instance + */ + CreateProfileRequest.prototype.deployment = null; + + /** + * CreateProfileRequest profileType. + * @member {Array.}profileType + * @memberof google.devtools.cloudprofiler.v2.CreateProfileRequest + * @instance + */ + CreateProfileRequest.prototype.profileType = $util.emptyArray; + + /** + * CreateProfileRequest profile. + * @member {(google.devtools.cloudprofiler.v2.IProfile|null|undefined)}profile + * @memberof google.devtools.cloudprofiler.v2.CreateProfileRequest + * @instance + */ + CreateProfileRequest.prototype.profile = null; + + /** + * Creates a new CreateProfileRequest instance using the specified properties. + * @function create + * @memberof google.devtools.cloudprofiler.v2.CreateProfileRequest + * @static + * @param {google.devtools.cloudprofiler.v2.ICreateProfileRequest=} [properties] Properties to set + * @returns {google.devtools.cloudprofiler.v2.CreateProfileRequest} CreateProfileRequest instance + */ + CreateProfileRequest.create = function create(properties) { + return new CreateProfileRequest(properties); + }; + + /** + * Encodes the specified CreateProfileRequest message. Does not implicitly {@link google.devtools.cloudprofiler.v2.CreateProfileRequest.verify|verify} messages. + * @function encode + * @memberof google.devtools.cloudprofiler.v2.CreateProfileRequest + * @static + * @param {google.devtools.cloudprofiler.v2.ICreateProfileRequest} message CreateProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProfileRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deployment != null && message.hasOwnProperty("deployment")) + $root.google.devtools.cloudprofiler.v2.Deployment.encode(message.deployment, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.profileType != null && message.profileType.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.profileType.length; ++i) + writer.int32(message.profileType[i]); + writer.ldelim(); + } + if (message.profile != null && message.hasOwnProperty("profile")) + $root.google.devtools.cloudprofiler.v2.Profile.encode(message.profile, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateProfileRequest message, length delimited. Does not implicitly {@link google.devtools.cloudprofiler.v2.CreateProfileRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devtools.cloudprofiler.v2.CreateProfileRequest + * @static + * @param {google.devtools.cloudprofiler.v2.ICreateProfileRequest} message CreateProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProfileRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateProfileRequest message from the specified reader or buffer. + * @function decode + * @memberof google.devtools.cloudprofiler.v2.CreateProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devtools.cloudprofiler.v2.CreateProfileRequest} CreateProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProfileRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudprofiler.v2.CreateProfileRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deployment = $root.google.devtools.cloudprofiler.v2.Deployment.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.profileType && message.profileType.length)) + message.profileType = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.profileType.push(reader.int32()); + } else + message.profileType.push(reader.int32()); + break; + case 3: + message.profile = $root.google.devtools.cloudprofiler.v2.Profile.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateProfileRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devtools.cloudprofiler.v2.CreateProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devtools.cloudprofiler.v2.CreateProfileRequest} CreateProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProfileRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateProfileRequest message. + * @function verify + * @memberof google.devtools.cloudprofiler.v2.CreateProfileRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateProfileRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deployment != null && message.hasOwnProperty("deployment")) { + var error = $root.google.devtools.cloudprofiler.v2.Deployment.verify(message.deployment); + if (error) + return "deployment." + error; + } + if (message.profileType != null && message.hasOwnProperty("profileType")) { + if (!Array.isArray(message.profileType)) + return "profileType: array expected"; + for (var i = 0; i < message.profileType.length; ++i) + switch (message.profileType[i]) { + default: + return "profileType: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + } + if (message.profile != null && message.hasOwnProperty("profile")) { + error = $root.google.devtools.cloudprofiler.v2.Profile.verify(message.profile); + if (error) + return "profile." + error; + } + return null; + }; + + /** + * Creates a CreateProfileRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devtools.cloudprofiler.v2.CreateProfileRequest + * @static + * @param {Object.} object Plain object + * @returns {google.devtools.cloudprofiler.v2.CreateProfileRequest} CreateProfileRequest + */ + CreateProfileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudprofiler.v2.CreateProfileRequest) + return object; + var message = new $root.google.devtools.cloudprofiler.v2.CreateProfileRequest(); + if (object.deployment != null) { + if (typeof object.deployment !== "object") + throw TypeError(".google.devtools.cloudprofiler.v2.CreateProfileRequest.deployment: object expected"); + message.deployment = $root.google.devtools.cloudprofiler.v2.Deployment.fromObject(object.deployment); + } + if (object.profileType) { + if (!Array.isArray(object.profileType)) + throw TypeError(".google.devtools.cloudprofiler.v2.CreateProfileRequest.profileType: array expected"); + message.profileType = []; + for (var i = 0; i < object.profileType.length; ++i) + switch (object.profileType[i]) { + default: + case "PROFILE_TYPE_UNSPECIFIED": + case 0: + message.profileType[i] = 0; + break; + case "CPU": + case 1: + message.profileType[i] = 1; + break; + case "WALL": + case 2: + message.profileType[i] = 2; + break; + case "HEAP": + case 3: + message.profileType[i] = 3; + break; + case "THREADS": + case 4: + message.profileType[i] = 4; + break; + case "CONTENTION": + case 5: + message.profileType[i] = 5; + break; + } + } + if (object.profile != null) { + if (typeof object.profile !== "object") + throw TypeError(".google.devtools.cloudprofiler.v2.CreateProfileRequest.profile: object expected"); + message.profile = $root.google.devtools.cloudprofiler.v2.Profile.fromObject(object.profile); + } + return message; + }; + + /** + * Creates a plain object from a CreateProfileRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.cloudprofiler.v2.CreateProfileRequest + * @static + * @param {google.devtools.cloudprofiler.v2.CreateProfileRequest} message CreateProfileRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateProfileRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.profileType = []; + if (options.defaults) { + object.deployment = null; + object.profile = null; + } + if (message.deployment != null && message.hasOwnProperty("deployment")) + object.deployment = $root.google.devtools.cloudprofiler.v2.Deployment.toObject(message.deployment, options); + if (message.profileType && message.profileType.length) { + object.profileType = []; + for (var j = 0; j < message.profileType.length; ++j) + object.profileType[j] = options.enums === String ? $root.google.devtools.cloudprofiler.v2.ProfileType[message.profileType[j]] : message.profileType[j]; + } + if (message.profile != null && message.hasOwnProperty("profile")) + object.profile = $root.google.devtools.cloudprofiler.v2.Profile.toObject(message.profile, options); + return object; + }; + + /** + * Converts this CreateProfileRequest to JSON. + * @function toJSON + * @memberof google.devtools.cloudprofiler.v2.CreateProfileRequest + * @instance + * @returns {Object.} JSON object + */ + CreateProfileRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateProfileRequest; + })(); + + v2.UpdateProfileRequest = (function() { + + /** + * Properties of an UpdateProfileRequest. + * @memberof google.devtools.cloudprofiler.v2 + * @interface IUpdateProfileRequest + * @property {google.devtools.cloudprofiler.v2.IProfile} [profile] UpdateProfileRequest profile + */ + + /** + * Constructs a new UpdateProfileRequest. + * @memberof google.devtools.cloudprofiler.v2 + * @classdesc Represents an UpdateProfileRequest. + * @constructor + * @param {google.devtools.cloudprofiler.v2.IUpdateProfileRequest=} [properties] Properties to set + */ + function UpdateProfileRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateProfileRequest profile. + * @member {(google.devtools.cloudprofiler.v2.IProfile|null|undefined)}profile + * @memberof google.devtools.cloudprofiler.v2.UpdateProfileRequest + * @instance + */ + UpdateProfileRequest.prototype.profile = null; + + /** + * Creates a new UpdateProfileRequest instance using the specified properties. + * @function create + * @memberof google.devtools.cloudprofiler.v2.UpdateProfileRequest + * @static + * @param {google.devtools.cloudprofiler.v2.IUpdateProfileRequest=} [properties] Properties to set + * @returns {google.devtools.cloudprofiler.v2.UpdateProfileRequest} UpdateProfileRequest instance + */ + UpdateProfileRequest.create = function create(properties) { + return new UpdateProfileRequest(properties); + }; + + /** + * Encodes the specified UpdateProfileRequest message. Does not implicitly {@link google.devtools.cloudprofiler.v2.UpdateProfileRequest.verify|verify} messages. + * @function encode + * @memberof google.devtools.cloudprofiler.v2.UpdateProfileRequest + * @static + * @param {google.devtools.cloudprofiler.v2.IUpdateProfileRequest} message UpdateProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProfileRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.profile != null && message.hasOwnProperty("profile")) + $root.google.devtools.cloudprofiler.v2.Profile.encode(message.profile, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateProfileRequest message, length delimited. Does not implicitly {@link google.devtools.cloudprofiler.v2.UpdateProfileRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devtools.cloudprofiler.v2.UpdateProfileRequest + * @static + * @param {google.devtools.cloudprofiler.v2.IUpdateProfileRequest} message UpdateProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProfileRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateProfileRequest message from the specified reader or buffer. + * @function decode + * @memberof google.devtools.cloudprofiler.v2.UpdateProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devtools.cloudprofiler.v2.UpdateProfileRequest} UpdateProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateProfileRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudprofiler.v2.UpdateProfileRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.profile = $root.google.devtools.cloudprofiler.v2.Profile.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateProfileRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devtools.cloudprofiler.v2.UpdateProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devtools.cloudprofiler.v2.UpdateProfileRequest} UpdateProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateProfileRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateProfileRequest message. + * @function verify + * @memberof google.devtools.cloudprofiler.v2.UpdateProfileRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateProfileRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.profile != null && message.hasOwnProperty("profile")) { + var error = $root.google.devtools.cloudprofiler.v2.Profile.verify(message.profile); + if (error) + return "profile." + error; + } + return null; + }; + + /** + * Creates an UpdateProfileRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devtools.cloudprofiler.v2.UpdateProfileRequest + * @static + * @param {Object.} object Plain object + * @returns {google.devtools.cloudprofiler.v2.UpdateProfileRequest} UpdateProfileRequest + */ + UpdateProfileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudprofiler.v2.UpdateProfileRequest) + return object; + var message = new $root.google.devtools.cloudprofiler.v2.UpdateProfileRequest(); + if (object.profile != null) { + if (typeof object.profile !== "object") + throw TypeError(".google.devtools.cloudprofiler.v2.UpdateProfileRequest.profile: object expected"); + message.profile = $root.google.devtools.cloudprofiler.v2.Profile.fromObject(object.profile); + } + return message; + }; + + /** + * Creates a plain object from an UpdateProfileRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.cloudprofiler.v2.UpdateProfileRequest + * @static + * @param {google.devtools.cloudprofiler.v2.UpdateProfileRequest} message UpdateProfileRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateProfileRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.profile = null; + if (message.profile != null && message.hasOwnProperty("profile")) + object.profile = $root.google.devtools.cloudprofiler.v2.Profile.toObject(message.profile, options); + return object; + }; + + /** + * Converts this UpdateProfileRequest to JSON. + * @function toJSON + * @memberof google.devtools.cloudprofiler.v2.UpdateProfileRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateProfileRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateProfileRequest; + })(); + + v2.Profile = (function() { + + /** + * Properties of a Profile. + * @memberof google.devtools.cloudprofiler.v2 + * @interface IProfile + * @property {string} [name] Profile name + * @property {google.devtools.cloudprofiler.v2.ProfileType} [profileType] Profile profileType + * @property {google.devtools.cloudprofiler.v2.IDeployment} [deployment] Profile deployment + * @property {google.protobuf.IDuration} [duration] Profile duration + * @property {Uint8Array} [profileBytes] Profile profileBytes + * @property {Object.} [labels] Profile labels + */ + + /** + * Constructs a new Profile. + * @memberof google.devtools.cloudprofiler.v2 + * @classdesc Represents a Profile. + * @constructor + * @param {google.devtools.cloudprofiler.v2.IProfile=} [properties] Properties to set + */ + function Profile(properties) { + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Profile name. + * @member {string}name + * @memberof google.devtools.cloudprofiler.v2.Profile + * @instance + */ + Profile.prototype.name = ""; + + /** + * Profile profileType. + * @member {google.devtools.cloudprofiler.v2.ProfileType}profileType + * @memberof google.devtools.cloudprofiler.v2.Profile + * @instance + */ + Profile.prototype.profileType = 0; + + /** + * Profile deployment. + * @member {(google.devtools.cloudprofiler.v2.IDeployment|null|undefined)}deployment + * @memberof google.devtools.cloudprofiler.v2.Profile + * @instance + */ + Profile.prototype.deployment = null; + + /** + * Profile duration. + * @member {(google.protobuf.IDuration|null|undefined)}duration + * @memberof google.devtools.cloudprofiler.v2.Profile + * @instance + */ + Profile.prototype.duration = null; + + /** + * Profile profileBytes. + * @member {Uint8Array}profileBytes + * @memberof google.devtools.cloudprofiler.v2.Profile + * @instance + */ + Profile.prototype.profileBytes = $util.newBuffer([]); + + /** + * Profile labels. + * @member {Object.}labels + * @memberof google.devtools.cloudprofiler.v2.Profile + * @instance + */ + Profile.prototype.labels = $util.emptyObject; + + /** + * Creates a new Profile instance using the specified properties. + * @function create + * @memberof google.devtools.cloudprofiler.v2.Profile + * @static + * @param {google.devtools.cloudprofiler.v2.IProfile=} [properties] Properties to set + * @returns {google.devtools.cloudprofiler.v2.Profile} Profile instance + */ + Profile.create = function create(properties) { + return new Profile(properties); + }; + + /** + * Encodes the specified Profile message. Does not implicitly {@link google.devtools.cloudprofiler.v2.Profile.verify|verify} messages. + * @function encode + * @memberof google.devtools.cloudprofiler.v2.Profile + * @static + * @param {google.devtools.cloudprofiler.v2.IProfile} message Profile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Profile.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.profileType != null && message.hasOwnProperty("profileType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.profileType); + if (message.deployment != null && message.hasOwnProperty("deployment")) + $root.google.devtools.cloudprofiler.v2.Deployment.encode(message.deployment, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.duration != null && message.hasOwnProperty("duration")) + $root.google.protobuf.Duration.encode(message.duration, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.profileBytes != null && message.hasOwnProperty("profileBytes")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.profileBytes); + if (message.labels != null && message.hasOwnProperty("labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified Profile message, length delimited. Does not implicitly {@link google.devtools.cloudprofiler.v2.Profile.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devtools.cloudprofiler.v2.Profile + * @static + * @param {google.devtools.cloudprofiler.v2.IProfile} message Profile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Profile.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Profile message from the specified reader or buffer. + * @function decode + * @memberof google.devtools.cloudprofiler.v2.Profile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devtools.cloudprofiler.v2.Profile} Profile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Profile.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudprofiler.v2.Profile(), key; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.profileType = reader.int32(); + break; + case 3: + message.deployment = $root.google.devtools.cloudprofiler.v2.Deployment.decode(reader, reader.uint32()); + break; + case 4: + message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + case 5: + message.profileBytes = reader.bytes(); + break; + case 6: + reader.skip().pos++; + if (message.labels === $util.emptyObject) + message.labels = {}; + key = reader.string(); + reader.pos++; + message.labels[key] = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Profile message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devtools.cloudprofiler.v2.Profile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devtools.cloudprofiler.v2.Profile} Profile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Profile.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Profile message. + * @function verify + * @memberof google.devtools.cloudprofiler.v2.Profile + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Profile.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.profileType != null && message.hasOwnProperty("profileType")) + switch (message.profileType) { + default: + return "profileType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.deployment != null && message.hasOwnProperty("deployment")) { + var error = $root.google.devtools.cloudprofiler.v2.Deployment.verify(message.deployment); + if (error) + return "deployment." + error; + } + if (message.duration != null && message.hasOwnProperty("duration")) { + error = $root.google.protobuf.Duration.verify(message.duration); + if (error) + return "duration." + error; + } + if (message.profileBytes != null && message.hasOwnProperty("profileBytes")) + if (!(message.profileBytes && typeof message.profileBytes.length === "number" || $util.isString(message.profileBytes))) + return "profileBytes: buffer expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a Profile message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devtools.cloudprofiler.v2.Profile + * @static + * @param {Object.} object Plain object + * @returns {google.devtools.cloudprofiler.v2.Profile} Profile + */ + Profile.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudprofiler.v2.Profile) + return object; + var message = new $root.google.devtools.cloudprofiler.v2.Profile(); + if (object.name != null) + message.name = String(object.name); + switch (object.profileType) { + case "PROFILE_TYPE_UNSPECIFIED": + case 0: + message.profileType = 0; + break; + case "CPU": + case 1: + message.profileType = 1; + break; + case "WALL": + case 2: + message.profileType = 2; + break; + case "HEAP": + case 3: + message.profileType = 3; + break; + case "THREADS": + case 4: + message.profileType = 4; + break; + case "CONTENTION": + case 5: + message.profileType = 5; + break; + } + if (object.deployment != null) { + if (typeof object.deployment !== "object") + throw TypeError(".google.devtools.cloudprofiler.v2.Profile.deployment: object expected"); + message.deployment = $root.google.devtools.cloudprofiler.v2.Deployment.fromObject(object.deployment); + } + if (object.duration != null) { + if (typeof object.duration !== "object") + throw TypeError(".google.devtools.cloudprofiler.v2.Profile.duration: object expected"); + message.duration = $root.google.protobuf.Duration.fromObject(object.duration); + } + if (object.profileBytes != null) + if (typeof object.profileBytes === "string") + $util.base64.decode(object.profileBytes, message.profileBytes = $util.newBuffer($util.base64.length(object.profileBytes)), 0); + else if (object.profileBytes.length) + message.profileBytes = object.profileBytes; + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.devtools.cloudprofiler.v2.Profile.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a Profile message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.cloudprofiler.v2.Profile + * @static + * @param {google.devtools.cloudprofiler.v2.Profile} message Profile + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Profile.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.profileType = options.enums === String ? "PROFILE_TYPE_UNSPECIFIED" : 0; + object.deployment = null; + object.duration = null; + object.profileBytes = options.bytes === String ? "" : []; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.profileType != null && message.hasOwnProperty("profileType")) + object.profileType = options.enums === String ? $root.google.devtools.cloudprofiler.v2.ProfileType[message.profileType] : message.profileType; + if (message.deployment != null && message.hasOwnProperty("deployment")) + object.deployment = $root.google.devtools.cloudprofiler.v2.Deployment.toObject(message.deployment, options); + if (message.duration != null && message.hasOwnProperty("duration")) + object.duration = $root.google.protobuf.Duration.toObject(message.duration, options); + if (message.profileBytes != null && message.hasOwnProperty("profileBytes")) + object.profileBytes = options.bytes === String ? $util.base64.encode(message.profileBytes, 0, message.profileBytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.profileBytes) : message.profileBytes; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this Profile to JSON. + * @function toJSON + * @memberof google.devtools.cloudprofiler.v2.Profile + * @instance + * @returns {Object.} JSON object + */ + Profile.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Profile; + })(); + + v2.Deployment = (function() { + + /** + * Properties of a Deployment. + * @memberof google.devtools.cloudprofiler.v2 + * @interface IDeployment + * @property {string} [projectId] Deployment projectId + * @property {string} [target] Deployment target + * @property {Object.} [labels] Deployment labels + */ + + /** + * Constructs a new Deployment. + * @memberof google.devtools.cloudprofiler.v2 + * @classdesc Represents a Deployment. + * @constructor + * @param {google.devtools.cloudprofiler.v2.IDeployment=} [properties] Properties to set + */ + function Deployment(properties) { + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Deployment projectId. + * @member {string}projectId + * @memberof google.devtools.cloudprofiler.v2.Deployment + * @instance + */ + Deployment.prototype.projectId = ""; + + /** + * Deployment target. + * @member {string}target + * @memberof google.devtools.cloudprofiler.v2.Deployment + * @instance + */ + Deployment.prototype.target = ""; + + /** + * Deployment labels. + * @member {Object.}labels + * @memberof google.devtools.cloudprofiler.v2.Deployment + * @instance + */ + Deployment.prototype.labels = $util.emptyObject; + + /** + * Creates a new Deployment instance using the specified properties. + * @function create + * @memberof google.devtools.cloudprofiler.v2.Deployment + * @static + * @param {google.devtools.cloudprofiler.v2.IDeployment=} [properties] Properties to set + * @returns {google.devtools.cloudprofiler.v2.Deployment} Deployment instance + */ + Deployment.create = function create(properties) { + return new Deployment(properties); + }; + + /** + * Encodes the specified Deployment message. Does not implicitly {@link google.devtools.cloudprofiler.v2.Deployment.verify|verify} messages. + * @function encode + * @memberof google.devtools.cloudprofiler.v2.Deployment + * @static + * @param {google.devtools.cloudprofiler.v2.IDeployment} message Deployment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Deployment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.projectId != null && message.hasOwnProperty("projectId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.projectId); + if (message.target != null && message.hasOwnProperty("target")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.target); + if (message.labels != null && message.hasOwnProperty("labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified Deployment message, length delimited. Does not implicitly {@link google.devtools.cloudprofiler.v2.Deployment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devtools.cloudprofiler.v2.Deployment + * @static + * @param {google.devtools.cloudprofiler.v2.IDeployment} message Deployment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Deployment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Deployment message from the specified reader or buffer. + * @function decode + * @memberof google.devtools.cloudprofiler.v2.Deployment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devtools.cloudprofiler.v2.Deployment} Deployment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Deployment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudprofiler.v2.Deployment(), key; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.projectId = reader.string(); + break; + case 2: + message.target = reader.string(); + break; + case 3: + reader.skip().pos++; + if (message.labels === $util.emptyObject) + message.labels = {}; + key = reader.string(); + reader.pos++; + message.labels[key] = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Deployment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devtools.cloudprofiler.v2.Deployment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devtools.cloudprofiler.v2.Deployment} Deployment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Deployment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Deployment message. + * @function verify + * @memberof google.devtools.cloudprofiler.v2.Deployment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Deployment.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.target != null && message.hasOwnProperty("target")) + if (!$util.isString(message.target)) + return "target: string expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a Deployment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devtools.cloudprofiler.v2.Deployment + * @static + * @param {Object.} object Plain object + * @returns {google.devtools.cloudprofiler.v2.Deployment} Deployment + */ + Deployment.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudprofiler.v2.Deployment) + return object; + var message = new $root.google.devtools.cloudprofiler.v2.Deployment(); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.target != null) + message.target = String(object.target); + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.devtools.cloudprofiler.v2.Deployment.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a Deployment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.cloudprofiler.v2.Deployment + * @static + * @param {google.devtools.cloudprofiler.v2.Deployment} message Deployment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Deployment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.projectId = ""; + object.target = ""; + } + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.target != null && message.hasOwnProperty("target")) + object.target = message.target; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this Deployment to JSON. + * @function toJSON + * @memberof google.devtools.cloudprofiler.v2.Deployment + * @instance + * @returns {Object.} JSON object + */ + Deployment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Deployment; + })(); + + /** + * ProfileType enum. + * @enum {string} + * @property {number} PROFILE_TYPE_UNSPECIFIED=0 PROFILE_TYPE_UNSPECIFIED value + * @property {number} CPU=1 CPU value + * @property {number} WALL=2 WALL value + * @property {number} HEAP=3 HEAP value + * @property {number} THREADS=4 THREADS value + * @property {number} CONTENTION=5 CONTENTION value + */ + v2.ProfileType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PROFILE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CPU"] = 1; + values[valuesById[2] = "WALL"] = 2; + values[valuesById[3] = "HEAP"] = 3; + values[valuesById[4] = "THREADS"] = 4; + values[valuesById[5] = "CONTENTION"] = 5; + return values; + })(); + + return v2; + })(); + + return cloudprofiler; + })(); + + return devtools; + })(); + + google.api = (function() { + + /** + * Namespace api. + * @memberof google + * @namespace + */ + var api = {}; + + api.Http = (function() { + + /** + * Properties of a Http. + * @memberof google.api + * @interface IHttp + * @property {Array.} [rules] Http rules + */ + + /** + * Constructs a new Http. + * @memberof google.api + * @classdesc Represents a Http. + * @constructor + * @param {google.api.IHttp=} [properties] Properties to set + */ + function Http(properties) { + this.rules = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Http rules. + * @member {Array.}rules + * @memberof google.api.Http + * @instance + */ + Http.prototype.rules = $util.emptyArray; + + /** + * Creates a new Http instance using the specified properties. + * @function create + * @memberof google.api.Http + * @static + * @param {google.api.IHttp=} [properties] Properties to set + * @returns {google.api.Http} Http instance + */ + Http.create = function create(properties) { + return new Http(properties); + }; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encode + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rules != null && message.rules.length) + for (var i = 0; i < message.rules.length; ++i) + $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Http message from the specified reader or buffer. + * @function decode + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Http message. + * @function verify + * @memberof google.api.Http + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Http.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rules != null && message.hasOwnProperty("rules")) { + if (!Array.isArray(message.rules)) + return "rules: array expected"; + for (var i = 0; i < message.rules.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.rules[i]); + if (error) + return "rules." + error; + } + } + return null; + }; + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Http + * @static + * @param {Object.} object Plain object + * @returns {google.api.Http} Http + */ + Http.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Http) + return object; + var message = new $root.google.api.Http(); + if (object.rules) { + if (!Array.isArray(object.rules)) + throw TypeError(".google.api.Http.rules: array expected"); + message.rules = []; + for (var i = 0; i < object.rules.length; ++i) { + if (typeof object.rules[i] !== "object") + throw TypeError(".google.api.Http.rules: object expected"); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Http + * @static + * @param {google.api.Http} message Http + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Http.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.rules = []; + if (message.rules && message.rules.length) { + object.rules = []; + for (var j = 0; j < message.rules.length; ++j) + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); + } + return object; + }; + + /** + * Converts this Http to JSON. + * @function toJSON + * @memberof google.api.Http + * @instance + * @returns {Object.} JSON object + */ + Http.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Http; + })(); + + api.HttpRule = (function() { + + /** + * Properties of a HttpRule. + * @memberof google.api + * @interface IHttpRule + * @property {string} [get] HttpRule get + * @property {string} [put] HttpRule put + * @property {string} [post] HttpRule post + * @property {string} ["delete"] HttpRule delete + * @property {string} [patch] HttpRule patch + * @property {google.api.ICustomHttpPattern} [custom] HttpRule custom + * @property {string} [selector] HttpRule selector + * @property {string} [body] HttpRule body + * @property {Array.} [additionalBindings] HttpRule additionalBindings + */ + + /** + * Constructs a new HttpRule. + * @memberof google.api + * @classdesc Represents a HttpRule. + * @constructor + * @param {google.api.IHttpRule=} [properties] Properties to set + */ + function HttpRule(properties) { + this.additionalBindings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpRule get. + * @member {string}get + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.get = ""; + + /** + * HttpRule put. + * @member {string}put + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.put = ""; + + /** + * HttpRule post. + * @member {string}post + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.post = ""; + + /** + * HttpRule delete. + * @member {string}delete_ + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype["delete"] = ""; + + /** + * HttpRule patch. + * @member {string}patch + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.patch = ""; + + /** + * HttpRule custom. + * @member {(google.api.ICustomHttpPattern|null|undefined)}custom + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.custom = null; + + /** + * HttpRule selector. + * @member {string}selector + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.selector = ""; + + /** + * HttpRule body. + * @member {string}body + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.body = ""; + + /** + * HttpRule additionalBindings. + * @member {Array.}additionalBindings + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.additionalBindings = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HttpRule pattern. + * @member {string|undefined} pattern + * @memberof google.api.HttpRule + * @instance + */ + Object.defineProperty(HttpRule.prototype, "pattern", { + get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HttpRule instance using the specified properties. + * @function create + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule=} [properties] Properties to set + * @returns {google.api.HttpRule} HttpRule instance + */ + HttpRule.create = function create(properties) { + return new HttpRule(properties); + }; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encode + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selector != null && message.hasOwnProperty("selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && message.hasOwnProperty("get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && message.hasOwnProperty("put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && message.hasOwnProperty("post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && message.hasOwnProperty("delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && message.hasOwnProperty("patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && message.hasOwnProperty("body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && message.hasOwnProperty("custom")) + $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.additionalBindings != null && message.additionalBindings.length) + for (var i = 0; i < message.additionalBindings.length; ++i) + $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @function decode + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.get = reader.string(); + break; + case 3: + message.put = reader.string(); + break; + case 4: + message.post = reader.string(); + break; + case 5: + message["delete"] = reader.string(); + break; + case 6: + message.patch = reader.string(); + break; + case 8: + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + case 1: + message.selector = reader.string(); + break; + case 7: + message.body = reader.string(); + break; + case 11: + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpRule message. + * @function verify + * @memberof google.api.HttpRule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpRule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.get != null && message.hasOwnProperty("get")) { + properties.pattern = 1; + if (!$util.isString(message.get)) + return "get: string expected"; + } + if (message.put != null && message.hasOwnProperty("put")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.put)) + return "put: string expected"; + } + if (message.post != null && message.hasOwnProperty("post")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.post)) + return "post: string expected"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.patch)) + return "patch: string expected"; + } + if (message.custom != null && message.hasOwnProperty("custom")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + var error = $root.google.api.CustomHttpPattern.verify(message.custom); + if (error) + return "custom." + error; + } + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { + if (!Array.isArray(message.additionalBindings)) + return "additionalBindings: array expected"; + for (var i = 0; i < message.additionalBindings.length; ++i) { + error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); + if (error) + return "additionalBindings." + error; + } + } + return null; + }; + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.HttpRule + * @static + * @param {Object.} object Plain object + * @returns {google.api.HttpRule} HttpRule + */ + HttpRule.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpRule) + return object; + var message = new $root.google.api.HttpRule(); + if (object.get != null) + message.get = String(object.get); + if (object.put != null) + message.put = String(object.put); + if (object.post != null) + message.post = String(object.post); + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.patch != null) + message.patch = String(object.patch); + if (object.custom != null) { + if (typeof object.custom !== "object") + throw TypeError(".google.api.HttpRule.custom: object expected"); + message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); + } + if (object.selector != null) + message.selector = String(object.selector); + if (object.body != null) + message.body = String(object.body); + if (object.additionalBindings) { + if (!Array.isArray(object.additionalBindings)) + throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); + message.additionalBindings = []; + for (var i = 0; i < object.additionalBindings.length; ++i) { + if (typeof object.additionalBindings[i] !== "object") + throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); + message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.HttpRule + * @static + * @param {google.api.HttpRule} message HttpRule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpRule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.additionalBindings = []; + if (options.defaults) { + object.selector = ""; + object.body = ""; + } + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.get != null && message.hasOwnProperty("get")) { + object.get = message.get; + if (options.oneofs) + object.pattern = "get"; + } + if (message.put != null && message.hasOwnProperty("put")) { + object.put = message.put; + if (options.oneofs) + object.pattern = "put"; + } + if (message.post != null && message.hasOwnProperty("post")) { + object.post = message.post; + if (options.oneofs) + object.pattern = "post"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.pattern = "delete"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + object.patch = message.patch; + if (options.oneofs) + object.pattern = "patch"; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.custom != null && message.hasOwnProperty("custom")) { + object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); + if (options.oneofs) + object.pattern = "custom"; + } + if (message.additionalBindings && message.additionalBindings.length) { + object.additionalBindings = []; + for (var j = 0; j < message.additionalBindings.length; ++j) + object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); + } + return object; + }; + + /** + * Converts this HttpRule to JSON. + * @function toJSON + * @memberof google.api.HttpRule + * @instance + * @returns {Object.} JSON object + */ + HttpRule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HttpRule; + })(); + + api.CustomHttpPattern = (function() { + + /** + * Properties of a CustomHttpPattern. + * @memberof google.api + * @interface ICustomHttpPattern + * @property {string} [kind] CustomHttpPattern kind + * @property {string} [path] CustomHttpPattern path + */ + + /** + * Constructs a new CustomHttpPattern. + * @memberof google.api + * @classdesc Represents a CustomHttpPattern. + * @constructor + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + */ + function CustomHttpPattern(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomHttpPattern kind. + * @member {string}kind + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.kind = ""; + + /** + * CustomHttpPattern path. + * @member {string}path + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.path = ""; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @function create + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance + */ + CustomHttpPattern.create = function create(properties) { + return new CustomHttpPattern(properties); + }; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encode + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && message.hasOwnProperty("kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && message.hasOwnProperty("path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + return writer; + }; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @function decode + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.kind = reader.string(); + break; + case 2: + message.path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomHttpPattern message. + * @function verify + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomHttpPattern.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + return null; + }; + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} object Plain object + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + */ + CustomHttpPattern.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CustomHttpPattern) + return object; + var message = new $root.google.api.CustomHttpPattern(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.CustomHttpPattern} message CustomHttpPattern + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomHttpPattern.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.path = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; + }; + + /** + * Converts this CustomHttpPattern to JSON. + * @function toJSON + * @memberof google.api.CustomHttpPattern + * @instance + * @returns {Object.} JSON object + */ + CustomHttpPattern.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CustomHttpPattern; + })(); + + return api; + })(); + + google.protobuf = (function() { + + /** + * Namespace protobuf. + * @memberof google + * @namespace + */ + var protobuf = {}; + + protobuf.FileDescriptorSet = (function() { + + /** + * Properties of a FileDescriptorSet. + * @memberof google.protobuf + * @interface IFileDescriptorSet + * @property {Array.} [file] FileDescriptorSet file + */ + + /** + * Constructs a new FileDescriptorSet. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorSet. + * @constructor + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + */ + function FileDescriptorSet(properties) { + this.file = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorSet file. + * @member {Array.}file + * @memberof google.protobuf.FileDescriptorSet + * @instance + */ + FileDescriptorSet.prototype.file = $util.emptyArray; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance + */ + FileDescriptorSet.create = function create(properties) { + return new FileDescriptorSet(properties); + }; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.file != null && message.file.length) + for (var i = 0; i < message.file.length; ++i) + $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.file && message.file.length)) + message.file = []; + message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorSet message. + * @function verify + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.file != null && message.hasOwnProperty("file")) { + if (!Array.isArray(message.file)) + return "file: array expected"; + for (var i = 0; i < message.file.length; ++i) { + var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]); + if (error) + return "file." + error; + } + } + return null; + }; + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + */ + FileDescriptorSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorSet) + return object; + var message = new $root.google.protobuf.FileDescriptorSet(); + if (object.file) { + if (!Array.isArray(object.file)) + throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); + message.file = []; + for (var i = 0; i < object.file.length; ++i) { + if (typeof object.file[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); + message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.file = []; + if (message.file && message.file.length) { + object.file = []; + for (var j = 0; j < message.file.length; ++j) + object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options); + } + return object; + }; + + /** + * Converts this FileDescriptorSet to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorSet + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FileDescriptorSet; + })(); + + protobuf.FileDescriptorProto = (function() { + + /** + * Properties of a FileDescriptorProto. + * @memberof google.protobuf + * @interface IFileDescriptorProto + * @property {string} [name] FileDescriptorProto name + * @property {string} ["package"] FileDescriptorProto package + * @property {Array.} [dependency] FileDescriptorProto dependency + * @property {Array.} [publicDependency] FileDescriptorProto publicDependency + * @property {Array.} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.} [messageType] FileDescriptorProto messageType + * @property {Array.} [enumType] FileDescriptorProto enumType + * @property {Array.} [service] FileDescriptorProto service + * @property {Array.} [extension] FileDescriptorProto extension + * @property {google.protobuf.IFileOptions} [options] FileDescriptorProto options + * @property {google.protobuf.ISourceCodeInfo} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo + * @property {string} [syntax] FileDescriptorProto syntax + */ + + /** + * Constructs a new FileDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorProto. + * @constructor + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + */ + function FileDescriptorProto(properties) { + this.dependency = []; + this.publicDependency = []; + this.weakDependency = []; + this.messageType = []; + this.enumType = []; + this.service = []; + this.extension = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorProto name. + * @member {string}name + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.name = ""; + + /** + * FileDescriptorProto package. + * @member {string}package_ + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype["package"] = ""; + + /** + * FileDescriptorProto dependency. + * @member {Array.}dependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.dependency = $util.emptyArray; + + /** + * FileDescriptorProto publicDependency. + * @member {Array.}publicDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.publicDependency = $util.emptyArray; + + /** + * FileDescriptorProto weakDependency. + * @member {Array.}weakDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + + /** + * FileDescriptorProto messageType. + * @member {Array.}messageType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.messageType = $util.emptyArray; + + /** + * FileDescriptorProto enumType. + * @member {Array.}enumType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * FileDescriptorProto service. + * @member {Array.}service + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.service = $util.emptyArray; + + /** + * FileDescriptorProto extension. + * @member {Array.}extension + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.extension = $util.emptyArray; + + /** + * FileDescriptorProto options. + * @member {(google.protobuf.IFileOptions|null|undefined)}options + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.options = null; + + /** + * FileDescriptorProto sourceCodeInfo. + * @member {(google.protobuf.ISourceCodeInfo|null|undefined)}sourceCodeInfo + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.sourceCodeInfo = null; + + /** + * FileDescriptorProto syntax. + * @member {string}syntax + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.syntax = ""; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance + */ + FileDescriptorProto.create = function create(properties) { + return new FileDescriptorProto(properties); + }; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message["package"] != null && message.hasOwnProperty("package")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message["package"]); + if (message.dependency != null && message.dependency.length) + for (var i = 0; i < message.dependency.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]); + if (message.messageType != null && message.messageType.length) + for (var i = 0; i < message.messageType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.messageType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.service != null && message.service.length) + for (var i = 0; i < message.service.length; ++i) + $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) + $root.google.protobuf.SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.publicDependency != null && message.publicDependency.length) + for (var i = 0; i < message.publicDependency.length; ++i) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.publicDependency[i]); + if (message.weakDependency != null && message.weakDependency.length) + for (var i = 0; i < message.weakDependency.length; ++i) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weakDependency[i]); + if (message.syntax != null && message.hasOwnProperty("syntax")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); + return writer; + }; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message["package"] = reader.string(); + break; + case 3: + if (!(message.dependency && message.dependency.length)) + message.dependency = []; + message.dependency.push(reader.string()); + break; + case 10: + if (!(message.publicDependency && message.publicDependency.length)) + message.publicDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.publicDependency.push(reader.int32()); + } else + message.publicDependency.push(reader.int32()); + break; + case 11: + if (!(message.weakDependency && message.weakDependency.length)) + message.weakDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.weakDependency.push(reader.int32()); + } else + message.weakDependency.push(reader.int32()); + break; + case 4: + if (!(message.messageType && message.messageType.length)) + message.messageType = []; + message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.service && message.service.length)) + message.service = []; + message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 8: + message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); + break; + case 9: + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); + break; + case 12: + message.syntax = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorProto message. + * @function verify + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message["package"] != null && message.hasOwnProperty("package")) + if (!$util.isString(message["package"])) + return "package: string expected"; + if (message.dependency != null && message.hasOwnProperty("dependency")) { + if (!Array.isArray(message.dependency)) + return "dependency: array expected"; + for (var i = 0; i < message.dependency.length; ++i) + if (!$util.isString(message.dependency[i])) + return "dependency: string[] expected"; + } + if (message.publicDependency != null && message.hasOwnProperty("publicDependency")) { + if (!Array.isArray(message.publicDependency)) + return "publicDependency: array expected"; + for (var i = 0; i < message.publicDependency.length; ++i) + if (!$util.isInteger(message.publicDependency[i])) + return "publicDependency: integer[] expected"; + } + if (message.weakDependency != null && message.hasOwnProperty("weakDependency")) { + if (!Array.isArray(message.weakDependency)) + return "weakDependency: array expected"; + for (var i = 0; i < message.weakDependency.length; ++i) + if (!$util.isInteger(message.weakDependency[i])) + return "weakDependency: integer[] expected"; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) { + if (!Array.isArray(message.messageType)) + return "messageType: array expected"; + for (var i = 0; i < message.messageType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.messageType[i]); + if (error) + return "messageType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.service != null && message.hasOwnProperty("service")) { + if (!Array.isArray(message.service)) + return "service: array expected"; + for (var i = 0; i < message.service.length; ++i) { + error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i]); + if (error) + return "service." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + error = $root.google.protobuf.FileOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) { + error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo); + if (error) + return "sourceCodeInfo." + error; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + if (!$util.isString(message.syntax)) + return "syntax: string expected"; + return null; + }; + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + */ + FileDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorProto) + return object; + var message = new $root.google.protobuf.FileDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object["package"] != null) + message["package"] = String(object["package"]); + if (object.dependency) { + if (!Array.isArray(object.dependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.dependency: array expected"); + message.dependency = []; + for (var i = 0; i < object.dependency.length; ++i) + message.dependency[i] = String(object.dependency[i]); + } + if (object.publicDependency) { + if (!Array.isArray(object.publicDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.publicDependency: array expected"); + message.publicDependency = []; + for (var i = 0; i < object.publicDependency.length; ++i) + message.publicDependency[i] = object.publicDependency[i] | 0; + } + if (object.weakDependency) { + if (!Array.isArray(object.weakDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.weakDependency: array expected"); + message.weakDependency = []; + for (var i = 0; i < object.weakDependency.length; ++i) + message.weakDependency[i] = object.weakDependency[i] | 0; + } + if (object.messageType) { + if (!Array.isArray(object.messageType)) + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); + message.messageType = []; + for (var i = 0; i < object.messageType.length; ++i) { + if (typeof object.messageType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: object expected"); + message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.service) { + if (!Array.isArray(object.service)) + throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); + message.service = []; + for (var i = 0; i < object.service.length; ++i) { + if (typeof object.service[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); + message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FileOptions.fromObject(object.options); + } + if (object.sourceCodeInfo != null) { + if (typeof object.sourceCodeInfo !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.sourceCodeInfo: object expected"); + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo); + } + if (object.syntax != null) + message.syntax = String(object.syntax); + return message; + }; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.FileDescriptorProto} message FileDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.dependency = []; + object.messageType = []; + object.enumType = []; + object.service = []; + object.extension = []; + object.publicDependency = []; + object.weakDependency = []; + } + if (options.defaults) { + object.name = ""; + object["package"] = ""; + object.options = null; + object.sourceCodeInfo = null; + object.syntax = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message["package"] != null && message.hasOwnProperty("package")) + object["package"] = message["package"]; + if (message.dependency && message.dependency.length) { + object.dependency = []; + for (var j = 0; j < message.dependency.length; ++j) + object.dependency[j] = message.dependency[j]; + } + if (message.messageType && message.messageType.length) { + object.messageType = []; + for (var j = 0; j < message.messageType.length; ++j) + object.messageType[j] = $root.google.protobuf.DescriptorProto.toObject(message.messageType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.service && message.service.length) { + object.service = []; + for (var j = 0; j < message.service.length; ++j) + object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FileOptions.toObject(message.options, options); + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) + object.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.toObject(message.sourceCodeInfo, options); + if (message.publicDependency && message.publicDependency.length) { + object.publicDependency = []; + for (var j = 0; j < message.publicDependency.length; ++j) + object.publicDependency[j] = message.publicDependency[j]; + } + if (message.weakDependency && message.weakDependency.length) { + object.weakDependency = []; + for (var j = 0; j < message.weakDependency.length; ++j) + object.weakDependency[j] = message.weakDependency[j]; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + object.syntax = message.syntax; + return object; + }; + + /** + * Converts this FileDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FileDescriptorProto; + })(); + + protobuf.DescriptorProto = (function() { + + /** + * Properties of a DescriptorProto. + * @memberof google.protobuf + * @interface IDescriptorProto + * @property {string} [name] DescriptorProto name + * @property {Array.} [field] DescriptorProto field + * @property {Array.} [extension] DescriptorProto extension + * @property {Array.} [nestedType] DescriptorProto nestedType + * @property {Array.} [enumType] DescriptorProto enumType + * @property {Array.} [extensionRange] DescriptorProto extensionRange + * @property {Array.} [oneofDecl] DescriptorProto oneofDecl + * @property {google.protobuf.IMessageOptions} [options] DescriptorProto options + * @property {Array.} [reservedRange] DescriptorProto reservedRange + * @property {Array.} [reservedName] DescriptorProto reservedName + */ + + /** + * Constructs a new DescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a DescriptorProto. + * @constructor + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + */ + function DescriptorProto(properties) { + this.field = []; + this.extension = []; + this.nestedType = []; + this.enumType = []; + this.extensionRange = []; + this.oneofDecl = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DescriptorProto name. + * @member {string}name + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.name = ""; + + /** + * DescriptorProto field. + * @member {Array.}field + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.field = $util.emptyArray; + + /** + * DescriptorProto extension. + * @member {Array.}extension + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extension = $util.emptyArray; + + /** + * DescriptorProto nestedType. + * @member {Array.}nestedType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.nestedType = $util.emptyArray; + + /** + * DescriptorProto enumType. + * @member {Array.}enumType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * DescriptorProto extensionRange. + * @member {Array.}extensionRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extensionRange = $util.emptyArray; + + /** + * DescriptorProto oneofDecl. + * @member {Array.}oneofDecl + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.oneofDecl = $util.emptyArray; + + /** + * DescriptorProto options. + * @member {(google.protobuf.IMessageOptions|null|undefined)}options + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.options = null; + + /** + * DescriptorProto reservedRange. + * @member {Array.}reservedRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * DescriptorProto reservedName. + * @member {Array.}reservedName + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto} DescriptorProto instance + */ + DescriptorProto.create = function create(properties) { + return new DescriptorProto(properties); + }; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.field != null && message.field.length) + for (var i = 0; i < message.field.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nestedType != null && message.nestedType.length) + for (var i = 0; i < message.nestedType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.nestedType[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.extensionRange != null && message.extensionRange.length) + for (var i = 0; i < message.extensionRange.length; ++i) + $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extensionRange[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.oneofDecl != null && message.oneofDecl.length) + for (var i = 0; i < message.oneofDecl.length; ++i) + $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + return writer; + }; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.field && message.field.length)) + message.field = []; + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.nestedType && message.nestedType.length)) + message.nestedType = []; + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.extensionRange && message.extensionRange.length)) + message.extensionRange = []; + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); + break; + case 8: + if (!(message.oneofDecl && message.oneofDecl.length)) + message.oneofDecl = []; + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); + break; + case 9: + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); + break; + case 10: + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DescriptorProto message. + * @function verify + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.field != null && message.hasOwnProperty("field")) { + if (!Array.isArray(message.field)) + return "field: array expected"; + for (var i = 0; i < message.field.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); + if (error) + return "field." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.nestedType != null && message.hasOwnProperty("nestedType")) { + if (!Array.isArray(message.nestedType)) + return "nestedType: array expected"; + for (var i = 0; i < message.nestedType.length; ++i) { + error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i]); + if (error) + return "nestedType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.extensionRange != null && message.hasOwnProperty("extensionRange")) { + if (!Array.isArray(message.extensionRange)) + return "extensionRange: array expected"; + for (var i = 0; i < message.extensionRange.length; ++i) { + error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i]); + if (error) + return "extensionRange." + error; + } + } + if (message.oneofDecl != null && message.hasOwnProperty("oneofDecl")) { + if (!Array.isArray(message.oneofDecl)) + return "oneofDecl: array expected"; + for (var i = 0; i < message.oneofDecl.length; ++i) { + error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i]); + if (error) + return "oneofDecl." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + error = $root.google.protobuf.MessageOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + return null; + }; + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto} DescriptorProto + */ + DescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto) + return object; + var message = new $root.google.protobuf.DescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.field) { + if (!Array.isArray(object.field)) + throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); + message.field = []; + for (var i = 0; i < object.field.length; ++i) { + if (typeof object.field[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); + message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.nestedType) { + if (!Array.isArray(object.nestedType)) + throw TypeError(".google.protobuf.DescriptorProto.nestedType: array expected"); + message.nestedType = []; + for (var i = 0; i < object.nestedType.length; ++i) { + if (typeof object.nestedType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); + message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.DescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.extensionRange) { + if (!Array.isArray(object.extensionRange)) + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: array expected"); + message.extensionRange = []; + for (var i = 0; i < object.extensionRange.length; ++i) { + if (typeof object.extensionRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); + message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i]); + } + } + if (object.oneofDecl) { + if (!Array.isArray(object.oneofDecl)) + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: array expected"); + message.oneofDecl = []; + for (var i = 0; i < object.oneofDecl.length; ++i) { + if (typeof object.oneofDecl[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); + message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.DescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + return message; + }; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.DescriptorProto} message DescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.field = []; + object.nestedType = []; + object.enumType = []; + object.extensionRange = []; + object.extension = []; + object.oneofDecl = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.field && message.field.length) { + object.field = []; + for (var j = 0; j < message.field.length; ++j) + object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); + } + if (message.nestedType && message.nestedType.length) { + object.nestedType = []; + for (var j = 0; j < message.nestedType.length; ++j) + object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.extensionRange && message.extensionRange.length) { + object.extensionRange = []; + for (var j = 0; j < message.extensionRange.length; ++j) + object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); + if (message.oneofDecl && message.oneofDecl.length) { + object.oneofDecl = []; + for (var j = 0; j < message.oneofDecl.length; ++j) + object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options); + } + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + return object; + }; + + /** + * Converts this DescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto + * @instance + * @returns {Object.} JSON object + */ + DescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + DescriptorProto.ExtensionRange = (function() { + + /** + * Properties of an ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @interface IExtensionRange + * @property {number} [start] ExtensionRange start + * @property {number} [end] ExtensionRange end + */ + + /** + * Constructs a new ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents an ExtensionRange. + * @constructor + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + */ + function ExtensionRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRange start. + * @member {number}start + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.start = 0; + + /** + * ExtensionRange end. + * @member {number}end + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.end = 0; + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange instance + */ + ExtensionRange.create = function create(properties) { + return new ExtensionRange(properties); + }; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && message.hasOwnProperty("start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && message.hasOwnProperty("end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + */ + ExtensionRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this ExtensionRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + * @returns {Object.} JSON object + */ + ExtensionRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExtensionRange; + })(); + + DescriptorProto.ReservedRange = (function() { + + /** + * Properties of a ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @interface IReservedRange + * @property {number} [start] ReservedRange start + * @property {number} [end] ReservedRange end + */ + + /** + * Constructs a new ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents a ReservedRange. + * @constructor + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + */ + function ReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReservedRange start. + * @member {number}start + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.start = 0; + + /** + * ReservedRange end. + * @member {number}end + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.end = 0; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance + */ + ReservedRange.create = function create(properties) { + return new ReservedRange(properties); + }; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && message.hasOwnProperty("start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && message.hasOwnProperty("end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReservedRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + */ + ReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this ReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + * @returns {Object.} JSON object + */ + ReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReservedRange; + })(); + + return DescriptorProto; + })(); + + protobuf.FieldDescriptorProto = (function() { + + /** + * Properties of a FieldDescriptorProto. + * @memberof google.protobuf + * @interface IFieldDescriptorProto + * @property {string} [name] FieldDescriptorProto name + * @property {number} [number] FieldDescriptorProto number + * @property {google.protobuf.FieldDescriptorProto.Label} [label] FieldDescriptorProto label + * @property {google.protobuf.FieldDescriptorProto.Type} [type] FieldDescriptorProto type + * @property {string} [typeName] FieldDescriptorProto typeName + * @property {string} [extendee] FieldDescriptorProto extendee + * @property {string} [defaultValue] FieldDescriptorProto defaultValue + * @property {number} [oneofIndex] FieldDescriptorProto oneofIndex + * @property {string} [jsonName] FieldDescriptorProto jsonName + * @property {google.protobuf.IFieldOptions} [options] FieldDescriptorProto options + */ + + /** + * Constructs a new FieldDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FieldDescriptorProto. + * @constructor + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + */ + function FieldDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldDescriptorProto name. + * @member {string}name + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.name = ""; + + /** + * FieldDescriptorProto number. + * @member {number}number + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.number = 0; + + /** + * FieldDescriptorProto label. + * @member {google.protobuf.FieldDescriptorProto.Label}label + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.label = 1; + + /** + * FieldDescriptorProto type. + * @member {google.protobuf.FieldDescriptorProto.Type}type + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.type = 1; + + /** + * FieldDescriptorProto typeName. + * @member {string}typeName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.typeName = ""; + + /** + * FieldDescriptorProto extendee. + * @member {string}extendee + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.extendee = ""; + + /** + * FieldDescriptorProto defaultValue. + * @member {string}defaultValue + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.defaultValue = ""; + + /** + * FieldDescriptorProto oneofIndex. + * @member {number}oneofIndex + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.oneofIndex = 0; + + /** + * FieldDescriptorProto jsonName. + * @member {string}jsonName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.jsonName = ""; + + /** + * FieldDescriptorProto options. + * @member {(google.protobuf.IFieldOptions|null|undefined)}options + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.options = null; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance + */ + FieldDescriptorProto.create = function create(properties) { + return new FieldDescriptorProto(properties); + }; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.extendee != null && message.hasOwnProperty("extendee")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); + if (message.number != null && message.hasOwnProperty("number")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); + if (message.label != null && message.hasOwnProperty("label")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); + if (message.typeName != null && message.hasOwnProperty("typeName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); + return writer; + }; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 3: + message.number = reader.int32(); + break; + case 4: + message.label = reader.int32(); + break; + case 5: + message.type = reader.int32(); + break; + case 6: + message.typeName = reader.string(); + break; + case 2: + message.extendee = reader.string(); + break; + case 7: + message.defaultValue = reader.string(); + break; + case 9: + message.oneofIndex = reader.int32(); + break; + case 10: + message.jsonName = reader.string(); + break; + case 8: + message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldDescriptorProto message. + * @function verify + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.label != null && message.hasOwnProperty("label")) + switch (message.label) { + default: + return "label: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + break; + } + if (message.typeName != null && message.hasOwnProperty("typeName")) + if (!$util.isString(message.typeName)) + return "typeName: string expected"; + if (message.extendee != null && message.hasOwnProperty("extendee")) + if (!$util.isString(message.extendee)) + return "extendee: string expected"; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + if (!$util.isString(message.defaultValue)) + return "defaultValue: string expected"; + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + if (!$util.isInteger(message.oneofIndex)) + return "oneofIndex: integer expected"; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + if (!$util.isString(message.jsonName)) + return "jsonName: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FieldOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + */ + FieldDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldDescriptorProto) + return object; + var message = new $root.google.protobuf.FieldDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + switch (object.label) { + case "LABEL_OPTIONAL": + case 1: + message.label = 1; + break; + case "LABEL_REQUIRED": + case 2: + message.label = 2; + break; + case "LABEL_REPEATED": + case 3: + message.label = 3; + break; + } + switch (object.type) { + case "TYPE_DOUBLE": + case 1: + message.type = 1; + break; + case "TYPE_FLOAT": + case 2: + message.type = 2; + break; + case "TYPE_INT64": + case 3: + message.type = 3; + break; + case "TYPE_UINT64": + case 4: + message.type = 4; + break; + case "TYPE_INT32": + case 5: + message.type = 5; + break; + case "TYPE_FIXED64": + case 6: + message.type = 6; + break; + case "TYPE_FIXED32": + case 7: + message.type = 7; + break; + case "TYPE_BOOL": + case 8: + message.type = 8; + break; + case "TYPE_STRING": + case 9: + message.type = 9; + break; + case "TYPE_GROUP": + case 10: + message.type = 10; + break; + case "TYPE_MESSAGE": + case 11: + message.type = 11; + break; + case "TYPE_BYTES": + case 12: + message.type = 12; + break; + case "TYPE_UINT32": + case 13: + message.type = 13; + break; + case "TYPE_ENUM": + case 14: + message.type = 14; + break; + case "TYPE_SFIXED32": + case 15: + message.type = 15; + break; + case "TYPE_SFIXED64": + case 16: + message.type = 16; + break; + case "TYPE_SINT32": + case 17: + message.type = 17; + break; + case "TYPE_SINT64": + case 18: + message.type = 18; + break; + } + if (object.typeName != null) + message.typeName = String(object.typeName); + if (object.extendee != null) + message.extendee = String(object.extendee); + if (object.defaultValue != null) + message.defaultValue = String(object.defaultValue); + if (object.oneofIndex != null) + message.oneofIndex = object.oneofIndex | 0; + if (object.jsonName != null) + message.jsonName = String(object.jsonName); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.extendee = ""; + object.number = 0; + object.label = options.enums === String ? "LABEL_OPTIONAL" : 1; + object.type = options.enums === String ? "TYPE_DOUBLE" : 1; + object.typeName = ""; + object.defaultValue = ""; + object.options = null; + object.oneofIndex = 0; + object.jsonName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.extendee != null && message.hasOwnProperty("extendee")) + object.extendee = message.extendee; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.label != null && message.hasOwnProperty("label")) + object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; + if (message.typeName != null && message.hasOwnProperty("typeName")) + object.typeName = message.typeName; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + object.defaultValue = message.defaultValue; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + object.oneofIndex = message.oneofIndex; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + object.jsonName = message.jsonName; + return object; + }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FieldDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FieldDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @enum {string} + * @property {number} TYPE_DOUBLE=1 TYPE_DOUBLE value + * @property {number} TYPE_FLOAT=2 TYPE_FLOAT value + * @property {number} TYPE_INT64=3 TYPE_INT64 value + * @property {number} TYPE_UINT64=4 TYPE_UINT64 value + * @property {number} TYPE_INT32=5 TYPE_INT32 value + * @property {number} TYPE_FIXED64=6 TYPE_FIXED64 value + * @property {number} TYPE_FIXED32=7 TYPE_FIXED32 value + * @property {number} TYPE_BOOL=8 TYPE_BOOL value + * @property {number} TYPE_STRING=9 TYPE_STRING value + * @property {number} TYPE_GROUP=10 TYPE_GROUP value + * @property {number} TYPE_MESSAGE=11 TYPE_MESSAGE value + * @property {number} TYPE_BYTES=12 TYPE_BYTES value + * @property {number} TYPE_UINT32=13 TYPE_UINT32 value + * @property {number} TYPE_ENUM=14 TYPE_ENUM value + * @property {number} TYPE_SFIXED32=15 TYPE_SFIXED32 value + * @property {number} TYPE_SFIXED64=16 TYPE_SFIXED64 value + * @property {number} TYPE_SINT32=17 TYPE_SINT32 value + * @property {number} TYPE_SINT64=18 TYPE_SINT64 value + */ + FieldDescriptorProto.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "TYPE_DOUBLE"] = 1; + values[valuesById[2] = "TYPE_FLOAT"] = 2; + values[valuesById[3] = "TYPE_INT64"] = 3; + values[valuesById[4] = "TYPE_UINT64"] = 4; + values[valuesById[5] = "TYPE_INT32"] = 5; + values[valuesById[6] = "TYPE_FIXED64"] = 6; + values[valuesById[7] = "TYPE_FIXED32"] = 7; + values[valuesById[8] = "TYPE_BOOL"] = 8; + values[valuesById[9] = "TYPE_STRING"] = 9; + values[valuesById[10] = "TYPE_GROUP"] = 10; + values[valuesById[11] = "TYPE_MESSAGE"] = 11; + values[valuesById[12] = "TYPE_BYTES"] = 12; + values[valuesById[13] = "TYPE_UINT32"] = 13; + values[valuesById[14] = "TYPE_ENUM"] = 14; + values[valuesById[15] = "TYPE_SFIXED32"] = 15; + values[valuesById[16] = "TYPE_SFIXED64"] = 16; + values[valuesById[17] = "TYPE_SINT32"] = 17; + values[valuesById[18] = "TYPE_SINT64"] = 18; + return values; + })(); + + /** + * Label enum. + * @enum {string} + * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value + * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value + * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value + */ + FieldDescriptorProto.Label = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "LABEL_OPTIONAL"] = 1; + values[valuesById[2] = "LABEL_REQUIRED"] = 2; + values[valuesById[3] = "LABEL_REPEATED"] = 3; + return values; + })(); + + return FieldDescriptorProto; + })(); + + protobuf.OneofDescriptorProto = (function() { + + /** + * Properties of an OneofDescriptorProto. + * @memberof google.protobuf + * @interface IOneofDescriptorProto + * @property {string} [name] OneofDescriptorProto name + * @property {google.protobuf.IOneofOptions} [options] OneofDescriptorProto options + */ + + /** + * Constructs a new OneofDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an OneofDescriptorProto. + * @constructor + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + */ + function OneofDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofDescriptorProto name. + * @member {string}name + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.name = ""; + + /** + * OneofDescriptorProto options. + * @member {(google.protobuf.IOneofOptions|null|undefined)}options + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.options = null; + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance + */ + OneofDescriptorProto.create = function create(properties) { + return new OneofDescriptorProto(properties); + }; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofDescriptorProto message. + * @function verify + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.OneofOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + */ + OneofDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofDescriptorProto) + return object; + var message = new $root.google.protobuf.OneofDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.OneofDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + OneofDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OneofDescriptorProto; + })(); + + protobuf.EnumDescriptorProto = (function() { + + /** + * Properties of an EnumDescriptorProto. + * @memberof google.protobuf + * @interface IEnumDescriptorProto + * @property {string} [name] EnumDescriptorProto name + * @property {Array.} [value] EnumDescriptorProto value + * @property {google.protobuf.IEnumOptions} [options] EnumDescriptorProto options + */ + + /** + * Constructs a new EnumDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumDescriptorProto. + * @constructor + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + */ + function EnumDescriptorProto(properties) { + this.value = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumDescriptorProto name. + * @member {string}name + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.name = ""; + + /** + * EnumDescriptorProto value. + * @member {Array.}value + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.value = $util.emptyArray; + + /** + * EnumDescriptorProto options. + * @member {(google.protobuf.IEnumOptions|null|undefined)}options + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.options = null; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance + */ + EnumDescriptorProto.create = function create(properties) { + return new EnumDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && message.value.length) + for (var i = 0; i < message.value.length; ++i) + $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.value && message.value.length)) + message.value = []; + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) { + if (!Array.isArray(message.value)) + return "value: array expected"; + for (var i = 0; i < message.value.length; ++i) { + var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); + if (error) + return "value." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + error = $root.google.protobuf.EnumOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + */ + EnumDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.value) { + if (!Array.isArray(object.value)) + throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); + message.value = []; + for (var i = 0; i < object.value.length; ++i) { + if (typeof object.value[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); + message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.value = []; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value && message.value.length) { + object.value = []; + for (var j = 0; j < message.value.length; ++j) + object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumDescriptorProto; + })(); + + protobuf.EnumValueDescriptorProto = (function() { + + /** + * Properties of an EnumValueDescriptorProto. + * @memberof google.protobuf + * @interface IEnumValueDescriptorProto + * @property {string} [name] EnumValueDescriptorProto name + * @property {number} [number] EnumValueDescriptorProto number + * @property {google.protobuf.IEnumValueOptions} [options] EnumValueDescriptorProto options + */ + + /** + * Constructs a new EnumValueDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumValueDescriptorProto. + * @constructor + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + */ + function EnumValueDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueDescriptorProto name. + * @member {string}name + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.name = ""; + + /** + * EnumValueDescriptorProto number. + * @member {number}number + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.number = 0; + + /** + * EnumValueDescriptorProto options. + * @member {(google.protobuf.IEnumValueOptions|null|undefined)}options + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.options = null; + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance + */ + EnumValueDescriptorProto.create = function create(properties) { + return new EnumValueDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.number != null && message.hasOwnProperty("number")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.number = reader.int32(); + break; + case 3: + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumValueOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + */ + EnumValueDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumValueDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.number = 0; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumValueDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumValueDescriptorProto; + })(); + + protobuf.ServiceDescriptorProto = (function() { + + /** + * Properties of a ServiceDescriptorProto. + * @memberof google.protobuf + * @interface IServiceDescriptorProto + * @property {string} [name] ServiceDescriptorProto name + * @property {Array.} [method] ServiceDescriptorProto method + * @property {google.protobuf.IServiceOptions} [options] ServiceDescriptorProto options + */ + + /** + * Constructs a new ServiceDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a ServiceDescriptorProto. + * @constructor + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + */ + function ServiceDescriptorProto(properties) { + this.method = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceDescriptorProto name. + * @member {string}name + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.name = ""; + + /** + * ServiceDescriptorProto method. + * @member {Array.}method + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.method = $util.emptyArray; + + /** + * ServiceDescriptorProto options. + * @member {(google.protobuf.IServiceOptions|null|undefined)}options + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.options = null; + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance + */ + ServiceDescriptorProto.create = function create(properties) { + return new ServiceDescriptorProto(properties); + }; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.method != null && message.method.length) + for (var i = 0; i < message.method.length; ++i) + $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.method && message.method.length)) + message.method = []; + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceDescriptorProto message. + * @function verify + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.method != null && message.hasOwnProperty("method")) { + if (!Array.isArray(message.method)) + return "method: array expected"; + for (var i = 0; i < message.method.length; ++i) { + var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); + if (error) + return "method." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + error = $root.google.protobuf.ServiceOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + */ + ServiceDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceDescriptorProto) + return object; + var message = new $root.google.protobuf.ServiceDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.method) { + if (!Array.isArray(object.method)) + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); + message.method = []; + for (var i = 0; i < object.method.length; ++i) { + if (typeof object.method[i] !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); + message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.method = []; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.method && message.method.length) { + object.method = []; + for (var j = 0; j < message.method.length; ++j) + object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + ServiceDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ServiceDescriptorProto; + })(); + + protobuf.MethodDescriptorProto = (function() { + + /** + * Properties of a MethodDescriptorProto. + * @memberof google.protobuf + * @interface IMethodDescriptorProto + * @property {string} [name] MethodDescriptorProto name + * @property {string} [inputType] MethodDescriptorProto inputType + * @property {string} [outputType] MethodDescriptorProto outputType + * @property {google.protobuf.IMethodOptions} [options] MethodDescriptorProto options + * @property {boolean} [clientStreaming] MethodDescriptorProto clientStreaming + * @property {boolean} [serverStreaming] MethodDescriptorProto serverStreaming + */ + + /** + * Constructs a new MethodDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a MethodDescriptorProto. + * @constructor + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + */ + function MethodDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodDescriptorProto name. + * @member {string}name + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.name = ""; + + /** + * MethodDescriptorProto inputType. + * @member {string}inputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.inputType = ""; + + /** + * MethodDescriptorProto outputType. + * @member {string}outputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.outputType = ""; + + /** + * MethodDescriptorProto options. + * @member {(google.protobuf.IMethodOptions|null|undefined)}options + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.options = null; + + /** + * MethodDescriptorProto clientStreaming. + * @member {boolean}clientStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.clientStreaming = false; + + /** + * MethodDescriptorProto serverStreaming. + * @member {boolean}serverStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.serverStreaming = false; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance + */ + MethodDescriptorProto.create = function create(properties) { + return new MethodDescriptorProto(properties); + }; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.inputType != null && message.hasOwnProperty("inputType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); + if (message.outputType != null && message.hasOwnProperty("outputType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); + return writer; + }; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.inputType = reader.string(); + break; + case 3: + message.outputType = reader.string(); + break; + case 4: + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + break; + case 5: + message.clientStreaming = reader.bool(); + break; + case 6: + message.serverStreaming = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodDescriptorProto message. + * @function verify + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.inputType != null && message.hasOwnProperty("inputType")) + if (!$util.isString(message.inputType)) + return "inputType: string expected"; + if (message.outputType != null && message.hasOwnProperty("outputType")) + if (!$util.isString(message.outputType)) + return "outputType: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MethodOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + if (typeof message.clientStreaming !== "boolean") + return "clientStreaming: boolean expected"; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + if (typeof message.serverStreaming !== "boolean") + return "serverStreaming: boolean expected"; + return null; + }; + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + */ + MethodDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodDescriptorProto) + return object; + var message = new $root.google.protobuf.MethodDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.inputType != null) + message.inputType = String(object.inputType); + if (object.outputType != null) + message.outputType = String(object.outputType); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); + } + if (object.clientStreaming != null) + message.clientStreaming = Boolean(object.clientStreaming); + if (object.serverStreaming != null) + message.serverStreaming = Boolean(object.serverStreaming); + return message; + }; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.inputType = ""; + object.outputType = ""; + object.options = null; + object.clientStreaming = false; + object.serverStreaming = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.inputType != null && message.hasOwnProperty("inputType")) + object.inputType = message.inputType; + if (message.outputType != null && message.hasOwnProperty("outputType")) + object.outputType = message.outputType; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + object.clientStreaming = message.clientStreaming; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + object.serverStreaming = message.serverStreaming; + return object; + }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.MethodDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + MethodDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MethodDescriptorProto; + })(); + + protobuf.FileOptions = (function() { + + /** + * Properties of a FileOptions. + * @memberof google.protobuf + * @interface IFileOptions + * @property {string} [javaPackage] FileOptions javaPackage + * @property {string} [javaOuterClassname] FileOptions javaOuterClassname + * @property {boolean} [javaMultipleFiles] FileOptions javaMultipleFiles + * @property {boolean} [javaGenerateEqualsAndHash] FileOptions javaGenerateEqualsAndHash + * @property {boolean} [javaStringCheckUtf8] FileOptions javaStringCheckUtf8 + * @property {google.protobuf.FileOptions.OptimizeMode} [optimizeFor] FileOptions optimizeFor + * @property {string} [goPackage] FileOptions goPackage + * @property {boolean} [ccGenericServices] FileOptions ccGenericServices + * @property {boolean} [javaGenericServices] FileOptions javaGenericServices + * @property {boolean} [pyGenericServices] FileOptions pyGenericServices + * @property {boolean} [deprecated] FileOptions deprecated + * @property {boolean} [ccEnableArenas] FileOptions ccEnableArenas + * @property {string} [objcClassPrefix] FileOptions objcClassPrefix + * @property {string} [csharpNamespace] FileOptions csharpNamespace + * @property {Array.} [uninterpretedOption] FileOptions uninterpretedOption + */ + + /** + * Constructs a new FileOptions. + * @memberof google.protobuf + * @classdesc Represents a FileOptions. + * @constructor + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + */ + function FileOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileOptions javaPackage. + * @member {string}javaPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaPackage = ""; + + /** + * FileOptions javaOuterClassname. + * @member {string}javaOuterClassname + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaOuterClassname = ""; + + /** + * FileOptions javaMultipleFiles. + * @member {boolean}javaMultipleFiles + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaMultipleFiles = false; + + /** + * FileOptions javaGenerateEqualsAndHash. + * @member {boolean}javaGenerateEqualsAndHash + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenerateEqualsAndHash = false; + + /** + * FileOptions javaStringCheckUtf8. + * @member {boolean}javaStringCheckUtf8 + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaStringCheckUtf8 = false; + + /** + * FileOptions optimizeFor. + * @member {google.protobuf.FileOptions.OptimizeMode}optimizeFor + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.optimizeFor = 1; + + /** + * FileOptions goPackage. + * @member {string}goPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.goPackage = ""; + + /** + * FileOptions ccGenericServices. + * @member {boolean}ccGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccGenericServices = false; + + /** + * FileOptions javaGenericServices. + * @member {boolean}javaGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenericServices = false; + + /** + * FileOptions pyGenericServices. + * @member {boolean}pyGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.pyGenericServices = false; + + /** + * FileOptions deprecated. + * @member {boolean}deprecated + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.deprecated = false; + + /** + * FileOptions ccEnableArenas. + * @member {boolean}ccEnableArenas + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccEnableArenas = false; + + /** + * FileOptions objcClassPrefix. + * @member {string}objcClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.objcClassPrefix = ""; + + /** + * FileOptions csharpNamespace. + * @member {string}csharpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.csharpNamespace = ""; + + /** + * FileOptions uninterpretedOption. + * @member {Array.}uninterpretedOption + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new FileOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + * @returns {google.protobuf.FileOptions} FileOptions instance + */ + FileOptions.create = function create(properties) { + return new FileOptions(properties); + }; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.javaPackage = reader.string(); + break; + case 8: + message.javaOuterClassname = reader.string(); + break; + case 10: + message.javaMultipleFiles = reader.bool(); + break; + case 20: + message.javaGenerateEqualsAndHash = reader.bool(); + break; + case 27: + message.javaStringCheckUtf8 = reader.bool(); + break; + case 9: + message.optimizeFor = reader.int32(); + break; + case 11: + message.goPackage = reader.string(); + break; + case 16: + message.ccGenericServices = reader.bool(); + break; + case 17: + message.javaGenericServices = reader.bool(); + break; + case 18: + message.pyGenericServices = reader.bool(); + break; + case 23: + message.deprecated = reader.bool(); + break; + case 31: + message.ccEnableArenas = reader.bool(); + break; + case 36: + message.objcClassPrefix = reader.string(); + break; + case 37: + message.csharpNamespace = reader.string(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileOptions message. + * @function verify + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + if (!$util.isString(message.javaPackage)) + return "javaPackage: string expected"; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + if (!$util.isString(message.javaOuterClassname)) + return "javaOuterClassname: string expected"; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + if (typeof message.javaMultipleFiles !== "boolean") + return "javaMultipleFiles: boolean expected"; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + if (typeof message.javaGenerateEqualsAndHash !== "boolean") + return "javaGenerateEqualsAndHash: boolean expected"; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + if (typeof message.javaStringCheckUtf8 !== "boolean") + return "javaStringCheckUtf8: boolean expected"; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + switch (message.optimizeFor) { + default: + return "optimizeFor: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + if (!$util.isString(message.goPackage)) + return "goPackage: string expected"; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + if (typeof message.ccGenericServices !== "boolean") + return "ccGenericServices: boolean expected"; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + if (typeof message.javaGenericServices !== "boolean") + return "javaGenericServices: boolean expected"; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + if (typeof message.pyGenericServices !== "boolean") + return "pyGenericServices: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + if (typeof message.ccEnableArenas !== "boolean") + return "ccEnableArenas: boolean expected"; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + if (!$util.isString(message.objcClassPrefix)) + return "objcClassPrefix: string expected"; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + if (!$util.isString(message.csharpNamespace)) + return "csharpNamespace: string expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileOptions} FileOptions + */ + FileOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileOptions) + return object; + var message = new $root.google.protobuf.FileOptions(); + if (object.javaPackage != null) + message.javaPackage = String(object.javaPackage); + if (object.javaOuterClassname != null) + message.javaOuterClassname = String(object.javaOuterClassname); + if (object.javaMultipleFiles != null) + message.javaMultipleFiles = Boolean(object.javaMultipleFiles); + if (object.javaGenerateEqualsAndHash != null) + message.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); + if (object.javaStringCheckUtf8 != null) + message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); + switch (object.optimizeFor) { + case "SPEED": + case 1: + message.optimizeFor = 1; + break; + case "CODE_SIZE": + case 2: + message.optimizeFor = 2; + break; + case "LITE_RUNTIME": + case 3: + message.optimizeFor = 3; + break; + } + if (object.goPackage != null) + message.goPackage = String(object.goPackage); + if (object.ccGenericServices != null) + message.ccGenericServices = Boolean(object.ccGenericServices); + if (object.javaGenericServices != null) + message.javaGenericServices = Boolean(object.javaGenericServices); + if (object.pyGenericServices != null) + message.pyGenericServices = Boolean(object.pyGenericServices); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.ccEnableArenas != null) + message.ccEnableArenas = Boolean(object.ccEnableArenas); + if (object.objcClassPrefix != null) + message.objcClassPrefix = String(object.objcClassPrefix); + if (object.csharpNamespace != null) + message.csharpNamespace = String(object.csharpNamespace); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.FileOptions} message FileOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.javaPackage = ""; + object.javaOuterClassname = ""; + object.optimizeFor = options.enums === String ? "SPEED" : 1; + object.javaMultipleFiles = false; + object.goPackage = ""; + object.ccGenericServices = false; + object.javaGenericServices = false; + object.pyGenericServices = false; + object.javaGenerateEqualsAndHash = false; + object.deprecated = false; + object.javaStringCheckUtf8 = false; + object.ccEnableArenas = false; + object.objcClassPrefix = ""; + object.csharpNamespace = ""; + } + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + object.javaPackage = message.javaPackage; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + object.javaOuterClassname = message.javaOuterClassname; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + object.javaMultipleFiles = message.javaMultipleFiles; + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + object.goPackage = message.goPackage; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + object.ccGenericServices = message.ccGenericServices; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + object.javaGenericServices = message.javaGenericServices; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + object.pyGenericServices = message.pyGenericServices; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + object.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + object.javaStringCheckUtf8 = message.javaStringCheckUtf8; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + object.ccEnableArenas = message.ccEnableArenas; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + object.objcClassPrefix = message.objcClassPrefix; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + object.csharpNamespace = message.csharpNamespace; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this FileOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FileOptions + * @instance + * @returns {Object.} JSON object + */ + FileOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * OptimizeMode enum. + * @enum {string} + * @property {number} SPEED=1 SPEED value + * @property {number} CODE_SIZE=2 CODE_SIZE value + * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value + */ + FileOptions.OptimizeMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "SPEED"] = 1; + values[valuesById[2] = "CODE_SIZE"] = 2; + values[valuesById[3] = "LITE_RUNTIME"] = 3; + return values; + })(); + + return FileOptions; + })(); + + protobuf.MessageOptions = (function() { + + /** + * Properties of a MessageOptions. + * @memberof google.protobuf + * @interface IMessageOptions + * @property {boolean} [messageSetWireFormat] MessageOptions messageSetWireFormat + * @property {boolean} [noStandardDescriptorAccessor] MessageOptions noStandardDescriptorAccessor + * @property {boolean} [deprecated] MessageOptions deprecated + * @property {boolean} [mapEntry] MessageOptions mapEntry + * @property {Array.} [uninterpretedOption] MessageOptions uninterpretedOption + */ + + /** + * Constructs a new MessageOptions. + * @memberof google.protobuf + * @classdesc Represents a MessageOptions. + * @constructor + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + */ + function MessageOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageOptions messageSetWireFormat. + * @member {boolean}messageSetWireFormat + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.messageSetWireFormat = false; + + /** + * MessageOptions noStandardDescriptorAccessor. + * @member {boolean}noStandardDescriptorAccessor + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.noStandardDescriptorAccessor = false; + + /** + * MessageOptions deprecated. + * @member {boolean}deprecated + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.deprecated = false; + + /** + * MessageOptions mapEntry. + * @member {boolean}mapEntry + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.mapEntry = false; + + /** + * MessageOptions uninterpretedOption. + * @member {Array.}uninterpretedOption + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + * @returns {google.protobuf.MessageOptions} MessageOptions instance + */ + MessageOptions.create = function create(properties) { + return new MessageOptions(properties); + }; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.mapEntry); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messageSetWireFormat = reader.bool(); + break; + case 2: + message.noStandardDescriptorAccessor = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 7: + message.mapEntry = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageOptions message. + * @function verify + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + if (typeof message.messageSetWireFormat !== "boolean") + return "messageSetWireFormat: boolean expected"; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + if (typeof message.noStandardDescriptorAccessor !== "boolean") + return "noStandardDescriptorAccessor: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + if (typeof message.mapEntry !== "boolean") + return "mapEntry: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MessageOptions} MessageOptions + */ + MessageOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MessageOptions) + return object; + var message = new $root.google.protobuf.MessageOptions(); + if (object.messageSetWireFormat != null) + message.messageSetWireFormat = Boolean(object.messageSetWireFormat); + if (object.noStandardDescriptorAccessor != null) + message.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.mapEntry != null) + message.mapEntry = Boolean(object.mapEntry); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.MessageOptions} message MessageOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.messageSetWireFormat = false; + object.noStandardDescriptorAccessor = false; + object.deprecated = false; + object.mapEntry = false; + } + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + object.messageSetWireFormat = message.messageSetWireFormat; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + object.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + object.mapEntry = message.mapEntry; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this MessageOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MessageOptions + * @instance + * @returns {Object.} JSON object + */ + MessageOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MessageOptions; + })(); + + protobuf.FieldOptions = (function() { + + /** + * Properties of a FieldOptions. + * @memberof google.protobuf + * @interface IFieldOptions + * @property {google.protobuf.FieldOptions.CType} [ctype] FieldOptions ctype + * @property {boolean} [packed] FieldOptions packed + * @property {google.protobuf.FieldOptions.JSType} [jstype] FieldOptions jstype + * @property {boolean} [lazy] FieldOptions lazy + * @property {boolean} [deprecated] FieldOptions deprecated + * @property {boolean} [weak] FieldOptions weak + * @property {Array.} [uninterpretedOption] FieldOptions uninterpretedOption + */ + + /** + * Constructs a new FieldOptions. + * @memberof google.protobuf + * @classdesc Represents a FieldOptions. + * @constructor + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + */ + function FieldOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldOptions ctype. + * @member {google.protobuf.FieldOptions.CType}ctype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.ctype = 0; + + /** + * FieldOptions packed. + * @member {boolean}packed + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.packed = false; + + /** + * FieldOptions jstype. + * @member {google.protobuf.FieldOptions.JSType}jstype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.jstype = 0; + + /** + * FieldOptions lazy. + * @member {boolean}lazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.lazy = false; + + /** + * FieldOptions deprecated. + * @member {boolean}deprecated + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.deprecated = false; + + /** + * FieldOptions weak. + * @member {boolean}weak + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.weak = false; + + /** + * FieldOptions uninterpretedOption. + * @member {Array.}uninterpretedOption + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions} FieldOptions instance + */ + FieldOptions.create = function create(properties) { + return new FieldOptions(properties); + }; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ctype != null && message.hasOwnProperty("ctype")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); + if (message.packed != null && message.hasOwnProperty("packed")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.lazy != null && message.hasOwnProperty("lazy")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); + if (message.jstype != null && message.hasOwnProperty("jstype")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); + if (message.weak != null && message.hasOwnProperty("weak")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ctype = reader.int32(); + break; + case 2: + message.packed = reader.bool(); + break; + case 6: + message.jstype = reader.int32(); + break; + case 5: + message.lazy = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 10: + message.weak = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldOptions message. + * @function verify + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ctype != null && message.hasOwnProperty("ctype")) + switch (message.ctype) { + default: + return "ctype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.packed != null && message.hasOwnProperty("packed")) + if (typeof message.packed !== "boolean") + return "packed: boolean expected"; + if (message.jstype != null && message.hasOwnProperty("jstype")) + switch (message.jstype) { + default: + return "jstype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.lazy != null && message.hasOwnProperty("lazy")) + if (typeof message.lazy !== "boolean") + return "lazy: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.weak != null && message.hasOwnProperty("weak")) + if (typeof message.weak !== "boolean") + return "weak: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions} FieldOptions + */ + FieldOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions) + return object; + var message = new $root.google.protobuf.FieldOptions(); + switch (object.ctype) { + case "STRING": + case 0: + message.ctype = 0; + break; + case "CORD": + case 1: + message.ctype = 1; + break; + case "STRING_PIECE": + case 2: + message.ctype = 2; + break; + } + if (object.packed != null) + message.packed = Boolean(object.packed); + switch (object.jstype) { + case "JS_NORMAL": + case 0: + message.jstype = 0; + break; + case "JS_STRING": + case 1: + message.jstype = 1; + break; + case "JS_NUMBER": + case 2: + message.jstype = 2; + break; + } + if (object.lazy != null) + message.lazy = Boolean(object.lazy); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.weak != null) + message.weak = Boolean(object.weak); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.FieldOptions} message FieldOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.ctype = options.enums === String ? "STRING" : 0; + object.packed = false; + object.deprecated = false; + object.lazy = false; + object.jstype = options.enums === String ? "JS_NORMAL" : 0; + object.weak = false; + } + if (message.ctype != null && message.hasOwnProperty("ctype")) + object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; + if (message.packed != null && message.hasOwnProperty("packed")) + object.packed = message.packed; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.lazy != null && message.hasOwnProperty("lazy")) + object.lazy = message.lazy; + if (message.jstype != null && message.hasOwnProperty("jstype")) + object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; + if (message.weak != null && message.hasOwnProperty("weak")) + object.weak = message.weak; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this FieldOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions + * @instance + * @returns {Object.} JSON object + */ + FieldOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * CType enum. + * @enum {string} + * @property {number} STRING=0 STRING value + * @property {number} CORD=1 CORD value + * @property {number} STRING_PIECE=2 STRING_PIECE value + */ + FieldOptions.CType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STRING"] = 0; + values[valuesById[1] = "CORD"] = 1; + values[valuesById[2] = "STRING_PIECE"] = 2; + return values; + })(); + + /** + * JSType enum. + * @enum {string} + * @property {number} JS_NORMAL=0 JS_NORMAL value + * @property {number} JS_STRING=1 JS_STRING value + * @property {number} JS_NUMBER=2 JS_NUMBER value + */ + FieldOptions.JSType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JS_NORMAL"] = 0; + values[valuesById[1] = "JS_STRING"] = 1; + values[valuesById[2] = "JS_NUMBER"] = 2; + return values; + })(); + + return FieldOptions; + })(); + + protobuf.OneofOptions = (function() { + + /** + * Properties of an OneofOptions. + * @memberof google.protobuf + * @interface IOneofOptions + * @property {Array.} [uninterpretedOption] OneofOptions uninterpretedOption + */ + + /** + * Constructs a new OneofOptions. + * @memberof google.protobuf + * @classdesc Represents an OneofOptions. + * @constructor + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + */ + function OneofOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofOptions uninterpretedOption. + * @member {Array.}uninterpretedOption + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + * @returns {google.protobuf.OneofOptions} OneofOptions instance + */ + OneofOptions.create = function create(properties) { + return new OneofOptions(properties); + }; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofOptions message. + * @function verify + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofOptions} OneofOptions + */ + OneofOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofOptions) + return object; + var message = new $root.google.protobuf.OneofOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.OneofOptions} message OneofOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this OneofOptions to JSON. + * @function toJSON + * @memberof google.protobuf.OneofOptions + * @instance + * @returns {Object.} JSON object + */ + OneofOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OneofOptions; + })(); + + protobuf.EnumOptions = (function() { + + /** + * Properties of an EnumOptions. + * @memberof google.protobuf + * @interface IEnumOptions + * @property {boolean} [allowAlias] EnumOptions allowAlias + * @property {boolean} [deprecated] EnumOptions deprecated + * @property {Array.} [uninterpretedOption] EnumOptions uninterpretedOption + */ + + /** + * Constructs a new EnumOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumOptions. + * @constructor + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + */ + function EnumOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumOptions allowAlias. + * @member {boolean}allowAlias + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.allowAlias = false; + + /** + * EnumOptions deprecated. + * @member {boolean}deprecated + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.deprecated = false; + + /** + * EnumOptions uninterpretedOption. + * @member {Array.}uninterpretedOption + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumOptions} EnumOptions instance + */ + EnumOptions.create = function create(properties) { + return new EnumOptions(properties); + }; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.allowAlias = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumOptions message. + * @function verify + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + if (typeof message.allowAlias !== "boolean") + return "allowAlias: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumOptions} EnumOptions + */ + EnumOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumOptions) + return object; + var message = new $root.google.protobuf.EnumOptions(); + if (object.allowAlias != null) + message.allowAlias = Boolean(object.allowAlias); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.EnumOptions} message EnumOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.allowAlias = false; + object.deprecated = false; + } + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + object.allowAlias = message.allowAlias; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumOptions + * @instance + * @returns {Object.} JSON object + */ + EnumOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumOptions; + })(); + + protobuf.EnumValueOptions = (function() { + + /** + * Properties of an EnumValueOptions. + * @memberof google.protobuf + * @interface IEnumValueOptions + * @property {boolean} [deprecated] EnumValueOptions deprecated + * @property {Array.} [uninterpretedOption] EnumValueOptions uninterpretedOption + */ + + /** + * Constructs a new EnumValueOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumValueOptions. + * @constructor + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + */ + function EnumValueOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueOptions deprecated. + * @member {boolean}deprecated + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.deprecated = false; + + /** + * EnumValueOptions uninterpretedOption. + * @member {Array.}uninterpretedOption + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance + */ + EnumValueOptions.create = function create(properties) { + return new EnumValueOptions(properties); + }; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueOptions message. + * @function verify + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + */ + EnumValueOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueOptions) + return object; + var message = new $root.google.protobuf.EnumValueOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.EnumValueOptions} message EnumValueOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) + object.deprecated = false; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumValueOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueOptions + * @instance + * @returns {Object.} JSON object + */ + EnumValueOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumValueOptions; + })(); + + protobuf.ServiceOptions = (function() { + + /** + * Properties of a ServiceOptions. + * @memberof google.protobuf + * @interface IServiceOptions + * @property {boolean} [deprecated] ServiceOptions deprecated + * @property {Array.} [uninterpretedOption] ServiceOptions uninterpretedOption + */ + + /** + * Constructs a new ServiceOptions. + * @memberof google.protobuf + * @classdesc Represents a ServiceOptions. + * @constructor + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + */ + function ServiceOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceOptions deprecated. + * @member {boolean}deprecated + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.deprecated = false; + + /** + * ServiceOptions uninterpretedOption. + * @member {Array.}uninterpretedOption + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + * @returns {google.protobuf.ServiceOptions} ServiceOptions instance + */ + ServiceOptions.create = function create(properties) { + return new ServiceOptions(properties); + }; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceOptions message. + * @function verify + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceOptions} ServiceOptions + */ + ServiceOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceOptions) + return object; + var message = new $root.google.protobuf.ServiceOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.ServiceOptions} message ServiceOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) + object.deprecated = false; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this ServiceOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceOptions + * @instance + * @returns {Object.} JSON object + */ + ServiceOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ServiceOptions; + })(); + + protobuf.MethodOptions = (function() { + + /** + * Properties of a MethodOptions. + * @memberof google.protobuf + * @interface IMethodOptions + * @property {boolean} [deprecated] MethodOptions deprecated + * @property {Array.} [uninterpretedOption] MethodOptions uninterpretedOption + * @property {google.api.IHttpRule} [".google.api.http"] MethodOptions .google.api.http + */ + + /** + * Constructs a new MethodOptions. + * @memberof google.protobuf + * @classdesc Represents a MethodOptions. + * @constructor + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + */ + function MethodOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodOptions deprecated. + * @member {boolean}deprecated + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.deprecated = false; + + /** + * MethodOptions uninterpretedOption. + * @member {Array.}uninterpretedOption + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MethodOptions .google.api.http. + * @member {(google.api.IHttpRule|null|undefined)}.google.api.http + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.http"] = null; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + * @returns {google.protobuf.MethodOptions} MethodOptions instance + */ + MethodOptions.create = function create(properties) { + return new MethodOptions(properties); + }; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) + $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 72295728: + message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodOptions message. + * @function verify + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) { + error = $root.google.api.HttpRule.verify(message[".google.api.http"]); + if (error) + return ".google.api.http." + error; + } + return null; + }; + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodOptions} MethodOptions + */ + MethodOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodOptions) + return object; + var message = new $root.google.protobuf.MethodOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.http"] != null) { + if (typeof object[".google.api.http"] !== "object") + throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); + message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"]); + } + return message; + }; + + /** + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.MethodOptions} message MethodOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.deprecated = false; + object[".google.api.http"] = null; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) + object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options); + return object; + }; + + /** + * Converts this MethodOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MethodOptions + * @instance + * @returns {Object.} JSON object + */ + MethodOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MethodOptions; + })(); + + protobuf.UninterpretedOption = (function() { + + /** + * Properties of an UninterpretedOption. + * @memberof google.protobuf + * @interface IUninterpretedOption + * @property {Array.} [name] UninterpretedOption name + * @property {string} [identifierValue] UninterpretedOption identifierValue + * @property {number|Long} [positiveIntValue] UninterpretedOption positiveIntValue + * @property {number|Long} [negativeIntValue] UninterpretedOption negativeIntValue + * @property {number} [doubleValue] UninterpretedOption doubleValue + * @property {Uint8Array} [stringValue] UninterpretedOption stringValue + * @property {string} [aggregateValue] UninterpretedOption aggregateValue + */ + + /** + * Constructs a new UninterpretedOption. + * @memberof google.protobuf + * @classdesc Represents an UninterpretedOption. + * @constructor + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + */ + function UninterpretedOption(properties) { + this.name = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UninterpretedOption name. + * @member {Array.}name + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.name = $util.emptyArray; + + /** + * UninterpretedOption identifierValue. + * @member {string}identifierValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.identifierValue = ""; + + /** + * UninterpretedOption positiveIntValue. + * @member {number|Long}positiveIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.positiveIntValue = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * UninterpretedOption negativeIntValue. + * @member {number|Long}negativeIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.negativeIntValue = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UninterpretedOption doubleValue. + * @member {number}doubleValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.doubleValue = 0; + + /** + * UninterpretedOption stringValue. + * @member {Uint8Array}stringValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.stringValue = $util.newBuffer([]); + + /** + * UninterpretedOption aggregateValue. + * @member {string}aggregateValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.aggregateValue = ""; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption instance + */ + UninterpretedOption.create = function create(properties) { + return new UninterpretedOption(properties); + }; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.name.length) + for (var i = 0; i < message.name.length; ++i) + $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregateValue); + return writer; + }; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (!(message.name && message.name.length)) + message.name = []; + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); + break; + case 3: + message.identifierValue = reader.string(); + break; + case 4: + message.positiveIntValue = reader.uint64(); + break; + case 5: + message.negativeIntValue = reader.int64(); + break; + case 6: + message.doubleValue = reader.double(); + break; + case 7: + message.stringValue = reader.bytes(); + break; + case 8: + message.aggregateValue = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UninterpretedOption message. + * @function verify + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UninterpretedOption.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) { + if (!Array.isArray(message.name)) + return "name: array expected"; + for (var i = 0; i < message.name.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i]); + if (error) + return "name." + error; + } + } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + if (!$util.isString(message.identifierValue)) + return "identifierValue: string expected"; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (!$util.isInteger(message.positiveIntValue) && !(message.positiveIntValue && $util.isInteger(message.positiveIntValue.low) && $util.isInteger(message.positiveIntValue.high))) + return "positiveIntValue: integer|Long expected"; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (!$util.isInteger(message.negativeIntValue) && !(message.negativeIntValue && $util.isInteger(message.negativeIntValue.low) && $util.isInteger(message.negativeIntValue.high))) + return "negativeIntValue: integer|Long expected"; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + if (typeof message.doubleValue !== "number") + return "doubleValue: number expected"; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + if (!(message.stringValue && typeof message.stringValue.length === "number" || $util.isString(message.stringValue))) + return "stringValue: buffer expected"; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + if (!$util.isString(message.aggregateValue)) + return "aggregateValue: string expected"; + return null; + }; + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + */ + UninterpretedOption.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption) + return object; + var message = new $root.google.protobuf.UninterpretedOption(); + if (object.name) { + if (!Array.isArray(object.name)) + throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); + message.name = []; + for (var i = 0; i < object.name.length; ++i) { + if (typeof object.name[i] !== "object") + throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); + message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i]); + } + } + if (object.identifierValue != null) + message.identifierValue = String(object.identifierValue); + if (object.positiveIntValue != null) + if ($util.Long) + (message.positiveIntValue = $util.Long.fromValue(object.positiveIntValue)).unsigned = true; + else if (typeof object.positiveIntValue === "string") + message.positiveIntValue = parseInt(object.positiveIntValue, 10); + else if (typeof object.positiveIntValue === "number") + message.positiveIntValue = object.positiveIntValue; + else if (typeof object.positiveIntValue === "object") + message.positiveIntValue = new $util.LongBits(object.positiveIntValue.low >>> 0, object.positiveIntValue.high >>> 0).toNumber(true); + if (object.negativeIntValue != null) + if ($util.Long) + (message.negativeIntValue = $util.Long.fromValue(object.negativeIntValue)).unsigned = false; + else if (typeof object.negativeIntValue === "string") + message.negativeIntValue = parseInt(object.negativeIntValue, 10); + else if (typeof object.negativeIntValue === "number") + message.negativeIntValue = object.negativeIntValue; + else if (typeof object.negativeIntValue === "object") + message.negativeIntValue = new $util.LongBits(object.negativeIntValue.low >>> 0, object.negativeIntValue.high >>> 0).toNumber(); + if (object.doubleValue != null) + message.doubleValue = Number(object.doubleValue); + if (object.stringValue != null) + if (typeof object.stringValue === "string") + $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); + else if (object.stringValue.length) + message.stringValue = object.stringValue; + if (object.aggregateValue != null) + message.aggregateValue = String(object.aggregateValue); + return message; + }; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.UninterpretedOption} message UninterpretedOption + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UninterpretedOption.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.name = []; + if (options.defaults) { + object.identifierValue = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.positiveIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.positiveIntValue = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.negativeIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.negativeIntValue = options.longs === String ? "0" : 0; + object.doubleValue = 0; + object.stringValue = options.bytes === String ? "" : []; + object.aggregateValue = ""; + } + if (message.name && message.name.length) { + object.name = []; + for (var j = 0; j < message.name.length; ++j) + object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options); + } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + object.identifierValue = message.identifierValue; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (typeof message.positiveIntValue === "number") + object.positiveIntValue = options.longs === String ? String(message.positiveIntValue) : message.positiveIntValue; + else + object.positiveIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.positiveIntValue) : options.longs === Number ? new $util.LongBits(message.positiveIntValue.low >>> 0, message.positiveIntValue.high >>> 0).toNumber(true) : message.positiveIntValue; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (typeof message.negativeIntValue === "number") + object.negativeIntValue = options.longs === String ? String(message.negativeIntValue) : message.negativeIntValue; + else + object.negativeIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.negativeIntValue) : options.longs === Number ? new $util.LongBits(message.negativeIntValue.low >>> 0, message.negativeIntValue.high >>> 0).toNumber() : message.negativeIntValue; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + object.stringValue = options.bytes === String ? $util.base64.encode(message.stringValue, 0, message.stringValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.stringValue) : message.stringValue; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + object.aggregateValue = message.aggregateValue; + return object; + }; + + /** + * Converts this UninterpretedOption to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption + * @instance + * @returns {Object.} JSON object + */ + UninterpretedOption.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + UninterpretedOption.NamePart = (function() { + + /** + * Properties of a NamePart. + * @memberof google.protobuf.UninterpretedOption + * @interface INamePart + * @property {string} namePart NamePart namePart + * @property {boolean} isExtension NamePart isExtension + */ + + /** + * Constructs a new NamePart. + * @memberof google.protobuf.UninterpretedOption + * @classdesc Represents a NamePart. + * @constructor + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + */ + function NamePart(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NamePart namePart. + * @member {string}namePart + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.namePart = ""; + + /** + * NamePart isExtension. + * @member {boolean}isExtension + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.isExtension = false; + + /** + * Creates a new NamePart instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart instance + */ + NamePart.create = function create(properties) { + return new NamePart(properties); + }; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + writer.uint32(/* id 1, wireType 2 =*/10).string(message.namePart); + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isExtension); + return writer; + }; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption.NamePart(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.namePart = reader.string(); + break; + case 2: + message.isExtension = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + if (!message.hasOwnProperty("namePart")) + throw $util.ProtocolError("missing required 'namePart'", { instance: message }); + if (!message.hasOwnProperty("isExtension")) + throw $util.ProtocolError("missing required 'isExtension'", { instance: message }); + return message; + }; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NamePart message. + * @function verify + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NamePart.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (!$util.isString(message.namePart)) + return "namePart: string expected"; + if (typeof message.isExtension !== "boolean") + return "isExtension: boolean expected"; + return null; + }; + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + */ + NamePart.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) + return object; + var message = new $root.google.protobuf.UninterpretedOption.NamePart(); + if (object.namePart != null) + message.namePart = String(object.namePart); + if (object.isExtension != null) + message.isExtension = Boolean(object.isExtension); + return message; + }; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.NamePart} message NamePart + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NamePart.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.namePart = ""; + object.isExtension = false; + } + if (message.namePart != null && message.hasOwnProperty("namePart")) + object.namePart = message.namePart; + if (message.isExtension != null && message.hasOwnProperty("isExtension")) + object.isExtension = message.isExtension; + return object; + }; + + /** + * Converts this NamePart to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + * @returns {Object.} JSON object + */ + NamePart.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NamePart; + })(); + + return UninterpretedOption; + })(); + + protobuf.SourceCodeInfo = (function() { + + /** + * Properties of a SourceCodeInfo. + * @memberof google.protobuf + * @interface ISourceCodeInfo + * @property {Array.} [location] SourceCodeInfo location + */ + + /** + * Constructs a new SourceCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a SourceCodeInfo. + * @constructor + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + */ + function SourceCodeInfo(properties) { + this.location = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SourceCodeInfo location. + * @member {Array.}location + * @memberof google.protobuf.SourceCodeInfo + * @instance + */ + SourceCodeInfo.prototype.location = $util.emptyArray; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo instance + */ + SourceCodeInfo.create = function create(properties) { + return new SourceCodeInfo(properties); + }; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.location != null && message.location.length) + for (var i = 0; i < message.location.length; ++i) + $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.location && message.location.length)) + message.location = []; + message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceCodeInfo message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.location != null && message.hasOwnProperty("location")) { + if (!Array.isArray(message.location)) + return "location: array expected"; + for (var i = 0; i < message.location.length; ++i) { + var error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i]); + if (error) + return "location." + error; + } + } + return null; + }; + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + */ + SourceCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo) + return object; + var message = new $root.google.protobuf.SourceCodeInfo(); + if (object.location) { + if (!Array.isArray(object.location)) + throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected"); + message.location = []; + for (var i = 0; i < object.location.length; ++i) { + if (typeof object.location[i] !== "object") + throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); + message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.SourceCodeInfo} message SourceCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.location = []; + if (message.location && message.location.length) { + object.location = []; + for (var j = 0; j < message.location.length; ++j) + object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options); + } + return object; + }; + + /** + * Converts this SourceCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo + * @instance + * @returns {Object.} JSON object + */ + SourceCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SourceCodeInfo.Location = (function() { + + /** + * Properties of a Location. + * @memberof google.protobuf.SourceCodeInfo + * @interface ILocation + * @property {Array.} [path] Location path + * @property {Array.} [span] Location span + * @property {string} [leadingComments] Location leadingComments + * @property {string} [trailingComments] Location trailingComments + * @property {Array.} [leadingDetachedComments] Location leadingDetachedComments + */ + + /** + * Constructs a new Location. + * @memberof google.protobuf.SourceCodeInfo + * @classdesc Represents a Location. + * @constructor + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + */ + function Location(properties) { + this.path = []; + this.span = []; + this.leadingDetachedComments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Location path. + * @member {Array.}path + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.path = $util.emptyArray; + + /** + * Location span. + * @member {Array.}span + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.span = $util.emptyArray; + + /** + * Location leadingComments. + * @member {string}leadingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingComments = ""; + + /** + * Location trailingComments. + * @member {string}trailingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.trailingComments = ""; + + /** + * Location leadingDetachedComments. + * @member {Array.}leadingDetachedComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingDetachedComments = $util.emptyArray; + + /** + * Creates a new Location instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo.Location} Location instance + */ + Location.create = function create(properties) { + return new Location(properties); + }; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.span != null && message.span.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.span.length; ++i) + writer.int32(message.span[i]); + writer.ldelim(); + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.trailingComments); + if (message.leadingDetachedComments != null && message.leadingDetachedComments.length) + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.leadingDetachedComments[i]); + return writer; + }; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Location message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + case 2: + if (!(message.span && message.span.length)) + message.span = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.span.push(reader.int32()); + } else + message.span.push(reader.int32()); + break; + case 3: + message.leadingComments = reader.string(); + break; + case 4: + message.trailingComments = reader.string(); + break; + case 6: + if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) + message.leadingDetachedComments = []; + message.leadingDetachedComments.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Location message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Location.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.span != null && message.hasOwnProperty("span")) { + if (!Array.isArray(message.span)) + return "span: array expected"; + for (var i = 0; i < message.span.length; ++i) + if (!$util.isInteger(message.span[i])) + return "span: integer[] expected"; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + if (!$util.isString(message.leadingComments)) + return "leadingComments: string expected"; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + if (!$util.isString(message.trailingComments)) + return "trailingComments: string expected"; + if (message.leadingDetachedComments != null && message.hasOwnProperty("leadingDetachedComments")) { + if (!Array.isArray(message.leadingDetachedComments)) + return "leadingDetachedComments: array expected"; + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + if (!$util.isString(message.leadingDetachedComments[i])) + return "leadingDetachedComments: string[] expected"; + } + return null; + }; + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo.Location} Location + */ + Location.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) + return object; + var message = new $root.google.protobuf.SourceCodeInfo.Location(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.span) { + if (!Array.isArray(object.span)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.span: array expected"); + message.span = []; + for (var i = 0; i < object.span.length; ++i) + message.span[i] = object.span[i] | 0; + } + if (object.leadingComments != null) + message.leadingComments = String(object.leadingComments); + if (object.trailingComments != null) + message.trailingComments = String(object.trailingComments); + if (object.leadingDetachedComments) { + if (!Array.isArray(object.leadingDetachedComments)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.leadingDetachedComments: array expected"); + message.leadingDetachedComments = []; + for (var i = 0; i < object.leadingDetachedComments.length; ++i) + message.leadingDetachedComments[i] = String(object.leadingDetachedComments[i]); + } + return message; + }; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.Location} message Location + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Location.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.path = []; + object.span = []; + object.leadingDetachedComments = []; + } + if (options.defaults) { + object.leadingComments = ""; + object.trailingComments = ""; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.span && message.span.length) { + object.span = []; + for (var j = 0; j < message.span.length; ++j) + object.span[j] = message.span[j]; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + object.leadingComments = message.leadingComments; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + object.trailingComments = message.trailingComments; + if (message.leadingDetachedComments && message.leadingDetachedComments.length) { + object.leadingDetachedComments = []; + for (var j = 0; j < message.leadingDetachedComments.length; ++j) + object.leadingDetachedComments[j] = message.leadingDetachedComments[j]; + } + return object; + }; + + /** + * Converts this Location to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + * @returns {Object.} JSON object + */ + Location.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Location; + })(); + + return SourceCodeInfo; + })(); + + protobuf.GeneratedCodeInfo = (function() { + + /** + * Properties of a GeneratedCodeInfo. + * @memberof google.protobuf + * @interface IGeneratedCodeInfo + * @property {Array.} [annotation] GeneratedCodeInfo annotation + */ + + /** + * Constructs a new GeneratedCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a GeneratedCodeInfo. + * @constructor + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + */ + function GeneratedCodeInfo(properties) { + this.annotation = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GeneratedCodeInfo annotation. + * @member {Array.}annotation + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + */ + GeneratedCodeInfo.prototype.annotation = $util.emptyArray; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo instance + */ + GeneratedCodeInfo.create = function create(properties) { + return new GeneratedCodeInfo(properties); + }; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.annotation != null && message.annotation.length) + for (var i = 0; i < message.annotation.length; ++i) + $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.annotation && message.annotation.length)) + message.annotation = []; + message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GeneratedCodeInfo message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GeneratedCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.annotation != null && message.hasOwnProperty("annotation")) { + if (!Array.isArray(message.annotation)) + return "annotation: array expected"; + for (var i = 0; i < message.annotation.length; ++i) { + var error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i]); + if (error) + return "annotation." + error; + } + } + return null; + }; + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + */ + GeneratedCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo) + return object; + var message = new $root.google.protobuf.GeneratedCodeInfo(); + if (object.annotation) { + if (!Array.isArray(object.annotation)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: array expected"); + message.annotation = []; + for (var i = 0; i < object.annotation.length; ++i) { + if (typeof object.annotation[i] !== "object") + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); + message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GeneratedCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.annotation = []; + if (message.annotation && message.annotation.length) { + object.annotation = []; + for (var j = 0; j < message.annotation.length; ++j) + object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options); + } + return object; + }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + * @returns {Object.} JSON object + */ + GeneratedCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GeneratedCodeInfo.Annotation = (function() { + + /** + * Properties of an Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @interface IAnnotation + * @property {Array.} [path] Annotation path + * @property {string} [sourceFile] Annotation sourceFile + * @property {number} [begin] Annotation begin + * @property {number} [end] Annotation end + */ + + /** + * Constructs a new Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @classdesc Represents an Annotation. + * @constructor + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + */ + function Annotation(properties) { + this.path = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Annotation path. + * @member {Array.}path + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.path = $util.emptyArray; + + /** + * Annotation sourceFile. + * @member {string}sourceFile + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.sourceFile = ""; + + /** + * Annotation begin. + * @member {number}begin + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.begin = 0; + + /** + * Annotation end. + * @member {number}end + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.end = 0; + + /** + * Creates a new Annotation instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation instance + */ + Annotation.create = function create(properties) { + return new Annotation(properties); + }; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceFile); + if (message.begin != null && message.hasOwnProperty("begin")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); + if (message.end != null && message.hasOwnProperty("end")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); + return writer; + }; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + case 2: + message.sourceFile = reader.string(); + break; + case 3: + message.begin = reader.int32(); + break; + case 4: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Annotation message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Annotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + if (!$util.isString(message.sourceFile)) + return "sourceFile: string expected"; + if (message.begin != null && message.hasOwnProperty("begin")) + if (!$util.isInteger(message.begin)) + return "begin: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + */ + Annotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) + return object; + var message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.sourceFile != null) + message.sourceFile = String(object.sourceFile); + if (object.begin != null) + message.begin = object.begin | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.Annotation} message Annotation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Annotation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.path = []; + if (options.defaults) { + object.sourceFile = ""; + object.begin = 0; + object.end = 0; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + object.sourceFile = message.sourceFile; + if (message.begin != null && message.hasOwnProperty("begin")) + object.begin = message.begin; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this Annotation to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + * @returns {Object.} JSON object + */ + Annotation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Annotation; + })(); + + return GeneratedCodeInfo; + })(); + + protobuf.Duration = (function() { + + /** + * Properties of a Duration. + * @memberof google.protobuf + * @interface IDuration + * @property {number|Long} [seconds] Duration seconds + * @property {number} [nanos] Duration nanos + */ + + /** + * Constructs a new Duration. + * @memberof google.protobuf + * @classdesc Represents a Duration. + * @constructor + * @param {google.protobuf.IDuration=} [properties] Properties to set + */ + function Duration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Duration seconds. + * @member {number|Long}seconds + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Duration nanos. + * @member {number}nanos + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.nanos = 0; + + /** + * Creates a new Duration instance using the specified properties. + * @function create + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration=} [properties] Properties to set + * @returns {google.protobuf.Duration} Duration instance + */ + Duration.create = function create(properties) { + return new Duration(properties); + }; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && message.hasOwnProperty("seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && message.hasOwnProperty("nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Duration message. + * @function verify + * @memberof google.protobuf.Duration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Duration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Duration + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Duration} Duration + */ + Duration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Duration) + return object; + var message = new $root.google.protobuf.Duration(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.Duration} message Duration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Duration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Duration to JSON. + * @function toJSON + * @memberof google.protobuf.Duration + * @instance + * @returns {Object.} JSON object + */ + Duration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Duration; + })(); + + protobuf.Timestamp = (function() { + + /** + * Properties of a Timestamp. + * @memberof google.protobuf + * @interface ITimestamp + * @property {number|Long} [seconds] Timestamp seconds + * @property {number} [nanos] Timestamp nanos + */ + + /** + * Constructs a new Timestamp. + * @memberof google.protobuf + * @classdesc Represents a Timestamp. + * @constructor + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + */ + function Timestamp(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Timestamp seconds. + * @member {number|Long}seconds + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Timestamp nanos. + * @member {number}nanos + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.nanos = 0; + + /** + * Creates a new Timestamp instance using the specified properties. + * @function create + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @returns {google.protobuf.Timestamp} Timestamp instance + */ + Timestamp.create = function create(properties) { + return new Timestamp(properties); + }; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && message.hasOwnProperty("seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && message.hasOwnProperty("nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Timestamp message. + * @function verify + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Timestamp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Timestamp} Timestamp + */ + Timestamp.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Timestamp) + return object; + var message = new $root.google.protobuf.Timestamp(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.Timestamp} message Timestamp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Timestamp.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Timestamp to JSON. + * @function toJSON + * @memberof google.protobuf.Timestamp + * @instance + * @returns {Object.} JSON object + */ + Timestamp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Timestamp; + })(); + + return protobuf; + })(); + + return google; +})(); + +module.exports = $root; From d0bddc71db82a45a923ec9f3a411dd473a1266f6 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Wed, 1 Nov 2017 14:17:33 -0700 Subject: [PATCH 021/632] fix: add support for TypeScript 2.6 (#37) TypeScript 2.6 makes type checking for functions stricter [1]. Instead of using bivariant types for functions parameters, TypeScript now uses contravaiance. [1] https://blogs.msdn.microsoft.com/typescript/2017/10/31/announcing-typescript-2-6/ --- handwritten/cloud-profiler/package-lock.json | 162 +++++++++--------- handwritten/cloud-profiler/package.json | 2 +- .../ts/src/profilers/profile-serializer.ts | 44 ++--- 3 files changed, 97 insertions(+), 111 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index e4246c114ba..e4fc7151576 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -38,13 +38,13 @@ "@protobufjs/base64": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "integrity": "sha1-TIVzDlm5ofHzSQR9vyQpYDS7JzU=", "dev": true }, "@protobufjs/codegen": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "integrity": "sha1-fvN/DQEPsCitGtWXIuUG2SYoFcs=", "dev": true }, "@protobufjs/eventemitter": { @@ -96,7 +96,7 @@ "@types/delay": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/delay/-/delay-2.0.1.tgz", - "integrity": "sha512-D1/YuYOcdOIdaQnaiUJ77VcilVvESkynw79CtGqpjkXyv4OUezEVZtdXnSOwXL8Zcelu66QbyC8QQcVQ/ZPdig==", + "integrity": "sha1-YbzzGKdLYeedFlj78FT5hMkO+QE=", "dev": true }, "@types/extend": { @@ -108,7 +108,7 @@ "@types/form-data": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.0.tgz", - "integrity": "sha512-vm5OGsKc61Sx/GTRMQ9d0H0PYCDebT78/bdIBPCoPEHdgp0etaH1RzMmkDygymUmyXTj3rdWQn0sRUpYKZzljA==", + "integrity": "sha1-qYqskdyZhXtq8kyu98pt8wLzFWU=", "dev": true, "requires": { "@types/node": "8.0.47" @@ -117,30 +117,30 @@ "@types/long": { "version": "3.0.32", "resolved": "https://registry.npmjs.org/@types/long/-/long-3.0.32.tgz", - "integrity": "sha512-ZXyOOm83p7X8p3s0IYM3VeueNmHpkk/yMlP8CLeOnEcu6hIwPH7YjZBvhQkR0ZFS2DqZAxKtJ/M5fcuv3OU5BA==", + "integrity": "sha1-9OWvMenpsZbY5fyopeLiCqPWC2k=", "dev": true }, "@types/mocha": { "version": "2.2.44", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.44.tgz", - "integrity": "sha512-k2tWTQU8G4+iSMvqKi0Q9IIsWAp/n8xzdZS4Q4YVIltApoMA00wFBFdlJnmoaK1/z7B0Cy0yPe6GgXteSmdUNw==", + "integrity": "sha1-HUp5jlPzUhL9WtTQQFBiAXHNW14=", "dev": true }, "@types/node": { "version": "8.0.47", "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.47.tgz", - "integrity": "sha512-kOwL746WVvt/9Phf6/JgX/bsGQvbrK5iUgzyfwZNcKVFcjAUVSpF9HxevLTld2SG9aywYHOILj38arDdY1r/iQ==", + "integrity": "sha1-lo5Zb5Gs1ZBpBUVYoAcIxEXKMMI=", "dev": true }, "@types/pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/pify/-/pify-3.0.0.tgz", - "integrity": "sha512-BIRcpFqRm64rVuuYCFzOF37I2IEP3sXhiCjy8NbzJkxqFY2CLiDLFPhh6Sph/eXPXctg05MayCEDmeKCOIUBFg==" + "integrity": "sha1-4X2Vwn500jBevAaw+NKMsC+WEv4=" }, "@types/request": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/@types/request/-/request-2.0.7.tgz", - "integrity": "sha512-hlkmO+M7Xxx13YZwqQtXGC03KxcYbqmDQg3oHMRVODfSk2u0BELK7RfTNROisvrLRGOYdGoZPpnHwaPoKrPMbA==", + "integrity": "sha1-oqpaVzF8IZcdmwJOOTCRqyyZq5g=", "dev": true, "requires": { "@types/form-data": "2.2.0", @@ -150,7 +150,7 @@ "@types/sinon": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-2.3.7.tgz", - "integrity": "sha512-w+LjztaZbgZWgt/y/VMP5BUAWLtSyoIJhXyW279hehLPyubDoBNwvhcj3WaSptcekuKYeTCVxrq60rdLc6ImJA==", + "integrity": "sha1-6Swv7TKX6uB4140doDKyZ4i0r4Y=", "dev": true }, "ajv": { @@ -176,7 +176,7 @@ "ansi-escapes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", - "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", + "integrity": "sha1-7D6LTp+AZPwCw6ybZfHCdb2o75I=", "dev": true }, "ansi-regex": { @@ -226,7 +226,7 @@ "async": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", - "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", + "integrity": "sha1-hDGQ/WtzV6C54clW7d3V7IRitU0=", "requires": { "lodash": "4.17.4" } @@ -280,7 +280,7 @@ "bindings": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz", - "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==" + "integrity": "sha1-s0b27PapX1qBXFg5/HzbIlAvHtc=" }, "boom": { "version": "4.3.1", @@ -308,7 +308,7 @@ "ansi-styles": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "integrity": "sha1-wVm41b4PnlpvNG2rlPFs4CIWG4g=", "dev": true, "requires": { "color-convert": "1.9.0" @@ -323,7 +323,7 @@ "chalk": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "integrity": "sha1-tepI78nBeT3MybR2fJORTT8tUro=", "dev": true, "requires": { "ansi-styles": "3.2.0", @@ -411,7 +411,7 @@ "clang-format": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.1.0.tgz", - "integrity": "sha512-0Aru49uTLoROl4sPTyO3fvF/NZ+fnGEy5i7bsRwA/bAYT+eWaAxK3sDxRvm/AW7Nwq83BvARH/npeF8OIAaGVQ==", + "integrity": "sha1-oAtPf4V1sHKsVQVMPPl5oVHqEPE=", "dev": true, "requires": { "async": "1.5.2", @@ -641,7 +641,7 @@ "commander": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "integrity": "sha1-FXFS/R56bI2YpbcVzzdt+SgARWM=", "dev": true }, "concat-map": { @@ -663,7 +663,7 @@ "configstore": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.1.tgz", - "integrity": "sha512-5oNkD/L++l0O6xGXxb1EWS7SivtjfGQlRyxJsYgE0Z495/L81e2h4/d3r969hoPXuFItzNOKMtsXgYG4c7dYvw==", + "integrity": "sha1-CU7mYquD+tmRdnjeEU+q6o/NypA=", "dev": true, "requires": { "dot-prop": "4.2.0", @@ -709,7 +709,7 @@ "boom": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", - "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "integrity": "sha1-XdnabuOl8wIHdDYpDLcX0/SlTgI=", "requires": { "hoek": "4.2.0" } @@ -742,7 +742,7 @@ "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", "dev": true, "requires": { "ms": "2.0.0" @@ -776,13 +776,13 @@ "diff": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.4.0.tgz", - "integrity": "sha512-QpVuMTEoJMF7cKzi6bvWhRulU1fZqZnvyVQgNhPaxxuTYwyjn/j1v9falseQ/uXWwPnO56RBfwtg4h/EQXmucA==", + "integrity": "sha1-sdhVB9rzlkgo3lSzfQ1zumfdpWw=", "dev": true }, "dot-prop": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", - "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "integrity": "sha1-HxngwuGqDjJ5fEl5nyg3rGr2nFc=", "dev": true, "requires": { "is-obj": "1.0.1" @@ -797,7 +797,7 @@ "duplexify": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.1.tgz", - "integrity": "sha512-j5goxHTwVED1Fpe5hh3q9R93Kip0Bg2KVAt4f8CEYM3UEwYcPSvWbXaUQOzdX/HtiNomipv+gU7ASQPDbV7pGQ==", + "integrity": "sha1-ThUWvmiDi8kKSZlPCzmm5ZYL780=", "requires": { "end-of-stream": "1.4.0", "inherits": "2.0.3", @@ -880,7 +880,7 @@ "external-editor": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.5.tgz", - "integrity": "sha512-Msjo64WT5W+NhOpQXh0nOHm+n0RfU1QUwDnKYvJ8dEJ8zlwLrqXNTv5mSUTJpepf41PDJGyhueTw2vNZW+Fr/w==", + "integrity": "sha1-UsJJo5gbm6GHx8rPW+tQvx2Rprw=", "dev": true, "requires": { "iconv-lite": "0.4.19", @@ -955,7 +955,7 @@ "gcp-metadata": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.4.0.tgz", - "integrity": "sha512-utt8/TgnjfiVd2WnOuxQ64P66f9jc6v15wbchcjc3WAGxFlTYZmH6d7YGae7aW1A57z5vgzOaP973dmFqY+BRQ==", + "integrity": "sha1-JY6ZCWvw37/mvrWp+PUrjfOR2NM=", "requires": { "extend": "3.0.1", "retry-request": "3.1.0" @@ -999,7 +999,7 @@ "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "dev": true, "requires": { "fs.realpath": "1.0.0", @@ -1033,7 +1033,7 @@ "google-auto-auth": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.7.2.tgz", - "integrity": "sha512-ux2n2AE2g3+vcLXwL4dP/M12SFMRX5dzCzBfhAEkTeAB7dpyGdOIEj7nmUx0BHKaCcUQrRWg9kT63X/Mmtk1+A==", + "integrity": "sha1-v5NS1cSgiXvzH9nEkQKLdl++px4=", "requires": { "async": "2.5.0", "gcp-metadata": "0.3.1", @@ -1044,7 +1044,7 @@ "gcp-metadata": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.3.1.tgz", - "integrity": "sha512-5kJPX/RXuqoLmHiOOgkSDk/LI0QaXpEvZ3pvQP4ifjGGDKZKVSOjL/GcDjXA5kLxppFCOjmmsu0Uoop9d1upaQ==", + "integrity": "sha1-MTgURW58PQ7rj4sISzNXnohvgpo=", "requires": { "extend": "3.0.1", "retry-request": "3.1.0" @@ -1088,13 +1088,13 @@ "growl": { "version": "1.10.3", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", - "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", + "integrity": "sha1-GSa6kM8+3+KttJJ/WIC8IsZseQ8=", "dev": true }, "gtoken": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-1.2.3.tgz", - "integrity": "sha512-wQAJflfoqSgMWrSBk9Fg86q+sd6s7y6uJhIvvIPz++RElGlMtEqsdAR2oWwZ/WTEtp7P9xFbJRrT976oRgzJ/w==", + "integrity": "sha1-VQlXG4r9QyLhJM9mz2gRUoTEdtg=", "requires": { "google-p12-pem": "0.1.2", "jws": "3.1.4", @@ -1105,7 +1105,7 @@ "gts": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/gts/-/gts-0.3.1.tgz", - "integrity": "sha512-sQ3PB13CRo25OLFnnQw2Y2Kcrdp2q8onLxxcWSyqoSSPFfvcIM0yVwJHllQeCGT/CuDIrrD0XAEt5GqKMbv1CA==", + "integrity": "sha1-K0EYb8sb4X+b1c072hAiWIHIwro=", "dev": true, "requires": { "chalk": "2.3.0", @@ -1123,7 +1123,7 @@ "ansi-styles": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "integrity": "sha1-wVm41b4PnlpvNG2rlPFs4CIWG4g=", "dev": true, "requires": { "color-convert": "1.9.0" @@ -1132,7 +1132,7 @@ "chalk": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "integrity": "sha1-tepI78nBeT3MybR2fJORTT8tUro=", "dev": true, "requires": { "ansi-styles": "3.2.0", @@ -1183,7 +1183,7 @@ "hawk": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", - "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", + "integrity": "sha1-r02RTrBl+bXOTZ0RwcshJu7MMDg=", "requires": { "boom": "4.3.1", "cryptiles": "3.1.2", @@ -1200,12 +1200,12 @@ "hoek": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", - "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==" + "integrity": "sha1-ctnQdU9/4lyi0BrY+PmpRJqJUm0=" }, "hosted-git-info": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", - "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", + "integrity": "sha1-bWDjSzq7yDEwYsO3mO+NkBoHrzw=", "dev": true }, "http-signature": { @@ -1221,7 +1221,7 @@ "iconv-lite": { "version": "0.4.19", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", + "integrity": "sha1-90aPYBNfXl2tM5nAqBvpoWA6CCs=", "dev": true }, "import-lazy": { @@ -1269,7 +1269,7 @@ "inquirer": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", - "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", + "integrity": "sha1-ndLyrXZdyrH/BEO0kUQqILoifck=", "dev": true, "requires": { "ansi-escapes": "3.0.0", @@ -1297,7 +1297,7 @@ "ansi-styles": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "integrity": "sha1-wVm41b4PnlpvNG2rlPFs4CIWG4g=", "dev": true, "requires": { "color-convert": "1.9.0" @@ -1306,7 +1306,7 @@ "chalk": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "integrity": "sha1-tepI78nBeT3MybR2fJORTT8tUro=", "dev": true, "requires": { "ansi-styles": "3.2.0", @@ -1382,7 +1382,7 @@ "is-my-json-valid": { "version": "2.16.1", "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz", - "integrity": "sha512-ochPsqWS1WXj8ZnMIV0vnNXooaMhp7cyL4FMSIPKTtnV0Ha/T19G2b9kkhcNsabV9bxYkze7/aLZJb/bYuFduQ==", + "integrity": "sha1-WoRnd+LCYg0eaRBOXToDsfYIjxE=", "dev": true, "requires": { "generate-function": "2.0.0", @@ -1489,13 +1489,13 @@ "jschardet": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.6.0.tgz", - "integrity": "sha512-xYuhvQ7I9PDJIGBWev9xm0+SMSed3ZDBAmvVjbFR1ZRLAF+vlXcQu6cRI9uAlj81rzikElRVteehwV7DuX2ZmQ==", + "integrity": "sha1-x9GnHtz/KDnbL57DD8XV69PBpng=", "dev": true }, "json-parse-better-errors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz", - "integrity": "sha512-xyQpxeWWMKyJps9CuGJYeng6ssI5bpqS9ltQpdVQ90t4ql6NdnxFKh95JcRt2cun/DjMVNrdjniLPuMA69xmCw==", + "integrity": "sha1-UBg80bLSUnXeBp6ecbRnrJ6rlzo=", "dev": true }, "json-schema": { @@ -1611,7 +1611,7 @@ "lolex": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.1.3.tgz", - "integrity": "sha512-BdHq78SeI+6PAUtl4atDuCt7L6E4fab3mSRtqxm4ywaXe4uP7jZ0TTcFNuU20syUjxZc2l7jFqKVMJ+AX0LnpQ==", + "integrity": "sha1-U/iTu+iMgDeBViQOEnEmuQXIMIc=", "dev": true }, "long": { @@ -1639,7 +1639,7 @@ "lru-cache": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "integrity": "sha1-Yi4y6CSItJJ5EUpPns9F581rulU=", "dev": true, "requires": { "pseudomap": "1.0.2", @@ -1649,7 +1649,7 @@ "make-dir": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.1.0.tgz", - "integrity": "sha512-0Pkui4wLJ7rxvmfUvs87skoEaxmu0hCUApF8nonzpl7q//FWp9zu8W61Scz4sd/kUiqDxvUhtoam2efDyiBzcA==", + "integrity": "sha1-GbQ2n+SMEW9Twq+VrRAsDjnoXVE=", "dev": true, "requires": { "pify": "3.0.0" @@ -1687,7 +1687,7 @@ "mime": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + "integrity": "sha1-Eh+evEnjdm8xGnbh+hyAA8SwOqY=" }, "mime-db": { "version": "1.30.0", @@ -1711,7 +1711,7 @@ "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", "dev": true, "requires": { "brace-expansion": "1.1.8" @@ -1743,7 +1743,7 @@ "mocha": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.0.1.tgz", - "integrity": "sha512-evDmhkoA+cBNiQQQdSKZa2b9+W2mpLoj50367lhy+Klnx9OV8XlCIhigUnn1gaTFLQCa0kdNhEGDr0hCXOQFDw==", + "integrity": "sha1-Cu5alc9ppGGIIPXlH6MXFxF9rxs=", "dev": true, "requires": { "browser-stdout": "1.3.0", @@ -1761,13 +1761,13 @@ "diff": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", - "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", + "integrity": "sha1-qoVnpu7QPFMfyJ0/cRzQ5SWd7HU=", "dev": true }, "supports-color": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "integrity": "sha1-iD992rwWUUKyphQn8zUt7RldGj4=", "dev": true, "requires": { "has-flag": "2.0.0" @@ -1800,7 +1800,7 @@ "nise": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/nise/-/nise-1.2.0.tgz", - "integrity": "sha512-q9jXh3UNsMV28KeqI43ILz5+c3l+RiNW8mhurEwCKckuHQbL+hTJIKKTiUlCPKlgQ/OukFvSnKB/Jk3+sFbkGA==", + "integrity": "sha1-B51srbvLErow448cmZ82rU1rqlM=", "dev": true, "requires": { "formatio": "1.2.0", @@ -1826,7 +1826,7 @@ "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "integrity": "sha1-EvlaMH1YNSB1oEkHuErIvpisAS8=", "dev": true, "requires": { "hosted-git-info": "2.5.0", @@ -3665,7 +3665,7 @@ "protobufjs": { "version": "6.8.0", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.0.tgz", - "integrity": "sha512-47Y49f5JN5Qsbxas2TyI2zFO8j9GpQAQm5thf54fr2O8qcP/jkIXYxmYx1hN2WQFAhESU1xpVn5NWVDBB8WFnw==", + "integrity": "sha1-BOhUk8ThZTh47Cg/GLx4sefF1aI=", "dev": true, "requires": { "@protobufjs/aspromise": "1.1.2", @@ -3686,7 +3686,7 @@ "@types/node": { "version": "7.0.46", "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.46.tgz", - "integrity": "sha512-u+JAi1KtmaUoU/EHJkxoiuvzyo91FCE41Z9TZWWcOUU3P8oUdlDLdrGzCGWySPgbRMD17B0B+1aaJLYI9egQ6A==", + "integrity": "sha1-w97dJVWMZ2s9YwPlF5mrucP48xQ=", "dev": true } } @@ -3705,7 +3705,7 @@ "qs": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" + "integrity": "sha1-NJzfbu+J7EXBLX1es/wMhwNDptg=" }, "rc": { "version": "1.2.2", @@ -3722,7 +3722,7 @@ "read-package-json": { "version": "2.0.12", "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.0.12.tgz", - "integrity": "sha512-m7/I0+tP6D34EVvSlzCtuVA4D/dHL6OpLcn2e4XVP5X57pCKGUy1JjRSBVKHWpB+vUU91sL85h84qX0MdXzBSw==", + "integrity": "sha1-aOpF+Ys3QctuEK47vUKmBQJqaVE=", "dev": true, "requires": { "glob": "7.1.2", @@ -3756,7 +3756,7 @@ "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", "requires": { "core-util-is": "1.0.2", "inherits": "2.0.3", @@ -3808,7 +3808,7 @@ "request": { "version": "2.83.0", "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", - "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", + "integrity": "sha1-ygtl2gLtYpNYh4COb1EDgQNOM1Y=", "requires": { "aws-sign2": "0.7.0", "aws4": "1.6.0", @@ -3837,7 +3837,7 @@ "resolve": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", - "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", + "integrity": "sha1-HwmsznlsmnYlefMbLBzEw83fnzY=", "dev": true, "requires": { "path-parse": "1.0.5" @@ -3856,7 +3856,7 @@ "retry-request": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-3.1.0.tgz", - "integrity": "sha512-jOwZQlWR/boHhbAfzfOoUn28EDDotW2A7YxV2o5mfBb07H0k/zZAgbxRcckW08GKl/aT0JtPk1NViuk2BfHqVg==", + "integrity": "sha1-+UjKF5JlemSryJoPrXJ90HtisNY=", "requires": { "request": "2.83.0", "through2": "2.0.3" @@ -3865,7 +3865,7 @@ "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "integrity": "sha1-LtgVDSShbqhlHm1u8PR8QVjOejY=", "dev": true, "requires": { "glob": "7.1.2" @@ -3898,18 +3898,18 @@ "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" + "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=" }, "samsam": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.3.0.tgz", - "integrity": "sha512-1HwIYD/8UlOtFS3QO3w7ey+SdSDFE4HRNLZoZRYVQefrOY3l17epswImeB1ijgJFQJodIaHcwkp3r/myBjFVbg==", + "integrity": "sha1-jR2TUOJWItow3j5EumkrUiGrfFA=", "dev": true }, "semver": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", + "integrity": "sha1-4FnAnYVx8FQII3M0M1BdOi8AsY4=", "dev": true }, "semver-diff": { @@ -3945,7 +3945,7 @@ "sinon": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.0.2.tgz", - "integrity": "sha512-4mUsjHfjrHyPFGDTtNJl0q8cv4VOJGvQykI1r3fnn05ys0sQL9M1Y+DyyGNWLD2PMcoyqjJ/nFDm4K54V1eQOg==", + "integrity": "sha1-yB9iRW03mGyE6fUi3bnOQTvaSdI=", "dev": true, "requires": { "diff": "3.4.0", @@ -3977,7 +3977,7 @@ "sntp": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", - "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", + "integrity": "sha1-LGzsFP7cIiJznK+bXD2F0cxaLMg=", "requires": { "hoek": "4.2.0" } @@ -4048,7 +4048,7 @@ "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", "dev": true, "requires": { "is-fullwidth-code-point": "2.0.0", @@ -4075,7 +4075,7 @@ "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", "requires": { "safe-buffer": "5.1.1" } @@ -4174,7 +4174,7 @@ "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "integrity": "sha1-bTQzWIl2jSGyvNoKonfO07G/rfk=", "dev": true, "requires": { "os-tmpdir": "1.0.2" @@ -4197,7 +4197,7 @@ "tslib": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz", - "integrity": "sha512-ymKWWZJST0/CkgduC2qkzjMOWr4bouhuURNXCn/inEX0L57BnRG6FhX76o7FOnsjHazCjfU2LKeSrlS2sIKQJg==", + "integrity": "sha1-3GBOutZLy/aW1hPabJVKoOfqHrY=", "dev": true }, "tslint": { @@ -4222,7 +4222,7 @@ "ansi-styles": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "integrity": "sha1-wVm41b4PnlpvNG2rlPFs4CIWG4g=", "dev": true, "requires": { "color-convert": "1.9.0" @@ -4231,7 +4231,7 @@ "chalk": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "integrity": "sha1-tepI78nBeT3MybR2fJORTT8tUro=", "dev": true, "requires": { "ansi-styles": "3.2.0", @@ -4285,9 +4285,9 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, "typescript": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.3.tgz", - "integrity": "sha512-ptLSQs2S4QuS6/OD1eAKG+S5G8QQtrU5RT32JULdZQtM1L3WTi34Wsu48Yndzi8xsObRAB9RPt/KhA9wlpEF6w==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.1.tgz", + "integrity": "sha1-7znN6ierrAtQAkLWcmq5DgyEZjE=", "dev": true }, "unique-string": { @@ -4325,7 +4325,7 @@ "ansi-styles": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "integrity": "sha1-wVm41b4PnlpvNG2rlPFs4CIWG4g=", "dev": true, "requires": { "color-convert": "1.9.0" @@ -4334,7 +4334,7 @@ "chalk": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "integrity": "sha1-tepI78nBeT3MybR2fJORTT8tUro=", "dev": true, "requires": { "ansi-styles": "3.2.0", @@ -4376,7 +4376,7 @@ "uuid": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" + "integrity": "sha1-PdPT55Crwk17DToDT/q6vijrvAQ=" }, "validate-npm-package-license": { "version": "3.0.1", @@ -4401,7 +4401,7 @@ "which": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "integrity": "sha1-/wS9/AEO5UfXgL7DjhrBwnd9JTo=", "dev": true, "requires": { "isexe": "2.0.0" @@ -4446,7 +4446,7 @@ "write-file-atomic": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", - "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "integrity": "sha1-H/YVdcLipOjlENb6TiQ8zhg5mas=", "dev": true, "requires": { "graceful-fs": "4.1.11", diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 5ba9f38ea61..f26c9446e64 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -48,7 +48,7 @@ "nyc": "^11.2.1", "protobufjs": "~6.8.0", "sinon": "^4.0.1", - "typescript": "^2.4.1" + "typescript": "^2.6.1" }, "files": [ "build/src", diff --git a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts index 0d23cccde75..87e01b56566 100644 --- a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts +++ b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts @@ -26,30 +26,14 @@ type Stack = Array; * A function which converts entry into one or more samples, then * appends those sample(s) to samples. */ -type AppendEntryToSamples = - (entry: Entry, samples: perftools.profiles.Sample[]) => void; +type AppendEntryToSamples = + (entry: Entry, samples: perftools.profiles.Sample[]) => void; /** * Profile node and stack trace to that node. */ -interface Entry { - node: ProfileNode; - stack: Stack; -} - -/** - * Heap profile node and stack trace to that node. - */ -interface AllocationEntry { - node: AllocationProfileNode; - stack: Stack; -} - -/** - * Time profile node and stack trace to that node. - */ -interface TimeEntry { - node: TimeProfileNode; +interface Entry { + node: T; stack: Stack; } @@ -94,9 +78,9 @@ class StringTable { * appends these to end of an array of samples. * @param stringTable - string table for the existing profile. */ -function serialize( - profile: perftools.profiles.IProfile, root: ProfileNode, - appendToSamples: AppendEntryToSamples, stringTable: StringTable) { +function serialize( + profile: perftools.profiles.IProfile, root: T, + appendToSamples: AppendEntryToSamples, stringTable: StringTable) { const samples: Array = []; const locations: Array = []; const functions: Array = []; @@ -105,7 +89,8 @@ function serialize( const functionIdMap = new Map(); const locationIdMap = new Map(); - const entries: Entry[] = root.children.map((n) => ({node: n, stack: []})); + const entries: Entry[] = + (root.children as Array).map((n: T) => ({node: n, stack: []})); while (entries.length > 0) { const entry = entries.pop()!; const node = entry.node; @@ -113,7 +98,7 @@ function serialize( const location = getLocation(node); stack.unshift(location.id as number); appendToSamples(entry, samples); - for (let child of node.children) { + for (let child of node.children as Array) { entries.push({node: child, stack: stack.slice()}); } } @@ -209,8 +194,8 @@ function createAllocationValueType(table: StringTable): */ export function serializeTimeProfile( prof: TimeProfile, intervalMicros: number): perftools.profiles.IProfile { - const appendTimeEntryToSamples: AppendEntryToSamples = - (entry: TimeEntry, samples: perftools.profiles.Sample[]) => { + const appendTimeEntryToSamples: AppendEntryToSamples = + (entry: Entry, samples: perftools.profiles.Sample[]) => { if (entry.node.hitCount > 0) { const sample = new perftools.profiles.Sample({ locationId: entry.stack, @@ -251,8 +236,9 @@ export function serializeTimeProfile( export function serializeHeapProfile( prof: AllocationProfileNode, startTimeNanos: number, durationNanos: number, intervalBytes: number): perftools.profiles.IProfile { - const appendHeapEntryToSamples: AppendEntryToSamples = - (entry: AllocationEntry, samples: perftools.profiles.Sample[]) => { + const appendHeapEntryToSamples: AppendEntryToSamples = + (entry: Entry, + samples: perftools.profiles.Sample[]) => { if (entry.node.allocations.length > 0) { for (const alloc of entry.node.allocations) { const sample = new perftools.profiles.Sample({ From 07b57ddc2072968ff094dc4e5e5fc1a2c05ffcf6 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Wed, 1 Nov 2017 16:43:38 -0700 Subject: [PATCH 022/632] build: start testing on node 9 (#36) --- handwritten/cloud-profiler/.travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/handwritten/cloud-profiler/.travis.yml b/handwritten/cloud-profiler/.travis.yml index ba5340de3e1..238b3eb2f5c 100644 --- a/handwritten/cloud-profiler/.travis.yml +++ b/handwritten/cloud-profiler/.travis.yml @@ -5,6 +5,7 @@ language: node_js node_js: - "6" - "8" + - "9" env: - CXX=g++-4.8 From 1f596613c151b699bf2560402498b61ec71fe690 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 2 Nov 2017 07:16:07 -0700 Subject: [PATCH 023/632] fix: change sample type for heap profile (#40) --- .../ts/src/profilers/profile-serializer.ts | 18 +++++++++++++++--- .../ts/test/profiles-for-tests.ts | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts index 87e01b56566..c5617b410ed 100644 --- a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts +++ b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts @@ -156,7 +156,7 @@ function serialize( * Returns value type for samples counts (type:samples, units:count), and * adds strings used in this value type to the table. */ -function createSampleValueType(table: StringTable): +function createSampleCountValueType(table: StringTable): perftools.profiles.ValueType { return new perftools.profiles.ValueType({ type: table.getIndexOrAdd('samples'), @@ -175,6 +175,18 @@ function createTimeValueType(table: StringTable): perftools.profiles.ValueType { }); } +/** + * Returns value type for object counts (type:objects, units:count), and + * adds strings used in this value type to the table. + */ +function createObjectCountValueType(table: StringTable): + perftools.profiles.ValueType { + return new perftools.profiles.ValueType({ + type: table.getIndexOrAdd('objects'), + unit: table.getIndexOrAdd('count') + }); +} + /** * Returns value type for memory allocations (type:space, units:bytes), and * adds strings used in this value type to the table. @@ -207,7 +219,7 @@ export function serializeTimeProfile( }; const stringTable = new StringTable(); - const sampleValueType = createSampleValueType(stringTable); + const sampleValueType = createSampleCountValueType(stringTable); const timeValueType = createTimeValueType(stringTable); const profile = { @@ -252,7 +264,7 @@ export function serializeHeapProfile( }; const stringTable = new StringTable(); - const sampleValueType = createSampleValueType(stringTable); + const sampleValueType = createObjectCountValueType(stringTable); const allocationValueType = createAllocationValueType(stringTable); const profile = { diff --git a/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts index 3183b3d4a92..f02734ce8e2 100644 --- a/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts +++ b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts @@ -240,7 +240,7 @@ export const heapProfile: perftools.profiles.IProfile = { function: heapFunctions, stringTable: [ '', - 'samples', + 'objects', 'count', 'space', 'bytes', From 1f8542b6f6bb62dc91770996c2a0fc530d6aa9c5 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Thu, 2 Nov 2017 07:16:46 -0700 Subject: [PATCH 024/632] chore: use stricter semver range for typescript (#41) TypeScript famously doesn't follow semver. To avoid unnecessary breakages in CI due, let's use a stricter semver range. --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index f26c9446e64..484104946c2 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -48,7 +48,7 @@ "nyc": "^11.2.1", "protobufjs": "~6.8.0", "sinon": "^4.0.1", - "typescript": "^2.6.1" + "typescript": "~2.6.x" }, "files": [ "build/src", From b925d8ebf6693ef2fbfcc6228b9162d47fb99f07 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 2 Nov 2017 07:17:45 -0700 Subject: [PATCH 025/632] fix: ignore build/test in test coverage (#35) --- handwritten/cloud-profiler/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 484104946c2..978b0fca59b 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -62,7 +62,8 @@ ], "nyc": { "exclude": [ - "proto" + "proto", + "build/test" ] } } From 27f17ee05cf2f28828268836c577c8d4114b9998 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Thu, 2 Nov 2017 07:23:03 -0700 Subject: [PATCH 026/632] =?UTF-8?q?Update=20dependencies=20to=20enable=20G?= =?UTF-8?q?reenkeeper=20=F0=9F=8C=B4=20(#26)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(package): update dependencies * docs(readme): add Greenkeeper badge * fix: compatibility with @types/extend We are now getting better types from @types/extend which, coupled with typescript 2.6, is leading to type errors. --- handwritten/cloud-profiler/README.md | 2 ++ handwritten/cloud-profiler/package.json | 6 +++--- handwritten/cloud-profiler/ts/src/config.ts | 20 ++++++++++++++----- handwritten/cloud-profiler/ts/src/index.ts | 4 ++-- handwritten/cloud-profiler/ts/src/profiler.ts | 11 +--------- .../ts/test/test-init-config.ts | 2 +- 6 files changed, 24 insertions(+), 21 deletions(-) diff --git a/handwritten/cloud-profiler/README.md b/handwritten/cloud-profiler/README.md index 75677cb4fd2..4f170bd8ccb 100644 --- a/handwritten/cloud-profiler/README.md +++ b/handwritten/cloud-profiler/README.md @@ -1,5 +1,7 @@ # Google Cloud Profiler +[![Greenkeeper badge](https://badges.greenkeeper.io/GoogleCloudPlatform/cloud-profiler-nodejs.svg)](https://greenkeeper.io/) + [![Dependency Status][david-image]][david-url] [![devDependency Status][david-dev-image]][david-dev-url] diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 978b0fca59b..8b5d5b95f36 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -36,14 +36,14 @@ }, "devDependencies": { "@types/delay": "^2.0.0", - "@types/extend": "^2.0.30", + "@types/extend": "^3.0.0", "@types/mocha": "^2.2.43", "@types/node": "^8.0.30", "@types/request": "^2.0.4", "@types/sinon": "^2.3.6", "clang-format": "^1.0.33", - "codecov": "^2.3.1", - "gts": "^0.3.1", + "codecov": "^3.0.0", + "gts": "^0.4.0", "mocha": "^4.0.1", "nyc": "^11.2.1", "protobufjs": "~6.8.0", diff --git a/handwritten/cloud-profiler/ts/src/config.ts b/handwritten/cloud-profiler/ts/src/config.ts index 65257731666..c39fc572c9f 100644 --- a/handwritten/cloud-profiler/ts/src/config.ts +++ b/handwritten/cloud-profiler/ts/src/config.ts @@ -15,7 +15,6 @@ */ import {AuthenticationConfig, Common, ServiceConfig} from '../third_party/types/common-types'; -import {ProfilerConfig} from './profiler'; const common: Common = require('@google-cloud/common'); const extend = require('extend'); @@ -62,12 +61,23 @@ export interface Config extends AuthenticationConfig { disableHeap?: boolean; } +/** + * Subtype of Config that declares some properties to be non-optional. This + * helps avoid null checks in the profiler code. + */ +export interface ProfilerConfig extends Config { + logLevel: number; + serviceContext: {service?: string; version?: string;}; + instance: string; + zone: string; + disableTime: boolean; + disableHeap: boolean; +} + // Default values for configuration for a profiler. -export const defaultConfig: Config = { +export const defaultConfig: ProfilerConfig = { logLevel: 1, - serviceContext: { - version: '', - }, + serviceContext: {}, disableHeap: false, disableTime: false, instance: '', diff --git a/handwritten/cloud-profiler/ts/src/index.ts b/handwritten/cloud-profiler/ts/src/index.ts index b8530547820..f1abfa4418b 100644 --- a/handwritten/cloud-profiler/ts/src/index.ts +++ b/handwritten/cloud-profiler/ts/src/index.ts @@ -21,8 +21,8 @@ import * as pify from 'pify'; import {AuthenticationConfig, Common, ServiceConfig, ServiceObject} from '../third_party/types/common-types'; -import {Config, defaultConfig} from './config'; -import {Profiler, ProfilerConfig} from './profiler'; +import {Config, defaultConfig, ProfilerConfig} from './config'; +import {Profiler} from './profiler'; const common: Common = require('@google-cloud/common'); diff --git a/handwritten/cloud-profiler/ts/src/profiler.ts b/handwritten/cloud-profiler/ts/src/profiler.ts index 2abfbeae32e..605e46ddbfb 100644 --- a/handwritten/cloud-profiler/ts/src/profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profiler.ts @@ -17,22 +17,13 @@ import * as path from 'path'; import {AuthenticationConfig, Common, Logger, Service, ServiceConfig} from '../third_party/types/common-types'; -import {Config} from './config'; +import {Config, ProfilerConfig} from './config'; import {HeapProfiler} from './profilers/heap-profiler'; import {TimeProfiler} from './profilers/time-profiler'; const pjson = require('../../package.json'); const common: Common = require('@google-cloud/common'); -export interface ProfilerConfig extends AuthenticationConfig { - logLevel: number; - serviceContext: {service: string; version?: string;}; - instance: string; - zone: string; - disableTime: boolean; - disableHeap: boolean; -} - // TODO: finish implementing Profiler. // TODO: add stop() method to stop profiling. export class Profiler { diff --git a/handwritten/cloud-profiler/ts/test/test-init-config.ts b/handwritten/cloud-profiler/ts/test/test-init-config.ts index 16891914330..1dd84150b9e 100644 --- a/handwritten/cloud-profiler/ts/test/test-init-config.ts +++ b/handwritten/cloud-profiler/ts/test/test-init-config.ts @@ -116,7 +116,7 @@ describe('initConfig', () => { }; const expConfig = { logLevel: 1, - serviceContext: {version: '', service: 'fake-service'}, + serviceContext: {service: 'fake-service'}, disableHeap: false, disableTime: false, instance: '', From 22df68593b1642e633300f041050955dc76962eb Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 2 Nov 2017 07:27:46 -0700 Subject: [PATCH 027/632] feat: add heap profile collection (#34) --- .../ts/src/profilers/heap-profiler.ts | 56 ++++++++++++++-- .../ts/src/profilers/profile-serializer.ts | 3 +- .../ts/test/profiles-for-tests.ts | 1 - .../ts/test/test-heap-profiler.ts | 66 +++++++++++++++++++ .../ts/test/test-profile-serializer.ts | 3 +- 5 files changed, 120 insertions(+), 9 deletions(-) create mode 100644 handwritten/cloud-profiler/ts/test/test-heap-profiler.ts diff --git a/handwritten/cloud-profiler/ts/src/profilers/heap-profiler.ts b/handwritten/cloud-profiler/ts/src/profilers/heap-profiler.ts index 8b2a9004d57..5c9bdcc7536 100644 --- a/handwritten/cloud-profiler/ts/src/profilers/heap-profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profilers/heap-profiler.ts @@ -1,7 +1,55 @@ -// Unimplemented stub of HeapProfiler -// TODO: implement +/** + * 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. + */ + +import {perftools} from '../../../proto/profile'; +import {serializeHeapProfile} from './profile-serializer'; + +const profiler = require('bindings')('sampling_heap_profiler'); + export class HeapProfiler { - constructor() { - throw new Error('Heap Profiler is unimplemented'); + private enabled: boolean; + + /** + * @param intervalBytes - average bytes between samples. + * @param stackDepth - upper limit on number of frames in stack for sample. + */ + constructor(private intervalBytes: number, private stackDepth: number) { + this.enable(); + } + + /** + * Collects a heap profile when heapProfiler is enabled. Otherwise throws + * an error. + */ + profile(): perftools.profiles.IProfile { + if (!this.enabled) { + throw new Error('Heap profiler is not enabled.'); + } + const result = profiler.getAllocationProfile(); + const startTimeNanos = Date.now() * 1000 * 1000; + return serializeHeapProfile(result, startTimeNanos, this.intervalBytes); + } + + enable() { + profiler.startSamplingHeapProfiler(this.intervalBytes, this.stackDepth); + this.enabled = true; + } + + disable() { + this.enabled = false; + profiler.stopSamplingHeapProfiler(); } } diff --git a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts index c5617b410ed..8e2235040c4 100644 --- a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts +++ b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts @@ -246,7 +246,7 @@ export function serializeTimeProfile( * @param intervalBytes - bytes allocated between samples. */ export function serializeHeapProfile( - prof: AllocationProfileNode, startTimeNanos: number, durationNanos: number, + prof: AllocationProfileNode, startTimeNanos: number, intervalBytes: number): perftools.profiles.IProfile { const appendHeapEntryToSamples: AppendEntryToSamples = (entry: Entry, @@ -270,7 +270,6 @@ export function serializeHeapProfile( const profile = { sampleType: [sampleValueType, allocationValueType], timeNanos: startTimeNanos, - durationNanos: durationNanos, periodType: allocationValueType, period: intervalBytes, }; diff --git a/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts index f02734ce8e2..953bb5fea49 100644 --- a/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts +++ b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts @@ -251,7 +251,6 @@ export const heapProfile: perftools.profiles.IProfile = { 'function2', ], timeNanos: 0, - durationNanos: 10 * 1000 * 1000 * 1000, periodType: new perftools.profiles.ValueType({type: 3, unit: 4}), period: 524288 }; diff --git a/handwritten/cloud-profiler/ts/test/test-heap-profiler.ts b/handwritten/cloud-profiler/ts/test/test-heap-profiler.ts new file mode 100644 index 00000000000..28e774fc7d4 --- /dev/null +++ b/handwritten/cloud-profiler/ts/test/test-heap-profiler.ts @@ -0,0 +1,66 @@ +/** + * 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. + */ + +import * as delay from 'delay'; +import * as sinon from 'sinon'; + +import {perftools} from '../../proto/profile'; +import {HeapProfiler} from '../src/profilers/heap-profiler'; + +import {heapProfile, v8HeapProfile} from './profiles-for-tests'; + +let assert = require('assert'); +const v8HeapProfiler = require('bindings')('sampling_heap_profiler'); + +describe('HeapProfiler', () => { + describe('profile', () => { + before(() => { + sinon.stub(v8HeapProfiler, 'startSamplingHeapProfiler'); + sinon.stub(v8HeapProfiler, 'stopSamplingHeapProfiler'); + sinon.stub(v8HeapProfiler, 'getAllocationProfile').returns(v8HeapProfile); + sinon.stub(Date, 'now').returns(0); + }); + + after(() => { + v8HeapProfiler.startSamplingHeapProfiler.restore(); + v8HeapProfiler.stopSamplingHeapProfiler.restore(); + v8HeapProfiler.getAllocationProfile.restore(); + (Date.now as any).restore(); + }); + + it('should return a profile equal to the expected profile', async () => { + const intervalBytes = 1024 * 512; + const stackDepth = 32; + let profiler = new HeapProfiler(intervalBytes, stackDepth); + let profile = profiler.profile(); + assert.deepEqual(heapProfile, profile); + }); + + it('should throw error when disabled', () => { + const intervalBytes = 1024 * 512; + const stackDepth = 32; + const profiler = new HeapProfiler(intervalBytes, stackDepth); + profiler.disable(); + assert.throws( + () => { + profiler.profile(); + }, + (err: Error) => { + return err.message === 'Heap profiler is not enabled.'; + }); + }); + }); +}); diff --git a/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts b/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts index f4c6beb924c..5133d5e5201 100644 --- a/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts +++ b/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts @@ -30,8 +30,7 @@ describe('serializeTimeProfile', () => { describe('serializeHeapProfile', () => { it('should produce expected profile', () => { - const heapProfileOut = serializeHeapProfile( - v8HeapProfile, 0, 10 * 1000 * 1000 * 1000, 512 * 1024); + const heapProfileOut = serializeHeapProfile(v8HeapProfile, 0, 512 * 1024); assert.deepEqual(heapProfileOut, heapProfile); }); }); From 8cb66eb29ea87dc9dfdb0b2ab68e33a37e8fdae4 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 2 Nov 2017 15:16:12 -0700 Subject: [PATCH 028/632] fix: should use '(anonymous)' as function name when no name specified (#39) * fix: should use '(anonymous)' as function name when serializing and no value for name * Add tests for when function name missing * fix test cases after merge --- .../ts/src/profilers/profile-serializer.ts | 2 +- handwritten/cloud-profiler/ts/src/v8-types.ts | 2 +- .../ts/test/profiles-for-tests.ts | 122 ++++++++++++++++++ .../ts/test/test-profile-serializer.ts | 13 +- 4 files changed, 136 insertions(+), 3 deletions(-) diff --git a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts index 8e2235040c4..dd893e326b1 100644 --- a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts +++ b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts @@ -140,7 +140,7 @@ function serialize( } id = functions.length + 1; functionIdMap.set(keyStr, id); - let nameId = stringTable.getIndexOrAdd(node.name); + let nameId = stringTable.getIndexOrAdd(node.name || '(anonymous)'); let f = new perftools.profiles.Function({ id: id, name: nameId, diff --git a/handwritten/cloud-profiler/ts/src/v8-types.ts b/handwritten/cloud-profiler/ts/src/v8-types.ts index 27848d14cec..ee543dd197b 100644 --- a/handwritten/cloud-profiler/ts/src/v8-types.ts +++ b/handwritten/cloud-profiler/ts/src/v8-types.ts @@ -26,7 +26,7 @@ export interface TimeProfile { export interface ProfileNode { // name is the function name. - name: string; + name?: string; scriptName: string; scriptId: number; lineNumber: number; diff --git a/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts index 953bb5fea49..3c319078d80 100644 --- a/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts +++ b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts @@ -254,3 +254,125 @@ export const heapProfile: perftools.profiles.IProfile = { periodType: new perftools.profiles.ValueType({type: 3, unit: 4}), period: 524288 }; + + +const anonymousHeapNode = { + scriptName: 'main', + scriptId: 0, + lineNumber: 1, + columnNumber: 5, + allocations: [{count: 1, sizeBytes: 5}], + children: [] +}; + +export const v8AnonymousFunctionHeapProfile = { + name: '(root)', + scriptName: '(root)', + scriptId: 10000, + lineNumber: 0, + columnNumber: 5, + allocations: [], + children: [anonymousHeapNode] +}; + +const anonymousFunctionHeapLines = [ + {functionId: 1, line: 1}, +]; + +const anonymousFunctionHeapFunctions = [ + new perftools.profiles.Function({id: 1, name: 5, systemName: 5, filename: 6}), +]; + +const anonymousFunctionHeapLocations = [ + new perftools.profiles.Location({line: [heapLines[0]], id: 1}), +]; + +export const anonymousFunctionHeapProfile: perftools.profiles.IProfile = { + sampleType: [ + new perftools.profiles.ValueType({type: 1, unit: 2}), + new perftools.profiles.ValueType({type: 3, unit: 4}), + ], + sample: [ + new perftools.profiles.Sample({locationId: [1], value: [1, 5], label: []}), + ], + location: anonymousFunctionHeapLocations, + function: anonymousFunctionHeapFunctions, + stringTable: [ + '', + 'objects', + 'count', + 'space', + 'bytes', + '(anonymous)', + 'main', + ], + timeNanos: 0, + periodType: new perftools.profiles.ValueType({type: 3, unit: 4}), + period: 524288 +}; + +const anonymousFunctionTimeNode = { + scriptName: 'main', + scriptId: 2, + lineNumber: 1, + columnNumber: 5, + hitCount: 1, + children: [] +}; + +const anonymousFunctionTimeRoot = { + name: '(root)', + scriptName: 'root', + scriptId: 0, + lineNumber: 0, + columnNumber: 0, + hitCount: 0, + children: [anonymousFunctionTimeNode] +}; + +export const v8AnonymousFunctionTimeProfile: TimeProfile = { + startTime: 0, + endTime: 10 * 1000, + topDownRoot: anonymousFunctionTimeRoot, +}; + +const anonymousFunctionTimeLines = [ + {functionId: 1, line: 1}, +]; + +const anonymousFunctionTimeFunctions = [ + new perftools.profiles.Function({id: 1, name: 5, systemName: 5, filename: 6}), +]; + +const anonymousFunctionTimeLocations = [ + new perftools.profiles.Location({ + line: [timeLines[0]], + id: 1, + }), +]; + +export const anonymousFunctionTimeProfile: perftools.profiles.IProfile = { + sampleType: [ + new perftools.profiles.ValueType({type: 1, unit: 2}), + new perftools.profiles.ValueType({type: 3, unit: 4}), + ], + sample: [ + new perftools.profiles.Sample( + {locationId: [1], value: [1, 1000], label: []}), + ], + location: anonymousFunctionTimeLocations, + function: anonymousFunctionTimeFunctions, + stringTable: [ + '', + 'samples', + 'count', + 'time', + 'microseconds', + '(anonymous)', + 'main', + ], + timeNanos: 0, + durationNanos: 10 * 1000 * 1000 * 1000, + periodType: new perftools.profiles.ValueType({type: 3, unit: 4}), + period: 1000, +}; diff --git a/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts b/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts index 5133d5e5201..a7ec65f207c 100644 --- a/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts +++ b/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts @@ -17,7 +17,8 @@ import {perftools} from '../../proto/profile'; import {serializeHeapProfile, serializeTimeProfile} from '../src/profilers/profile-serializer'; import {TimeProfile, TimeProfileNode} from '../src/v8-types'; -import {heapProfile, timeProfile, v8HeapProfile, v8TimeProfile} from './profiles-for-tests'; + +import {anonymousFunctionHeapProfile, anonymousFunctionTimeProfile, heapProfile, timeProfile, v8AnonymousFunctionHeapProfile, v8AnonymousFunctionTimeProfile, v8HeapProfile, v8TimeProfile} from './profiles-for-tests'; let assert = require('assert'); @@ -26,6 +27,11 @@ describe('serializeTimeProfile', () => { const timeProfileOut = serializeTimeProfile(v8TimeProfile, 1000); assert.deepEqual(timeProfileOut, timeProfile); }); + it('should produce expected profile when there is anyonmous function', () => { + const heapProfileOut = + serializeTimeProfile(v8AnonymousFunctionTimeProfile, 1000); + assert.deepEqual(heapProfileOut, anonymousFunctionTimeProfile); + }); }); describe('serializeHeapProfile', () => { @@ -33,4 +39,9 @@ describe('serializeHeapProfile', () => { const heapProfileOut = serializeHeapProfile(v8HeapProfile, 0, 512 * 1024); assert.deepEqual(heapProfileOut, heapProfile); }); + it('should produce expected profile when there is anyonmous function', () => { + const heapProfileOut = + serializeHeapProfile(v8AnonymousFunctionHeapProfile, 0, 512 * 1024); + assert.deepEqual(heapProfileOut, anonymousFunctionHeapProfile); + }); }); From 3351eae76b3ce02a15a05a61fc603e4220d0ede8 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Fri, 3 Nov 2017 13:03:03 -0700 Subject: [PATCH 029/632] fix: rm .gitmodules from third_party/googleapis (#46) Fixes: https://github.com/GoogleCloudPlatform/cloud-profiler-nodejs/issues/45 --- .../third_party/googleapis/.gitmodules | 12 ------------ .../third_party/googleapis/README.google | 1 + 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 handwritten/cloud-profiler/third_party/googleapis/.gitmodules diff --git a/handwritten/cloud-profiler/third_party/googleapis/.gitmodules b/handwritten/cloud-profiler/third_party/googleapis/.gitmodules deleted file mode 100644 index a25fa8ce827..00000000000 --- a/handwritten/cloud-profiler/third_party/googleapis/.gitmodules +++ /dev/null @@ -1,12 +0,0 @@ -[submodule "third_party/protobuf"] - path = third_party/protobuf - url = https://github.com/google/protobuf -[submodule "third_party/zlib"] - path = third_party/zlib - url = https://github.com/makdharma/zlib -[submodule "third_party/boringssl-with-bazel"] - path = third_party/boringssl-with-bazel - url = https://boringssl.googlesource.com/boringssl -[submodule "third_party/nanopb"] - path = third_party/nanopb - url = https://github.com/nanopb/nanopb diff --git a/handwritten/cloud-profiler/third_party/googleapis/README.google b/handwritten/cloud-profiler/third_party/googleapis/README.google index 921b034899d..cd663e4dc02 100644 --- a/handwritten/cloud-profiler/third_party/googleapis/README.google +++ b/handwritten/cloud-profiler/third_party/googleapis/README.google @@ -7,6 +7,7 @@ Description: Local Modifications: README.google was removed from .gitignore. Remote submodules were not imported. + Remove .gitmodules. Imported as a git-subtree. From 53f80c3eb5ac29e9e60b370925b83898e6b6db28 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Fri, 3 Nov 2017 13:51:22 -0700 Subject: [PATCH 030/632] fix(package): update @google-cloud/common to version 0.14.0 (#48) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 8b5d5b95f36..40a96133b7b 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -23,7 +23,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/common": "^0.13.6", + "@google-cloud/common": "^0.14.0", "@types/pify": "^3.0.0", "bindings": "^1.2.1", "delay": "^2.0.0", From a90065877399996e8445e14e4fa59ad8714c053c Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Tue, 7 Nov 2017 07:52:24 -0800 Subject: [PATCH 031/632] =?UTF-8?q?Update=20gts=20to=20the=20latest=20vers?= =?UTF-8?q?ion=20=F0=9F=9A=80=20(#49)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(package): update gts to version 0.5.0 * refactor: compatibility with gts-0.5.0 * fix typo --- handwritten/cloud-profiler/package-lock.json | 536 ++++++------------ handwritten/cloud-profiler/package.json | 2 +- handwritten/cloud-profiler/ts/src/index.ts | 6 +- .../ts/src/profilers/profile-serializer.ts | 22 +- .../ts/src/profilers/time-profiler.ts | 2 +- handwritten/cloud-profiler/ts/src/v8-types.ts | 4 +- .../ts/test/test-heap-profiler.ts | 7 +- .../ts/test/test-init-config.ts | 17 +- .../ts/test/test-profile-serializer.ts | 2 +- .../ts/test/test-time-profiler.ts | 10 +- .../ts/third_party/types/common-types.ts | 19 +- 11 files changed, 234 insertions(+), 393 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index e4fc7151576..206a80efce8 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -5,9 +5,9 @@ "requires": true, "dependencies": { "@google-cloud/common": { - "version": "0.13.6", - "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.13.6.tgz", - "integrity": "sha1-qdjhN7xCmkSrqWif5qDkMxeE+FM=", + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.14.0.tgz", + "integrity": "sha1-xWA4KXJH6nKnUNUUVegBcQl2rEM=", "requires": { "array-uniq": "1.0.3", "arrify": "1.0.1", @@ -100,9 +100,9 @@ "dev": true }, "@types/extend": { - "version": "2.0.30", - "resolved": "https://registry.npmjs.org/@types/extend/-/extend-2.0.30.tgz", - "integrity": "sha1-WMyT9iHQo1jT/sm9bnObxg7H4nU=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/extend/-/extend-3.0.0.tgz", + "integrity": "sha512-Eo8NQCbgjlMPQarlFAE3vpyCvFda4dg1Ob5ZJb6BJI9x4NAZVWowyMNB8GJJDgDI4lr2oqiQvXlPB0Fn1NoXnQ==", "dev": true }, "@types/form-data": { @@ -176,20 +176,23 @@ "ansi-escapes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", - "integrity": "sha1-7D6LTp+AZPwCw6ybZfHCdb2o75I=", + "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", "dev": true }, "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } }, "argv": { "version": "0.0.2", @@ -224,9 +227,9 @@ "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" }, "async": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", - "integrity": "sha1-hDGQ/WtzV6C54clW7d3V7IRitU0=", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", "requires": { "lodash": "4.17.4" } @@ -255,6 +258,48 @@ "chalk": "1.1.3", "esutils": "2.0.2", "js-tokens": "3.0.2" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } } }, "balanced-match": { @@ -305,40 +350,11 @@ "widest-line": "1.0.0" }, "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha1-wVm41b4PnlpvNG2rlPFs4CIWG4g=", - "dev": true, - "requires": { - "color-convert": "1.9.0" - } - }, "camelcase": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha1-tepI78nBeT3MybR2fJORTT8tUro=", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } } } }, @@ -396,16 +412,14 @@ "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", "dev": true, "requires": { - "ansi-styles": "2.2.1", + "ansi-styles": "3.2.0", "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "supports-color": "4.5.0" } }, "clang-format": { @@ -460,16 +474,26 @@ "dev": true }, "codecov": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/codecov/-/codecov-2.3.1.tgz", - "integrity": "sha1-fdqUXNWKH2CBAltbA+4Bou8g+G4=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/codecov/-/codecov-3.0.0.tgz", + "integrity": "sha1-wnO4xPEpRXI+jcnSWAPYk0Pl8o4=", "dev": true, "requires": { "argv": "0.0.2", - "request": "2.77.0", + "request": "2.81.0", "urlgrey": "0.4.4" }, "dependencies": { + "ajv": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "dev": true, + "requires": { + "co": "4.6.0", + "json-stable-stringify": "1.0.1" + } + }, "assert-plus": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", @@ -491,12 +515,6 @@ "hoek": "2.16.3" } }, - "caseless": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", - "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", - "dev": true - }, "cryptiles": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", @@ -517,16 +535,20 @@ "mime-types": "2.1.17" } }, + "har-schema": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", + "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=", + "dev": true + }, "har-validator": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", - "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", + "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", "dev": true, "requires": { - "chalk": "1.1.3", - "commander": "2.11.0", - "is-my-json-valid": "2.16.1", - "pinkie-promise": "2.0.1" + "ajv": "4.11.8", + "har-schema": "1.0.5" } }, "hawk": { @@ -558,44 +580,46 @@ "sshpk": "1.13.1" } }, - "node-uuid": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", - "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=", + "performance-now": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", + "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", "dev": true }, "qs": { - "version": "6.3.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", - "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", + "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=", "dev": true }, "request": { - "version": "2.77.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.77.0.tgz", - "integrity": "sha1-KwDYIDDt7cyXCJ/6XYgQqcKqMUs=", + "version": "2.81.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", + "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", "dev": true, "requires": { "aws-sign2": "0.6.0", "aws4": "1.6.0", - "caseless": "0.11.0", + "caseless": "0.12.0", "combined-stream": "1.0.5", "extend": "3.0.1", "forever-agent": "0.6.1", "form-data": "2.1.4", - "har-validator": "2.0.6", + "har-validator": "4.2.1", "hawk": "3.1.3", "http-signature": "1.1.1", "is-typedarray": "1.0.0", "isstream": "0.1.2", "json-stringify-safe": "5.0.1", "mime-types": "2.1.17", - "node-uuid": "1.4.8", "oauth-sign": "0.8.2", - "qs": "6.3.2", + "performance-now": "0.2.0", + "qs": "6.4.0", + "safe-buffer": "5.1.1", "stringstream": "0.0.5", "tough-cookie": "2.3.3", - "tunnel-agent": "0.4.3" + "tunnel-agent": "0.6.0", + "uuid": "3.1.0" } }, "sntp": { @@ -606,12 +630,6 @@ "requires": { "hoek": "2.16.3" } - }, - "tunnel-agent": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", - "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", - "dev": true } } }, @@ -663,7 +681,7 @@ "configstore": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.1.tgz", - "integrity": "sha1-CU7mYquD+tmRdnjeEU+q6o/NypA=", + "integrity": "sha512-5oNkD/L++l0O6xGXxb1EWS7SivtjfGQlRyxJsYgE0Z495/L81e2h4/d3r969hoPXuFItzNOKMtsXgYG4c7dYvw==", "dev": true, "requires": { "dot-prop": "4.2.0", @@ -782,7 +800,7 @@ "dot-prop": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", - "integrity": "sha1-HxngwuGqDjJ5fEl5nyg3rGr2nFc=", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", "dev": true, "requires": { "is-obj": "1.0.1" @@ -797,7 +815,7 @@ "duplexify": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.1.tgz", - "integrity": "sha1-ThUWvmiDi8kKSZlPCzmm5ZYL780=", + "integrity": "sha512-j5goxHTwVED1Fpe5hh3q9R93Kip0Bg2KVAt4f8CEYM3UEwYcPSvWbXaUQOzdX/HtiNomipv+gU7ASQPDbV7pGQ==", "requires": { "end-of-stream": "1.4.0", "inherits": "2.0.3", @@ -880,7 +898,7 @@ "external-editor": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.5.tgz", - "integrity": "sha1-UsJJo5gbm6GHx8rPW+tQvx2Rprw=", + "integrity": "sha512-Msjo64WT5W+NhOpQXh0nOHm+n0RfU1QUwDnKYvJ8dEJ8zlwLrqXNTv5mSUTJpepf41PDJGyhueTw2vNZW+Fr/w==", "dev": true, "requires": { "iconv-lite": "0.4.19", @@ -961,21 +979,6 @@ "retry-request": "3.1.0" } }, - "generate-function": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", - "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", - "dev": true - }, - "generate-object-property": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", - "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", - "dev": true, - "requires": { - "is-property": "1.0.2" - } - }, "get-stdin": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", @@ -1033,9 +1036,9 @@ "google-auto-auth": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.7.2.tgz", - "integrity": "sha1-v5NS1cSgiXvzH9nEkQKLdl++px4=", + "integrity": "sha512-ux2n2AE2g3+vcLXwL4dP/M12SFMRX5dzCzBfhAEkTeAB7dpyGdOIEj7nmUx0BHKaCcUQrRWg9kT63X/Mmtk1+A==", "requires": { - "async": "2.5.0", + "async": "2.6.0", "gcp-metadata": "0.3.1", "google-auth-library": "0.10.0", "request": "2.83.0" @@ -1044,7 +1047,7 @@ "gcp-metadata": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.3.1.tgz", - "integrity": "sha1-MTgURW58PQ7rj4sISzNXnohvgpo=", + "integrity": "sha512-5kJPX/RXuqoLmHiOOgkSDk/LI0QaXpEvZ3pvQP4ifjGGDKZKVSOjL/GcDjXA5kLxppFCOjmmsu0Uoop9d1upaQ==", "requires": { "extend": "3.0.1", "retry-request": "3.1.0" @@ -1094,7 +1097,7 @@ "gtoken": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-1.2.3.tgz", - "integrity": "sha1-VQlXG4r9QyLhJM9mz2gRUoTEdtg=", + "integrity": "sha512-wQAJflfoqSgMWrSBk9Fg86q+sd6s7y6uJhIvvIPz++RElGlMtEqsdAR2oWwZ/WTEtp7P9xFbJRrT976oRgzJ/w==", "requires": { "google-p12-pem": "0.1.2", "jws": "3.1.4", @@ -1103,9 +1106,9 @@ } }, "gts": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/gts/-/gts-0.3.1.tgz", - "integrity": "sha1-K0EYb8sb4X+b1c072hAiWIHIwro=", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/gts/-/gts-0.5.0.tgz", + "integrity": "sha512-UP38al3ZmgBXjTjHKpVFdxLVt+rA9meuvRvfETsKUyd9fWmOTbOD92DT3DViWY8FaXMPwe/EzJdPSTWGhoU0YA==", "dev": true, "requires": { "chalk": "2.3.0", @@ -1113,42 +1116,10 @@ "inquirer": "3.3.0", "meow": "3.7.0", "pify": "3.0.0", - "read-package-json": "2.0.12", "rimraf": "2.6.2", "tslint": "5.8.0", "update-notifier": "2.3.0", "write-file-atomic": "2.3.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha1-wVm41b4PnlpvNG2rlPFs4CIWG4g=", - "dev": true, - "requires": { - "color-convert": "1.9.0" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha1-tepI78nBeT3MybR2fJORTT8tUro=", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } } }, "har-schema": { @@ -1172,6 +1143,14 @@ "dev": true, "requires": { "ansi-regex": "2.1.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + } } }, "has-flag": { @@ -1205,7 +1184,7 @@ "hosted-git-info": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", - "integrity": "sha1-bWDjSzq7yDEwYsO3mO+NkBoHrzw=", + "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", "dev": true }, "http-signature": { @@ -1221,7 +1200,7 @@ "iconv-lite": { "version": "0.4.19", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha1-90aPYBNfXl2tM5nAqBvpoWA6CCs=", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", "dev": true }, "import-lazy": { @@ -1269,7 +1248,7 @@ "inquirer": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", - "integrity": "sha1-ndLyrXZdyrH/BEO0kUQqILoifck=", + "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", "dev": true, "requires": { "ansi-escapes": "3.0.0", @@ -1286,52 +1265,6 @@ "string-width": "2.1.1", "strip-ansi": "4.0.0", "through": "2.3.8" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha1-wVm41b4PnlpvNG2rlPFs4CIWG4g=", - "dev": true, - "requires": { - "color-convert": "1.9.0" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha1-tepI78nBeT3MybR2fJORTT8tUro=", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } } }, "is": { @@ -1379,18 +1312,6 @@ "is-path-inside": "1.0.0" } }, - "is-my-json-valid": { - "version": "2.16.1", - "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz", - "integrity": "sha1-WoRnd+LCYg0eaRBOXToDsfYIjxE=", - "dev": true, - "requires": { - "generate-function": "2.0.0", - "generate-object-property": "1.2.0", - "jsonpointer": "4.0.1", - "xtend": "4.0.1" - } - }, "is-npm": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", @@ -1418,12 +1339,6 @@ "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", "dev": true }, - "is-property": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", - "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", - "dev": true - }, "is-redirect": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", @@ -1489,13 +1404,7 @@ "jschardet": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.6.0.tgz", - "integrity": "sha1-x9GnHtz/KDnbL57DD8XV69PBpng=", - "dev": true - }, - "json-parse-better-errors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz", - "integrity": "sha1-UBg80bLSUnXeBp6ecbRnrJ6rlzo=", + "integrity": "sha512-xYuhvQ7I9PDJIGBWev9xm0+SMSed3ZDBAmvVjbFR1ZRLAF+vlXcQu6cRI9uAlj81rzikElRVteehwV7DuX2ZmQ==", "dev": true }, "json-schema": { @@ -1508,15 +1417,24 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, + "requires": { + "jsonify": "0.0.0" + } + }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, - "jsonpointer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", - "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", "dev": true }, "jsprim": { @@ -1639,7 +1557,7 @@ "lru-cache": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha1-Yi4y6CSItJJ5EUpPns9F581rulU=", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", "dev": true, "requires": { "pseudomap": "1.0.2", @@ -1649,7 +1567,7 @@ "make-dir": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.1.0.tgz", - "integrity": "sha1-GbQ2n+SMEW9Twq+VrRAsDjnoXVE=", + "integrity": "sha512-0Pkui4wLJ7rxvmfUvs87skoEaxmu0hCUApF8nonzpl7q//FWp9zu8W61Scz4sd/kUiqDxvUhtoam2efDyiBzcA==", "dev": true, "requires": { "pify": "3.0.0" @@ -1687,7 +1605,7 @@ "mime": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha1-Eh+evEnjdm8xGnbh+hyAA8SwOqY=" + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" }, "mime-db": { "version": "1.30.0", @@ -1826,7 +1744,7 @@ "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha1-EvlaMH1YNSB1oEkHuErIvpisAS8=", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", "dev": true, "requires": { "hosted-git-info": "2.5.0", @@ -3719,19 +3637,6 @@ "strip-json-comments": "2.0.1" } }, - "read-package-json": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.0.12.tgz", - "integrity": "sha1-aOpF+Ys3QctuEK47vUKmBQJqaVE=", - "dev": true, - "requires": { - "glob": "7.1.2", - "graceful-fs": "4.1.11", - "json-parse-better-errors": "1.0.1", - "normalize-package-data": "2.4.0", - "slash": "1.0.0" - } - }, "read-pkg": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", @@ -3865,7 +3770,7 @@ "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha1-LtgVDSShbqhlHm1u8PR8QVjOejY=", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { "glob": "7.1.2" @@ -3909,7 +3814,7 @@ "semver": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha1-4FnAnYVx8FQII3M0M1BdOi8AsY4=", + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", "dev": true }, "semver-diff": { @@ -3968,12 +3873,6 @@ } } }, - "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", - "dev": true - }, "sntp": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", @@ -4008,7 +3907,7 @@ "resolved": "https://registry.npmjs.org/split-array-stream/-/split-array-stream-1.0.3.tgz", "integrity": "sha1-0rdajl4Ngk1S/eyLgiWDncLjXfo=", "requires": { - "async": "2.5.0", + "async": "2.6.0", "is-stream-ended": "0.1.3" } }, @@ -4048,28 +3947,11 @@ "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { "is-fullwidth-code-point": "2.0.0", "strip-ansi": "4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - } } }, "string_decoder": { @@ -4086,12 +3968,12 @@ "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" }, "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "3.0.0" } }, "strip-bom": { @@ -4130,10 +4012,13 @@ "integrity": "sha1-6NK6H6nJBXAwPAMLaQD31fiavls=" }, "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } }, "term-size": { "version": "1.2.0", @@ -4174,7 +4059,7 @@ "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha1-bTQzWIl2jSGyvNoKonfO07G/rfk=", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, "requires": { "os-tmpdir": "1.0.2" @@ -4197,7 +4082,7 @@ "tslib": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz", - "integrity": "sha1-3GBOutZLy/aW1hPabJVKoOfqHrY=", + "integrity": "sha512-ymKWWZJST0/CkgduC2qkzjMOWr4bouhuURNXCn/inEX0L57BnRG6FhX76o7FOnsjHazCjfU2LKeSrlS2sIKQJg==", "dev": true }, "tslint": { @@ -4216,44 +4101,13 @@ "resolve": "1.5.0", "semver": "5.4.1", "tslib": "1.8.0", - "tsutils": "2.12.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha1-wVm41b4PnlpvNG2rlPFs4CIWG4g=", - "dev": true, - "requires": { - "color-convert": "1.9.0" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha1-tepI78nBeT3MybR2fJORTT8tUro=", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } + "tsutils": "2.12.2" } }, "tsutils": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.12.1.tgz", - "integrity": "sha1-9Nlc4zkciXHkblTEzw7bCiHdWyQ=", + "version": "2.12.2", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.12.2.tgz", + "integrity": "sha1-rVikhl0X7D3bZjG2ylO+FKVlb/M=", "dev": true, "requires": { "tslib": "1.8.0" @@ -4320,37 +4174,6 @@ "latest-version": "3.1.0", "semver-diff": "2.1.0", "xdg-basedir": "3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha1-wVm41b4PnlpvNG2rlPFs4CIWG4g=", - "dev": true, - "requires": { - "color-convert": "1.9.0" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha1-tepI78nBeT3MybR2fJORTT8tUro=", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } } }, "url-parse-lax": { @@ -4401,7 +4224,7 @@ "which": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha1-/wS9/AEO5UfXgL7DjhrBwnd9JTo=", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "dev": true, "requires": { "isexe": "2.0.0" @@ -4416,6 +4239,12 @@ "string-width": "1.0.2" }, "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, "is-fullwidth-code-point": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", @@ -4435,6 +4264,15 @@ "is-fullwidth-code-point": "1.0.0", "strip-ansi": "3.0.1" } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } } } }, @@ -4446,7 +4284,7 @@ "write-file-atomic": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", - "integrity": "sha1-H/YVdcLipOjlENb6TiQ8zhg5mas=", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", "dev": true, "requires": { "graceful-fs": "4.1.11", diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 40a96133b7b..f86ad77e4fe 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -43,7 +43,7 @@ "@types/sinon": "^2.3.6", "clang-format": "^1.0.33", "codecov": "^3.0.0", - "gts": "^0.4.0", + "gts": "^0.5.0", "mocha": "^4.0.1", "nyc": "^11.2.1", "protobufjs": "~6.8.0", diff --git a/handwritten/cloud-profiler/ts/src/index.ts b/handwritten/cloud-profiler/ts/src/index.ts index f1abfa4418b..c87a842205a 100644 --- a/handwritten/cloud-profiler/ts/src/index.ts +++ b/handwritten/cloud-profiler/ts/src/index.ts @@ -51,8 +51,8 @@ export async function initConfig(config: Config): Promise { }; if (process.env.GCLOUD_PROFILER_LOGLEVEL !== undefined) { - let envLogLevel = parseInt(process.env.GCLOUD_PROFILER_LOGLEVEL || '', 10); - if (envLogLevel !== NaN) { + const envLogLevel = Number(process.env.GCLOUD_PROFILER_LOGLEVEL); + if (!isNaN(envLogLevel)) { envConfig.logLevel = envLogLevel; } } @@ -63,7 +63,7 @@ export async function initConfig(config: Config): Promise { require(path.resolve(process.env.GCLOUD_PROFILER_CONFIG)) as Config; } - let mergedConfig = + const mergedConfig = extend(true, {}, defaultConfig, envSetConfig, envConfig, config); if (!mergedConfig.zone || !mergedConfig.instance) { diff --git a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts index dd893e326b1..92e4b74eb2d 100644 --- a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts +++ b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts @@ -20,7 +20,7 @@ import {AllocationProfileNode, ProfileNode, TimeProfile, TimeProfileNode} from ' /** * A stack of function IDs. */ -type Stack = Array; +type Stack = number[]; /** * A function which converts entry into one or more samples, then @@ -81,16 +81,16 @@ class StringTable { function serialize( profile: perftools.profiles.IProfile, root: T, appendToSamples: AppendEntryToSamples, stringTable: StringTable) { - const samples: Array = []; - const locations: Array = []; - const functions: Array = []; + const samples: perftools.profiles.Sample[] = []; + const locations: perftools.profiles.Location[] = []; + const functions: perftools.profiles.Function[] = []; const locationMap: Map = new Map(); const functionMap: Map = new Map(); const functionIdMap = new Map(); const locationIdMap = new Map(); - const entries: Entry[] = - (root.children as Array).map((n: T) => ({node: n, stack: []})); + const entries: Array> = + (root.children as T[]).map((n: T) => ({node: n, stack: []})); while (entries.length > 0) { const entry = entries.pop()!; const node = entry.node; @@ -98,7 +98,7 @@ function serialize( const location = getLocation(node); stack.unshift(location.id as number); appendToSamples(entry, samples); - for (let child of node.children as Array) { + for (const child of node.children as T[]) { entries.push({node: child, stack: stack.slice()}); } } @@ -119,7 +119,7 @@ function serialize( id = locations.length + 1; locationIdMap.set(keyStr, id); const location = - new perftools.profiles.Location({id: id, line: [getLine(node)]}); + new perftools.profiles.Location({id, line: [getLine(node)]}); locations.push(location); return location; } @@ -140,9 +140,9 @@ function serialize( } id = functions.length + 1; functionIdMap.set(keyStr, id); - let nameId = stringTable.getIndexOrAdd(node.name || '(anonymous)'); - let f = new perftools.profiles.Function({ - id: id, + const nameId = stringTable.getIndexOrAdd(node.name || '(anonymous)'); + const f = new perftools.profiles.Function({ + id, name: nameId, systemName: nameId, filename: stringTable.getIndexOrAdd(node.scriptName) diff --git a/handwritten/cloud-profiler/ts/src/profilers/time-profiler.ts b/handwritten/cloud-profiler/ts/src/profilers/time-profiler.ts index 9cc72497375..129e1e07723 100644 --- a/handwritten/cloud-profiler/ts/src/profilers/time-profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profilers/time-profiler.ts @@ -38,7 +38,7 @@ export class TimeProfiler { const runName = 'stackdriver-profiler-' + Date.now() + '-' + Math.random(); profiler.startProfiling(runName, true); await delay(durationMillis); - let result = profiler.stopProfiling(runName); + const result = profiler.stopProfiling(runName); return serializeTimeProfile(result, this.intervalMicros); } } diff --git a/handwritten/cloud-profiler/ts/src/v8-types.ts b/handwritten/cloud-profiler/ts/src/v8-types.ts index ee543dd197b..28ec28cf032 100644 --- a/handwritten/cloud-profiler/ts/src/v8-types.ts +++ b/handwritten/cloud-profiler/ts/src/v8-types.ts @@ -31,13 +31,13 @@ export interface ProfileNode { scriptId: number; lineNumber: number; columnNumber: number; - children: Array; + children: ProfileNode[]; } export interface TimeProfileNode extends ProfileNode { hitCount: number; } export interface AllocationProfileNode extends ProfileNode { - allocations: Array; + allocations: Allocation[]; } export interface Allocation { diff --git a/handwritten/cloud-profiler/ts/test/test-heap-profiler.ts b/handwritten/cloud-profiler/ts/test/test-heap-profiler.ts index 28e774fc7d4..5c1ce02ca61 100644 --- a/handwritten/cloud-profiler/ts/test/test-heap-profiler.ts +++ b/handwritten/cloud-profiler/ts/test/test-heap-profiler.ts @@ -22,7 +22,7 @@ import {HeapProfiler} from '../src/profilers/heap-profiler'; import {heapProfile, v8HeapProfile} from './profiles-for-tests'; -let assert = require('assert'); +const assert = require('assert'); const v8HeapProfiler = require('bindings')('sampling_heap_profiler'); describe('HeapProfiler', () => { @@ -38,14 +38,15 @@ describe('HeapProfiler', () => { v8HeapProfiler.startSamplingHeapProfiler.restore(); v8HeapProfiler.stopSamplingHeapProfiler.restore(); v8HeapProfiler.getAllocationProfile.restore(); + // tslint:disable-next-line: no-any (Date.now as any).restore(); }); it('should return a profile equal to the expected profile', async () => { const intervalBytes = 1024 * 512; const stackDepth = 32; - let profiler = new HeapProfiler(intervalBytes, stackDepth); - let profile = profiler.profile(); + const profiler = new HeapProfiler(intervalBytes, stackDepth); + const profile = profiler.profile(); assert.deepEqual(heapProfile, profile); }); diff --git a/handwritten/cloud-profiler/ts/test/test-init-config.ts b/handwritten/cloud-profiler/ts/test/test-init-config.ts index 1dd84150b9e..abf3062d867 100644 --- a/handwritten/cloud-profiler/ts/test/test-init-config.ts +++ b/handwritten/cloud-profiler/ts/test/test-init-config.ts @@ -33,6 +33,7 @@ describe('initConfig', () => { }); afterEach(() => { + // tslint:disable-next-line: no-any (gcpMetadata.instance as any).restore(); }); @@ -53,7 +54,7 @@ describe('initConfig', () => { zone: 'zone', projectId: 'fake-projectId', }; - let initializedConfig = await initConfig(config); + const initializedConfig = await initConfig(config); assert.deepEqual(initializedConfig, config); }); @@ -74,7 +75,7 @@ describe('initConfig', () => { zone: 'zone', projectId: 'fake-projectId' }; - let initializedConfig = await initConfig(config); + const initializedConfig = await initConfig(config); assert.deepEqual(initializedConfig, config); }); @@ -102,7 +103,7 @@ describe('initConfig', () => { zone: 'gce-zone', projectId: 'projectId', }; - let initializedConfig = await initConfig(config); + const initializedConfig = await initConfig(config); assert.deepEqual(initializedConfig, expConfig); }); @@ -123,7 +124,7 @@ describe('initConfig', () => { zone: '', projectId: 'fake-projectId', }; - let initializedConfig = await initConfig(config); + const initializedConfig = await initConfig(config); assert.deepEqual(initializedConfig, expConfig); }); @@ -158,7 +159,7 @@ describe('initConfig', () => { instance: 'instance', zone: 'zone' }; - let initializedConfig = await initConfig(config); + const initializedConfig = await initConfig(config); assert.deepEqual(initializedConfig, config); }); @@ -187,7 +188,7 @@ describe('initConfig', () => { instance: 'envConfig-instance', zone: 'envConfig-zone', }; - let initializedConfig = await initConfig(config); + const initializedConfig = await initConfig(config); assert.deepEqual(initializedConfig, expConfig); }); @@ -215,7 +216,7 @@ describe('initConfig', () => { instance: 'instance', zone: 'zone' }; - let initializedConfig = await initConfig(config); + const initializedConfig = await initConfig(config); assert.deepEqual(initializedConfig, config); }); @@ -238,7 +239,7 @@ describe('initConfig', () => { }; const config = {}; - let initializedConfig = await initConfig(config); + const initializedConfig = await initConfig(config); assert.deepEqual(initializedConfig, expConfig); }); }); diff --git a/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts b/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts index a7ec65f207c..b2b05bf6248 100644 --- a/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts +++ b/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts @@ -20,7 +20,7 @@ import {TimeProfile, TimeProfileNode} from '../src/v8-types'; import {anonymousFunctionHeapProfile, anonymousFunctionTimeProfile, heapProfile, timeProfile, v8AnonymousFunctionHeapProfile, v8AnonymousFunctionTimeProfile, v8HeapProfile, v8TimeProfile} from './profiles-for-tests'; -let assert = require('assert'); +const assert = require('assert'); describe('serializeTimeProfile', () => { it('should produce expected profile', () => { diff --git a/handwritten/cloud-profiler/ts/test/test-time-profiler.ts b/handwritten/cloud-profiler/ts/test/test-time-profiler.ts index 1b4d0bbce59..0e0938c01bb 100644 --- a/handwritten/cloud-profiler/ts/test/test-time-profiler.ts +++ b/handwritten/cloud-profiler/ts/test/test-time-profiler.ts @@ -22,7 +22,7 @@ import {TimeProfiler} from '../src/profilers/time-profiler'; import {timeProfile, v8TimeProfile} from './profiles-for-tests'; -let assert = require('assert'); +const assert = require('assert'); const v8TimeProfiler = require('bindings')('time_profiler'); describe('TimeProfiler', () => { @@ -43,9 +43,9 @@ describe('TimeProfiler', () => { async () => { const durationMillis = 500; const intervalMicros = 1000; - let profiler = new TimeProfiler(intervalMicros); + const profiler = new TimeProfiler(intervalMicros); let isProfiling = true; - let profilePromise = profiler.profile(durationMillis).then(() => { + const profilePromise = profiler.profile(durationMillis).then(() => { isProfiling = false; }); await delay(2 * durationMillis); @@ -55,8 +55,8 @@ describe('TimeProfiler', () => { it('should return a profile equal to the expected profile', async () => { const durationMillis = 500; const intervalMicros = 1000; - let profiler = new TimeProfiler(intervalMicros); - let profile = await profiler.profile(durationMillis); + const profiler = new TimeProfiler(intervalMicros); + const profile = await profiler.profile(durationMillis); assert.deepEqual(timeProfile, profile); }); }); diff --git a/handwritten/cloud-profiler/ts/third_party/types/common-types.ts b/handwritten/cloud-profiler/ts/third_party/types/common-types.ts index 0ad5857df16..13ec1afe084 100644 --- a/handwritten/cloud-profiler/ts/third_party/types/common-types.ts +++ b/handwritten/cloud-profiler/ts/third_party/types/common-types.ts @@ -57,11 +57,11 @@ export interface ServiceConfig { // TODO: Make this more precise export interface ServiceObjectConfig { - parent: any; + parent: object; baseUrl: string; createMethod?: string; id?: string; - methods?: any; + methods?: object; } export interface LoggerOptions { @@ -74,10 +74,10 @@ export interface Logger { new(options?: string|LoggerOptions): Logger; LEVELS: string[]; // TODO: Determine the correct signatures for these members - error: (message: any, ...args: any[]) => void; - warn: (message: any, ...args: any[]) => void; - info: (message: any, ...args: any[]) => void; - debug: (message: any, ...args: any[]) => void; + error: (message: {}, ...args: Array<{}>) => void; + warn: (message: {}, ...args: Array<{}>) => void; + info: (message: {}, ...args: Array<{}>) => void; + debug: (message: {}, ...args: Array<{}>) => void; } export interface Service { @@ -89,7 +89,7 @@ export interface ServiceObject { // TODO: Determine if this signature is correct. request: (reqOpts: {uri: string, json: boolean}, - callback: (err: Error, body: any, response: http.ServerResponse) => + callback: (err: Error, body: object, response: http.ServerResponse) => void) => void; } @@ -99,7 +99,8 @@ export interface Common { logger: Logger; util: { // TODO: Make this more precise. - normalizeArguments: (globalContext: any, localConfig: any, options?: any) => - any; + normalizeArguments: + (globalContext: object|null, localConfig: object, options?: object) => + object; }; } From 417816bde01dd3106aac7cc75818d4b089928d48 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Fri, 10 Nov 2017 16:23:33 -0800 Subject: [PATCH 032/632] chore(package): export types for package (#50) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index f86ad77e4fe..6f90a4c6c50 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -3,6 +3,7 @@ "version": "0.0.1", "description": "Adds support for Google Cloud Profiler to node.js applications", "main": "build/src/index.js", + "types": "build/src/index.d.ts", "scripts": { "install": "node-gyp rebuild", "test": "nyc mocha build/test/test-*.js", @@ -52,7 +53,6 @@ }, "files": [ "build/src", - "build/types", "bindings", "proto", "binding.gyp", From 5c87b868eafeafc880157a0aae91c4a9e903f47a Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Fri, 10 Nov 2017 17:55:12 -0800 Subject: [PATCH 033/632] 0.1.0 --- handwritten/cloud-profiler/package-lock.json | 2 +- handwritten/cloud-profiler/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 206a80efce8..82d17726421 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.0.1", + "version": "0.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 6f90a4c6c50..91d78813531 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.0.1", + "version": "0.1.0", "description": "Adds support for Google Cloud Profiler to node.js applications", "main": "build/src/index.js", "types": "build/src/index.d.ts", From 446cdd443492d150debdf7304808c3c0e0625787 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Fri, 10 Nov 2017 18:00:44 -0800 Subject: [PATCH 034/632] chore(package): add repo link (#51) --- handwritten/cloud-profiler/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 91d78813531..a8cf2990eb6 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -2,6 +2,7 @@ "name": "@google-cloud/profiler", "version": "0.1.0", "description": "Adds support for Google Cloud Profiler to node.js applications", + "repository": "GoogleCloudPlatform/cloud-profiler-nodejs", "main": "build/src/index.js", "types": "build/src/index.d.ts", "scripts": { From 42923b4486699c7a3312ce3d2507ef30a03a4bc7 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Mon, 13 Nov 2017 11:09:15 -0800 Subject: [PATCH 035/632] change location for compiled typescript (#52) * change location for compiled typescript * switch compiled-ts to out --- handwritten/cloud-profiler/package.json | 6 +++--- handwritten/cloud-profiler/tsconfig.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index a8cf2990eb6..7ecb6cecce2 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -3,11 +3,11 @@ "version": "0.1.0", "description": "Adds support for Google Cloud Profiler to node.js applications", "repository": "GoogleCloudPlatform/cloud-profiler-nodejs", - "main": "build/src/index.js", - "types": "build/src/index.d.ts", + "main": "out/src/index.js", + "types": "out/src/index.d.ts", "scripts": { "install": "node-gyp rebuild", - "test": "nyc mocha build/test/test-*.js", + "test": "nyc mocha out/test/test-*.js", "check": "gts check", "clean": "gts clean", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json", diff --git a/handwritten/cloud-profiler/tsconfig.json b/handwritten/cloud-profiler/tsconfig.json index 7c1bd582cc9..898de98ff87 100644 --- a/handwritten/cloud-profiler/tsconfig.json +++ b/handwritten/cloud-profiler/tsconfig.json @@ -2,7 +2,7 @@ "extends": "./node_modules/gts/tsconfig-google.json", "compilerOptions": { "rootDir": "ts", - "outDir": "build", + "outDir": "out", "lib": [ "es2015" ] }, "include": [ From 3116d154be69bb14d49301d636c9644524c4ab50 Mon Sep 17 00:00:00 2001 From: Maggie Nolan Date: Mon, 13 Nov 2017 11:13:18 -0800 Subject: [PATCH 036/632] 0.1.1 --- handwritten/cloud-profiler/package-lock.json | 2 +- handwritten/cloud-profiler/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 82d17726421..9defb7d37df 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 7ecb6cecce2..054bad7f936 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.0", + "version": "0.1.1", "description": "Adds support for Google Cloud Profiler to node.js applications", "repository": "GoogleCloudPlatform/cloud-profiler-nodejs", "main": "out/src/index.js", From 655fe09bf58ad0a6d228c0a2936963032b7fb945 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Mon, 13 Nov 2017 15:22:23 -0800 Subject: [PATCH 037/632] add out/src to files (#53) --- handwritten/cloud-profiler/.gitignore | 1 + handwritten/cloud-profiler/package.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/.gitignore b/handwritten/cloud-profiler/.gitignore index e8b24972b36..60f63316ba0 100644 --- a/handwritten/cloud-profiler/.gitignore +++ b/handwritten/cloud-profiler/.gitignore @@ -1,4 +1,5 @@ .nyc_output .vscode build +out node_modules diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 054bad7f936..d2d9b015591 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -53,7 +53,7 @@ "typescript": "~2.6.x" }, "files": [ - "build/src", + "out/src", "bindings", "proto", "binding.gyp", @@ -64,7 +64,7 @@ "nyc": { "exclude": [ "proto", - "build/test" + "out/test" ] } } From e39e0d652c2cab64313853a2a97a0f4d82c5e858 Mon Sep 17 00:00:00 2001 From: Maggie Nolan Date: Mon, 13 Nov 2017 15:23:46 -0800 Subject: [PATCH 038/632] 0.1.2 --- handwritten/cloud-profiler/package-lock.json | 2 +- handwritten/cloud-profiler/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 9defb7d37df..fd1aef1ff1d 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.1", + "version": "0.1.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index d2d9b015591..5149c4d7ef0 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.1", + "version": "0.1.2", "description": "Adds support for Google Cloud Profiler to node.js applications", "repository": "GoogleCloudPlatform/cloud-profiler-nodejs", "main": "out/src/index.js", From c8f787240a7047010858dfa8b504c69bd720a988 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Mon, 13 Nov 2017 16:12:59 -0800 Subject: [PATCH 039/632] chore(package): update @types/sinon to version 4.0.0 (#54) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 5149c4d7ef0..3bf42f9ebd7 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -42,7 +42,7 @@ "@types/mocha": "^2.2.43", "@types/node": "^8.0.30", "@types/request": "^2.0.4", - "@types/sinon": "^2.3.6", + "@types/sinon": "^4.0.0", "clang-format": "^1.0.33", "codecov": "^3.0.0", "gts": "^0.5.0", From 4a4ba77dafed1d65a7781e2ab69750f37e7cc1b7 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 15 Nov 2017 13:58:17 -0800 Subject: [PATCH 040/632] feat: add communications with Stackdriver Profiler API (#16) --- handwritten/cloud-profiler/package-lock.json | 981 +++++++++++------- handwritten/cloud-profiler/package.json | 9 +- handwritten/cloud-profiler/ts/src/config.ts | 43 +- handwritten/cloud-profiler/ts/src/index.ts | 35 +- handwritten/cloud-profiler/ts/src/profiler.ts | 361 ++++++- .../ts/src/profilers/profile-serializer.ts | 2 +- .../ts/test/fixtures/gcloud-credentials.json | 6 + .../ts/test/profiles-for-tests.ts | 24 + .../ts/test/test-heap-profiler.ts | 18 +- .../ts/test/test-init-config.ts | 118 ++- .../ts/test/test-profile-serializer.ts | 9 +- .../cloud-profiler/ts/test/test-profiler.ts | 551 ++++++++++ .../ts/test/test-time-profiler.ts | 15 +- .../ts/third_party/types/README.google | 6 +- .../ts/third_party/types/common-types.ts | 17 +- 15 files changed, 1733 insertions(+), 462 deletions(-) create mode 100644 handwritten/cloud-profiler/ts/test/fixtures/gcloud-credentials.json create mode 100644 handwritten/cloud-profiler/ts/test/test-profiler.ts diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index fd1aef1ff1d..11724abe7b4 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -22,7 +22,7 @@ "methmeth": "1.1.0", "modelo": "4.2.0", "request": "2.83.0", - "retry-request": "3.1.0", + "retry-request": "3.1.1", "split-array-stream": "1.0.3", "stream-events": "1.0.2", "string-format-obj": "1.1.0", @@ -38,13 +38,13 @@ "@protobufjs/base64": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha1-TIVzDlm5ofHzSQR9vyQpYDS7JzU=", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", "dev": true }, "@protobufjs/codegen": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha1-fvN/DQEPsCitGtWXIuUG2SYoFcs=", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", "dev": true }, "@protobufjs/eventemitter": { @@ -96,7 +96,7 @@ "@types/delay": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/delay/-/delay-2.0.1.tgz", - "integrity": "sha1-YbzzGKdLYeedFlj78FT5hMkO+QE=", + "integrity": "sha512-D1/YuYOcdOIdaQnaiUJ77VcilVvESkynw79CtGqpjkXyv4OUezEVZtdXnSOwXL8Zcelu66QbyC8QQcVQ/ZPdig==", "dev": true }, "@types/extend": { @@ -108,49 +108,59 @@ "@types/form-data": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.0.tgz", - "integrity": "sha1-qYqskdyZhXtq8kyu98pt8wLzFWU=", + "integrity": "sha512-vm5OGsKc61Sx/GTRMQ9d0H0PYCDebT78/bdIBPCoPEHdgp0etaH1RzMmkDygymUmyXTj3rdWQn0sRUpYKZzljA==", "dev": true, "requires": { - "@types/node": "8.0.47" + "@types/node": "8.0.49" } }, "@types/long": { "version": "3.0.32", "resolved": "https://registry.npmjs.org/@types/long/-/long-3.0.32.tgz", - "integrity": "sha1-9OWvMenpsZbY5fyopeLiCqPWC2k=", + "integrity": "sha512-ZXyOOm83p7X8p3s0IYM3VeueNmHpkk/yMlP8CLeOnEcu6hIwPH7YjZBvhQkR0ZFS2DqZAxKtJ/M5fcuv3OU5BA==", "dev": true }, "@types/mocha": { "version": "2.2.44", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.44.tgz", - "integrity": "sha1-HUp5jlPzUhL9WtTQQFBiAXHNW14=", + "integrity": "sha512-k2tWTQU8G4+iSMvqKi0Q9IIsWAp/n8xzdZS4Q4YVIltApoMA00wFBFdlJnmoaK1/z7B0Cy0yPe6GgXteSmdUNw==", "dev": true }, + "@types/nock": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@types/nock/-/nock-8.2.1.tgz", + "integrity": "sha1-H75b3suUPBCad4VT+k0kAcuTlLQ=", + "dev": true, + "requires": { + "@types/node": "8.0.49" + } + }, "@types/node": { - "version": "8.0.47", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.47.tgz", - "integrity": "sha1-lo5Zb5Gs1ZBpBUVYoAcIxEXKMMI=", + "version": "8.0.49", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.49.tgz", + "integrity": "sha512-Oq3cV/mrMKy6Tv42llfS8YIH30ooDdhbJ40h1zoWl+goOJw8Kjy8j8RfjGZtZIUDO0gLwCfcbYM7+LModnbeMw==", "dev": true }, "@types/pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-4X2Vwn500jBevAaw+NKMsC+WEv4=" + "integrity": "sha512-BIRcpFqRm64rVuuYCFzOF37I2IEP3sXhiCjy8NbzJkxqFY2CLiDLFPhh6Sph/eXPXctg05MayCEDmeKCOIUBFg==", + "dev": true }, "@types/request": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/@types/request/-/request-2.0.7.tgz", - "integrity": "sha1-oqpaVzF8IZcdmwJOOTCRqyyZq5g=", + "integrity": "sha512-hlkmO+M7Xxx13YZwqQtXGC03KxcYbqmDQg3oHMRVODfSk2u0BELK7RfTNROisvrLRGOYdGoZPpnHwaPoKrPMbA==", "dev": true, "requires": { "@types/form-data": "2.2.0", - "@types/node": "8.0.47" + "@types/node": "8.0.49" } }, "@types/sinon": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-2.3.7.tgz", - "integrity": "sha1-6Swv7TKX6uB4140doDKyZ4i0r4Y=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.0.0.tgz", + "integrity": "sha512-cuK4xM8Lg2wd8cxshcQa8RG4IK/xfyB6TNE6tNVvkrShR4xdrYgsV04q6Dp6v1Lp6biEFdzD8k8zg/ujQeiw+A==", "dev": true }, "ajv": { @@ -226,6 +236,12 @@ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" }, + "assertion-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", + "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", + "dev": true + }, "async": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", @@ -325,7 +341,7 @@ "bindings": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz", - "integrity": "sha1-s0b27PapX1qBXFg5/HzbIlAvHtc=" + "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==" }, "boom": { "version": "4.3.1", @@ -411,6 +427,17 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, + "chai": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-3.5.0.tgz", + "integrity": "sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc=", + "dev": true, + "requires": { + "assertion-error": "1.0.2", + "deep-eql": "0.1.3", + "type-detect": "1.0.0" + } + }, "chalk": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", @@ -425,7 +452,7 @@ "clang-format": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.1.0.tgz", - "integrity": "sha1-oAtPf4V1sHKsVQVMPPl5oVHqEPE=", + "integrity": "sha512-0Aru49uTLoROl4sPTyO3fvF/NZ+fnGEy5i7bsRwA/bAYT+eWaAxK3sDxRvm/AW7Nwq83BvARH/npeF8OIAaGVQ==", "dev": true, "requires": { "async": "1.5.2", @@ -659,7 +686,7 @@ "commander": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha1-FXFS/R56bI2YpbcVzzdt+SgARWM=", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", "dev": true }, "concat-map": { @@ -727,7 +754,7 @@ "boom": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", - "integrity": "sha1-XdnabuOl8wIHdDYpDLcX0/SlTgI=", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", "requires": { "hoek": "4.2.0" } @@ -760,7 +787,7 @@ "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { "ms": "2.0.0" @@ -772,6 +799,29 @@ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, + "deep-eql": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", + "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", + "dev": true, + "requires": { + "type-detect": "0.1.1" + }, + "dependencies": { + "type-detect": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz", + "integrity": "sha1-C6XsKohWQORw6k6FBZcZANrFiCI=", + "dev": true + } + } + }, + "deep-equal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", + "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", + "dev": true + }, "deep-extend": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", @@ -794,7 +844,7 @@ "diff": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.4.0.tgz", - "integrity": "sha1-sdhVB9rzlkgo3lSzfQ1zumfdpWw=", + "integrity": "sha512-QpVuMTEoJMF7cKzi6bvWhRulU1fZqZnvyVQgNhPaxxuTYwyjn/j1v9falseQ/uXWwPnO56RBfwtg4h/EQXmucA==", "dev": true }, "dot-prop": { @@ -971,12 +1021,12 @@ "dev": true }, "gcp-metadata": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.4.0.tgz", - "integrity": "sha1-JY6ZCWvw37/mvrWp+PUrjfOR2NM=", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.4.1.tgz", + "integrity": "sha512-yFE7v+NyoMiTOi2L6r8q87eVbiZCKooJNPKXTHhBStga8pwwgWofK9iHl00qd0XevZxcpk7ORaEL/ALuTvlaGQ==", "requires": { "extend": "3.0.1", - "retry-request": "3.1.0" + "retry-request": "3.1.1" } }, "get-stdin": { @@ -1002,7 +1052,7 @@ "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { "fs.realpath": "1.0.0", @@ -1050,7 +1100,7 @@ "integrity": "sha512-5kJPX/RXuqoLmHiOOgkSDk/LI0QaXpEvZ3pvQP4ifjGGDKZKVSOjL/GcDjXA5kLxppFCOjmmsu0Uoop9d1upaQ==", "requires": { "extend": "3.0.1", - "retry-request": "3.1.0" + "retry-request": "3.1.1" } } } @@ -1091,7 +1141,7 @@ "growl": { "version": "1.10.3", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", - "integrity": "sha1-GSa6kM8+3+KttJJ/WIC8IsZseQ8=", + "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", "dev": true }, "gtoken": { @@ -1162,7 +1212,7 @@ "hawk": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", - "integrity": "sha1-r02RTrBl+bXOTZ0RwcshJu7MMDg=", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", "requires": { "boom": "4.3.1", "cryptiles": "3.1.2", @@ -1179,7 +1229,7 @@ "hoek": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", - "integrity": "sha1-ctnQdU9/4lyi0BrY+PmpRJqJUm0=" + "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==" }, "hosted-git-info": { "version": "2.5.0", @@ -1449,9 +1499,9 @@ } }, "just-extend": { - "version": "1.1.26", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-1.1.26.tgz", - "integrity": "sha512-IIG0FXHB/XpUZ7vGbktoc2EGsF+fLHJ1tU+vaqoKkVRBwH2FDxLTmkGkSp0XHRp6Y3KGZPIldH1YW8lOluGYrA==", + "version": "1.1.27", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-1.1.27.tgz", + "integrity": "sha512-mJVp13Ix6gFo3SBAy9U/kL+oeZqzlYYYLQBwXVBlVzIsZwBqGREnOro24oC/8s8aox+rJhtZ2DiQof++IrkA+g==", "dev": true }, "jwa": { @@ -1529,7 +1579,7 @@ "lolex": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.1.3.tgz", - "integrity": "sha1-U/iTu+iMgDeBViQOEnEmuQXIMIc=", + "integrity": "sha512-BdHq78SeI+6PAUtl4atDuCt7L6E4fab3mSRtqxm4ywaXe4uP7jZ0TTcFNuU20syUjxZc2l7jFqKVMJ+AX0LnpQ==", "dev": true }, "long": { @@ -1629,7 +1679,7 @@ "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { "brace-expansion": "1.1.8" @@ -1661,7 +1711,7 @@ "mocha": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.0.1.tgz", - "integrity": "sha1-Cu5alc9ppGGIIPXlH6MXFxF9rxs=", + "integrity": "sha512-evDmhkoA+cBNiQQQdSKZa2b9+W2mpLoj50367lhy+Klnx9OV8XlCIhigUnn1gaTFLQCa0kdNhEGDr0hCXOQFDw==", "dev": true, "requires": { "browser-stdout": "1.3.0", @@ -1679,13 +1729,13 @@ "diff": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", - "integrity": "sha1-qoVnpu7QPFMfyJ0/cRzQ5SWd7HU=", + "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", "dev": true }, "supports-color": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha1-iD992rwWUUKyphQn8zUt7RldGj4=", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", "dev": true, "requires": { "has-flag": "2.0.0" @@ -1718,11 +1768,11 @@ "nise": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/nise/-/nise-1.2.0.tgz", - "integrity": "sha1-B51srbvLErow448cmZ82rU1rqlM=", + "integrity": "sha512-q9jXh3UNsMV28KeqI43ILz5+c3l+RiNW8mhurEwCKckuHQbL+hTJIKKTiUlCPKlgQ/OukFvSnKB/Jk3+sFbkGA==", "dev": true, "requires": { "formatio": "1.2.0", - "just-extend": "1.1.26", + "just-extend": "1.1.27", "lolex": "1.6.0", "path-to-regexp": "1.7.0", "text-encoding": "0.6.4" @@ -1736,6 +1786,34 @@ } } }, + "nock": { + "version": "9.0.28", + "resolved": "https://registry.npmjs.org/nock/-/nock-9.0.28.tgz", + "integrity": "sha512-MXGP3NA+I8BpwF8r2LnK9N1Dwz69N82peP9Ht3G9EMUAKHK73relYI8Pjik9AwvGSVV0kAo6KA20IbKsCjNyIA==", + "dev": true, + "requires": { + "chai": "3.5.0", + "debug": "2.6.9", + "deep-equal": "1.0.1", + "json-stringify-safe": "5.0.1", + "lodash": "4.17.4", + "mkdirp": "0.5.1", + "propagate": "0.4.0", + "qs": "6.5.1", + "semver": "5.4.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, "node-forge": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.1.tgz", @@ -1769,9 +1847,9 @@ "dev": true }, "nyc": { - "version": "11.2.1", - "resolved": "https://registry.npmjs.org/nyc/-/nyc-11.2.1.tgz", - "integrity": "sha1-rYUK/p261/SXByi0suR/7Rw4chw=", + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-11.3.0.tgz", + "integrity": "sha512-oUu0WHt1k/JMIODvAYXX6C50Mupw2GO34P/Jdg2ty9xrLufBthHiKR2gf08aF+9S0abW1fl24R7iKRBXzibZmg==", "dev": true, "requires": { "archy": "1.0.0", @@ -1785,27 +1863,28 @@ "foreground-child": "1.5.6", "glob": "7.1.2", "istanbul-lib-coverage": "1.1.1", - "istanbul-lib-hook": "1.0.7", - "istanbul-lib-instrument": "1.8.0", - "istanbul-lib-report": "1.1.1", - "istanbul-lib-source-maps": "1.2.1", - "istanbul-reports": "1.1.2", + "istanbul-lib-hook": "1.1.0", + "istanbul-lib-instrument": "1.9.1", + "istanbul-lib-report": "1.1.2", + "istanbul-lib-source-maps": "1.2.2", + "istanbul-reports": "1.1.3", "md5-hex": "1.3.0", "merge-source-map": "1.0.4", "micromatch": "2.3.11", "mkdirp": "0.5.1", "resolve-from": "2.0.0", - "rimraf": "2.6.1", + "rimraf": "2.6.2", "signal-exit": "3.0.2", "spawn-wrap": "1.3.8", "test-exclude": "4.1.1", - "yargs": "8.0.2", - "yargs-parser": "5.0.0" + "yargs": "10.0.3", + "yargs-parser": "8.0.0" }, "dependencies": { "align-text": { "version": "0.1.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", "dev": true, "requires": { "kind-of": "3.2.2", @@ -1815,22 +1894,26 @@ }, "amdefine": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", "dev": true }, "ansi-regex": { "version": "2.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, "ansi-styles": { "version": "2.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", "dev": true }, "append-transform": { "version": "0.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-0.4.0.tgz", + "integrity": "sha1-126/jKlNJ24keja61EpLdKthGZE=", "dev": true, "requires": { "default-require-extensions": "1.0.0" @@ -1838,12 +1921,14 @@ }, "archy": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", "dev": true }, "arr-diff": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", "dev": true, "requires": { "arr-flatten": "1.1.0" @@ -1851,27 +1936,32 @@ }, "arr-flatten": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", "dev": true }, "array-unique": { "version": "0.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", "dev": true }, "arrify": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "dev": true }, "async": { "version": "1.5.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", "dev": true }, "babel-code-frame": { "version": "6.26.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", "dev": true, "requires": { "chalk": "1.1.3", @@ -1881,7 +1971,8 @@ }, "babel-generator": { "version": "6.26.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", + "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", "dev": true, "requires": { "babel-messages": "6.23.0", @@ -1896,7 +1987,8 @@ }, "babel-messages": { "version": "6.23.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", "dev": true, "requires": { "babel-runtime": "6.26.0" @@ -1904,7 +1996,8 @@ }, "babel-runtime": { "version": "6.26.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "dev": true, "requires": { "core-js": "2.5.1", @@ -1913,7 +2006,8 @@ }, "babel-template": { "version": "6.26.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", "dev": true, "requires": { "babel-runtime": "6.26.0", @@ -1925,7 +2019,8 @@ }, "babel-traverse": { "version": "6.26.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", "dev": true, "requires": { "babel-code-frame": "6.26.0", @@ -1933,7 +2028,7 @@ "babel-runtime": "6.26.0", "babel-types": "6.26.0", "babylon": "6.18.0", - "debug": "2.6.8", + "debug": "2.6.9", "globals": "9.18.0", "invariant": "2.2.2", "lodash": "4.17.4" @@ -1941,7 +2036,8 @@ }, "babel-types": { "version": "6.26.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", "dev": true, "requires": { "babel-runtime": "6.26.0", @@ -1952,17 +2048,20 @@ }, "babylon": { "version": "6.18.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", "dev": true }, "balanced-match": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, "brace-expansion": { "version": "1.1.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", "dev": true, "requires": { "balanced-match": "1.0.0", @@ -1971,7 +2070,8 @@ }, "braces": { "version": "1.8.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", "dev": true, "requires": { "expand-range": "1.8.2", @@ -1981,12 +2081,14 @@ }, "builtin-modules": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, "caching-transform": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-1.0.1.tgz", + "integrity": "sha1-bb2y8g+Nj7znnz6U6dF0Lc31wKE=", "dev": true, "requires": { "md5-hex": "1.3.0", @@ -1996,13 +2098,15 @@ }, "camelcase": { "version": "1.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", "dev": true, "optional": true }, "center-align": { "version": "0.1.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", "dev": true, "optional": true, "requires": { @@ -2012,7 +2116,8 @@ }, "chalk": { "version": "1.1.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { "ansi-styles": "2.2.1", @@ -2024,7 +2129,8 @@ }, "cliui": { "version": "2.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", "dev": true, "optional": true, "requires": { @@ -2035,7 +2141,8 @@ "dependencies": { "wordwrap": { "version": "0.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", "dev": true, "optional": true } @@ -2043,32 +2150,38 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, "commondir": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", "dev": true }, "concat-map": { "version": "0.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, "convert-source-map": { "version": "1.5.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", + "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", "dev": true }, "core-js": { "version": "2.5.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", + "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=", "dev": true }, "cross-spawn": { "version": "4.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", + "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", "dev": true, "requires": { "lru-cache": "4.1.1", @@ -2076,8 +2189,9 @@ } }, "debug": { - "version": "2.6.8", - "bundled": true, + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, "requires": { "ms": "2.0.0" @@ -2085,17 +2199,20 @@ }, "debug-log": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/debug-log/-/debug-log-1.0.1.tgz", + "integrity": "sha1-IwdjLUwEOCuN+KMvcLiVBG1SdF8=", "dev": true }, "decamelize": { "version": "1.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, "default-require-extensions": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-1.0.0.tgz", + "integrity": "sha1-836hXT4T/9m0N9M+GnW1+5eHTLg=", "dev": true, "requires": { "strip-bom": "2.0.0" @@ -2103,7 +2220,8 @@ }, "detect-indent": { "version": "4.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", "dev": true, "requires": { "repeating": "2.0.1" @@ -2111,7 +2229,8 @@ }, "error-ex": { "version": "1.3.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", + "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", "dev": true, "requires": { "is-arrayish": "0.2.1" @@ -2119,17 +2238,20 @@ }, "escape-string-regexp": { "version": "1.0.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, "esutils": { "version": "2.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", "dev": true }, "execa": { "version": "0.7.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true, "requires": { "cross-spawn": "5.1.0", @@ -2143,7 +2265,8 @@ "dependencies": { "cross-spawn": { "version": "5.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { "lru-cache": "4.1.1", @@ -2155,7 +2278,8 @@ }, "expand-brackets": { "version": "0.1.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", "dev": true, "requires": { "is-posix-bracket": "0.1.1" @@ -2163,7 +2287,8 @@ }, "expand-range": { "version": "1.8.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "dev": true, "requires": { "fill-range": "2.2.3" @@ -2171,7 +2296,8 @@ }, "extglob": { "version": "0.3.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", "dev": true, "requires": { "is-extglob": "1.0.0" @@ -2179,12 +2305,14 @@ }, "filename-regex": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", "dev": true }, "fill-range": { "version": "2.2.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", + "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", "dev": true, "requires": { "is-number": "2.1.0", @@ -2196,7 +2324,8 @@ }, "find-cache-dir": { "version": "0.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-0.1.1.tgz", + "integrity": "sha1-yN765XyKUqinhPnjHFfHQumToLk=", "dev": true, "requires": { "commondir": "1.0.1", @@ -2206,7 +2335,8 @@ }, "find-up": { "version": "2.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { "locate-path": "2.0.0" @@ -2214,12 +2344,14 @@ }, "for-in": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", "dev": true }, "for-own": { "version": "0.1.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", "dev": true, "requires": { "for-in": "1.0.2" @@ -2227,7 +2359,8 @@ }, "foreground-child": { "version": "1.5.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-1.5.6.tgz", + "integrity": "sha1-T9ca0t/elnibmApcCilZN8svXOk=", "dev": true, "requires": { "cross-spawn": "4.0.2", @@ -2236,22 +2369,26 @@ }, "fs.realpath": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, "get-caller-file": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", + "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", "dev": true }, "get-stream": { "version": "3.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, "glob": { "version": "7.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { "fs.realpath": "1.0.0", @@ -2264,7 +2401,8 @@ }, "glob-base": { "version": "0.3.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", "dev": true, "requires": { "glob-parent": "2.0.0", @@ -2273,7 +2411,8 @@ }, "glob-parent": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", "dev": true, "requires": { "is-glob": "2.0.1" @@ -2281,17 +2420,20 @@ }, "globals": { "version": "9.18.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", "dev": true }, "graceful-fs": { "version": "4.1.11", - "bundled": true, + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", "dev": true }, "handlebars": { - "version": "4.0.10", - "bundled": true, + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", + "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", "dev": true, "requires": { "async": "1.5.2", @@ -2302,7 +2444,8 @@ "dependencies": { "source-map": { "version": "0.4.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { "amdefine": "1.0.1" @@ -2312,7 +2455,8 @@ }, "has-ansi": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true, "requires": { "ansi-regex": "2.1.1" @@ -2320,22 +2464,26 @@ }, "has-flag": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", "dev": true }, "hosted-git-info": { "version": "2.5.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", + "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", "dev": true }, "imurmurhash": { "version": "0.1.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, "inflight": { "version": "1.0.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { "once": "1.4.0", @@ -2344,12 +2492,14 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, "invariant": { "version": "2.2.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", "dev": true, "requires": { "loose-envify": "1.3.1" @@ -2357,22 +2507,26 @@ }, "invert-kv": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, "is-arrayish": { "version": "0.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, "is-buffer": { "version": "1.1.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", + "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", "dev": true }, "is-builtin-module": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { "builtin-modules": "1.1.1" @@ -2380,12 +2534,14 @@ }, "is-dotfile": { "version": "1.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", "dev": true }, "is-equal-shallow": { "version": "0.1.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", "dev": true, "requires": { "is-primitive": "2.0.0" @@ -2393,17 +2549,20 @@ }, "is-extendable": { "version": "0.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", "dev": true }, "is-extglob": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", "dev": true }, "is-finite": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", "dev": true, "requires": { "number-is-nan": "1.0.1" @@ -2411,7 +2570,8 @@ }, "is-fullwidth-code-point": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { "number-is-nan": "1.0.1" @@ -2419,7 +2579,8 @@ }, "is-glob": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { "is-extglob": "1.0.0" @@ -2427,7 +2588,8 @@ }, "is-number": { "version": "2.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", "dev": true, "requires": { "kind-of": "3.2.2" @@ -2435,37 +2597,44 @@ }, "is-posix-bracket": { "version": "0.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", "dev": true }, "is-primitive": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", "dev": true }, "is-stream": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, "is-utf8": { "version": "0.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", "dev": true }, "isarray": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, "isexe": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, "isobject": { "version": "2.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", "dev": true, "requires": { "isarray": "1.0.0" @@ -2473,20 +2642,23 @@ }, "istanbul-lib-coverage": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz", + "integrity": "sha512-0+1vDkmzxqJIn5rcoEqapSB4DmPxE31EtI2dF2aCkV5esN9EWHxZ0dwgDClivMXJqE7zaYQxq30hj5L0nlTN5Q==", "dev": true }, "istanbul-lib-hook": { - "version": "1.0.7", - "bundled": true, + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-1.1.0.tgz", + "integrity": "sha512-U3qEgwVDUerZ0bt8cfl3dSP3S6opBoOtk3ROO5f2EfBr/SRiD9FQqzwaZBqFORu8W7O0EXpai+k7kxHK13beRg==", "dev": true, "requires": { "append-transform": "0.4.0" } }, "istanbul-lib-instrument": { - "version": "1.8.0", - "bundled": true, + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.1.tgz", + "integrity": "sha512-RQmXeQ7sphar7k7O1wTNzVczF9igKpaeGQAG9qR2L+BS4DCJNTI9nytRmIVYevwO0bbq+2CXvJmYDuz0gMrywA==", "dev": true, "requires": { "babel-generator": "6.26.0", @@ -2499,8 +2671,9 @@ } }, "istanbul-lib-report": { - "version": "1.1.1", - "bundled": true, + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-1.1.2.tgz", + "integrity": "sha512-UTv4VGx+HZivJQwAo1wnRwe1KTvFpfi/NYwN7DcsrdzMXwpRT/Yb6r4SBPoHWj4VuQPakR32g4PUUeyKkdDkBA==", "dev": true, "requires": { "istanbul-lib-coverage": "1.1.1", @@ -2511,7 +2684,8 @@ "dependencies": { "supports-color": { "version": "3.2.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", "dev": true, "requires": { "has-flag": "1.0.0" @@ -2520,38 +2694,54 @@ } }, "istanbul-lib-source-maps": { - "version": "1.2.1", - "bundled": true, + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.2.tgz", + "integrity": "sha512-8BfdqSfEdtip7/wo1RnrvLpHVEd8zMZEDmOFEnpC6dg0vXflHt9nvoAyQUzig2uMSXfF2OBEYBV3CVjIL9JvaQ==", "dev": true, "requires": { - "debug": "2.6.8", + "debug": "3.1.0", "istanbul-lib-coverage": "1.1.1", "mkdirp": "0.5.1", - "rimraf": "2.6.1", + "rimraf": "2.6.2", "source-map": "0.5.7" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } } }, "istanbul-reports": { - "version": "1.1.2", - "bundled": true, + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.3.tgz", + "integrity": "sha512-ZEelkHh8hrZNI5xDaKwPMFwDsUf5wIEI2bXAFGp1e6deR2mnEKBPhLJEgr4ZBt8Gi6Mj38E/C8kcy9XLggVO2Q==", "dev": true, "requires": { - "handlebars": "4.0.10" + "handlebars": "4.0.11" } }, "js-tokens": { "version": "3.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", "dev": true }, "jsesc": { "version": "1.3.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, "kind-of": { "version": "3.2.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { "is-buffer": "1.1.5" @@ -2559,13 +2749,15 @@ }, "lazy-cache": { "version": "1.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", "dev": true, "optional": true }, "lcid": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true, "requires": { "invert-kv": "1.0.0" @@ -2573,7 +2765,8 @@ }, "load-json-file": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { "graceful-fs": "4.1.11", @@ -2585,7 +2778,8 @@ }, "locate-path": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true, "requires": { "p-locate": "2.0.0", @@ -2594,24 +2788,28 @@ "dependencies": { "path-exists": { "version": "3.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true } } }, "lodash": { "version": "4.17.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", "dev": true }, "longest": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", "dev": true }, "loose-envify": { "version": "1.3.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", "dev": true, "requires": { "js-tokens": "3.0.2" @@ -2619,7 +2817,8 @@ }, "lru-cache": { "version": "4.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", "dev": true, "requires": { "pseudomap": "1.0.2", @@ -2628,7 +2827,8 @@ }, "md5-hex": { "version": "1.3.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/md5-hex/-/md5-hex-1.3.0.tgz", + "integrity": "sha1-0sSv6YPENwZiF5uMrRRSGRNQRsQ=", "dev": true, "requires": { "md5-o-matic": "0.1.1" @@ -2636,12 +2836,14 @@ }, "md5-o-matic": { "version": "0.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/md5-o-matic/-/md5-o-matic-0.1.1.tgz", + "integrity": "sha1-givM1l4RfFFPqxdrJZRdVBAKA8M=", "dev": true }, "mem": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true, "requires": { "mimic-fn": "1.1.0" @@ -2649,7 +2851,8 @@ }, "merge-source-map": { "version": "1.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.0.4.tgz", + "integrity": "sha1-pd5GU42uhNQRTMXqArR3KmNGcB8=", "dev": true, "requires": { "source-map": "0.5.7" @@ -2657,7 +2860,8 @@ }, "micromatch": { "version": "2.3.11", - "bundled": true, + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", "dev": true, "requires": { "arr-diff": "2.0.0", @@ -2677,12 +2881,14 @@ }, "mimic-fn": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", + "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", "dev": true }, "minimatch": { "version": "3.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { "brace-expansion": "1.1.8" @@ -2690,12 +2896,14 @@ }, "minimist": { "version": "0.0.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { "minimist": "0.0.8" @@ -2703,12 +2911,14 @@ }, "ms": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, "normalize-package-data": { "version": "2.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", "dev": true, "requires": { "hosted-git-info": "2.5.0", @@ -2719,7 +2929,8 @@ }, "normalize-path": { "version": "2.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { "remove-trailing-separator": "1.1.0" @@ -2727,7 +2938,8 @@ }, "npm-run-path": { "version": "2.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, "requires": { "path-key": "2.0.1" @@ -2735,17 +2947,20 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, "object-assign": { "version": "4.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true }, "object.omit": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", "dev": true, "requires": { "for-own": "0.1.5", @@ -2754,7 +2969,8 @@ }, "once": { "version": "1.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { "wrappy": "1.0.2" @@ -2762,7 +2978,8 @@ }, "optimist": { "version": "0.6.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", "dev": true, "requires": { "minimist": "0.0.8", @@ -2771,12 +2988,14 @@ }, "os-homedir": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, "os-locale": { "version": "2.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "dev": true, "requires": { "execa": "0.7.0", @@ -2786,17 +3005,20 @@ }, "p-finally": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, "p-limit": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", + "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=", "dev": true }, "p-locate": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true, "requires": { "p-limit": "1.1.0" @@ -2804,7 +3026,8 @@ }, "parse-glob": { "version": "3.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", "dev": true, "requires": { "glob-base": "0.3.0", @@ -2815,7 +3038,8 @@ }, "parse-json": { "version": "2.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { "error-ex": "1.3.1" @@ -2823,7 +3047,8 @@ }, "path-exists": { "version": "2.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { "pinkie-promise": "2.0.1" @@ -2831,22 +3056,26 @@ }, "path-is-absolute": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, "path-key": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "dev": true }, "path-parse": { "version": "1.0.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", "dev": true }, "path-type": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, "requires": { "graceful-fs": "4.1.11", @@ -2856,17 +3085,20 @@ }, "pify": { "version": "2.3.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, "pinkie": { "version": "2.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", "dev": true }, "pinkie-promise": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { "pinkie": "2.0.4" @@ -2874,7 +3106,8 @@ }, "pkg-dir": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz", + "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=", "dev": true, "requires": { "find-up": "1.1.2" @@ -2882,7 +3115,8 @@ "dependencies": { "find-up": { "version": "1.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { "path-exists": "2.1.0", @@ -2893,17 +3127,20 @@ }, "preserve": { "version": "0.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", "dev": true }, "pseudomap": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, "randomatic": { "version": "1.1.7", - "bundled": true, + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", + "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", "dev": true, "requires": { "is-number": "3.0.0", @@ -2912,7 +3149,8 @@ "dependencies": { "is-number": { "version": "3.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, "requires": { "kind-of": "3.2.2" @@ -2920,7 +3158,8 @@ "dependencies": { "kind-of": { "version": "3.2.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { "is-buffer": "1.1.5" @@ -2930,7 +3169,8 @@ }, "kind-of": { "version": "4.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, "requires": { "is-buffer": "1.1.5" @@ -2940,7 +3180,8 @@ }, "read-pkg": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "dev": true, "requires": { "load-json-file": "1.1.0", @@ -2950,7 +3191,8 @@ }, "read-pkg-up": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, "requires": { "find-up": "1.1.2", @@ -2959,7 +3201,8 @@ "dependencies": { "find-up": { "version": "1.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { "path-exists": "2.1.0", @@ -2970,12 +3213,14 @@ }, "regenerator-runtime": { "version": "0.11.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", + "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==", "dev": true }, "regex-cache": { "version": "0.4.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", "dev": true, "requires": { "is-equal-shallow": "0.1.3" @@ -2983,22 +3228,26 @@ }, "remove-trailing-separator": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", "dev": true }, "repeat-element": { "version": "1.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", "dev": true }, "repeat-string": { "version": "1.6.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", "dev": true }, "repeating": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", "dev": true, "requires": { "is-finite": "1.0.2" @@ -3006,22 +3255,26 @@ }, "require-directory": { "version": "2.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, "require-main-filename": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, "resolve-from": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", + "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=", "dev": true }, "right-align": { "version": "0.1.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", "dev": true, "optional": true, "requires": { @@ -3029,8 +3282,9 @@ } }, "rimraf": { - "version": "2.6.1", - "bundled": true, + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { "glob": "7.1.2" @@ -3038,17 +3292,20 @@ }, "semver": { "version": "5.4.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", "dev": true }, "set-blocking": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, "shebang-command": { "version": "1.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { "shebang-regex": "1.0.0" @@ -3056,40 +3313,46 @@ }, "shebang-regex": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, "signal-exit": { "version": "3.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, "slide": { "version": "1.1.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", "dev": true }, "source-map": { "version": "0.5.7", - "bundled": true, + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true }, "spawn-wrap": { "version": "1.3.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-1.3.8.tgz", + "integrity": "sha512-Yfkd7Yiwz4RcBPrDWzvhnTzQINBHNqOEhUzOdWZ67Y9b4wzs3Gz6ymuptQmRBpzlpOzroM7jwzmBdRec7JJ0UA==", "dev": true, "requires": { "foreground-child": "1.5.6", "mkdirp": "0.5.1", "os-homedir": "1.0.2", - "rimraf": "2.6.1", + "rimraf": "2.6.2", "signal-exit": "3.0.2", "which": "1.3.0" } }, "spdx-correct": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", + "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", "dev": true, "requires": { "spdx-license-ids": "1.2.2" @@ -3097,17 +3360,20 @@ }, "spdx-expression-parse": { "version": "1.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", + "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", "dev": true }, "spdx-license-ids": { "version": "1.2.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", + "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", "dev": true }, "string-width": { "version": "2.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { "is-fullwidth-code-point": "2.0.0", @@ -3116,17 +3382,20 @@ "dependencies": { "ansi-regex": { "version": "3.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, "is-fullwidth-code-point": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "strip-ansi": { "version": "4.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { "ansi-regex": "3.0.0" @@ -3136,7 +3405,8 @@ }, "strip-ansi": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { "ansi-regex": "2.1.1" @@ -3144,7 +3414,8 @@ }, "strip-bom": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { "is-utf8": "0.2.1" @@ -3152,17 +3423,20 @@ }, "strip-eof": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, "supports-color": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, "test-exclude": { "version": "4.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.1.1.tgz", + "integrity": "sha512-35+Asrsk3XHJDBgf/VRFexPgh3UyETv8IAn/LRTiZjVy6rjPVqdEk8dJcJYBzl1w0XCJM48lvTy8SfEsCWS4nA==", "dev": true, "requires": { "arrify": "1.0.1", @@ -3174,17 +3448,20 @@ }, "to-fast-properties": { "version": "1.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", "dev": true }, "trim-right": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", "dev": true }, "uglify-js": { "version": "2.8.29", - "bundled": true, + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", "dev": true, "optional": true, "requires": { @@ -3195,7 +3472,8 @@ "dependencies": { "yargs": { "version": "3.10.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "optional": true, "requires": { @@ -3209,13 +3487,15 @@ }, "uglify-to-browserify": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", "dev": true, "optional": true }, "validate-npm-package-license": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", + "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", "dev": true, "requires": { "spdx-correct": "1.0.2", @@ -3224,7 +3504,8 @@ }, "which": { "version": "1.3.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "dev": true, "requires": { "isexe": "2.0.0" @@ -3232,23 +3513,27 @@ }, "which-module": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, "window-size": { "version": "0.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", "dev": true, "optional": true }, "wordwrap": { "version": "0.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", "dev": true }, "wrap-ansi": { "version": "2.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { "string-width": "1.0.2", @@ -3257,7 +3542,8 @@ "dependencies": { "string-width": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { "code-point-at": "1.1.0", @@ -3269,12 +3555,14 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, "write-file-atomic": { "version": "1.3.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.4.tgz", + "integrity": "sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=", "dev": true, "requires": { "graceful-fs": "4.1.11", @@ -3284,42 +3572,40 @@ }, "y18n": { "version": "3.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", "dev": true }, "yallist": { "version": "2.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true }, "yargs": { - "version": "8.0.2", - "bundled": true, + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.0.3.tgz", + "integrity": "sha512-DqBpQ8NAUX4GyPP/ijDGHsJya4tYqLQrjPr95HNsr1YwL3+daCfvBwg7+gIC6IdJhR2kATh3hb61vjzMWEtjdw==", "dev": true, "requires": { - "camelcase": "4.1.0", "cliui": "3.2.0", "decamelize": "1.2.0", + "find-up": "2.1.0", "get-caller-file": "1.0.2", "os-locale": "2.1.0", - "read-pkg-up": "2.0.0", "require-directory": "2.1.1", "require-main-filename": "1.0.1", "set-blocking": "2.0.0", "string-width": "2.1.1", "which-module": "2.0.0", "y18n": "3.2.1", - "yargs-parser": "7.0.0" + "yargs-parser": "8.0.0" }, "dependencies": { - "camelcase": { - "version": "4.1.0", - "bundled": true, - "dev": true - }, "cliui": { "version": "3.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "dev": true, "requires": { "string-width": "1.0.2", @@ -3329,7 +3615,8 @@ "dependencies": { "string-width": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { "code-point-at": "1.1.0", @@ -3338,71 +3625,22 @@ } } } - }, - "load-json-file": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "strip-bom": "3.0.0" - } - }, - "path-type": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "pify": "2.3.0" - } - }, - "read-pkg": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "load-json-file": "2.0.0", - "normalize-package-data": "2.4.0", - "path-type": "2.0.0" - } - }, - "read-pkg-up": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "find-up": "2.1.0", - "read-pkg": "2.0.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "bundled": true, - "dev": true - }, - "yargs-parser": { - "version": "7.0.0", - "bundled": true, - "dev": true, - "requires": { - "camelcase": "4.1.0" - } } } }, "yargs-parser": { - "version": "5.0.0", - "bundled": true, + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.0.0.tgz", + "integrity": "sha1-IdR2Mw5agieaS4gTRb8GYQLiGcY=", "dev": true, "requires": { - "camelcase": "3.0.0" + "camelcase": "4.1.0" }, "dependencies": { "camelcase": { - "version": "3.0.0", - "bundled": true, + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true } } @@ -3466,6 +3704,11 @@ "semver": "5.4.1" } }, + "parse-duration": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/parse-duration/-/parse-duration-0.1.1.tgz", + "integrity": "sha1-ExFN3JiRwezSgANiRFVN5DZHoiY=" + }, "parse-json": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", @@ -3580,10 +3823,16 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" }, + "propagate": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/propagate/-/propagate-0.4.0.tgz", + "integrity": "sha1-8/zKCm/gZzanulcpZgaWF8EwtIE=", + "dev": true + }, "protobufjs": { "version": "6.8.0", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.0.tgz", - "integrity": "sha1-BOhUk8ThZTh47Cg/GLx4sefF1aI=", + "integrity": "sha512-47Y49f5JN5Qsbxas2TyI2zFO8j9GpQAQm5thf54fr2O8qcP/jkIXYxmYx1hN2WQFAhESU1xpVn5NWVDBB8WFnw==", "dev": true, "requires": { "@protobufjs/aspromise": "1.1.2", @@ -3604,7 +3853,7 @@ "@types/node": { "version": "7.0.46", "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.46.tgz", - "integrity": "sha1-w97dJVWMZ2s9YwPlF5mrucP48xQ=", + "integrity": "sha512-u+JAi1KtmaUoU/EHJkxoiuvzyo91FCE41Z9TZWWcOUU3P8oUdlDLdrGzCGWySPgbRMD17B0B+1aaJLYI9egQ6A==", "dev": true } } @@ -3623,7 +3872,7 @@ "qs": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha1-NJzfbu+J7EXBLX1es/wMhwNDptg=" + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" }, "rc": { "version": "1.2.2", @@ -3661,7 +3910,7 @@ "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", + "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", "requires": { "core-util-is": "1.0.2", "inherits": "2.0.3", @@ -3713,7 +3962,7 @@ "request": { "version": "2.83.0", "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", - "integrity": "sha1-ygtl2gLtYpNYh4COb1EDgQNOM1Y=", + "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", "requires": { "aws-sign2": "0.7.0", "aws4": "1.6.0", @@ -3742,7 +3991,7 @@ "resolve": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", - "integrity": "sha1-HwmsznlsmnYlefMbLBzEw83fnzY=", + "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", "dev": true, "requires": { "path-parse": "1.0.5" @@ -3759,9 +4008,9 @@ } }, "retry-request": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-3.1.0.tgz", - "integrity": "sha1-+UjKF5JlemSryJoPrXJ90HtisNY=", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-3.1.1.tgz", + "integrity": "sha512-Sj3M3bC8ODJT+jfVxbTwvORRkFtc/AlDhhiMch5RJalLMAjz6+lIf5Q/Ox2esAM4tXcAYfG4ecNHPtaGNWIqvQ==", "requires": { "request": "2.83.0", "through2": "2.0.3" @@ -3803,12 +4052,12 @@ "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=" + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, "samsam": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.3.0.tgz", - "integrity": "sha1-jR2TUOJWItow3j5EumkrUiGrfFA=", + "integrity": "sha512-1HwIYD/8UlOtFS3QO3w7ey+SdSDFE4HRNLZoZRYVQefrOY3l17epswImeB1ijgJFQJodIaHcwkp3r/myBjFVbg==", "dev": true }, "semver": { @@ -3848,9 +4097,9 @@ "dev": true }, "sinon": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.0.2.tgz", - "integrity": "sha1-yB9iRW03mGyE6fUi3bnOQTvaSdI=", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.1.1.tgz", + "integrity": "sha512-l+74gYEaCH967jIfuLCsBxmAW88/6+y+dzr6HJqOuKdGFYA5JQWOxYcyF6aBd49v8/QOIIQYwzcfaTP9FQawdg==", "dev": true, "requires": { "diff": "3.4.0", @@ -3862,21 +4111,18 @@ "type-detect": "4.0.3" }, "dependencies": { - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } + "type-detect": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", + "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", + "dev": true } } }, "sntp": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", - "integrity": "sha1-LGzsFP7cIiJznK+bXD2F0cxaLMg=", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", "requires": { "hoek": "4.2.0" } @@ -3957,7 +4203,7 @@ "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "requires": { "safe-buffer": "5.1.1" } @@ -4079,6 +4325,15 @@ "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", "dev": true }, + "ts-mockito": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/ts-mockito/-/ts-mockito-2.2.5.tgz", + "integrity": "sha512-cIdDMSOq9Eg06pQro2I+ZBOwqs663lIqJDQgGfi/MRs/05ENSlMCpDX9CwYlgux0MesLEUFEB8RSKcq6BeI2yg==", + "dev": true, + "requires": { + "lodash": "4.17.4" + } + }, "tslib": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz", @@ -4128,9 +4383,9 @@ "optional": true }, "type-detect": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", - "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-1.0.0.tgz", + "integrity": "sha1-diIXzAbbJY7EiQihKY6LlRIejqI=", "dev": true }, "typedarray": { @@ -4199,7 +4454,7 @@ "uuid": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha1-PdPT55Crwk17DToDT/q6vijrvAQ=" + "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" }, "validate-npm-package-license": { "version": "3.0.1", diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 3bf42f9ebd7..7562f85ea92 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -26,12 +26,12 @@ "license": "Apache-2.0", "dependencies": { "@google-cloud/common": "^0.14.0", - "@types/pify": "^3.0.0", "bindings": "^1.2.1", "delay": "^2.0.0", "extend": "^3.0.1", "gcp-metadata": "^0.4.0", "nan": "^2.1.0", + "parse-duration": "^0.1.1", "pify": "^3.0.0", "request": "^2.83.0", "retry-request": "^3.0.1" @@ -39,17 +39,22 @@ "devDependencies": { "@types/delay": "^2.0.0", "@types/extend": "^3.0.0", + "@types/long": "^3.0.32", "@types/mocha": "^2.2.43", + "@types/nock": "^8.2.1", "@types/node": "^8.0.30", - "@types/request": "^2.0.4", + "@types/pify": "^3.0.0", + "@types/request": "^2.0.7", "@types/sinon": "^4.0.0", "clang-format": "^1.0.33", "codecov": "^3.0.0", "gts": "^0.5.0", "mocha": "^4.0.1", + "nock": "^9.0.22", "nyc": "^11.2.1", "protobufjs": "~6.8.0", "sinon": "^4.0.1", + "ts-mockito": "^2.2.5", "typescript": "~2.6.x" }, "files": [ diff --git a/handwritten/cloud-profiler/ts/src/config.ts b/handwritten/cloud-profiler/ts/src/config.ts index c39fc572c9f..afccf578eb5 100644 --- a/handwritten/cloud-profiler/ts/src/config.ts +++ b/handwritten/cloud-profiler/ts/src/config.ts @@ -59,27 +59,54 @@ export interface Config extends AuthenticationConfig { // When true, heap profiling will be disabled. disableHeap?: boolean; + + // Average time between samples collected by time profiler. + // Increasing the time between samples will reduce quality of profiles by + // reducing number of samples. + // Decreasing time between samples may increase overhead of profiling. + timeIntervalMicros?: number; + + // Average bytes between samples collected by heap profiler. + // Increasing the bytes between samples will reduce quality of profiles by + // reducing number of samples. + // Decreasing bytes between samples may increase overhead of profiling. + heapIntervalBytes?: number; + + // Maximum depth of stacks recorded for heap samples. Decreasing stack depth + // will make it more likely that stack traces are truncated. Increasing + // stack depth may increase overhead of profiling. + heapMaxStackDepth?: number; + + // Time to wait before trying to create a profile again if profile creation + // fails. + backoffMillis?: number; } -/** - * Subtype of Config that declares some properties to be non-optional. This - * helps avoid null checks in the profiler code. - */ -export interface ProfilerConfig extends Config { +// Interface for an initialized config. +export interface ProfilerConfig extends AuthenticationConfig { + projectId?: string; logLevel: number; - serviceContext: {service?: string; version?: string;}; + serviceContext: {service: string; version?: string;}; instance: string; zone: string; disableTime: boolean; disableHeap: boolean; + timeIntervalMicros: number; + heapIntervalBytes: number; + heapMaxStackDepth: number; + backoffMillis: number; } // Default values for configuration for a profiler. -export const defaultConfig: ProfilerConfig = { +export const defaultConfig = { logLevel: 1, serviceContext: {}, disableHeap: false, disableTime: false, instance: '', - zone: '' + zone: '', + timeIntervalMicros: 1000, + heapIntervalBytes: 512 * 1024, + heapMaxStackDepth: 64, + backoffMillis: 5 * 60 * 1000 }; diff --git a/handwritten/cloud-profiler/ts/src/index.ts b/handwritten/cloud-profiler/ts/src/index.ts index c87a842205a..161ff31c864 100644 --- a/handwritten/cloud-profiler/ts/src/index.ts +++ b/handwritten/cloud-profiler/ts/src/index.ts @@ -18,27 +18,35 @@ import * as extend from 'extend'; import * as gcpMetadata from 'gcp-metadata'; import * as path from 'path'; import * as pify from 'pify'; - -import {AuthenticationConfig, Common, ServiceConfig, ServiceObject} from '../third_party/types/common-types'; - +import {AuthenticationConfig, Common, ServiceConfig} from '../third_party/types/common-types'; import {Config, defaultConfig, ProfilerConfig} from './config'; import {Profiler} from './profiler'; const common: Common = require('@google-cloud/common'); -// Returns value of metadata field. -// Throws error if there is a problem accessing metadata API. +/** + * Returns value of metadata field. + * Throws error if there is a problem accessing metadata API. + */ async function getMetadataInstanceField(field: string): Promise { const [response, metadata] = await pify(gcpMetadata.instance, {multiArgs: true})(field); return metadata; } -// initConfig sets unset values in the configuration to the value retrieved from -// environment variables, metadata, or the default values specified in -// defaultConfig. -// Throws error if value that must be set cannot be initialized. -// Exported for testing purposes. +function hasService(config: Config): + config is {serviceContext: {service: string}} { + return config.serviceContext !== undefined && + typeof config.serviceContext.service === 'string'; +} + +/** + * Sets unset values in the configuration to the value retrieved from + * environment variables, metadata, or specified in defaultConfig. + * Throws error if value that must be set cannot be initialized. + * + * Exported for testing purposes. + */ export async function initConfig(config: Config): Promise { config = common.util.normalizeArguments(null, config); @@ -85,7 +93,7 @@ export async function initConfig(config: Config): Promise { } } - if (mergedConfig.serviceContext.service === undefined) { + if (!hasService(mergedConfig)) { throw new Error('Service must be specified in the configuration.'); } @@ -96,7 +104,8 @@ let profiler: Profiler|undefined = undefined; /** * Starts the profiling agent and returns a promise. - * If any error is encountered when profiling, the promise will be rejected. + * If any error is encountered when configuring the profiler the promise will + * be rejected. Resolves when profiling is started. * * config - Config describing configuration for profiling. * @@ -110,7 +119,7 @@ let profiler: Profiler|undefined = undefined; export async function start(config: Config = {}): Promise { const normalizedConfig = await initConfig(config); profiler = new Profiler(normalizedConfig); - return profiler.start(); + profiler.start(); } // If the module was --require'd from the command line, start the agent. diff --git a/handwritten/cloud-profiler/ts/src/profiler.ts b/handwritten/cloud-profiler/ts/src/profiler.ts index 605e46ddbfb..626f228c30e 100644 --- a/handwritten/cloud-profiler/ts/src/profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profiler.ts @@ -13,47 +13,358 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import * as path from 'path'; -import {AuthenticationConfig, Common, Logger, Service, ServiceConfig} from '../third_party/types/common-types'; +import * as path from 'path'; +import * as pify from 'pify'; +import * as zlib from 'zlib'; -import {Config, ProfilerConfig} from './config'; +import {perftools} from '../../proto/profile'; +import {Common, Logger, Service, ServiceObject} from '../third_party/types/common-types'; +import {ProfilerConfig} from './config'; import {HeapProfiler} from './profilers/heap-profiler'; import {TimeProfiler} from './profilers/time-profiler'; +export const common: Common = require('@google-cloud/common'); +const parseDuration: (str: string) => number = require('parse-duration'); const pjson = require('../../package.json'); -const common: Common = require('@google-cloud/common'); +const API = 'https://cloudprofiler.googleapis.com/v2'; +const SCOPE = 'https://www.googleapis.com/auth/monitoring.write'; +const gzip = pify(zlib.gzip); + +enum ProfileTypes { + Wall = 'WALL', + Heap = 'HEAP' +} + +/** + * @return - true if http status code indicates an error and false otherwise. + */ +function isErrorResponseStatusCode(code: number) { + return code < 200 || code >= 300; +} -// TODO: finish implementing Profiler. -// TODO: add stop() method to stop profiling. -export class Profiler { - config: ProfilerConfig; - logger: Logger; - service: Service; +/** + * Interface for deployment field of RequestProfile. Profiles with matching + * deployments will be grouped together. + * Used as body of request when creating profile using the profiler API. + * + * Public for testing. + */ +export interface Deployment { + projectId?: string; + target?: string; + labels?: {zone?: string, version?: string}; +} + +/** + * Interface for body of response from profiler API when creating + * profile and used as body of request to profiler API when + * uploading a profile. + * + * Public for testing. + */ +export interface RequestProfile { + name: string; + profileType?: string; + duration: string; + profileBytes?: string; + deployment?: Deployment; + labels?: {instance: string}; +} + +/** + * @return true if an deployment is a Deployment and false otherwise. + */ +// tslint:disable-next-line: no-any +function isDeployment(deployment: any): deployment is Deployment { + return (deployment.projectId === undefined || + typeof deployment.projectId === 'string') && + (deployment.target === undefined || + typeof deployment.target === 'string') && + (deployment.labels === undefined || + (deployment.labels.zone === undefined || + typeof deployment.labels.zone === 'string') && + (deployment.labels.version === undefined || + typeof deployment.labels.zone === 'string')); +} + +/** + * @return true if an prof is a RequestProfile and false otherwise. + */ +// tslint:disable-next-line: no-any +function isRequestProfile(prof: any): prof is RequestProfile { + return prof && typeof prof.name === 'string' && + typeof prof.profileType === 'string' && + typeof prof.duration === 'string' && + (prof.labels === undefined || typeof prof.labels.instance === 'string') && + (prof.deployment === undefined || isDeployment(prof.deployment)); +} + +/** + * Returns true if response has statusCode. + */ +// tslint:disable-next-line: no-any +function hasHttpStatusCode(response: any): + response is {statusCode: number, statusMessage: string} { + return response && typeof response.statusCode === 'number'; +} + +/** + * Converts a profile to a compressed, base64 encoded string. + * + * Work for converting profile is done on the event loop. In particular, + * profile encoding is done on the event loop. So, this does block execution + * of the program, but for a short period of time, since profiles are small. + * + * @param p - profile to be converted to string. + */ +async function profileBytes(p: perftools.profiles.IProfile): Promise { + const pwriter = perftools.profiles.Profile.encode(p); + const buffer = new Buffer(pwriter.finish()); + const gzBuf = await gzip(buffer); + return gzBuf.toString('base64'); +} + +/** + * Polls profiler server for instructions on behalf of a task and + * collects and uploads profiles as requested + */ +export class Profiler extends common.ServiceObject { + private config: ProfilerConfig; + private logger: Logger; + private profileLabels: {instance: string}; + private deployment: Deployment; + private profileTypes: string[]; + + // Public for testing. + timeProfiler: TimeProfiler|undefined; + heapProfiler: HeapProfiler|undefined; constructor(config: ProfilerConfig) { - this.config = config; + config = common.util.normalizeArguments(null, config); + const serviceConfig = { + baseUrl: API, + scopes: [SCOPE], + packageJson: pjson, + }; + super({parent: new common.Service(serviceConfig, config), baseUrl: '/'}); - this.service = new common.Service( - { - baseUrl: 'https://cloudprofiler.googleapis.com/v2', - scopes: ['https://www.googleapis.com/auth/monitoring.write'], - }, - this.config); + this.config = config; this.logger = new common.logger({ level: common.logger.LEVELS[config.logLevel as number], tag: pjson.name }); + + this.deployment = { + projectId: this.config.projectId, + target: this.config.serviceContext.service, + labels: { + zone: this.config.zone, + version: this.config.serviceContext.version + } + }; + + this.profileLabels = {instance: this.config.instance}; + + this.profileTypes = []; + if (!this.config.disableTime) { + this.profileTypes.push(ProfileTypes.Wall); + this.timeProfiler = new TimeProfiler(this.config.timeIntervalMicros); + } + if (!this.config.disableHeap) { + this.profileTypes.push(ProfileTypes.Heap); + this.heapProfiler = new HeapProfiler( + this.config.heapIntervalBytes, this.config.heapMaxStackDepth); + } + } + + /** + * Starts an endless loop to poll profiler server for instructions, and + * collects and uploads profiles as requested. + * If there is a problem when collecting a profile or uploading a profile to + * profiler server, this problem will be logged at the error level and + * otherwise ignored. + * If there is a problem polling profiler server for instructions + * on the type of profile to be collected, this problem will be logged at the + * error level and getting profile type will be retried. + */ + start() { + this.runLoop(); + } + + /** + * Endlessly polls the profiler server for instructions, and collects and + * uploads profiles as requested. + */ + async runLoop() { + const delayMillis = await this.collectProfile(); + + // Schedule the next profile. + setTimeout(this.runLoop.bind(this), delayMillis).unref(); + } + + /** + * Waits for profiler server to tell it to collect a profile, then collects + * a profile and uploads it. + * + * @return - time, in ms, to wait before asking profiler server again about + * collecting another profile. + * + * TODO: implement backoff and retry. When error encountered in + * createProfile() should be retried when response indicates this request + * should be retried or with exponential backoff (up to one hour) if the + * response does not indicate when to retry this request. + */ + async collectProfile(): Promise { + let prof: RequestProfile; + try { + prof = await this.createProfile(); + } catch (err) { + this.logger.error( + `Error requesting profile type to be collected: ${err}.`); + return this.config.backoffMillis; + } + try { + await this.profileAndUpload(prof); + } catch (err) { + this.logger.error(`Error collecting and uploading profile: ${err}.`); + } + return 0; + } + + /** + * Talks to profiler server, which hangs until server indicates + * job should be profiled and then indicates what type of profile should + * be collected. + * + * If any problem is encountered, an error will be thrown. + * + * @return - a RequestProfile specifying which type of profile should be + * collected and other information needed to collect and upload a profile of + * the specified type. + * + * TODO (issue #28): right now, this call could hang for up to an hour when + * this method is the only thing on the event loop, keeping the program open + * even when all work is done. Should expose the ability to cancel the http + * request made here, and then determine when to cancel this request. + * + * Public to allow for testing. + */ + async createProfile(): Promise { + const reqBody = { + deployment: this.deployment, + profileType: this.profileTypes, + }; + const options = { + method: 'POST', + uri: '/profiles', + body: reqBody, + json: true, + }; + + const [body, response] = await this.request(options); + if (!hasHttpStatusCode(response)) { + throw new Error('Server response missing status information.'); + } + if (isErrorResponseStatusCode(response.statusCode)) { + let message: number|string = response.statusCode; + // tslint:disable-next-line: no-any + if ((response as any).statusMessage) { + message = response.statusMessage; + } + throw new Error(message.toString()); + } + if (!isRequestProfile(body)) { + throw new Error(`Profile not valid: ${body}.`); + } + return body; + } + + /** + * Collects a profile of the type specified by the profileType field of prof. + * If any problem is encountered, like a problem collecting or uploading the + * profile, an error will be thrown. + * + * Public to allow for testing. + */ + async profileAndUpload(prof: RequestProfile): Promise { + prof = await this.profile(prof); + prof.labels = this.profileLabels; + + const options = { + method: 'PATCH', + uri: API + '/' + prof.name, + body: prof, + json: true, + }; + const [body, response] = await this.request(options); + if (!hasHttpStatusCode(response)) { + throw new Error( + 'Server response missing status information when attempting to upload profile.'); + } + if (isErrorResponseStatusCode(response.statusCode)) { + let message: number|string = response.statusCode; + // tslint:disable-next-line: no-any + if ((response as any).statusMessage) { + message = response.statusMessage; + } + throw new Error(`Could not upload profile: ${message}.`); + } + } + + /** + * Collects a profile of the type specified by profileType field of prof. + * If any problem is encountered, for example the profileType is not + * recognized or profiling is disabled for the specified profileType, an + * error will be thrown. + * + * Public to allow for testing. + */ + async profile(prof: RequestProfile): Promise { + switch (prof.profileType) { + case ProfileTypes.Wall: + return await this.writeTimeProfile(prof); + case ProfileTypes.Heap: + return this.writeHeapProfile(prof); + default: + throw new Error(`Unexpected profile type ${prof.profileType}.`); + } + } + + /** + * Collects a time profile, converts profile to compressed, base64 encoded + * string, and puts this string in profileBytes field of prof. + * + * Public to allow for testing. + */ + async writeTimeProfile(prof: RequestProfile): Promise { + if (!this.timeProfiler) { + throw Error('Cannot collect time profile, time profiler not enabled.'); + } + const durationMillis = parseDuration(prof.duration); + if (!durationMillis) { + throw Error( + `Cannot collect time profile, duration "${prof.duration}" cannot` + + ` be parsed.`); + } + const p = await this.timeProfiler.profile(durationMillis); + prof.profileBytes = await profileBytes(p); + return prof; } - // Begins collection and uploading of profiles. - // If profiling fails or another problem is encountered, the returned promise - // will be rejected. - // TODO: implement - // TODO: explain failure situations. - async start(): Promise { - return Promise.reject( - new Error('start() is unimplemented for ProfileAgent.')); + /** + * Collects a heap profile, converts profile to compressed, base64 encoded + * string, and adds profileBytes field to prof with this string. + * + * Public to allow for testing. + */ + async writeHeapProfile(prof: RequestProfile): Promise { + if (!this.heapProfiler) { + throw Error('Cannot collect heap profile, heap profiler not enabled.'); + } + const p = this.heapProfiler.profile(); + prof.profileBytes = await profileBytes(p); + return prof; } } diff --git a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts index 92e4b74eb2d..9d3840a2cb4 100644 --- a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts +++ b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts @@ -224,7 +224,7 @@ export function serializeTimeProfile( const profile = { sampleType: [sampleValueType, timeValueType], - timeNanos: prof.startTime * 1000 * 1000, + timeNanos: Date.now() * 1000 * 1000, durationNanos: (prof.endTime - prof.startTime) * 1000 * 1000, periodType: timeValueType, period: intervalMicros, diff --git a/handwritten/cloud-profiler/ts/test/fixtures/gcloud-credentials.json b/handwritten/cloud-profiler/ts/test/fixtures/gcloud-credentials.json new file mode 100644 index 00000000000..3499fcc9c3d --- /dev/null +++ b/handwritten/cloud-profiler/ts/test/fixtures/gcloud-credentials.json @@ -0,0 +1,6 @@ +{ + "client_id": "x", + "client_secret": "y", + "refresh_token": "z", + "type": "authorized_user" +} diff --git a/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts index 3c319078d80..e4316e9db73 100644 --- a/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts +++ b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts @@ -150,6 +150,19 @@ export const timeProfile: perftools.profiles.IProfile = { period: 1000, }; +// timeProfile is encoded then decoded to convert numbers to longs, in +// decodedTimeProfile +const encodedTimeProfile = + perftools.profiles.Profile.encode(timeProfile).finish(); +export const decodedTimeProfile = + perftools.profiles.Profile.decode(encodedTimeProfile); + +export const base64TimeProfile = 'H4sIAAAAAAAAA0XPMQrCMBQGYPOSNGkQGrrYsRRc3J' + + 'pTODo7KbFCwKalTXeP4g1cPYKjx+gxfCmI28f//vfgKSaJBsUk1SxPFQDJKZlFLhWBnNLXJ' + + 'oYUCZ8sksEyr6QkVVwlKECB5ihaxUMZii2Z2mFP84KXCQq0KEQpUXRRYlZGjOe2vzWj4bab' + + 'fDAsuLYx69bZoRsb2/nLaNLr5G1wnTdYt4Prg/ln9S+r96vD/f18bI/LM6dZfAGLaAVw3AA' + + 'AAA=='; + const heapLeaf1 = { name: 'function2', @@ -255,6 +268,17 @@ export const heapProfile: perftools.profiles.IProfile = { period: 524288 }; +// heapProfile is encoded then decoded to convert numbers to longs, in +// decodedHeapProfile +const encodedHeapProfile = + perftools.profiles.Profile.encode(heapProfile).finish(); +export const decodedHeapProfile = + perftools.profiles.Profile.decode(encodedHeapProfile); + +export const base64HeapProfile = 'H4sIAAAAAAAAA0XPvQqDQBAEYO9nvfWaHELAUqxCOjc' + + 'vkTJ1quhhwEBU4lmk87HyeFlNwO5jGAbGahROWo3K6dRYIVIp4A+1TxOrlGTiJbU/qt0HF+v' + + 'FMB8KRFEsI4IlWdIBSxXLpGVplnZ45J6DDHJgSRdncW5YymGGq7RLsiQ3FJHp60fjw0jg+6k' + + 'LBONQ+YagfodmJP2s2o6S+9T50PZdSWb0r3YI5ZadNtI5uq7nbvOcfwHxB6/r7QAAAA=='; const anonymousHeapNode = { scriptName: 'main', diff --git a/handwritten/cloud-profiler/ts/test/test-heap-profiler.ts b/handwritten/cloud-profiler/ts/test/test-heap-profiler.ts index 5c1ce02ca61..ec403f082d2 100644 --- a/handwritten/cloud-profiler/ts/test/test-heap-profiler.ts +++ b/handwritten/cloud-profiler/ts/test/test-heap-profiler.ts @@ -27,19 +27,19 @@ const v8HeapProfiler = require('bindings')('sampling_heap_profiler'); describe('HeapProfiler', () => { describe('profile', () => { + const sinonStubs: sinon.SinonStub[] = new Array(); before(() => { - sinon.stub(v8HeapProfiler, 'startSamplingHeapProfiler'); - sinon.stub(v8HeapProfiler, 'stopSamplingHeapProfiler'); - sinon.stub(v8HeapProfiler, 'getAllocationProfile').returns(v8HeapProfile); - sinon.stub(Date, 'now').returns(0); + sinonStubs.push(sinon.stub(v8HeapProfiler, 'startSamplingHeapProfiler')); + sinonStubs.push(sinon.stub(v8HeapProfiler, 'stopSamplingHeapProfiler')); + sinonStubs.push(sinon.stub(v8HeapProfiler, 'getAllocationProfile') + .returns(v8HeapProfile)); + sinonStubs.push(sinon.stub(Date, 'now').returns(0)); }); after(() => { - v8HeapProfiler.startSamplingHeapProfiler.restore(); - v8HeapProfiler.stopSamplingHeapProfiler.restore(); - v8HeapProfiler.getAllocationProfile.restore(); - // tslint:disable-next-line: no-any - (Date.now as any).restore(); + sinonStubs.forEach((stub) => { + stub.restore(); + }); }); it('should return a profile equal to the expected profile', async () => { diff --git a/handwritten/cloud-profiler/ts/test/test-init-config.ts b/handwritten/cloud-profiler/ts/test/test-init-config.ts index abf3062d867..a7bfefaeab1 100644 --- a/handwritten/cloud-profiler/ts/test/test-init-config.ts +++ b/handwritten/cloud-profiler/ts/test/test-init-config.ts @@ -16,13 +16,13 @@ import * as assert from 'assert'; import * as gcpMetadata from 'gcp-metadata'; -import * as request from 'request'; import * as sinon from 'sinon'; import {initConfig} from '../src/index'; describe('initConfig', () => { let savedEnv: NodeJS.ProcessEnv; + let metadataStub: sinon.SinonStub|undefined; before(() => { savedEnv = process.env; @@ -33,8 +33,9 @@ describe('initConfig', () => { }); afterEach(() => { - // tslint:disable-next-line: no-any - (gcpMetadata.instance as any).restore(); + if (metadataStub) { + metadataStub.restore(); + } }); after(() => { @@ -42,10 +43,19 @@ describe('initConfig', () => { }); it('should not modify specified fields when not on GCE', async () => { - sinon.stub(gcpMetadata, 'instance') - .throwsException('cannot access metadata'); + metadataStub = sinon.stub(gcpMetadata, 'instance') + .throwsException('cannot access metadata'); const config = { + logLevel: 2, + serviceContext: {version: 'fake-version', service: 'fake-service'}, + disableHeap: true, + disableTime: true, + instance: 'instance', + zone: 'zone', + projectId: 'fake-projectId' + }; + const expConfig = { logLevel: 2, serviceContext: {version: 'fake-version', service: 'fake-service'}, disableHeap: true, @@ -53,14 +63,18 @@ describe('initConfig', () => { instance: 'instance', zone: 'zone', projectId: 'fake-projectId', + timeIntervalMicros: 1000, + heapIntervalBytes: 512 * 1024, + heapMaxStackDepth: 64, + backoffMillis: 300000 }; const initializedConfig = await initConfig(config); - assert.deepEqual(initializedConfig, config); + assert.deepEqual(initializedConfig, expConfig); }); it('should not modify specified fields when on GCE', async () => { - sinon.stub(gcpMetadata, 'instance') - .withArgs('name') + metadataStub = sinon.stub(gcpMetadata, 'instance'); + metadataStub.withArgs('name') .callsArgWith(1, null, undefined, 'gce-instance') .withArgs('zone') .callsArgWith( @@ -75,13 +89,26 @@ describe('initConfig', () => { zone: 'zone', projectId: 'fake-projectId' }; + const expConfig = { + logLevel: 2, + serviceContext: {version: 'fake-version', service: 'fake-service'}, + disableHeap: true, + disableTime: true, + instance: 'instance', + zone: 'zone', + projectId: 'fake-projectId', + timeIntervalMicros: 1000, + heapIntervalBytes: 512 * 1024, + heapMaxStackDepth: 64, + backoffMillis: 300000 + }; const initializedConfig = await initConfig(config); - assert.deepEqual(initializedConfig, config); + assert.deepEqual(initializedConfig, expConfig); }); it('should get zone and instance from GCE', async () => { - sinon.stub(gcpMetadata, 'instance') - .withArgs('name') + metadataStub = sinon.stub(gcpMetadata, 'instance'); + metadataStub.withArgs('name') .callsArgWith(1, null, undefined, 'gce-instance') .withArgs('zone') .callsArgWith( @@ -102,6 +129,10 @@ describe('initConfig', () => { instance: 'gce-instance', zone: 'gce-zone', projectId: 'projectId', + timeIntervalMicros: 1000, + heapIntervalBytes: 512 * 1024, + heapMaxStackDepth: 64, + backoffMillis: 300000 }; const initializedConfig = await initConfig(config); assert.deepEqual(initializedConfig, expConfig); @@ -109,8 +140,8 @@ describe('initConfig', () => { it('should not reject when not on GCE and no zone and instance found', async () => { - sinon.stub(gcpMetadata, 'instance') - .throwsException('cannot access metadata'); + metadataStub = sinon.stub(gcpMetadata, 'instance'); + metadataStub.throwsException('cannot access metadata'); const config = { projectId: 'fake-projectId', serviceContext: {service: 'fake-service'} @@ -123,14 +154,18 @@ describe('initConfig', () => { instance: '', zone: '', projectId: 'fake-projectId', + timeIntervalMicros: 1000, + heapIntervalBytes: 512 * 1024, + heapMaxStackDepth: 64, + backoffMillis: 300000 }; const initializedConfig = await initConfig(config); assert.deepEqual(initializedConfig, expConfig); }); it('should reject when no service specified', () => { - sinon.stub(gcpMetadata, 'instance') - .throwsException('cannot access metadata'); + metadataStub = sinon.stub(gcpMetadata, 'instance'); + metadataStub.throwsException('cannot access metadata'); const config = { logLevel: 2, serviceContext: {version: ''}, @@ -148,8 +183,8 @@ describe('initConfig', () => { }); it('should get have no projectId when no projectId given', async () => { - sinon.stub(gcpMetadata, 'instance') - .throwsException('cannot access metadata'); + metadataStub = sinon.stub(gcpMetadata, 'instance'); + metadataStub.throwsException('cannot access metadata'); const config = { logLevel: 2, @@ -159,8 +194,20 @@ describe('initConfig', () => { instance: 'instance', zone: 'zone' }; + const expConfig = { + logLevel: 2, + serviceContext: {version: '', service: 'fake-service'}, + disableHeap: true, + disableTime: true, + instance: 'instance', + zone: 'zone', + timeIntervalMicros: 1000, + heapIntervalBytes: 512 * 1024, + heapMaxStackDepth: 64, + backoffMillis: 300000 + }; const initializedConfig = await initConfig(config); - assert.deepEqual(initializedConfig, config); + assert.deepEqual(initializedConfig, expConfig); }); it('should get values from from environment variable when not specified in config or environment variables', @@ -171,8 +218,8 @@ describe('initConfig', () => { process.env.GAE_VERSION = 'process-version'; process.env.GCLOUD_PROFILER_CONFIG = './ts/test/fixtures/test-config.json'; - sinon.stub(gcpMetadata, 'instance') - .withArgs('name') + metadataStub = sinon.stub(gcpMetadata, 'instance'); + metadataStub.withArgs('name') .callsArgWith(1, null, undefined, 'gce-instance') .withArgs('zone') .callsArgWith( @@ -187,6 +234,10 @@ describe('initConfig', () => { disableTime: true, instance: 'envConfig-instance', zone: 'envConfig-zone', + timeIntervalMicros: 1000, + heapIntervalBytes: 512 * 1024, + heapMaxStackDepth: 64, + backoffMillis: 300000 }; const initializedConfig = await initConfig(config); assert.deepEqual(initializedConfig, expConfig); @@ -200,8 +251,8 @@ describe('initConfig', () => { process.env.GAE_VERSION = 'process-version'; process.env.GCLOUD_PROFILER_CONFIG = './ts/test/fixtures/test-config.json'; - sinon.stub(gcpMetadata, 'instance') - .withArgs('name') + metadataStub = sinon.stub(gcpMetadata, 'instance'); + metadataStub.withArgs('name') .callsArgWith(1, null, undefined, 'gce-instance') .withArgs('zone') .callsArgWith( @@ -216,14 +267,27 @@ describe('initConfig', () => { instance: 'instance', zone: 'zone' }; + const expConfig = { + projectId: 'config-projectId', + logLevel: 1, + serviceContext: {version: 'config-version', service: 'config-service'}, + disableHeap: false, + disableTime: false, + instance: 'instance', + zone: 'zone', + timeIntervalMicros: 1000, + heapIntervalBytes: 512 * 1024, + heapMaxStackDepth: 64, + backoffMillis: 300000 + }; const initializedConfig = await initConfig(config); - assert.deepEqual(initializedConfig, config); + assert.deepEqual(initializedConfig, expConfig); }); it('should get values from from environment config when not specified in config or other environment variables', async () => { - sinon.stub(gcpMetadata, 'instance') - .throwsException('cannot access metadata'); + metadataStub = sinon.stub(gcpMetadata, 'instance'); + metadataStub.throwsException('cannot access metadata'); process.env.GCLOUD_PROFILER_CONFIG = './ts/test/fixtures/test-config.json'; @@ -236,6 +300,10 @@ describe('initConfig', () => { instance: 'envConfig-instance', zone: 'envConfig-zone', projectId: 'envConfig-fake-projectId', + timeIntervalMicros: 1000, + heapIntervalBytes: 512 * 1024, + heapMaxStackDepth: 64, + backoffMillis: 300000 }; const config = {}; diff --git a/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts b/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts index b2b05bf6248..e8101652f5b 100644 --- a/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts +++ b/handwritten/cloud-profiler/ts/test/test-profile-serializer.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +import * as sinon from 'sinon'; import {perftools} from '../../proto/profile'; import {serializeHeapProfile, serializeTimeProfile} from '../src/profilers/profile-serializer'; import {TimeProfile, TimeProfileNode} from '../src/v8-types'; @@ -23,6 +23,13 @@ import {anonymousFunctionHeapProfile, anonymousFunctionTimeProfile, heapProfile, const assert = require('assert'); describe('serializeTimeProfile', () => { + let dateStub: sinon.SinonStub; + before(() => { + dateStub = sinon.stub(Date, 'now').returns(0); + }); + after(() => { + dateStub.restore(); + }); it('should produce expected profile', () => { const timeProfileOut = serializeTimeProfile(v8TimeProfile, 1000); assert.deepEqual(timeProfileOut, timeProfile); diff --git a/handwritten/cloud-profiler/ts/test/test-profiler.ts b/handwritten/cloud-profiler/ts/test/test-profiler.ts new file mode 100644 index 00000000000..13ada239cf0 --- /dev/null +++ b/handwritten/cloud-profiler/ts/test/test-profiler.ts @@ -0,0 +1,551 @@ +/** + * 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. + */ + +import * as assert from 'assert'; +import * as extend from 'extend'; +import * as nock from 'nock'; +import * as pify from 'pify'; +import * as sinon from 'sinon'; +import {instance, mock, when} from 'ts-mockito'; +import * as zlib from 'zlib'; + +import {perftools} from '../../proto/profile'; +import {ProfilerConfig} from '../src/config'; +import {Profiler} from '../src/profiler'; +import {HeapProfiler} from '../src/profilers/heap-profiler'; +import {TimeProfiler} from '../src/profilers/time-profiler'; +import {Common} from '../third_party/types/common-types'; + +import {base64HeapProfile, base64TimeProfile, decodedHeapProfile, decodedTimeProfile, heapProfile, timeProfile} from './profiles-for-tests'; + +const common: Common = require('@google-cloud/common'); +const v8TimeProfiler = require('bindings')('time_profiler'); + +const fakeCredentials = + require('../../ts/test/fixtures/gcloud-credentials.json'); + +const testConfig: ProfilerConfig = { + projectId: 'test-projectId', + logLevel: 0, + serviceContext: {service: 'test-service', version: 'test-version'}, + instance: 'test-instance', + zone: 'test-zone', + disableTime: false, + disableHeap: false, + credentials: fakeCredentials, + timeIntervalMicros: 1000, + heapIntervalBytes: 512 * 1024, + heapMaxStackDepth: 64, + backoffMillis: 1000 +}; + +const API = 'https://cloudprofiler.googleapis.com/v2'; + +const mockTimeProfiler = mock(TimeProfiler); +when(mockTimeProfiler.profile(10 * 1000)).thenReturn(new Promise((resolve) => { + resolve(timeProfile); +})); + +const mockHeapProfiler = mock(HeapProfiler); +when(mockHeapProfiler.profile()).thenReturn(heapProfile); + +nock.disableNetConnect(); +function nockOauth2(): nock.Scope { + return nock('https://accounts.google.com') + .post( + '/o/oauth2/token', + (body: {}) => { + return true; + }) + .once() + .reply(200, { + refresh_token: 'hello', + access_token: 'goodbye', + expiry_date: new Date(9999, 1, 1) + }); +} + +describe('Profiler', () => { + afterEach(() => { + nock.cleanAll(); + }); + describe('profile', () => { + it('should return expected profile when profile type is WALL.', + async () => { + const profiler = new Profiler(testConfig); + profiler.timeProfiler = instance(mockTimeProfiler); + const requestProf = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {instance: 'test-instance'} + }; + const prof = await profiler.profile(requestProf); + assert.deepEqual(prof.profileBytes, base64TimeProfile); + }); + it('should return expected profile when profile type is HEAP.', + async () => { + const profiler = new Profiler(testConfig); + profiler.heapProfiler = instance(mockHeapProfiler); + const requestProf = { + name: 'projects/12345678901/test-projectId', + profileType: 'HEAP', + duration: '10s', + labels: {instance: 'test-instance'} + }; + const prof = await profiler.profile(requestProf); + assert.deepEqual(prof.profileBytes, base64HeapProfile); + }); + it('should throw error when unexpected profile type is requested.', + async () => { + const profiler = new Profiler(testConfig); + profiler.timeProfiler = instance(mockTimeProfiler); + const requestProf = { + name: 'projects/12345678901/test-projectId', + profileType: 'UNKNOWN', + duration: '10s', + labels: {instance: 'test-instance'} + }; + try { + await profiler.profile(requestProf); + assert.fail('Expected an error to be thrown,'); + } catch (err) { + assert.equal(err.message, 'Unexpected profile type UNKNOWN.'); + } + }); + }); + describe('writeTimeProfile', () => { + it('should return request with base64-encoded profile when time profiling' + + ' enabled', + async () => { + const profiler = new Profiler(testConfig); + profiler.timeProfiler = instance(mockTimeProfiler); + + const requestProf = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {'instance': 'test-instance'} + }; + + const outRequestProfile = await profiler.writeTimeProfile(requestProf); + const encodedBytes = outRequestProfile.profileBytes; + + if (encodedBytes === undefined) { + assert.fail('profile bytes are undefined.'); + } + + const decodedBytes = Buffer.from(encodedBytes as string, 'base64'); + const unzippedBytes = await pify(zlib.gunzip)(decodedBytes); + const outProfile = perftools.profiles.Profile.decode(unzippedBytes); + + // compare to decodedTimeProfile, which is equivalent to timeProfile, + // but numbers are replaced with longs. + assert.deepEqual(decodedTimeProfile, outProfile); + }); + it('should throw error when time profiling is not enabled.', async () => { + const config = extend(true, {}, testConfig); + config.disableTime = true; + const profiler = new Profiler(config); + const requestProf = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {instance: 'test-instance'} + }; + try { + await profiler.writeTimeProfile(requestProf); + assert.fail('expected error, no error thrown'); + } catch (err) { + assert.equal( + err.message, + 'Cannot collect time profile, time profiler not enabled.'); + } + }); + }); + describe('writeHeapProfile', () => { + it('should return request with base64-encoded profile when time profiling' + + ' enabled', + async () => { + const profiler = new Profiler(testConfig); + profiler.heapProfiler = instance(mockHeapProfiler); + + const requestProf = { + name: 'projects/12345678901/test-projectId', + profileType: 'HEAP', + duration: '10s', + labels: {instance: 'test-instance'} + }; + + const outRequestProfile = await profiler.writeHeapProfile(requestProf); + const encodedBytes = outRequestProfile.profileBytes; + + if (encodedBytes === undefined) { + assert.fail('profile bytes are undefined.'); + } + + const decodedBytes = Buffer.from(encodedBytes as string, 'base64'); + const unzippedBytes = await pify(zlib.gunzip)(decodedBytes); + const outProfile = perftools.profiles.Profile.decode(unzippedBytes); + + // compare to decodedTimeProfile, which is equivalent to timeProfile, + // but numbers are replaced with longs. + assert.deepEqual(decodedHeapProfile, outProfile); + }); + it('should throw error when heap profiling is not enabled.', async () => { + const config = extend(true, {}, testConfig); + config.disableHeap = true; + const profiler = new Profiler(config); + const requestProf = { + name: 'projects/12345678901/test-projectId', + profileType: 'HEAP', + duration: '10s', + labels: {instance: 'test-instance'} + }; + try { + await profiler.writeHeapProfile(requestProf); + assert.fail('expected error, no error thrown'); + } catch (err) { + assert.equal( + err.message, + 'Cannot collect heap profile, heap profiler not enabled.'); + } + }); + }); + describe('profileAndUpload', () => { + let requestStub: undefined|sinon.SinonStub; + afterEach(() => { + if (requestStub) { + requestStub.restore(); + } + }); + it('should send request to upload time profile.', async () => { + const requestProf = { + name: 'projects/12345678901/test-projectId', + duration: '10s', + profileType: 'WALL', + labels: {instance: 'test-instance'} + }; + const expBody = + extend(true, {profileBytes: base64TimeProfile}, requestProf); + nockOauth2(); + const uploadProfileMock = + nock(API) + .patch('/' + requestProf.name) + .reply(200, (uri: string, requestBody: {}) => { + assert.deepEqual(expBody, requestBody); + }); + + const profiler = new Profiler(testConfig); + profiler.timeProfiler = instance(mockTimeProfiler); + await profiler.profileAndUpload(requestProf); + assert.ok(uploadProfileMock.isDone(), 'expected call to upload profile'); + }); + it('should send request to upload heap profile.', async () => { + const requestProf = { + name: 'projects/12345678901/test-projectId', + duration: '10s', + profileType: 'HEAP', + labels: {instance: 'test-instance'} + }; + const expBody = + extend(true, {profileBytes: base64HeapProfile}, requestProf); + nockOauth2(); + const uploadProfileMock = + nock(API) + .patch('/' + requestProf.name) + .reply(200, (uri: string, requestBody: {}) => { + assert.deepEqual(expBody, requestBody); + }); + + const profiler = new Profiler(testConfig); + profiler.heapProfiler = instance(mockHeapProfiler); + await profiler.profileAndUpload(requestProf); + assert.ok(uploadProfileMock.isDone(), 'expected call to upload profile'); + }); + it('should throw error when profile type unknown.', async () => { + const requestProf = { + name: 'projects/12345678901/test-projectId', + duration: '10s', + profileType: 'UNKNOWN_PROFILE_TYPE', + labels: {instance: 'test-instance'} + }; + const profiler = new Profiler(testConfig); + try { + await profiler.profileAndUpload(requestProf); + assert.fail('expected error, no error thrown'); + } catch (err) { + assert.equal( + err.message, 'Unexpected profile type UNKNOWN_PROFILE_TYPE.'); + } + }); + it('should throw error when error thrown by http request.', async () => { + const requestProf = { + name: 'projects/12345678901/test-projectId', + duration: '10s', + profileType: 'WALL', + labels: {instance: 'test-instance'} + }; + requestStub = sinon.stub(common.ServiceObject.prototype, 'request') + .rejects(new Error('Network error')); + const profiler = new Profiler(testConfig); + profiler.timeProfiler = instance(mockTimeProfiler); + try { + await profiler.profileAndUpload(requestProf); + assert.fail('expected error, no error thrown'); + } catch (err) { + assert.equal(err.message, 'Network error'); + } + }); + it('should throw error when non-200 status code returned.', async () => { + const requestProf = { + name: 'projects/12345678901/test-projectId', + duration: '10s', + profileType: 'WALL', + labels: {instance: 'test-instance'} + }; + requestStub = + sinon.stub(common.ServiceObject.prototype, 'request') + .returns(new Promise(resolve => { + resolve( + [undefined, {statusCode: 500, statusMessage: 'Error 500'}]); + })); + const profiler = new Profiler(testConfig); + profiler.timeProfiler = instance(mockTimeProfiler); + try { + await profiler.profileAndUpload(requestProf); + assert.fail('expected error, no error thrown'); + } catch (err) { + assert.equal(err.message, 'Could not upload profile: Error 500.'); + } + }); + }); + describe('createProfile', () => { + let requestStub: undefined|sinon.SinonStub; + afterEach(() => { + if (requestStub) { + requestStub.restore(); + } + }); + it('should send request for only wall profile when heap disabled.', + async () => { + const config = extend(true, {}, testConfig); + config.disableHeap = true; + const response = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {instance: config.instance} + }; + nockOauth2(); + const requestProfileMock = + nock(API) + .post('/projects/' + testConfig.projectId + '/profiles') + .once() + .reply(200, response); + const profiler = new Profiler(testConfig); + const actualResponse = await profiler.createProfile(); + assert.deepEqual(response, actualResponse); + assert.ok( + requestProfileMock.isDone(), 'expected call to create profile'); + }); + it('should keep additional fields in request profile.', async () => { + const config = extend(true, {}, testConfig); + config.disableHeap = true; + const response = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {instance: config.instance}, + additionalField: 'additionalField' + }; + nockOauth2(); + const requestProfileMock = + nock(API) + .post('/projects/' + testConfig.projectId + '/profiles') + .once() + .reply(200, response); + const profiler = new Profiler(testConfig); + const actualResponse = await profiler.createProfile(); + assert.deepEqual(response, actualResponse); + }); + it('should throw error when error thrown by http request.', async () => { + const config = extend(true, {}, testConfig); + config.disableHeap = true; + const response = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {instance: config.instance} + }; + requestStub = sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .returns(Promise.reject(new Error('Network error'))); + const profiler = new Profiler(testConfig); + try { + await profiler.createProfile(); + assert.fail('expected error, no error thrown'); + } catch (err) { + assert.equal(err.message, 'Network error'); + } + }); + it('should throw status message when response has non-200 status.', + async () => { + const config = extend(true, {}, testConfig); + const response = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {instance: config.instance} + }; + requestStub = + sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .returns(new Promise(resolve => { + resolve([ + {}, {statusCode: 500, statusMessage: '500 status code'} + ]); + })); + + const profiler = new Profiler(testConfig); + try { + await profiler.createProfile(); + assert.fail('expected error, no error thrown'); + } catch (err) { + assert.equal(err.message, '500 status code'); + } + }); + it('should throw status code when response has non-200 status and no status message.', + async () => { + const config = extend(true, {}, testConfig); + const response = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {instance: config.instance} + }; + requestStub = sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .returns(new Promise(resolve => { + resolve([{}, {statusCode: 500}]); + })); + + const profiler = new Profiler(testConfig); + try { + await profiler.createProfile(); + assert.fail('expected error, no error thrown'); + } catch (err) { + assert.equal(err.message, '500'); + } + }); + }); + describe('collectProfile', () => { + let requestStub: undefined|sinon.SinonStub; + afterEach(() => { + if (requestStub) { + requestStub.restore(); + } + }); + it('should indicate collectProfile should be called immediately when no errors', + async () => { + const config = extend(true, {}, testConfig); + const requestProfileResponseBody = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {instance: config.instance} + }; + const expUploadedProfile = extend( + true, {}, requestProfileResponseBody, + {profileBytes: base64TimeProfile}); + requestStub = + sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .returns(new Promise(resolve => { + resolve([requestProfileResponseBody, {statusCode: 200}]); + })) + .onCall(1) + .returns(new Promise(resolve => { + resolve([{}, {statusCode: 200}]); + })); + + + const profiler = new Profiler(testConfig); + profiler.timeProfiler = instance(mockTimeProfiler); + const delayMillis = await profiler.collectProfile(); + assert.deepEqual( + expUploadedProfile, requestStub.secondCall.args[0].body); + assert.equal( + 0, delayMillis, 'No delay before asking to collect next profile'); + }); + it('should indicate collectProfile should be called after some backoff' + + 'when error in requesting profile', + async () => { + const config = extend(true, {}, testConfig); + const requestProfileResponseBody = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {instance: config.instance} + }; + const expUploadedProfile = extend( + true, {}, requestProfileResponseBody, + {profileBytes: base64TimeProfile}); + requestStub = sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .returns(new Promise(resolve => { + resolve([{}, {statusCode: 404}]); + })); + + + const profiler = new Profiler(testConfig); + profiler.timeProfiler = instance(mockTimeProfiler); + const delayMillis = await profiler.collectProfile(); + assert.equal( + 1000, delayMillis, + 'No delay before asking to collect next profile'); + }); + it('should indicate collectProfile should be called immediately error' + + ' in collecting and uploading profile.', + async () => { + const config = extend(true, {}, testConfig); + const requestProfileResponseBody = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {instance: config.instance} + }; + const expUploadedProfile = extend( + true, {}, requestProfileResponseBody, + {profileBytes: base64TimeProfile}); + requestStub = + sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .returns(new Promise(resolve => { + resolve([requestProfileResponseBody, {statusCode: 200}]); + })) + .onCall(1) + .returns(Promise.reject('Error uploading profile')); + + + const profiler = new Profiler(testConfig); + profiler.timeProfiler = instance(mockTimeProfiler); + const delayMillis = await profiler.collectProfile(); + assert.equal( + 0, delayMillis, 'No delay before asking to collect next profile'); + }); + }); +}); diff --git a/handwritten/cloud-profiler/ts/test/test-time-profiler.ts b/handwritten/cloud-profiler/ts/test/test-time-profiler.ts index 0e0938c01bb..244b61583f6 100644 --- a/handwritten/cloud-profiler/ts/test/test-time-profiler.ts +++ b/handwritten/cloud-profiler/ts/test/test-time-profiler.ts @@ -27,16 +27,19 @@ const v8TimeProfiler = require('bindings')('time_profiler'); describe('TimeProfiler', () => { describe('profile', () => { + const sinonStubs: sinon.SinonStub[] = new Array(); before(() => { - sinon.stub(v8TimeProfiler, 'startProfiling'); - sinon.stub(v8TimeProfiler, 'stopProfiling').returns(v8TimeProfile); - sinon.stub(v8TimeProfiler, 'setSamplingInterval'); + sinonStubs.push(sinon.stub(v8TimeProfiler, 'startProfiling')); + sinonStubs.push( + sinon.stub(v8TimeProfiler, 'stopProfiling').returns(v8TimeProfile)); + sinonStubs.push(sinon.stub(v8TimeProfiler, 'setSamplingInterval')); + sinonStubs.push(sinon.stub(Date, 'now').returns(0)); }); after(() => { - v8TimeProfiler.startProfiling.restore(); - v8TimeProfiler.stopProfiling.restore(); - v8TimeProfiler.setSamplingInterval.restore(); + sinonStubs.forEach((stub) => { + stub.restore(); + }); }); it('should profile during duration and finish profiling after duration', diff --git a/handwritten/cloud-profiler/ts/third_party/types/README.google b/handwritten/cloud-profiler/ts/third_party/types/README.google index fcc6d07b7d6..fdf267735d5 100644 --- a/handwritten/cloud-profiler/ts/third_party/types/README.google +++ b/handwritten/cloud-profiler/ts/third_party/types/README.google @@ -6,5 +6,7 @@ Description: cloud-debug-nodejs provides Stackdriver Debugger support for Node.js applications. Local Modifications: - All code except common-types.ts and gcp-metadata-types.ts has been - removed. + All code except common-types.ts has been removed. + RequestOptions interface added. + ServiceObject interface modified so promisified request can be used. + Definitions modified to comply with gts 0.5 diff --git a/handwritten/cloud-profiler/ts/third_party/types/common-types.ts b/handwritten/cloud-profiler/ts/third_party/types/common-types.ts index 13ec1afe084..39f1bf6cf05 100644 --- a/handwritten/cloud-profiler/ts/third_party/types/common-types.ts +++ b/handwritten/cloud-profiler/ts/third_party/types/common-types.ts @@ -84,13 +84,17 @@ export interface Service { new(config: ServiceConfig, options: AuthenticationConfig): Service; } +export interface RequestOptions { + uri: string; + json: boolean; + method?: string; + body?: {}; +} + export interface ServiceObject { new(config: ServiceObjectConfig): ServiceObject; // TODO: Determine if this signature is correct. - request: - (reqOpts: {uri: string, json: boolean}, - callback: (err: Error, body: object, response: http.ServerResponse) => - void) => void; + request: (reqOpts: RequestOptions) => Promise; } export interface Common { @@ -99,8 +103,7 @@ export interface Common { logger: Logger; util: { // TODO: Make this more precise. - normalizeArguments: - (globalContext: object|null, localConfig: object, options?: object) => - object; + normalizeArguments: ( + globalContext: object|null, localConfig: T, options?: object) => T; }; } From 9a9918c618ce1d11b22775ab06d500cf1ab2340f Mon Sep 17 00:00:00 2001 From: Maggie Nolan Date: Thu, 16 Nov 2017 07:36:50 -0800 Subject: [PATCH 041/632] 0.1.3 --- handwritten/cloud-profiler/package-lock.json | 2 +- handwritten/cloud-profiler/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 11724abe7b4..3ac31ed754d 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.2", + "version": "0.1.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 7562f85ea92..0a2b3643af7 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.2", + "version": "0.1.3", "description": "Adds support for Google Cloud Profiler to node.js applications", "repository": "GoogleCloudPlatform/cloud-profiler-nodejs", "main": "out/src/index.js", From a58b242e42b67784a91aafe4c574e10f610e16b7 Mon Sep 17 00:00:00 2001 From: Maggie Nolan Date: Thu, 16 Nov 2017 16:42:19 -0800 Subject: [PATCH 042/632] 0.1.4 --- handwritten/cloud-profiler/package-lock.json | 2 +- handwritten/cloud-profiler/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 3ac31ed754d..d3648973f51 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.3", + "version": "0.1.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 0a2b3643af7..c417905dc8a 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.3", + "version": "0.1.4", "description": "Adds support for Google Cloud Profiler to node.js applications", "repository": "GoogleCloudPlatform/cloud-profiler-nodejs", "main": "out/src/index.js", From 2244bfb4bf7e2d236cac3bc68c81027e06c18745 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Fri, 17 Nov 2017 07:21:16 -0800 Subject: [PATCH 043/632] move protobufjs from devDependecies to dependencies (#59) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index c417905dc8a..ace35a77cbe 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -33,6 +33,7 @@ "nan": "^2.1.0", "parse-duration": "^0.1.1", "pify": "^3.0.0", + "protobufjs": "~6.8.0", "request": "^2.83.0", "retry-request": "^3.0.1" }, @@ -52,7 +53,6 @@ "mocha": "^4.0.1", "nock": "^9.0.22", "nyc": "^11.2.1", - "protobufjs": "~6.8.0", "sinon": "^4.0.1", "ts-mockito": "^2.2.5", "typescript": "~2.6.x" From c64daaa18a82acb9ffc33c2114ff685fa8eea4f2 Mon Sep 17 00:00:00 2001 From: Maggie Nolan Date: Fri, 17 Nov 2017 08:14:03 -0800 Subject: [PATCH 044/632] 0.1.5 --- handwritten/cloud-profiler/package-lock.json | 2 +- handwritten/cloud-profiler/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index d3648973f51..f4c60d3d71b 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.4", + "version": "0.1.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index ace35a77cbe..120bde66b6a 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.4", + "version": "0.1.5", "description": "Adds support for Google Cloud Profiler to node.js applications", "repository": "GoogleCloudPlatform/cloud-profiler-nodejs", "main": "out/src/index.js", From 80c15be0901878f28a87a3af52907c80cd2e76bd Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Fri, 17 Nov 2017 10:19:38 -0800 Subject: [PATCH 045/632] fix: avoid unnecessary deprecated buffer constructor (#62) The Buffer constructor is deprecated. It was unnecessary anyway as the value returned by `finish` is a Buffer anyway. --- handwritten/cloud-profiler/ts/src/profiler.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/ts/src/profiler.ts b/handwritten/cloud-profiler/ts/src/profiler.ts index 626f228c30e..d4746e4a8ba 100644 --- a/handwritten/cloud-profiler/ts/src/profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profiler.ts @@ -119,8 +119,7 @@ function hasHttpStatusCode(response: any): * @param p - profile to be converted to string. */ async function profileBytes(p: perftools.profiles.IProfile): Promise { - const pwriter = perftools.profiles.Profile.encode(p); - const buffer = new Buffer(pwriter.finish()); + const buffer = perftools.profiles.Profile.encode(p).finish(); const gzBuf = await gzip(buffer); return gzBuf.toString('base64'); } From 92fd76e8871bd399455b871074abe15cde5ee715 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Fri, 17 Nov 2017 14:24:11 -0800 Subject: [PATCH 046/632] build: add source-map-support for better stack traces (#60) --- handwritten/cloud-profiler/package-lock.json | 53 ++++++++++---------- handwritten/cloud-profiler/package.json | 3 +- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index f4c60d3d71b..74a9c3e4791 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -32,32 +32,27 @@ "@protobufjs/aspromise": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=", - "dev": true + "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" }, "@protobufjs/base64": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", - "dev": true + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" }, "@protobufjs/codegen": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", - "dev": true + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" }, "@protobufjs/eventemitter": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=", - "dev": true + "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" }, "@protobufjs/fetch": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", - "dev": true, "requires": { "@protobufjs/aspromise": "1.1.2", "@protobufjs/inquire": "1.1.0" @@ -66,32 +61,27 @@ "@protobufjs/float": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=", - "dev": true + "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" }, "@protobufjs/inquire": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=", - "dev": true + "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" }, "@protobufjs/path": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=", - "dev": true + "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" }, "@protobufjs/pool": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=", - "dev": true + "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" }, "@protobufjs/utf8": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=", - "dev": true + "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" }, "@types/delay": { "version": "2.0.1", @@ -117,8 +107,7 @@ "@types/long": { "version": "3.0.32", "resolved": "https://registry.npmjs.org/@types/long/-/long-3.0.32.tgz", - "integrity": "sha512-ZXyOOm83p7X8p3s0IYM3VeueNmHpkk/yMlP8CLeOnEcu6hIwPH7YjZBvhQkR0ZFS2DqZAxKtJ/M5fcuv3OU5BA==", - "dev": true + "integrity": "sha512-ZXyOOm83p7X8p3s0IYM3VeueNmHpkk/yMlP8CLeOnEcu6hIwPH7YjZBvhQkR0ZFS2DqZAxKtJ/M5fcuv3OU5BA==" }, "@types/mocha": { "version": "2.2.44", @@ -1585,8 +1574,7 @@ "long": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", - "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=", - "dev": true + "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=" }, "loud-rejection": { "version": "1.6.0", @@ -3833,7 +3821,6 @@ "version": "6.8.0", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.0.tgz", "integrity": "sha512-47Y49f5JN5Qsbxas2TyI2zFO8j9GpQAQm5thf54fr2O8qcP/jkIXYxmYx1hN2WQFAhESU1xpVn5NWVDBB8WFnw==", - "dev": true, "requires": { "@protobufjs/aspromise": "1.1.2", "@protobufjs/base64": "1.1.2", @@ -3853,8 +3840,7 @@ "@types/node": { "version": "7.0.46", "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.46.tgz", - "integrity": "sha512-u+JAi1KtmaUoU/EHJkxoiuvzyo91FCE41Z9TZWWcOUU3P8oUdlDLdrGzCGWySPgbRMD17B0B+1aaJLYI9egQ6A==", - "dev": true + "integrity": "sha512-u+JAi1KtmaUoU/EHJkxoiuvzyo91FCE41Z9TZWWcOUU3P8oUdlDLdrGzCGWySPgbRMD17B0B+1aaJLYI9egQ6A==" } } }, @@ -4127,6 +4113,21 @@ "hoek": "4.2.0" } }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.0.tgz", + "integrity": "sha512-vUoN3I7fHQe0R/SJLKRdKYuEdRGogsviXFkHHo17AWaTGv17VLnxw+CFXvqy+y4ORZ3doWLQcxRYfwKrsd/H7Q==", + "dev": true, + "requires": { + "source-map": "0.6.1" + } + }, "spdx-correct": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 120bde66b6a..15bc593c9a9 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -7,7 +7,7 @@ "types": "out/src/index.d.ts", "scripts": { "install": "node-gyp rebuild", - "test": "nyc mocha out/test/test-*.js", + "test": "nyc mocha --require source-map-support/register out/test/test-*.js", "check": "gts check", "clean": "gts clean", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json", @@ -54,6 +54,7 @@ "nock": "^9.0.22", "nyc": "^11.2.1", "sinon": "^4.0.1", + "source-map-support": "^0.5.0", "ts-mockito": "^2.2.5", "typescript": "~2.6.x" }, From 6cb5c96ffef7817d721fefc94fc81c3722320c41 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Sun, 19 Nov 2017 14:58:25 -0800 Subject: [PATCH 047/632] fix(package): update @google-cloud/common to version 0.15.0 (#64) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 15bc593c9a9..2f9efd8593a 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -25,7 +25,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/common": "^0.14.0", + "@google-cloud/common": "^0.15.0", "bindings": "^1.2.1", "delay": "^2.0.0", "extend": "^3.0.1", From dc9ef154e2e9a75f360c4394fe21072592c9332b Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Mon, 20 Nov 2017 07:44:07 -0800 Subject: [PATCH 048/632] update tests for mac (#63) * update tests for mac * update travis * remove travis testing for mac --- .../ts/test/profiles-for-tests.ts | 12 --- .../cloud-profiler/ts/test/test-profiler.ts | 80 ++++++++++--------- 2 files changed, 44 insertions(+), 48 deletions(-) diff --git a/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts index e4316e9db73..1f404297c62 100644 --- a/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts +++ b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts @@ -157,13 +157,6 @@ const encodedTimeProfile = export const decodedTimeProfile = perftools.profiles.Profile.decode(encodedTimeProfile); -export const base64TimeProfile = 'H4sIAAAAAAAAA0XPMQrCMBQGYPOSNGkQGrrYsRRc3J' + - 'pTODo7KbFCwKalTXeP4g1cPYKjx+gxfCmI28f//vfgKSaJBsUk1SxPFQDJKZlFLhWBnNLXJ' + - 'oYUCZ8sksEyr6QkVVwlKECB5ihaxUMZii2Z2mFP84KXCQq0KEQpUXRRYlZGjOe2vzWj4bab' + - 'fDAsuLYx69bZoRsb2/nLaNLr5G1wnTdYt4Prg/ln9S+r96vD/f18bI/LM6dZfAGLaAVw3AA' + - 'AAA=='; - - const heapLeaf1 = { name: 'function2', scriptName: 'script1', @@ -275,11 +268,6 @@ const encodedHeapProfile = export const decodedHeapProfile = perftools.profiles.Profile.decode(encodedHeapProfile); -export const base64HeapProfile = 'H4sIAAAAAAAAA0XPvQqDQBAEYO9nvfWaHELAUqxCOjc' + - 'vkTJ1quhhwEBU4lmk87HyeFlNwO5jGAbGahROWo3K6dRYIVIp4A+1TxOrlGTiJbU/qt0HF+v' + - 'FMB8KRFEsI4IlWdIBSxXLpGVplnZ45J6DDHJgSRdncW5YymGGq7RLsiQ3FJHp60fjw0jg+6k' + - 'LBONQ+YagfodmJP2s2o6S+9T50PZdSWb0r3YI5ZadNtI5uq7nbvOcfwHxB6/r7QAAAA=='; - const anonymousHeapNode = { scriptName: 'main', scriptId: 0, diff --git a/handwritten/cloud-profiler/ts/test/test-profiler.ts b/handwritten/cloud-profiler/ts/test/test-profiler.ts index 13ada239cf0..bad7002ae68 100644 --- a/handwritten/cloud-profiler/ts/test/test-profiler.ts +++ b/handwritten/cloud-profiler/ts/test/test-profiler.ts @@ -29,7 +29,7 @@ import {HeapProfiler} from '../src/profilers/heap-profiler'; import {TimeProfiler} from '../src/profilers/time-profiler'; import {Common} from '../third_party/types/common-types'; -import {base64HeapProfile, base64TimeProfile, decodedHeapProfile, decodedTimeProfile, heapProfile, timeProfile} from './profiles-for-tests'; +import {decodedHeapProfile, decodedTimeProfile, heapProfile, timeProfile} from './profiles-for-tests'; const common: Common = require('@google-cloud/common'); const v8TimeProfiler = require('bindings')('time_profiler'); @@ -94,7 +94,11 @@ describe('Profiler', () => { labels: {instance: 'test-instance'} }; const prof = await profiler.profile(requestProf); - assert.deepEqual(prof.profileBytes, base64TimeProfile); + const decodedBytes = + Buffer.from(prof.profileBytes as 'string', 'base64'); + const unzippedBytes = await pify(zlib.gunzip)(decodedBytes); + const outProfile = perftools.profiles.Profile.decode(unzippedBytes); + assert.deepEqual(decodedTimeProfile, outProfile); }); it('should return expected profile when profile type is HEAP.', async () => { @@ -107,7 +111,11 @@ describe('Profiler', () => { labels: {instance: 'test-instance'} }; const prof = await profiler.profile(requestProf); - assert.deepEqual(prof.profileBytes, base64HeapProfile); + const decodedBytes = + Buffer.from(prof.profileBytes as 'string', 'base64'); + const unzippedBytes = await pify(zlib.gunzip)(decodedBytes); + const outProfile = perftools.profiles.Profile.decode(unzippedBytes); + assert.deepEqual(decodedHeapProfile, outProfile); }); it('should throw error when unexpected profile type is requested.', async () => { @@ -239,20 +247,27 @@ describe('Profiler', () => { profileType: 'WALL', labels: {instance: 'test-instance'} }; - const expBody = - extend(true, {profileBytes: base64TimeProfile}, requestProf); - nockOauth2(); - const uploadProfileMock = - nock(API) - .patch('/' + requestProf.name) - .reply(200, (uri: string, requestBody: {}) => { - assert.deepEqual(expBody, requestBody); - }); + + requestStub = sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .returns(new Promise(resolve => { + resolve([{}, {statusCode: 200}]); + })); const profiler = new Profiler(testConfig); profiler.timeProfiler = instance(mockTimeProfiler); await profiler.profileAndUpload(requestProf); - assert.ok(uploadProfileMock.isDone(), 'expected call to upload profile'); + + const uploaded = requestStub.firstCall.args[0].body; + const decodedBytes = + Buffer.from(uploaded.profileBytes as string, 'base64'); + const unzippedBytes = await pify(zlib.gunzip)(decodedBytes); + const outProfile = perftools.profiles.Profile.decode(unzippedBytes); + assert.deepEqual(decodedTimeProfile, outProfile); + + uploaded.profileBytes = undefined; + assert.deepEqual(uploaded, requestProf); + }); it('should send request to upload heap profile.', async () => { const requestProf = { @@ -261,20 +276,26 @@ describe('Profiler', () => { profileType: 'HEAP', labels: {instance: 'test-instance'} }; - const expBody = - extend(true, {profileBytes: base64HeapProfile}, requestProf); - nockOauth2(); - const uploadProfileMock = - nock(API) - .patch('/' + requestProf.name) - .reply(200, (uri: string, requestBody: {}) => { - assert.deepEqual(expBody, requestBody); - }); + + requestStub = sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .returns(new Promise(resolve => { + resolve([{}, {statusCode: 200}]); + })); const profiler = new Profiler(testConfig); profiler.heapProfiler = instance(mockHeapProfiler); await profiler.profileAndUpload(requestProf); - assert.ok(uploadProfileMock.isDone(), 'expected call to upload profile'); + + const uploaded = requestStub.firstCall.args[0].body; + const decodedBytes = + Buffer.from(uploaded.profileBytes as string, 'base64'); + const unzippedBytes = await pify(zlib.gunzip)(decodedBytes); + const outProfile = perftools.profiles.Profile.decode(unzippedBytes); + assert.deepEqual(decodedHeapProfile, outProfile); + + uploaded.profileBytes = undefined; + assert.deepEqual(uploaded, requestProf); }); it('should throw error when profile type unknown.', async () => { const requestProf = { @@ -468,9 +489,6 @@ describe('Profiler', () => { duration: '10s', labels: {instance: config.instance} }; - const expUploadedProfile = extend( - true, {}, requestProfileResponseBody, - {profileBytes: base64TimeProfile}); requestStub = sinon.stub(common.ServiceObject.prototype, 'request') .onCall(0) @@ -486,8 +504,6 @@ describe('Profiler', () => { const profiler = new Profiler(testConfig); profiler.timeProfiler = instance(mockTimeProfiler); const delayMillis = await profiler.collectProfile(); - assert.deepEqual( - expUploadedProfile, requestStub.secondCall.args[0].body); assert.equal( 0, delayMillis, 'No delay before asking to collect next profile'); }); @@ -501,9 +517,6 @@ describe('Profiler', () => { duration: '10s', labels: {instance: config.instance} }; - const expUploadedProfile = extend( - true, {}, requestProfileResponseBody, - {profileBytes: base64TimeProfile}); requestStub = sinon.stub(common.ServiceObject.prototype, 'request') .onCall(0) .returns(new Promise(resolve => { @@ -528,9 +541,6 @@ describe('Profiler', () => { duration: '10s', labels: {instance: config.instance} }; - const expUploadedProfile = extend( - true, {}, requestProfileResponseBody, - {profileBytes: base64TimeProfile}); requestStub = sinon.stub(common.ServiceObject.prototype, 'request') .onCall(0) @@ -539,8 +549,6 @@ describe('Profiler', () => { })) .onCall(1) .returns(Promise.reject('Error uploading profile')); - - const profiler = new Profiler(testConfig); profiler.timeProfiler = instance(mockTimeProfiler); const delayMillis = await profiler.collectProfile(); From 1953ec2e82dfeb56cbc72da79d5255bb4504a79a Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Mon, 20 Nov 2017 07:44:59 -0800 Subject: [PATCH 049/632] don't send instance and zone if values not specified (#57) * don't send instance and zone if values not specified * confirm empty strings not sent for instance and zone --- handwritten/cloud-profiler/ts/src/config.ts | 6 +- handwritten/cloud-profiler/ts/src/index.ts | 6 +- handwritten/cloud-profiler/ts/src/profiler.ts | 24 +++++--- .../ts/test/test-init-config.ts | 2 - .../cloud-profiler/ts/test/test-profiler.ts | 58 +++++++++++++++++++ 5 files changed, 79 insertions(+), 17 deletions(-) diff --git a/handwritten/cloud-profiler/ts/src/config.ts b/handwritten/cloud-profiler/ts/src/config.ts index afccf578eb5..403d819907a 100644 --- a/handwritten/cloud-profiler/ts/src/config.ts +++ b/handwritten/cloud-profiler/ts/src/config.ts @@ -87,8 +87,8 @@ export interface ProfilerConfig extends AuthenticationConfig { projectId?: string; logLevel: number; serviceContext: {service: string; version?: string;}; - instance: string; - zone: string; + instance?: string; + zone?: string; disableTime: boolean; disableHeap: boolean; timeIntervalMicros: number; @@ -103,8 +103,6 @@ export const defaultConfig = { serviceContext: {}, disableHeap: false, disableTime: false, - instance: '', - zone: '', timeIntervalMicros: 1000, heapIntervalBytes: 512 * 1024, heapMaxStackDepth: 64, diff --git a/handwritten/cloud-profiler/ts/src/index.ts b/handwritten/cloud-profiler/ts/src/index.ts index 161ff31c864..1e494f3fdd8 100644 --- a/handwritten/cloud-profiler/ts/src/index.ts +++ b/handwritten/cloud-profiler/ts/src/index.ts @@ -84,11 +84,11 @@ export async function initConfig(config: Config): Promise { (err: Error) => { // ignore errors, which will occur when not on GCE. }) || - ['', '']; - if (!mergedConfig.zone) { + [undefined, undefined]; + if (!mergedConfig.zone && zone) { mergedConfig.zone = zone.substring(zone.lastIndexOf('/') + 1); } - if (!mergedConfig.instance) { + if (!mergedConfig.instance && instance) { mergedConfig.instance = instance; } } diff --git a/handwritten/cloud-profiler/ts/src/profiler.ts b/handwritten/cloud-profiler/ts/src/profiler.ts index d4746e4a8ba..0293506179b 100644 --- a/handwritten/cloud-profiler/ts/src/profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profiler.ts @@ -69,7 +69,7 @@ export interface RequestProfile { duration: string; profileBytes?: string; deployment?: Deployment; - labels?: {instance: string}; + labels?: {instance?: string}; } /** @@ -96,7 +96,8 @@ function isRequestProfile(prof: any): prof is RequestProfile { return prof && typeof prof.name === 'string' && typeof prof.profileType === 'string' && typeof prof.duration === 'string' && - (prof.labels === undefined || typeof prof.labels.instance === 'string') && + (prof.labels === undefined || prof.labels.instance === undefined || + typeof prof.labels.instance === 'string') && (prof.deployment === undefined || isDeployment(prof.deployment)); } @@ -131,7 +132,7 @@ async function profileBytes(p: perftools.profiles.IProfile): Promise { export class Profiler extends common.ServiceObject { private config: ProfilerConfig; private logger: Logger; - private profileLabels: {instance: string}; + private profileLabels: {instance?: string}; private deployment: Deployment; private profileTypes: string[]; @@ -155,16 +156,23 @@ export class Profiler extends common.ServiceObject { tag: pjson.name }); + const labels: {zone?: string, version?: string} = {}; + if (this.config.zone) { + labels.zone = this.config.zone; + } + if (this.config.serviceContext.version) { + labels.version = this.config.serviceContext.version; + } this.deployment = { projectId: this.config.projectId, target: this.config.serviceContext.service, - labels: { - zone: this.config.zone, - version: this.config.serviceContext.version - } + labels }; - this.profileLabels = {instance: this.config.instance}; + this.profileLabels = {}; + if (this.config.instance) { + this.profileLabels.instance = this.config.instance; + } this.profileTypes = []; if (!this.config.disableTime) { diff --git a/handwritten/cloud-profiler/ts/test/test-init-config.ts b/handwritten/cloud-profiler/ts/test/test-init-config.ts index a7bfefaeab1..d2284698976 100644 --- a/handwritten/cloud-profiler/ts/test/test-init-config.ts +++ b/handwritten/cloud-profiler/ts/test/test-init-config.ts @@ -151,8 +151,6 @@ describe('initConfig', () => { serviceContext: {service: 'fake-service'}, disableHeap: false, disableTime: false, - instance: '', - zone: '', projectId: 'fake-projectId', timeIntervalMicros: 1000, heapIntervalBytes: 512 * 1024, diff --git a/handwritten/cloud-profiler/ts/test/test-profiler.ts b/handwritten/cloud-profiler/ts/test/test-profiler.ts index bad7002ae68..2052ba6d0d7 100644 --- a/handwritten/cloud-profiler/ts/test/test-profiler.ts +++ b/handwritten/cloud-profiler/ts/test/test-profiler.ts @@ -383,6 +383,64 @@ describe('Profiler', () => { assert.ok( requestProfileMock.isDone(), 'expected call to create profile'); }); + it('should not have instance and zone in request body when instance and' + + ' zone undefined', + async () => { + const config = extend(true, {}, testConfig); + config.instance = undefined; + config.zone = undefined; + const response = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + }; + requestStub = sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .returns(new Promise(resolve => { + resolve([response, {statusCode: 200}]); + })); + const expRequestBody = { + deployment: { + labels: {version: 'test-version'}, + projectId: 'test-projectId', + target: 'test-service' + }, + profileType: ['WALL', 'HEAP'] + }; + const profiler = new Profiler(config); + const actualResponse = await profiler.createProfile(); + assert.deepEqual(response, actualResponse); + assert.deepEqual(expRequestBody, requestStub.firstCall.args[0].body); + }); + it('should not have instance and zone in request body when instance and' + + ' zone empty strings', + async () => { + const config = extend(true, {}, testConfig); + config.instance = ''; + config.zone = ''; + const response = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + }; + requestStub = sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .returns(new Promise(resolve => { + resolve([response, {statusCode: 200}]); + })); + const expRequestBody = { + deployment: { + labels: {version: 'test-version'}, + projectId: 'test-projectId', + target: 'test-service' + }, + profileType: ['WALL', 'HEAP'] + }; + const profiler = new Profiler(config); + const actualResponse = await profiler.createProfile(); + assert.deepEqual(response, actualResponse); + assert.deepEqual(expRequestBody, requestStub.firstCall.args[0].body); + }); it('should keep additional fields in request profile.', async () => { const config = extend(true, {}, testConfig); config.disableHeap = true; From cb43b318e43d31d4cf63161b84c7236b228a2b71 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Mon, 20 Nov 2017 13:05:07 -0800 Subject: [PATCH 050/632] Revert "build: add source-map-support for better stack traces" (#72) This reverts #60. --- handwritten/cloud-profiler/package-lock.json | 53 ++++++++++---------- handwritten/cloud-profiler/package.json | 3 +- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 74a9c3e4791..f4c60d3d71b 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -32,27 +32,32 @@ "@protobufjs/aspromise": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" + "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=", + "dev": true }, "@protobufjs/base64": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "dev": true }, "@protobufjs/codegen": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "dev": true }, "@protobufjs/eventemitter": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" + "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=", + "dev": true }, "@protobufjs/fetch": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", + "dev": true, "requires": { "@protobufjs/aspromise": "1.1.2", "@protobufjs/inquire": "1.1.0" @@ -61,27 +66,32 @@ "@protobufjs/float": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" + "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=", + "dev": true }, "@protobufjs/inquire": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" + "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=", + "dev": true }, "@protobufjs/path": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" + "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=", + "dev": true }, "@protobufjs/pool": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" + "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=", + "dev": true }, "@protobufjs/utf8": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" + "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=", + "dev": true }, "@types/delay": { "version": "2.0.1", @@ -107,7 +117,8 @@ "@types/long": { "version": "3.0.32", "resolved": "https://registry.npmjs.org/@types/long/-/long-3.0.32.tgz", - "integrity": "sha512-ZXyOOm83p7X8p3s0IYM3VeueNmHpkk/yMlP8CLeOnEcu6hIwPH7YjZBvhQkR0ZFS2DqZAxKtJ/M5fcuv3OU5BA==" + "integrity": "sha512-ZXyOOm83p7X8p3s0IYM3VeueNmHpkk/yMlP8CLeOnEcu6hIwPH7YjZBvhQkR0ZFS2DqZAxKtJ/M5fcuv3OU5BA==", + "dev": true }, "@types/mocha": { "version": "2.2.44", @@ -1574,7 +1585,8 @@ "long": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", - "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=" + "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=", + "dev": true }, "loud-rejection": { "version": "1.6.0", @@ -3821,6 +3833,7 @@ "version": "6.8.0", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.0.tgz", "integrity": "sha512-47Y49f5JN5Qsbxas2TyI2zFO8j9GpQAQm5thf54fr2O8qcP/jkIXYxmYx1hN2WQFAhESU1xpVn5NWVDBB8WFnw==", + "dev": true, "requires": { "@protobufjs/aspromise": "1.1.2", "@protobufjs/base64": "1.1.2", @@ -3840,7 +3853,8 @@ "@types/node": { "version": "7.0.46", "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.46.tgz", - "integrity": "sha512-u+JAi1KtmaUoU/EHJkxoiuvzyo91FCE41Z9TZWWcOUU3P8oUdlDLdrGzCGWySPgbRMD17B0B+1aaJLYI9egQ6A==" + "integrity": "sha512-u+JAi1KtmaUoU/EHJkxoiuvzyo91FCE41Z9TZWWcOUU3P8oUdlDLdrGzCGWySPgbRMD17B0B+1aaJLYI9egQ6A==", + "dev": true } } }, @@ -4113,21 +4127,6 @@ "hoek": "4.2.0" } }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "source-map-support": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.0.tgz", - "integrity": "sha512-vUoN3I7fHQe0R/SJLKRdKYuEdRGogsviXFkHHo17AWaTGv17VLnxw+CFXvqy+y4ORZ3doWLQcxRYfwKrsd/H7Q==", - "dev": true, - "requires": { - "source-map": "0.6.1" - } - }, "spdx-correct": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 2f9efd8593a..9e3e709c773 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -7,7 +7,7 @@ "types": "out/src/index.d.ts", "scripts": { "install": "node-gyp rebuild", - "test": "nyc mocha --require source-map-support/register out/test/test-*.js", + "test": "nyc mocha out/test/test-*.js", "check": "gts check", "clean": "gts clean", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json", @@ -54,7 +54,6 @@ "nock": "^9.0.22", "nyc": "^11.2.1", "sinon": "^4.0.1", - "source-map-support": "^0.5.0", "ts-mockito": "^2.2.5", "typescript": "~2.6.x" }, From 9980323d506f93e3f6ba2a3496377631e5be71df Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Tue, 21 Nov 2017 11:30:13 -0800 Subject: [PATCH 051/632] updated logged messages (#69) --- handwritten/cloud-profiler/ts/src/profiler.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/handwritten/cloud-profiler/ts/src/profiler.ts b/handwritten/cloud-profiler/ts/src/profiler.ts index 0293506179b..09d56d6a58e 100644 --- a/handwritten/cloud-profiler/ts/src/profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profiler.ts @@ -228,14 +228,13 @@ export class Profiler extends common.ServiceObject { try { prof = await this.createProfile(); } catch (err) { - this.logger.error( - `Error requesting profile type to be collected: ${err}.`); + this.logger.error(`Failed to create profile: ${err}`); return this.config.backoffMillis; } try { await this.profileAndUpload(prof); } catch (err) { - this.logger.error(`Error collecting and uploading profile: ${err}.`); + this.logger.error(`Failed to collect and upload profile: ${err}`); } return 0; } @@ -270,7 +269,8 @@ export class Profiler extends common.ServiceObject { json: true, }; - const [body, response] = await this.request(options); + this.logger.debug(`Attempting to create profile.`); + const [prof, response] = await this.request(options); if (!hasHttpStatusCode(response)) { throw new Error('Server response missing status information.'); } @@ -282,10 +282,11 @@ export class Profiler extends common.ServiceObject { } throw new Error(message.toString()); } - if (!isRequestProfile(body)) { - throw new Error(`Profile not valid: ${body}.`); + if (!isRequestProfile(prof)) { + throw new Error(`Profile not valid: ${JSON.stringify(prof)}.`); } - return body; + this.logger.debug(`Successfully created profile ${prof.profileType}.`); + return prof; } /** @@ -297,6 +298,7 @@ export class Profiler extends common.ServiceObject { */ async profileAndUpload(prof: RequestProfile): Promise { prof = await this.profile(prof); + this.logger.debug(`Successfully collected profile ${prof.profileType}.`); prof.labels = this.profileLabels; const options = { @@ -318,6 +320,7 @@ export class Profiler extends common.ServiceObject { } throw new Error(`Could not upload profile: ${message}.`); } + this.logger.debug(`Successfully uploaded profile ${prof.profileType}.`); } /** From 59cae814db185dc00a7300ebba28b847082ebc78 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 23 Nov 2017 00:48:26 -0800 Subject: [PATCH 052/632] fix: fix ESOCKETTIMEDOUT Error by increasing timeout to 1 hour for createProfile() (#76) Fixes #70 I tested by running 8 copies of the acmeAir app both before and after this change (for about 10 minutes). Before, ESOCKETTIMEDOUT errors occurred on every request to createProfile(), after, no ESOCKETTIMEDOUT errors were observed. --- handwritten/cloud-profiler/ts/src/profiler.ts | 5 +++++ handwritten/cloud-profiler/ts/test/test-profiler.ts | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/ts/src/profiler.ts b/handwritten/cloud-profiler/ts/src/profiler.ts index 09d56d6a58e..f92a1cade18 100644 --- a/handwritten/cloud-profiler/ts/src/profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profiler.ts @@ -267,6 +267,11 @@ export class Profiler extends common.ServiceObject { uri: '/profiles', body: reqBody, json: true, + + // Default timeout for for a request is 1 minute, but request to create + // profile is designed to hang until it is time to collect a profile + // (up to one hour). + timeout: parseDuration('1h'), }; this.logger.debug(`Attempting to create profile.`); diff --git a/handwritten/cloud-profiler/ts/test/test-profiler.ts b/handwritten/cloud-profiler/ts/test/test-profiler.ts index 2052ba6d0d7..209ecd08f3e 100644 --- a/handwritten/cloud-profiler/ts/test/test-profiler.ts +++ b/handwritten/cloud-profiler/ts/test/test-profiler.ts @@ -267,7 +267,6 @@ describe('Profiler', () => { uploaded.profileBytes = undefined; assert.deepEqual(uploaded, requestProf); - }); it('should send request to upload heap profile.', async () => { const requestProf = { From d1efe35d8ecdb4146eb66da986bb42893a9da681 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 23 Nov 2017 01:12:41 -0800 Subject: [PATCH 053/632] replace 'Returns' in comments with '@return' (#78) --- handwritten/cloud-profiler/ts/src/index.ts | 2 +- handwritten/cloud-profiler/ts/src/profiler.ts | 8 ++++---- .../ts/src/profilers/profile-serializer.ts | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/handwritten/cloud-profiler/ts/src/index.ts b/handwritten/cloud-profiler/ts/src/index.ts index 1e494f3fdd8..3dbdeb49e72 100644 --- a/handwritten/cloud-profiler/ts/src/index.ts +++ b/handwritten/cloud-profiler/ts/src/index.ts @@ -25,7 +25,7 @@ import {Profiler} from './profiler'; const common: Common = require('@google-cloud/common'); /** - * Returns value of metadata field. + * @return value of metadata field. * Throws error if there is a problem accessing metadata API. */ async function getMetadataInstanceField(field: string): Promise { diff --git a/handwritten/cloud-profiler/ts/src/profiler.ts b/handwritten/cloud-profiler/ts/src/profiler.ts index f92a1cade18..9fc799df74c 100644 --- a/handwritten/cloud-profiler/ts/src/profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profiler.ts @@ -37,7 +37,7 @@ enum ProfileTypes { } /** - * @return - true if http status code indicates an error and false otherwise. + * @return true if http status code indicates an error and false otherwise. */ function isErrorResponseStatusCode(code: number) { return code < 200 || code >= 300; @@ -102,7 +102,7 @@ function isRequestProfile(prof: any): prof is RequestProfile { } /** - * Returns true if response has statusCode. + * @return true if response has statusCode. */ // tslint:disable-next-line: no-any function hasHttpStatusCode(response: any): @@ -215,7 +215,7 @@ export class Profiler extends common.ServiceObject { * Waits for profiler server to tell it to collect a profile, then collects * a profile and uploads it. * - * @return - time, in ms, to wait before asking profiler server again about + * @return time, in ms, to wait before asking profiler server again about * collecting another profile. * * TODO: implement backoff and retry. When error encountered in @@ -246,7 +246,7 @@ export class Profiler extends common.ServiceObject { * * If any problem is encountered, an error will be thrown. * - * @return - a RequestProfile specifying which type of profile should be + * @return a RequestProfile specifying which type of profile should be * collected and other information needed to collect and upload a profile of * the specified type. * diff --git a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts index 9d3840a2cb4..abada940037 100644 --- a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts +++ b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts @@ -52,7 +52,7 @@ class StringTable { } /** - * Returns index of str within the table. Also adds str to string table if + * @return index of str within the table. Also adds str to string table if * str is not in the table already. */ getIndexOrAdd(str: string): number { @@ -153,7 +153,7 @@ function serialize( } /** - * Returns value type for samples counts (type:samples, units:count), and + * @return value type for samples counts (type:samples, units:count), and * adds strings used in this value type to the table. */ function createSampleCountValueType(table: StringTable): @@ -165,7 +165,7 @@ function createSampleCountValueType(table: StringTable): } /** - * Returns value type for time samples (type:time, units:microseconds), and + * @return value type for time samples (type:time, units:microseconds), and * adds strings used in this value type to the table. */ function createTimeValueType(table: StringTable): perftools.profiles.ValueType { @@ -176,7 +176,7 @@ function createTimeValueType(table: StringTable): perftools.profiles.ValueType { } /** - * Returns value type for object counts (type:objects, units:count), and + * @return value type for object counts (type:objects, units:count), and * adds strings used in this value type to the table. */ function createObjectCountValueType(table: StringTable): @@ -188,7 +188,7 @@ function createObjectCountValueType(table: StringTable): } /** - * Returns value type for memory allocations (type:space, units:bytes), and + * @return value type for memory allocations (type:space, units:bytes), and * adds strings used in this value type to the table. */ function createAllocationValueType(table: StringTable): From d585091a7e3d046bd3f320c130f6447e1d04d79e Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 23 Nov 2017 01:14:21 -0800 Subject: [PATCH 054/632] fix: make duration in RequestProfile optional, so Heap Profiles do not have to have durations (#74) Right now, duration is a required field of RequestProfile. This does not make sense because heap profiles do not need to have a duration. Prior to this change, when attempting to collect heap profiles, the following error would occur: ``` Error collecting and uploading profile: ApiError: Request contains an invalid argument ``` --- handwritten/cloud-profiler/ts/src/profiler.ts | 14 +-- .../cloud-profiler/ts/test/test-profiler.ts | 116 ++++++++++++------ 2 files changed, 83 insertions(+), 47 deletions(-) diff --git a/handwritten/cloud-profiler/ts/src/profiler.ts b/handwritten/cloud-profiler/ts/src/profiler.ts index 9fc799df74c..b169210859c 100644 --- a/handwritten/cloud-profiler/ts/src/profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profiler.ts @@ -66,7 +66,7 @@ export interface Deployment { export interface RequestProfile { name: string; profileType?: string; - duration: string; + duration?: string; profileBytes?: string; deployment?: Deployment; labels?: {instance?: string}; @@ -80,12 +80,7 @@ function isDeployment(deployment: any): deployment is Deployment { return (deployment.projectId === undefined || typeof deployment.projectId === 'string') && (deployment.target === undefined || - typeof deployment.target === 'string') && - (deployment.labels === undefined || - (deployment.labels.zone === undefined || - typeof deployment.labels.zone === 'string') && - (deployment.labels.version === undefined || - typeof deployment.labels.zone === 'string')); + typeof deployment.target === 'string'); } /** @@ -95,7 +90,7 @@ function isDeployment(deployment: any): deployment is Deployment { function isRequestProfile(prof: any): prof is RequestProfile { return prof && typeof prof.name === 'string' && typeof prof.profileType === 'string' && - typeof prof.duration === 'string' && + (prof.duration === undefined || typeof prof.duration === 'string') && (prof.labels === undefined || prof.labels.instance === undefined || typeof prof.labels.instance === 'string') && (prof.deployment === undefined || isDeployment(prof.deployment)); @@ -357,6 +352,9 @@ export class Profiler extends common.ServiceObject { if (!this.timeProfiler) { throw Error('Cannot collect time profile, time profiler not enabled.'); } + if (prof.duration === undefined) { + throw Error('Cannot collect time profile, duration is undefined.'); + } const durationMillis = parseDuration(prof.duration); if (!durationMillis) { throw Error( diff --git a/handwritten/cloud-profiler/ts/test/test-profiler.ts b/handwritten/cloud-profiler/ts/test/test-profiler.ts index 209ecd08f3e..7d32cfb78b1 100644 --- a/handwritten/cloud-profiler/ts/test/test-profiler.ts +++ b/handwritten/cloud-profiler/ts/test/test-profiler.ts @@ -107,7 +107,6 @@ describe('Profiler', () => { const requestProf = { name: 'projects/12345678901/test-projectId', profileType: 'HEAP', - duration: '10s', labels: {instance: 'test-instance'} }; const prof = await profiler.profile(requestProf); @@ -194,7 +193,6 @@ describe('Profiler', () => { const requestProf = { name: 'projects/12345678901/test-projectId', profileType: 'HEAP', - duration: '10s', labels: {instance: 'test-instance'} }; @@ -220,7 +218,6 @@ describe('Profiler', () => { const requestProf = { name: 'projects/12345678901/test-projectId', profileType: 'HEAP', - duration: '10s', labels: {instance: 'test-instance'} }; try { @@ -285,7 +282,6 @@ describe('Profiler', () => { const profiler = new Profiler(testConfig); profiler.heapProfiler = instance(mockHeapProfiler); await profiler.profileAndUpload(requestProf); - const uploaded = requestStub.firstCall.args[0].body; const decodedBytes = Buffer.from(uploaded.profileBytes as string, 'base64'); @@ -360,28 +356,76 @@ describe('Profiler', () => { requestStub.restore(); } }); - it('should send request for only wall profile when heap disabled.', - async () => { - const config = extend(true, {}, testConfig); - config.disableHeap = true; - const response = { - name: 'projects/12345678901/test-projectId', - profileType: 'WALL', - duration: '10s', - labels: {instance: config.instance} - }; - nockOauth2(); - const requestProfileMock = - nock(API) - .post('/projects/' + testConfig.projectId + '/profiles') - .once() - .reply(200, response); - const profiler = new Profiler(testConfig); - const actualResponse = await profiler.createProfile(); - assert.deepEqual(response, actualResponse); - assert.ok( - requestProfileMock.isDone(), 'expected call to create profile'); - }); + it('should successfully create wall profile', async () => { + const config = extend(true, {}, testConfig); + config.disableHeap = true; + const response = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + deployment: { + labels: {version: 'test-version'}, + projectId: 'test-projectId', + target: 'test-service' + }, + labels: {version: config.serviceContext.version} + }; + nockOauth2(); + const requestProfileMock = + nock(API) + .post('/projects/' + testConfig.projectId + '/profiles') + .once() + .reply(200, response); + const profiler = new Profiler(testConfig); + const actualResponse = await profiler.createProfile(); + assert.deepEqual(response, actualResponse); + assert.ok(requestProfileMock.isDone(), 'expected call to create profile'); + }); + it('should successfully create heap profile', async () => { + const config = extend(true, {}, testConfig); + config.disableHeap = true; + const response = { + name: 'projects/12345678901/test-projectId', + profileType: 'HEAP', + deployment: { + labels: {version: 'test-version'}, + projectId: 'test-projectId', + target: 'test-service' + }, + labels: {version: config.serviceContext.version} + }; + nockOauth2(); + const requestProfileMock = + nock(API) + .post('/projects/' + testConfig.projectId + '/profiles') + .once() + .reply(200, response); + const profiler = new Profiler(testConfig); + const actualResponse = await profiler.createProfile(); + assert.deepEqual(response, actualResponse); + assert.ok(requestProfileMock.isDone(), 'expected call to create profile'); + }); + it('should throw error when invalid profile created', async () => { + const config = extend(true, {}, testConfig); + config.disableHeap = true; + const response = {name: 'projects/12345678901/test-projectId'}; + nockOauth2(); + const requestProfileMock = + nock(API) + .post('/projects/' + testConfig.projectId + '/profiles') + .once() + .reply(200, response); + const profiler = new Profiler(testConfig); + try { + await profiler.createProfile(); + assert.fail('expected error, no error thrown'); + } catch (err) { + assert.equal( + err.message, + 'Profile not valid: ' + + '{"name":"projects/12345678901/test-projectId"}.'); + } + }); it('should not have instance and zone in request body when instance and' + ' zone undefined', async () => { @@ -447,7 +491,7 @@ describe('Profiler', () => { name: 'projects/12345678901/test-projectId', profileType: 'WALL', duration: '10s', - labels: {instance: config.instance}, + labels: {version: config.serviceContext.version}, additionalField: 'additionalField' }; nockOauth2(); @@ -467,7 +511,7 @@ describe('Profiler', () => { name: 'projects/12345678901/test-projectId', profileType: 'WALL', duration: '10s', - labels: {instance: config.instance} + labels: {version: config.serviceContext.version} }; requestStub = sinon.stub(common.ServiceObject.prototype, 'request') .onCall(0) @@ -487,7 +531,7 @@ describe('Profiler', () => { name: 'projects/12345678901/test-projectId', profileType: 'WALL', duration: '10s', - labels: {instance: config.instance} + labels: {version: config.serviceContext.version} }; requestStub = sinon.stub(common.ServiceObject.prototype, 'request') @@ -497,7 +541,6 @@ describe('Profiler', () => { {}, {statusCode: 500, statusMessage: '500 status code'} ]); })); - const profiler = new Profiler(testConfig); try { await profiler.createProfile(); @@ -513,14 +556,13 @@ describe('Profiler', () => { name: 'projects/12345678901/test-projectId', profileType: 'WALL', duration: '10s', - labels: {instance: config.instance} + labels: {version: config.serviceContext.version} }; requestStub = sinon.stub(common.ServiceObject.prototype, 'request') .onCall(0) .returns(new Promise(resolve => { resolve([{}, {statusCode: 500}]); })); - const profiler = new Profiler(testConfig); try { await profiler.createProfile(); @@ -544,7 +586,7 @@ describe('Profiler', () => { name: 'projects/12345678901/test-projectId', profileType: 'WALL', duration: '10s', - labels: {instance: config.instance} + labels: {version: config.serviceContext.version} }; requestStub = sinon.stub(common.ServiceObject.prototype, 'request') @@ -556,8 +598,6 @@ describe('Profiler', () => { .returns(new Promise(resolve => { resolve([{}, {statusCode: 200}]); })); - - const profiler = new Profiler(testConfig); profiler.timeProfiler = instance(mockTimeProfiler); const delayMillis = await profiler.collectProfile(); @@ -572,15 +612,13 @@ describe('Profiler', () => { name: 'projects/12345678901/test-projectId', profileType: 'WALL', duration: '10s', - labels: {instance: config.instance} + labels: {version: config.serviceContext.version} }; requestStub = sinon.stub(common.ServiceObject.prototype, 'request') .onCall(0) .returns(new Promise(resolve => { resolve([{}, {statusCode: 404}]); })); - - const profiler = new Profiler(testConfig); profiler.timeProfiler = instance(mockTimeProfiler); const delayMillis = await profiler.collectProfile(); @@ -596,7 +634,7 @@ describe('Profiler', () => { name: 'projects/12345678901/test-projectId', profileType: 'WALL', duration: '10s', - labels: {instance: config.instance} + labels: {version: config.serviceContext.version} }; requestStub = sinon.stub(common.ServiceObject.prototype, 'request') From 474a9d8cf43e1cc48d30d4547fc12a5ffcaf3b49 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Mon, 27 Nov 2017 07:20:24 -0800 Subject: [PATCH 055/632] chore: upgrade nan dependency (#79) This gets rid of the deprecation warnings when building with node 9. CXX(target) Release/obj.target/sampling_heap_profiler/bindings/sampling-heap-profiler.o In file included from ../bindings/sampling-heap-profiler.cc:18: In file included from ../node_modules/nan/nan.h:192: ../node_modules/nan/nan_maybe_43_inl.h:112:15: warning: 'ForceSet' is deprecated [-Wdeprecated-declarations] return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs); --- handwritten/cloud-profiler/package-lock.json | 132 +++++++++---------- handwritten/cloud-profiler/package.json | 2 +- 2 files changed, 63 insertions(+), 71 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index f4c60d3d71b..6c2db57f33c 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -5,9 +5,9 @@ "requires": true, "dependencies": { "@google-cloud/common": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.14.0.tgz", - "integrity": "sha1-xWA4KXJH6nKnUNUUVegBcQl2rEM=", + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.15.1.tgz", + "integrity": "sha512-cnVtHLvyiSQvb1RzXWDp7PA1sA8Jmc47+wp/xwHwdGOlQZfKog5iluZ0C/LB8iklFXpcTwlNMorqLuZ/qH0DDA==", "requires": { "array-uniq": "1.0.3", "arrify": "1.0.1", @@ -16,7 +16,7 @@ "duplexify": "3.5.1", "ent": "2.2.0", "extend": "3.0.1", - "google-auto-auth": "0.7.2", + "google-auto-auth": "0.8.0", "is": "3.2.1", "log-driver": "1.2.5", "methmeth": "1.1.0", @@ -27,37 +27,66 @@ "stream-events": "1.0.2", "string-format-obj": "1.1.0", "through2": "2.0.3" + }, + "dependencies": { + "gcp-metadata": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.3.1.tgz", + "integrity": "sha512-5kJPX/RXuqoLmHiOOgkSDk/LI0QaXpEvZ3pvQP4ifjGGDKZKVSOjL/GcDjXA5kLxppFCOjmmsu0Uoop9d1upaQ==", + "requires": { + "extend": "3.0.1", + "retry-request": "3.1.1" + } + }, + "google-auth-library": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-0.12.0.tgz", + "integrity": "sha512-79qCXtJ1VweBmmLr4yLq9S4clZB2p5Y+iACvuKk9gu4JitEnPc+bQFmYvtCYehVR44MQzD1J8DVmYW2w677IEw==", + "requires": { + "gtoken": "1.2.3", + "jws": "3.1.4", + "lodash.isstring": "4.0.1", + "lodash.merge": "4.6.0", + "request": "2.83.0" + } + }, + "google-auto-auth": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.8.0.tgz", + "integrity": "sha512-ul3Bvh+3S83xSrD7KjD8xyJIVPx95Yb5yd7y5P+c2Ip2zlQIbDXw0lFyfswUJQEnPmh6iWQw8oQcfgrgbGF3VA==", + "requires": { + "async": "2.6.0", + "gcp-metadata": "0.3.1", + "google-auth-library": "0.12.0", + "request": "2.83.0" + } + } } }, "@protobufjs/aspromise": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=", - "dev": true + "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" }, "@protobufjs/base64": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", - "dev": true + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" }, "@protobufjs/codegen": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", - "dev": true + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" }, "@protobufjs/eventemitter": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=", - "dev": true + "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" }, "@protobufjs/fetch": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", - "dev": true, "requires": { "@protobufjs/aspromise": "1.1.2", "@protobufjs/inquire": "1.1.0" @@ -66,32 +95,27 @@ "@protobufjs/float": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=", - "dev": true + "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" }, "@protobufjs/inquire": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=", - "dev": true + "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" }, "@protobufjs/path": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=", - "dev": true + "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" }, "@protobufjs/pool": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=", - "dev": true + "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" }, "@protobufjs/utf8": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=", - "dev": true + "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" }, "@types/delay": { "version": "2.0.1", @@ -117,8 +141,7 @@ "@types/long": { "version": "3.0.32", "resolved": "https://registry.npmjs.org/@types/long/-/long-3.0.32.tgz", - "integrity": "sha512-ZXyOOm83p7X8p3s0IYM3VeueNmHpkk/yMlP8CLeOnEcu6hIwPH7YjZBvhQkR0ZFS2DqZAxKtJ/M5fcuv3OU5BA==", - "dev": true + "integrity": "sha512-ZXyOOm83p7X8p3s0IYM3VeueNmHpkk/yMlP8CLeOnEcu6hIwPH7YjZBvhQkR0ZFS2DqZAxKtJ/M5fcuv3OU5BA==" }, "@types/mocha": { "version": "2.2.44", @@ -1072,39 +1095,6 @@ "ini": "1.3.4" } }, - "google-auth-library": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-0.10.0.tgz", - "integrity": "sha1-bhW6vuhf0d0U2NEoopW2g41SE24=", - "requires": { - "gtoken": "1.2.3", - "jws": "3.1.4", - "lodash.noop": "3.0.1", - "request": "2.83.0" - } - }, - "google-auto-auth": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.7.2.tgz", - "integrity": "sha512-ux2n2AE2g3+vcLXwL4dP/M12SFMRX5dzCzBfhAEkTeAB7dpyGdOIEj7nmUx0BHKaCcUQrRWg9kT63X/Mmtk1+A==", - "requires": { - "async": "2.6.0", - "gcp-metadata": "0.3.1", - "google-auth-library": "0.10.0", - "request": "2.83.0" - }, - "dependencies": { - "gcp-metadata": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.3.1.tgz", - "integrity": "sha512-5kJPX/RXuqoLmHiOOgkSDk/LI0QaXpEvZ3pvQP4ifjGGDKZKVSOjL/GcDjXA5kLxppFCOjmmsu0Uoop9d1upaQ==", - "requires": { - "extend": "3.0.1", - "retry-request": "3.1.1" - } - } - } - }, "google-p12-pem": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-0.1.2.tgz", @@ -1566,10 +1556,15 @@ "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", "dev": true }, - "lodash.noop": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash.noop/-/lodash.noop-3.0.1.tgz", - "integrity": "sha1-OBiPTWUKOkdCWEObluxFsyYXEzw=" + "lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" + }, + "lodash.merge": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.0.tgz", + "integrity": "sha1-aYhLoUSsM/5plzemCG3v+t0PicU=" }, "log-driver": { "version": "1.2.5", @@ -1585,8 +1580,7 @@ "long": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", - "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=", - "dev": true + "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=" }, "loud-rejection": { "version": "1.6.0", @@ -1761,9 +1755,9 @@ "dev": true }, "nan": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", - "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=" + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz", + "integrity": "sha1-7XFfP+neArV6XmJS2QqWZ14fCFo=" }, "nise": { "version": "1.2.0", @@ -3833,7 +3827,6 @@ "version": "6.8.0", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.0.tgz", "integrity": "sha512-47Y49f5JN5Qsbxas2TyI2zFO8j9GpQAQm5thf54fr2O8qcP/jkIXYxmYx1hN2WQFAhESU1xpVn5NWVDBB8WFnw==", - "dev": true, "requires": { "@protobufjs/aspromise": "1.1.2", "@protobufjs/base64": "1.1.2", @@ -3853,8 +3846,7 @@ "@types/node": { "version": "7.0.46", "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.46.tgz", - "integrity": "sha512-u+JAi1KtmaUoU/EHJkxoiuvzyo91FCE41Z9TZWWcOUU3P8oUdlDLdrGzCGWySPgbRMD17B0B+1aaJLYI9egQ6A==", - "dev": true + "integrity": "sha512-u+JAi1KtmaUoU/EHJkxoiuvzyo91FCE41Z9TZWWcOUU3P8oUdlDLdrGzCGWySPgbRMD17B0B+1aaJLYI9egQ6A==" } } }, diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 9e3e709c773..7ae57059a26 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -30,7 +30,7 @@ "delay": "^2.0.0", "extend": "^3.0.1", "gcp-metadata": "^0.4.0", - "nan": "^2.1.0", + "nan": "^2.8.0", "parse-duration": "^0.1.1", "pify": "^3.0.0", "protobufjs": "~6.8.0", From 68c64a8384382e61116bbb5f9d9282f334e71ec3 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Fri, 1 Dec 2017 14:08:38 -0800 Subject: [PATCH 056/632] feat: add way to profile locally (#88) --- handwritten/cloud-profiler/ts/src/index.ts | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/handwritten/cloud-profiler/ts/src/index.ts b/handwritten/cloud-profiler/ts/src/index.ts index 3dbdeb49e72..53e962071bb 100644 --- a/handwritten/cloud-profiler/ts/src/index.ts +++ b/handwritten/cloud-profiler/ts/src/index.ts @@ -14,6 +14,7 @@ * limitations under the License. */ +import * as delay from 'delay'; import * as extend from 'extend'; import * as gcpMetadata from 'gcp-metadata'; import * as path from 'path'; @@ -122,6 +123,31 @@ export async function start(config: Config = {}): Promise { profiler.start(); } + +/** + * For debugging purposes. Collects profiles and discards the collected + * profiles. + */ +export async function startLocal(config: Config = {}): Promise { + const normalizedConfig = await initConfig(config); + profiler = new Profiler(normalizedConfig); + + while (true) { + if (!config.disableHeap) { + const heap = await profiler.profile( + {name: 'HEAP-Profile' + new Date(), profileType: 'HEAP'}); + } + if (!config.disableTime) { + const wall = await profiler.profile({ + name: 'Time-Profile' + new Date(), + profileType: 'WALL', + duration: '10s' + }); + } + await delay(1000); + } +} + // If the module was --require'd from the command line, start the agent. if (module.parent && module.parent.id === 'internal/preload') { start(); From 50b87c589bb78c92dafb685367670e6216c9467b Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Fri, 1 Dec 2017 14:28:45 -0800 Subject: [PATCH 057/632] chore: Note where log statements are printed (#80) --- handwritten/cloud-profiler/ts/src/config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/handwritten/cloud-profiler/ts/src/config.ts b/handwritten/cloud-profiler/ts/src/config.ts index 403d819907a..f2184ad15b7 100644 --- a/handwritten/cloud-profiler/ts/src/config.ts +++ b/handwritten/cloud-profiler/ts/src/config.ts @@ -26,6 +26,7 @@ export interface Config extends AuthenticationConfig { projectId?: string; // Log levels: 0-disabled,1-error,2-warn,3-info,4-debug. + // Log statements are printed to the console. logLevel?: number; // Specifies the service with which profiles from this application will be From a3ce7efb5236e625bd83f13d8d0352ba1dd169ab Mon Sep 17 00:00:00 2001 From: Maggie Nolan Date: Fri, 1 Dec 2017 14:35:32 -0800 Subject: [PATCH 058/632] 0.1.6 --- handwritten/cloud-profiler/package-lock.json | 2 +- handwritten/cloud-profiler/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 6c2db57f33c..5888a4c73d2 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.5", + "version": "0.1.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 7ae57059a26..ad5a3ac77c1 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.5", + "version": "0.1.6", "description": "Adds support for Google Cloud Profiler to node.js applications", "repository": "GoogleCloudPlatform/cloud-profiler-nodejs", "main": "out/src/index.js", From 3a6d30da457871e8d3e04edb415ce4e9ec9d6f2d Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Mon, 4 Dec 2017 07:57:24 -0800 Subject: [PATCH 059/632] chore: Add test for starting and running agent. (#73) --- handwritten/cloud-profiler/package.json | 5 +- .../ts/system-test/test-start.ts | 154 ++++++++++++++++++ 2 files changed, 157 insertions(+), 2 deletions(-) create mode 100644 handwritten/cloud-profiler/ts/system-test/test-start.ts diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index ad5a3ac77c1..a6e8a867473 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -7,7 +7,7 @@ "types": "out/src/index.d.ts", "scripts": { "install": "node-gyp rebuild", - "test": "nyc mocha out/test/test-*.js", + "test": "nyc mocha out/test/test-*.js && nyc --no-clean mocha out/system-test/test-*.js --timeout=60000", "check": "gts check", "clean": "gts clean", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json", @@ -69,7 +69,8 @@ "nyc": { "exclude": [ "proto", - "out/test" + "out/test", + "out/system-test" ] } } diff --git a/handwritten/cloud-profiler/ts/system-test/test-start.ts b/handwritten/cloud-profiler/ts/system-test/test-start.ts new file mode 100644 index 00000000000..13f411d8b01 --- /dev/null +++ b/handwritten/cloud-profiler/ts/system-test/test-start.ts @@ -0,0 +1,154 @@ +/** + * 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. + */ + +import * as assert from 'assert'; +import * as delay from 'delay'; +import * as nock from 'nock'; +import * as pify from 'pify'; +import * as zlib from 'zlib'; + +import {perftools} from '../../proto/profile'; +import {Config} from '../src/config'; +import {Profiler, RequestProfile} from '../src/profiler'; + +const API = 'https://cloudprofiler.googleapis.com/v2'; +let savedEnv: {}; +let uploadedProfiles: RequestProfile[] = new Array(); +let createProfileCount = 0; +nock.disableNetConnect(); + +const fakeCredentials = + require('../../ts/test/fixtures/gcloud-credentials.json'); + +// Start profiler and collect profiles before testing. +before(async () => { + savedEnv = process.env; + process.env = {}; + + process.env.GCLOUD_PROJECT = 'test-projectId'; + process.env.GAE_SERVICE = 'test-service'; + process.env.GAE_VERSION = '0.0.0'; + + + // Mock profiler API. + nock(API) + .persist() + .post('/projects/' + process.env.GCLOUD_PROJECT + '/profiles') + .delay(1000) + .reply(200, (): RequestProfile => { + let prof; + if (createProfileCount % 2 === 0) { + prof = { + name: 'projects/X/test-projectId', + profileType: 'WALL', + duration: '10s', + }; + } else { + prof = { + name: 'projects/X/test-projectId', + profileType: 'HEAP', + duration: '10s', + }; + } + createProfileCount++; + return prof; + }); + const tempUploadedProfiles = new Array(); + nock(API) + .persist() + .patch('/projects/X/test-projectId') + .reply(200, (request: RequestProfile, body: RequestProfile) => { + tempUploadedProfiles.push(body); + }); + nock('https://accounts.google.com') + .post( + '/o/oauth2/token', + (body: {}) => { + return true; + }) + .once() + .reply(200, { + refresh_token: 'hello', + access_token: 'goodbye', + expiry_date: new Date(9999, 1, 1) + }); + + // start profiling and wait to collect profiles. + const profiler = require('../src/index'); + profiler.start({credentials: fakeCredentials}); + await delay(30 * 1000); + + // copy over currently uploaded profiles, so all tests look at same profiles. + uploadedProfiles = tempUploadedProfiles.slice(); + + // Restore environment vairables and mocks. + process.env = savedEnv; +}); + + +// Restore environment vairables after tests. +// nock not restored, since profiles still being uploaded. +after(() => { + process.env = savedEnv; +}); + +describe('start', () => { + it('should have uploaded multiple profiles', () => { + nock.restore(); + assert.ok( + uploadedProfiles.length >= 2, + 'Expected 2 or more profiles to be uploaded'); + }); + it('should have uploaded wall profile with samples first', async () => { + const wall = uploadedProfiles[0]; + const decodedBytes = Buffer.from(wall.profileBytes as string, 'base64'); + const unzippedBytes = await pify(zlib.gunzip)(decodedBytes); + const outProfile = perftools.profiles.Profile.decode(unzippedBytes); + assert.equal(wall.profileType, 'WALL'); + assert.equal( + outProfile.stringTable[outProfile.sampleType[0].type as number], + 'samples'); + assert.equal( + outProfile.stringTable[outProfile.sampleType[1].type as number], + 'time'); + assert.equal( + outProfile.stringTable[outProfile.sampleType[0].unit as number], + 'count'); + assert.equal( + outProfile.stringTable[outProfile.sampleType[1].unit as number], + 'microseconds'); + assert.ok(outProfile.sample.length > 0, 'Expected 1 or more samples'); + }); + it('should have uploaded heap profile second', async () => { + const heap = uploadedProfiles[1]; + const decodedBytes = Buffer.from(heap.profileBytes as string, 'base64'); + const unzippedBytes = await pify(zlib.gunzip)(decodedBytes); + const outProfile = perftools.profiles.Profile.decode(unzippedBytes); + assert.equal(heap.profileType, 'HEAP'); + assert.equal( + outProfile.stringTable[outProfile.sampleType[0].type as number], + 'objects'); + assert.equal( + outProfile.stringTable[outProfile.sampleType[1].type as number], + 'space'); + assert.equal( + outProfile.stringTable[outProfile.sampleType[0].unit as number], + 'count'); + assert.equal( + outProfile.stringTable[outProfile.sampleType[1].unit as number], + 'bytes'); + }); +}); From e303a743b73266d4f80ac5b9d03a3a4fbe6adc66 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Tue, 12 Dec 2017 07:22:13 -0800 Subject: [PATCH 060/632] feat: add exponential and server-mediated backoff on retries (#75) --- handwritten/cloud-profiler/package-lock.json | 33 ++ handwritten/cloud-profiler/package.json | 2 + handwritten/cloud-profiler/ts/src/config.ts | 41 ++- handwritten/cloud-profiler/ts/src/profiler.ts | 200 ++++++++---- .../ts/test/test-init-config.ts | 105 ++---- .../cloud-profiler/ts/test/test-profiler.ts | 304 ++++++++++++++---- .../ts/third_party/types/README.google | 3 +- .../ts/third_party/types/common-types.ts | 5 +- 8 files changed, 480 insertions(+), 213 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 5888a4c73d2..66597185643 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -170,6 +170,12 @@ "integrity": "sha512-BIRcpFqRm64rVuuYCFzOF37I2IEP3sXhiCjy8NbzJkxqFY2CLiDLFPhh6Sph/eXPXctg05MayCEDmeKCOIUBFg==", "dev": true }, + "@types/pretty-ms": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/pretty-ms/-/pretty-ms-3.0.0.tgz", + "integrity": "sha512-6q4kUTCllNWcwUlcR4mt/qwjZw8vVZ053VWvuen1mjEKWEmLt26d8IoczzbRQ5OWe4WmqbWzd/+PzMLSJOBadw==", + "dev": true + }, "@types/request": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/@types/request/-/request-2.0.7.tgz", @@ -1307,6 +1313,11 @@ "through": "2.3.8" } }, + "irregular-plurals": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-1.4.0.tgz", + "integrity": "sha1-LKmwM2UREYVUEvFr5dd8YqRYp2Y=" + }, "is": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/is/-/is-3.2.1.tgz", @@ -3712,6 +3723,11 @@ "error-ex": "1.3.1" } }, + "parse-ms": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-1.0.1.tgz", + "integrity": "sha1-VjRtR0nXjyNDDKDHE4UK75GqNh0=" + }, "path-exists": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", @@ -3806,12 +3822,29 @@ "pinkie": "2.0.4" } }, + "plur": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/plur/-/plur-2.1.2.tgz", + "integrity": "sha1-dIJFLBoPUI4+NE6uwxLJHCncZVo=", + "requires": { + "irregular-plurals": "1.4.0" + } + }, "prepend-http": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", "dev": true }, + "pretty-ms": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-3.1.0.tgz", + "integrity": "sha1-6crJx2v27lL+lC3ZxsQhMVOxKIE=", + "requires": { + "parse-ms": "1.0.1", + "plur": "2.1.2" + } + }, "process-nextick-args": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index a6e8a867473..b3a2fffd807 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -33,6 +33,7 @@ "nan": "^2.8.0", "parse-duration": "^0.1.1", "pify": "^3.0.0", + "pretty-ms": "^3.1.0", "protobufjs": "~6.8.0", "request": "^2.83.0", "retry-request": "^3.0.1" @@ -45,6 +46,7 @@ "@types/nock": "^8.2.1", "@types/node": "^8.0.30", "@types/pify": "^3.0.0", + "@types/pretty-ms": "^3.0.0", "@types/request": "^2.0.7", "@types/sinon": "^4.0.0", "clang-format": "^1.0.33", diff --git a/handwritten/cloud-profiler/ts/src/config.ts b/handwritten/cloud-profiler/ts/src/config.ts index f2184ad15b7..403837c3d0b 100644 --- a/handwritten/cloud-profiler/ts/src/config.ts +++ b/handwritten/cloud-profiler/ts/src/config.ts @@ -16,6 +16,7 @@ import {AuthenticationConfig, Common, ServiceConfig} from '../third_party/types/common-types'; +const parseDuration: (str: string) => number = require('parse-duration'); const common: Common = require('@google-cloud/common'); const extend = require('extend'); @@ -78,9 +79,29 @@ export interface Config extends AuthenticationConfig { // stack depth may increase overhead of profiling. heapMaxStackDepth?: number; - // Time to wait before trying to create a profile again if profile creation - // fails. - backoffMillis?: number; + // On each consecutive error in profile creation, the backoff envelope will + // increase by this factor. The backoff will be a random value selected + // from a uniform distribution between 0 and the backoff envelope. + backoffMultiplier?: number; + + // On first error during profile creation, if the backoff is not specified + // by the server response, then profiler will wait between 0 and + // initialBackoffMillis before asking the server to create a profile again. + // After a successful profile creation, the backoff envelope will be reset to + // initialBackoffMillis. + initialBackoffMillis?: number; + + // If the backoff is not specified by the server response, then profiler will + // wait at most backoffCapMillis before asking server to create a profile + // again. + backoffCapMillis?: number; + + // Server-specified backoffs will be capped at serverBackoffCapMillis. + // The backoff is capped here because setTimeout (which is used to control + // when next profile is collected) will run immediately if the backoff is + // too large. + // https://nodejs.org/dist/latest-v9.x/docs/api/timers.html#timers_settimeout_callback_delay_args. + serverBackoffCapMillis?: number; } // Interface for an initialized config. @@ -95,7 +116,10 @@ export interface ProfilerConfig extends AuthenticationConfig { timeIntervalMicros: number; heapIntervalBytes: number; heapMaxStackDepth: number; - backoffMillis: number; + initialBackoffMillis: number; + backoffCapMillis: number; + backoffMultiplier: number; + serverBackoffCapMillis: number; } // Default values for configuration for a profiler. @@ -107,5 +131,12 @@ export const defaultConfig = { timeIntervalMicros: 1000, heapIntervalBytes: 512 * 1024, heapMaxStackDepth: 64, - backoffMillis: 5 * 60 * 1000 + initialBackoffMillis: 1000, + backoffCapMillis: parseDuration('1h'), + backoffMultiplier: 1.3, + + // This is the largest duration for setTimeout which does not cause it to + // run immediately. + // https://nodejs.org/dist/latest-v9.x/docs/api/timers.html#timers_settimeout_callback_delay_args. + serverBackoffCapMillis: 2147483647 }; diff --git a/handwritten/cloud-profiler/ts/src/profiler.ts b/handwritten/cloud-profiler/ts/src/profiler.ts index b169210859c..742877ccae5 100644 --- a/handwritten/cloud-profiler/ts/src/profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profiler.ts @@ -14,12 +14,15 @@ * limitations under the License. */ +import * as http from 'http'; import * as path from 'path'; import * as pify from 'pify'; +import * as msToStr from 'pretty-ms'; import * as zlib from 'zlib'; import {perftools} from '../../proto/profile'; import {Common, Logger, Service, ServiceObject} from '../third_party/types/common-types'; + import {ProfilerConfig} from './config'; import {HeapProfiler} from './profilers/heap-profiler'; import {TimeProfiler} from './profilers/time-profiler'; @@ -37,7 +40,7 @@ enum ProfileTypes { } /** - * @return true if http status code indicates an error and false otherwise. + * @return true iff http status code indicates an error. */ function isErrorResponseStatusCode(code: number) { return code < 200 || code >= 300; @@ -72,6 +75,29 @@ export interface RequestProfile { labels?: {instance?: string}; } +/** + * @return number indicated by backoff if the response indicates a backoff and + * that backoff is greater than 0. Otherwise returns undefined. + */ +function getServerResponseBackoff(response: http.ServerResponse): number| + undefined { + // tslint:disable-next-line: no-any + const body = (response as any).body; + if (body && body.error && body.error.details && + Array.isArray(body.error.details)) { + for (const item of body.error.details) { + if (typeof item === 'object' && item.retryDelay && + typeof item.retryDelay === 'string') { + const backoffMillis = parseDuration(item.retryDelay); + if (backoffMillis > 0) { + return backoffMillis; + } + } + } + } + return undefined; +} + /** * @return true if an deployment is a Deployment and false otherwise. */ @@ -96,15 +122,6 @@ function isRequestProfile(prof: any): prof is RequestProfile { (prof.deployment === undefined || isDeployment(prof.deployment)); } -/** - * @return true if response has statusCode. - */ -// tslint:disable-next-line: no-any -function hasHttpStatusCode(response: any): - response is {statusCode: number, statusMessage: string} { - return response && typeof response.statusCode === 'number'; -} - /** * Converts a profile to a compressed, base64 encoded string. * @@ -120,6 +137,68 @@ async function profileBytes(p: perftools.profiles.IProfile): Promise { return gzBuf.toString('base64'); } +/** + * Error constructed from HTTP server response which indicates backoff. + */ +class BackoffResponseError extends Error { + constructor(response: http.ServerResponse, readonly backoffMillis: number) { + super(response.statusMessage); + } +} + +/** + * @return true if error is a BackoffResponseError and false otherwise + */ +function isBackoffResponseError(err: Error): err is BackoffResponseError { + return typeof (err as BackoffResponseError).backoffMillis === 'number'; +} + +/** + * Class which tracks how long to wait before the next retry and can be + * used to get this backoff. + */ +export class Retryer { + private nextBackoffMillis: number; + constructor( + readonly initialBackoffMillis: number, readonly backoffCapMillis: number, + readonly backoffMultiplier: number) { + this.nextBackoffMillis = this.initialBackoffMillis; + } + getBackoff(): number { + const curBackoff = Math.random() * this.nextBackoffMillis; + this.nextBackoffMillis = Math.min( + this.backoffMultiplier * this.nextBackoffMillis, this.backoffCapMillis); + return curBackoff; + } + reset() { + this.nextBackoffMillis = this.initialBackoffMillis; + } +} + +/** + * @return profile iff response indicates success and the returned profile was + * valid. + * @throws error when the response indicated failure or the returned profile + * was not valid. + */ +function responseToProfileOrError( + err: Error, body: object, response: http.ServerResponse): RequestProfile { + if (response && isErrorResponseStatusCode(response.statusCode)) { + const delayMillis = getServerResponseBackoff(response); + if (delayMillis) { + throw new BackoffResponseError(response, delayMillis); + } + throw new Error(response.statusMessage); + } + if (err) { + throw err; + } + if (isRequestProfile(body)) { + return body; + } + throw new Error(`Profile not valid: ${JSON.stringify(body)}.`); +} + /** * Polls profiler server for instructions on behalf of a task and * collects and uploads profiles as requested @@ -130,6 +209,7 @@ export class Profiler extends common.ServiceObject { private profileLabels: {instance?: string}; private deployment: Deployment; private profileTypes: string[]; + private retryer: Retryer; // Public for testing. timeProfiler: TimeProfiler|undefined; @@ -179,6 +259,10 @@ export class Profiler extends common.ServiceObject { this.heapProfiler = new HeapProfiler( this.config.heapIntervalBytes, this.config.heapMaxStackDepth); } + + this.retryer = new Retryer( + this.config.initialBackoffMillis, this.config.backoffCapMillis, + this.config.backoffMultiplier); } /** @@ -201,8 +285,6 @@ export class Profiler extends common.ServiceObject { */ async runLoop() { const delayMillis = await this.collectProfile(); - - // Schedule the next profile. setTimeout(this.runLoop.bind(this), delayMillis).unref(); } @@ -212,25 +294,24 @@ export class Profiler extends common.ServiceObject { * * @return time, in ms, to wait before asking profiler server again about * collecting another profile. - * - * TODO: implement backoff and retry. When error encountered in - * createProfile() should be retried when response indicates this request - * should be retried or with exponential backoff (up to one hour) if the - * response does not indicate when to retry this request. */ async collectProfile(): Promise { let prof: RequestProfile; try { prof = await this.createProfile(); } catch (err) { - this.logger.error(`Failed to create profile: ${err}`); - return this.config.backoffMillis; - } - try { - await this.profileAndUpload(prof); - } catch (err) { - this.logger.error(`Failed to collect and upload profile: ${err}`); + if (isBackoffResponseError(err)) { + this.logger.debug(`Must wait ${ + msToStr(err.backoffMillis)} to create profile: ${err}`); + return Math.min(err.backoffMillis, this.config.serverBackoffCapMillis); + } + const backoff = this.retryer.getBackoff(); + this.logger.warn(`Failed to create profile, waiting ${ + msToStr(backoff)} to try again: ${err}`); + return backoff; } + this.retryer.reset(); + await this.profileAndUpload(prof); return 0; } @@ -270,57 +351,60 @@ export class Profiler extends common.ServiceObject { }; this.logger.debug(`Attempting to create profile.`); - const [prof, response] = await this.request(options); - if (!hasHttpStatusCode(response)) { - throw new Error('Server response missing status information.'); - } - if (isErrorResponseStatusCode(response.statusCode)) { - let message: number|string = response.statusCode; - // tslint:disable-next-line: no-any - if ((response as any).statusMessage) { - message = response.statusMessage; - } - throw new Error(message.toString()); - } - if (!isRequestProfile(prof)) { - throw new Error(`Profile not valid: ${JSON.stringify(prof)}.`); - } - this.logger.debug(`Successfully created profile ${prof.profileType}.`); - return prof; + return new Promise((resolve, reject) => { + this.request( + options, + (err: Error, body: object, response: http.ServerResponse) => { + try { + const prof = responseToProfileOrError(err, body, response); + this.logger.debug( + `Successfully created profile ${prof.profileType}.`); + resolve(prof); + } catch (err) { + reject(err); + } + }); + }); } /** * Collects a profile of the type specified by the profileType field of prof. * If any problem is encountered, like a problem collecting or uploading the - * profile, an error will be thrown. + * profile, a message will be logged, and the error will otherwise be ignored. * * Public to allow for testing. */ async profileAndUpload(prof: RequestProfile): Promise { - prof = await this.profile(prof); - this.logger.debug(`Successfully collected profile ${prof.profileType}.`); - prof.labels = this.profileLabels; - + try { + prof = await this.profile(prof); + this.logger.debug(`Successfully collected profile ${prof.profileType}.`); + prof.labels = this.profileLabels; + } catch (err) { + this.logger.debug(`Failed to collect profile: ${err}`); + return; + } const options = { method: 'PATCH', uri: API + '/' + prof.name, body: prof, json: true, }; - const [body, response] = await this.request(options); - if (!hasHttpStatusCode(response)) { - throw new Error( - 'Server response missing status information when attempting to upload profile.'); - } - if (isErrorResponseStatusCode(response.statusCode)) { - let message: number|string = response.statusCode; - // tslint:disable-next-line: no-any - if ((response as any).statusMessage) { - message = response.statusMessage; + + try { + const [body, serverResponse] = await this.request(options); + const response = serverResponse as http.ServerResponse; + if (isErrorResponseStatusCode(response.statusCode)) { + let message: number|string = response.statusCode; + if (response.statusMessage) { + message = response.statusMessage; + } + this.logger.debug(`Could not upload profile: ${message}.`); + return; } - throw new Error(`Could not upload profile: ${message}.`); + this.logger.debug(`Successfully uploaded profile ${prof.profileType}.`); + } catch (err) { + this.logger.debug(`Failed to upload profile: ${err}`); } - this.logger.debug(`Successfully uploaded profile ${prof.profileType}.`); } /** diff --git a/handwritten/cloud-profiler/ts/test/test-init-config.ts b/handwritten/cloud-profiler/ts/test/test-init-config.ts index d2284698976..80b10dad47e 100644 --- a/handwritten/cloud-profiler/ts/test/test-init-config.ts +++ b/handwritten/cloud-profiler/ts/test/test-init-config.ts @@ -15,6 +15,7 @@ */ import * as assert from 'assert'; +import * as extend from 'extend'; import * as gcpMetadata from 'gcp-metadata'; import * as sinon from 'sinon'; @@ -42,6 +43,16 @@ describe('initConfig', () => { process.env = savedEnv; }); + const internalConfigParams = { + timeIntervalMicros: 1000, + heapIntervalBytes: 512 * 1024, + heapMaxStackDepth: 64, + initialBackoffMillis: 1000, + backoffCapMillis: 60 * 60 * 1000, + backoffMultiplier: 1.3, + serverBackoffCapMillis: 2147483647 + }; + it('should not modify specified fields when not on GCE', async () => { metadataStub = sinon.stub(gcpMetadata, 'instance') .throwsException('cannot access metadata'); @@ -55,21 +66,8 @@ describe('initConfig', () => { zone: 'zone', projectId: 'fake-projectId' }; - const expConfig = { - logLevel: 2, - serviceContext: {version: 'fake-version', service: 'fake-service'}, - disableHeap: true, - disableTime: true, - instance: 'instance', - zone: 'zone', - projectId: 'fake-projectId', - timeIntervalMicros: 1000, - heapIntervalBytes: 512 * 1024, - heapMaxStackDepth: 64, - backoffMillis: 300000 - }; const initializedConfig = await initConfig(config); - assert.deepEqual(initializedConfig, expConfig); + assert.deepEqual(initializedConfig, extend(config, internalConfigParams)); }); it('should not modify specified fields when on GCE', async () => { @@ -89,21 +87,8 @@ describe('initConfig', () => { zone: 'zone', projectId: 'fake-projectId' }; - const expConfig = { - logLevel: 2, - serviceContext: {version: 'fake-version', service: 'fake-service'}, - disableHeap: true, - disableTime: true, - instance: 'instance', - zone: 'zone', - projectId: 'fake-projectId', - timeIntervalMicros: 1000, - heapIntervalBytes: 512 * 1024, - heapMaxStackDepth: 64, - backoffMillis: 300000 - }; const initializedConfig = await initConfig(config); - assert.deepEqual(initializedConfig, expConfig); + assert.deepEqual(initializedConfig, extend(config, internalConfigParams)); }); it('should get zone and instance from GCE', async () => { @@ -128,14 +113,11 @@ describe('initConfig', () => { disableTime: true, instance: 'gce-instance', zone: 'gce-zone', - projectId: 'projectId', - timeIntervalMicros: 1000, - heapIntervalBytes: 512 * 1024, - heapMaxStackDepth: 64, - backoffMillis: 300000 + projectId: 'projectId' }; const initializedConfig = await initConfig(config); - assert.deepEqual(initializedConfig, expConfig); + assert.deepEqual( + initializedConfig, extend(expConfig, internalConfigParams)); }); it('should not reject when not on GCE and no zone and instance found', @@ -152,13 +134,10 @@ describe('initConfig', () => { disableHeap: false, disableTime: false, projectId: 'fake-projectId', - timeIntervalMicros: 1000, - heapIntervalBytes: 512 * 1024, - heapMaxStackDepth: 64, - backoffMillis: 300000 }; const initializedConfig = await initConfig(config); - assert.deepEqual(initializedConfig, expConfig); + assert.deepEqual( + initializedConfig, extend(expConfig, internalConfigParams)); }); it('should reject when no service specified', () => { @@ -192,20 +171,8 @@ describe('initConfig', () => { instance: 'instance', zone: 'zone' }; - const expConfig = { - logLevel: 2, - serviceContext: {version: '', service: 'fake-service'}, - disableHeap: true, - disableTime: true, - instance: 'instance', - zone: 'zone', - timeIntervalMicros: 1000, - heapIntervalBytes: 512 * 1024, - heapMaxStackDepth: 64, - backoffMillis: 300000 - }; const initializedConfig = await initConfig(config); - assert.deepEqual(initializedConfig, expConfig); + assert.deepEqual(initializedConfig, extend(config, internalConfigParams)); }); it('should get values from from environment variable when not specified in config or environment variables', @@ -231,14 +198,11 @@ describe('initConfig', () => { disableHeap: true, disableTime: true, instance: 'envConfig-instance', - zone: 'envConfig-zone', - timeIntervalMicros: 1000, - heapIntervalBytes: 512 * 1024, - heapMaxStackDepth: 64, - backoffMillis: 300000 + zone: 'envConfig-zone' }; const initializedConfig = await initConfig(config); - assert.deepEqual(initializedConfig, expConfig); + assert.deepEqual( + initializedConfig, extend(expConfig, internalConfigParams)); }); it('should not get values from from environment variable when values specified in config', @@ -265,21 +229,9 @@ describe('initConfig', () => { instance: 'instance', zone: 'zone' }; - const expConfig = { - projectId: 'config-projectId', - logLevel: 1, - serviceContext: {version: 'config-version', service: 'config-service'}, - disableHeap: false, - disableTime: false, - instance: 'instance', - zone: 'zone', - timeIntervalMicros: 1000, - heapIntervalBytes: 512 * 1024, - heapMaxStackDepth: 64, - backoffMillis: 300000 - }; const initializedConfig = await initConfig(config); - assert.deepEqual(initializedConfig, expConfig); + assert.deepEqual( + initializedConfig, extend(config, internalConfigParams)); }); it('should get values from from environment config when not specified in config or other environment variables', @@ -297,15 +249,12 @@ describe('initConfig', () => { disableTime: true, instance: 'envConfig-instance', zone: 'envConfig-zone', - projectId: 'envConfig-fake-projectId', - timeIntervalMicros: 1000, - heapIntervalBytes: 512 * 1024, - heapMaxStackDepth: 64, - backoffMillis: 300000 + projectId: 'envConfig-fake-projectId' }; const config = {}; const initializedConfig = await initConfig(config); - assert.deepEqual(initializedConfig, expConfig); + assert.deepEqual( + initializedConfig, extend(expConfig, internalConfigParams)); }); }); diff --git a/handwritten/cloud-profiler/ts/test/test-profiler.ts b/handwritten/cloud-profiler/ts/test/test-profiler.ts index 7d32cfb78b1..e6b5047b32b 100644 --- a/handwritten/cloud-profiler/ts/test/test-profiler.ts +++ b/handwritten/cloud-profiler/ts/test/test-profiler.ts @@ -24,7 +24,7 @@ import * as zlib from 'zlib'; import {perftools} from '../../proto/profile'; import {ProfilerConfig} from '../src/config'; -import {Profiler} from '../src/profiler'; +import {Profiler, Retryer} from '../src/profiler'; import {HeapProfiler} from '../src/profilers/heap-profiler'; import {TimeProfiler} from '../src/profilers/time-profiler'; import {Common} from '../third_party/types/common-types'; @@ -33,6 +33,7 @@ import {decodedHeapProfile, decodedTimeProfile, heapProfile, timeProfile} from ' const common: Common = require('@google-cloud/common'); const v8TimeProfiler = require('bindings')('time_profiler'); +const parseDuration: (str: string) => number = require('parse-duration'); const fakeCredentials = require('../../ts/test/fixtures/gcloud-credentials.json'); @@ -49,7 +50,10 @@ const testConfig: ProfilerConfig = { timeIntervalMicros: 1000, heapIntervalBytes: 512 * 1024, heapMaxStackDepth: 64, - backoffMillis: 1000 + initialBackoffMillis: 1000, + backoffCapMillis: parseDuration('1h'), + backoffMultiplier: 1.3, + serverBackoffCapMillis: parseDuration('7d') }; const API = 'https://cloudprofiler.googleapis.com/v2'; @@ -78,6 +82,31 @@ function nockOauth2(): nock.Scope { }); } +describe('Retryer', () => { + let randomStub: sinon.SinonStub|undefined; + before(() => { + randomStub = sinon.stub(Math, 'random').returns(0.5); + }); + after(() => { + if (randomStub) { + randomStub.restore(); + } + }); + it('should backoff until max-backoff reached', () => { + const retryer = new Retryer(1000, 1000000, 5); + assert.equal(retryer.getBackoff(), 0.5 * 1000); + assert.equal(retryer.getBackoff(), 0.5 * 5000); + assert.equal(retryer.getBackoff(), 0.5 * 25000); + assert.equal(retryer.getBackoff(), 0.5 * 125000); + assert.equal(retryer.getBackoff(), 0.5 * 625000); + assert.equal(retryer.getBackoff(), 0.5 * 1000000); + assert.equal(retryer.getBackoff(), 0.5 * 1000000); + assert.equal(retryer.getBackoff(), 0.5 * 1000000); + assert.equal(retryer.getBackoff(), 0.5 * 1000000); + assert.equal(retryer.getBackoff(), 0.5 * 1000000); + }); +}); + describe('Profiler', () => { afterEach(() => { nock.cleanAll(); @@ -292,23 +321,23 @@ describe('Profiler', () => { uploaded.profileBytes = undefined; assert.deepEqual(uploaded, requestProf); }); - it('should throw error when profile type unknown.', async () => { + it('should not uploaded when profile type unknown.', async () => { const requestProf = { name: 'projects/12345678901/test-projectId', duration: '10s', profileType: 'UNKNOWN_PROFILE_TYPE', labels: {instance: 'test-instance'} }; + requestStub = sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .returns(new Promise(resolve => { + resolve([{}, {}]); + })); const profiler = new Profiler(testConfig); - try { - await profiler.profileAndUpload(requestProf); - assert.fail('expected error, no error thrown'); - } catch (err) { - assert.equal( - err.message, 'Unexpected profile type UNKNOWN_PROFILE_TYPE.'); - } + await profiler.profileAndUpload(requestProf); + assert.equal(0, requestStub.callCount); }); - it('should throw error when error thrown by http request.', async () => { + it('should ignore error thrown by http request.', async () => { const requestProf = { name: 'projects/12345678901/test-projectId', duration: '10s', @@ -319,14 +348,9 @@ describe('Profiler', () => { .rejects(new Error('Network error')); const profiler = new Profiler(testConfig); profiler.timeProfiler = instance(mockTimeProfiler); - try { - await profiler.profileAndUpload(requestProf); - assert.fail('expected error, no error thrown'); - } catch (err) { - assert.equal(err.message, 'Network error'); - } + await profiler.profileAndUpload(requestProf); }); - it('should throw error when non-200 status code returned.', async () => { + it('should ignore when non-200 status code returned.', async () => { const requestProf = { name: 'projects/12345678901/test-projectId', duration: '10s', @@ -341,12 +365,7 @@ describe('Profiler', () => { })); const profiler = new Profiler(testConfig); profiler.timeProfiler = instance(mockTimeProfiler); - try { - await profiler.profileAndUpload(requestProf); - assert.fail('expected error, no error thrown'); - } catch (err) { - assert.equal(err.message, 'Could not upload profile: Error 500.'); - } + await profiler.profileAndUpload(requestProf); }); }); describe('createProfile', () => { @@ -437,11 +456,10 @@ describe('Profiler', () => { profileType: 'WALL', duration: '10s', }; - requestStub = sinon.stub(common.ServiceObject.prototype, 'request') - .onCall(0) - .returns(new Promise(resolve => { - resolve([response, {statusCode: 200}]); - })); + requestStub = + sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .callsArgWith(1, undefined, response, {statusCode: 200}); const expRequestBody = { deployment: { labels: {version: 'test-version'}, @@ -466,11 +484,10 @@ describe('Profiler', () => { profileType: 'WALL', duration: '10s', }; - requestStub = sinon.stub(common.ServiceObject.prototype, 'request') - .onCall(0) - .returns(new Promise(resolve => { - resolve([response, {statusCode: 200}]); - })); + requestStub = + sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .callsArgWith(1, undefined, response, {statusCode: 200}); const expRequestBody = { deployment: { labels: {version: 'test-version'}, @@ -513,9 +530,11 @@ describe('Profiler', () => { duration: '10s', labels: {version: config.serviceContext.version} }; - requestStub = sinon.stub(common.ServiceObject.prototype, 'request') - .onCall(0) - .returns(Promise.reject(new Error('Network error'))); + requestStub = + sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .callsArgWith( + 1, new Error('Network error'), undefined, undefined); const profiler = new Profiler(testConfig); try { await profiler.createProfile(); @@ -536,11 +555,10 @@ describe('Profiler', () => { requestStub = sinon.stub(common.ServiceObject.prototype, 'request') .onCall(0) - .returns(new Promise(resolve => { - resolve([ - {}, {statusCode: 500, statusMessage: '500 status code'} - ]); - })); + .callsArgWith( + 1, undefined, undefined, + {statusCode: 500, statusMessage: '500 status code'}); + const profiler = new Profiler(testConfig); try { await profiler.createProfile(); @@ -549,10 +567,11 @@ describe('Profiler', () => { assert.equal(err.message, '500 status code'); } }); - it('should throw status code when response has non-200 status and no status message.', + it('should throw error with server-specified backoff when non-200 error' + + ' and backoff specified', async () => { const config = extend(true, {}, testConfig); - const response = { + const requestProfileResponseBody = { name: 'projects/12345678901/test-projectId', profileType: 'WALL', duration: '10s', @@ -560,25 +579,56 @@ describe('Profiler', () => { }; requestStub = sinon.stub(common.ServiceObject.prototype, 'request') .onCall(0) - .returns(new Promise(resolve => { - resolve([{}, {statusCode: 500}]); - })); + .callsArgWith(1, undefined, undefined, { + statusCode: 409, + body: {error: {details: [{retryDelay: '50s'}]}} + }); + const profiler = new Profiler(testConfig); try { await profiler.createProfile(); assert.fail('expected error, no error thrown'); } catch (err) { - assert.equal(err.message, '500'); + assert.equal(err.backoffMillis, 50000); } }); + it('should throw error when response undefined', async () => { + const config = extend(true, {}, testConfig); + const requestProfileResponseBody = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {version: config.serviceContext.version} + }; + requestStub = sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .callsArgWith(1, undefined, undefined, {status: 200}); + + const profiler = new Profiler(testConfig); + try { + await profiler.createProfile(); + assert.fail('expected error, no error thrown'); + } catch (err) { + assert.equal(err.message, 'Profile not valid: undefined.'); + } + }); }); describe('collectProfile', () => { let requestStub: undefined|sinon.SinonStub; + let randomStub: sinon.SinonStub|undefined; + before(() => { + randomStub = sinon.stub(Math, 'random').returns(0.5); + }); afterEach(() => { if (requestStub) { requestStub.restore(); } }); + after(() => { + if (randomStub) { + randomStub.restore(); + } + }); it('should indicate collectProfile should be called immediately when no errors', async () => { const config = extend(true, {}, testConfig); @@ -591,21 +641,21 @@ describe('Profiler', () => { requestStub = sinon.stub(common.ServiceObject.prototype, 'request') .onCall(0) - .returns(new Promise(resolve => { - resolve([requestProfileResponseBody, {statusCode: 200}]); - })) + .callsArgWith( + 1, undefined, requestProfileResponseBody, + {statusCode: 200}) .onCall(1) - .returns(new Promise(resolve => { - resolve([{}, {statusCode: 200}]); - })); + .callsArgWith(1, undefined, undefined, {statusCode: 200}); + + const profiler = new Profiler(testConfig); profiler.timeProfiler = instance(mockTimeProfiler); const delayMillis = await profiler.collectProfile(); assert.equal( 0, delayMillis, 'No delay before asking to collect next profile'); }); - it('should indicate collectProfile should be called after some backoff' + - 'when error in requesting profile', + it('should return expect backoff when non-200 response and no backoff' + + ' indicated', async () => { const config = extend(true, {}, testConfig); const requestProfileResponseBody = { @@ -614,20 +664,112 @@ describe('Profiler', () => { duration: '10s', labels: {version: config.serviceContext.version} }; + requestStub = + sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .callsArgWith(1, undefined, undefined, {statusCode: 404}); + + const profiler = new Profiler(testConfig); + profiler.timeProfiler = instance(mockTimeProfiler); + const delayMillis = await profiler.collectProfile(); + assert.deepEqual(500, delayMillis); + }); + it('should reset backoff after success', async () => { + const config = extend(true, {}, testConfig); + const requestProfileResponseBody = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {instance: config.instance} + }; + + const createProfileResponseBody = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {instance: config.instance} + }; + requestStub = + sinon + .stub(common.ServiceObject.prototype, 'request') + // createProfile - first failure + .onCall(0) + .callsArgWith(1, undefined, undefined, {statusCode: 404}) + // createProfile - second failure + .onCall(1) + .callsArgWith(1, undefined, undefined, {statusCode: 404}) + // createProfile - third failure + .onCall(2) + .callsArgWith(1, undefined, undefined, {statusCode: 404}) + // createProfile + .onCall(3) + // createProfile - success + .callsArgWith( + 1, undefined, createProfileResponseBody, {statusCode: 200}) + // upload profiler - success + .onCall(4) + .callsArgWith(1, undefined, undefined, {statusCode: 200}) + // createProfile - failure + .onCall(5) + .callsArgWith( + 1, new Error('error creating profile'), undefined, undefined); + const profiler = new Profiler(config); + profiler.timeProfiler = instance(mockTimeProfiler); + let delayMillis = await profiler.collectProfile(); + assert.deepEqual(500, delayMillis); + delayMillis = await profiler.collectProfile(); + assert.deepEqual(650, delayMillis); + delayMillis = await profiler.collectProfile(); + assert.deepEqual(845, delayMillis); + delayMillis = await profiler.collectProfile(); + assert.deepEqual(0, delayMillis); + delayMillis = await profiler.collectProfile(); + assert.deepEqual(500, delayMillis); + }); + it('should return server-specified backoff when non-200 error and backoff' + + ' specified', + async () => { + const config = extend(true, {}, testConfig); + const requestProfileResponseBody = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {instance: config.instance} + }; requestStub = sinon.stub(common.ServiceObject.prototype, 'request') .onCall(0) - .returns(new Promise(resolve => { - resolve([{}, {statusCode: 404}]); - })); + .callsArgWith(1, undefined, undefined, { + statusCode: 409, + body: {error: {details: [{retryDelay: '50s'}]}} + }); const profiler = new Profiler(testConfig); profiler.timeProfiler = instance(mockTimeProfiler); const delayMillis = await profiler.collectProfile(); - assert.equal( - 1000, delayMillis, - 'No delay before asking to collect next profile'); + assert.equal(50000, delayMillis); + }); + it('should return expected backoff when non-200 error and invalid server backoff' + + ' specified', + async () => { + const config = extend(true, {}, testConfig); + const requestProfileResponseBody = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {instance: config.instance} + }; + requestStub = sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .callsArgWith(1, undefined, undefined, { + statusCode: 409, + body: {error: {details: [{retryDelay: ''}]}} + }); + const profiler = new Profiler(testConfig); + profiler.timeProfiler = instance(mockTimeProfiler); + const delayMillis = await profiler.collectProfile(); + assert.equal(500, delayMillis); }); - it('should indicate collectProfile should be called immediately error' + - ' in collecting and uploading profile.', + it('should return backoff limit, when server specified backoff is greater' + + 'then backoff limit', async () => { const config = extend(true, {}, testConfig); const requestProfileResponseBody = { @@ -639,16 +781,38 @@ describe('Profiler', () => { requestStub = sinon.stub(common.ServiceObject.prototype, 'request') .onCall(0) - .returns(new Promise(resolve => { - resolve([requestProfileResponseBody, {statusCode: 200}]); - })) + .callsArgWith(1, undefined, undefined, { + statusCode: 409, + body: {error: {details: [{retryDelay: '1000h'}]}} + }); + const profiler = new Profiler(testConfig); + profiler.timeProfiler = instance(mockTimeProfiler); + const delayMillis = await profiler.collectProfile(); + assert.equal(parseDuration('7d'), delayMillis); + }); + it('should indicate collectProfile should be called immediately if there' + + ' is an error when collecting and uploading profile.', + async () => { + const config = extend(true, {}, testConfig); + const createProfileResponseBody = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + labels: {instance: config.instance} + }; + requestStub = + sinon.stub(common.ServiceObject.prototype, 'request') + .onCall(0) + .callsArgWith( + 1, undefined, createProfileResponseBody, {statusCode: 200}) .onCall(1) - .returns(Promise.reject('Error uploading profile')); + .callsArgWith( + 1, new Error('Error uploading'), undefined, undefined); + const profiler = new Profiler(testConfig); profiler.timeProfiler = instance(mockTimeProfiler); const delayMillis = await profiler.collectProfile(); - assert.equal( - 0, delayMillis, 'No delay before asking to collect next profile'); + assert.equal(0, delayMillis); }); }); }); diff --git a/handwritten/cloud-profiler/ts/third_party/types/README.google b/handwritten/cloud-profiler/ts/third_party/types/README.google index fdf267735d5..bc280dded6b 100644 --- a/handwritten/cloud-profiler/ts/third_party/types/README.google +++ b/handwritten/cloud-profiler/ts/third_party/types/README.google @@ -8,5 +8,6 @@ Description: Local Modifications: All code except common-types.ts has been removed. RequestOptions interface added. - ServiceObject interface modified so promisified request can be used. + ServiceObject interface modified so both non-promisified and promisified + request can be used. Definitions modified to comply with gts 0.5 diff --git a/handwritten/cloud-profiler/ts/third_party/types/common-types.ts b/handwritten/cloud-profiler/ts/third_party/types/common-types.ts index 39f1bf6cf05..e86b19d843e 100644 --- a/handwritten/cloud-profiler/ts/third_party/types/common-types.ts +++ b/handwritten/cloud-profiler/ts/third_party/types/common-types.ts @@ -94,7 +94,10 @@ export interface RequestOptions { export interface ServiceObject { new(config: ServiceObjectConfig): ServiceObject; // TODO: Determine if this signature is correct. - request: (reqOpts: RequestOptions) => Promise; + request: + ((reqOpts: RequestOptions, + callback: (err: Error, body: object, response: http.ServerResponse) => + void) => void)&((reqOpts: RequestOptions) => Promise); } export interface Common { From e52aedf0731f3f3b77728e72061903f2fb530f54 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Wed, 13 Dec 2017 12:40:21 -0800 Subject: [PATCH 061/632] chore(package): update @types/nock to version 9.1.0 (#91) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index b3a2fffd807..d5d8b594587 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -43,7 +43,7 @@ "@types/extend": "^3.0.0", "@types/long": "^3.0.32", "@types/mocha": "^2.2.43", - "@types/nock": "^8.2.1", + "@types/nock": "^9.1.0", "@types/node": "^8.0.30", "@types/pify": "^3.0.0", "@types/pretty-ms": "^3.0.0", From e025a481ade2b9185dc4fb3f382f69965def7abb Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Tue, 19 Dec 2017 14:07:59 -0800 Subject: [PATCH 062/632] fix: set default log level to warn (#93) --- handwritten/cloud-profiler/ts/src/config.ts | 2 +- handwritten/cloud-profiler/ts/src/index.ts | 14 +++++++++++++- .../cloud-profiler/ts/test/test-init-config.ts | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/handwritten/cloud-profiler/ts/src/config.ts b/handwritten/cloud-profiler/ts/src/config.ts index 403837c3d0b..290fd4e9873 100644 --- a/handwritten/cloud-profiler/ts/src/config.ts +++ b/handwritten/cloud-profiler/ts/src/config.ts @@ -124,7 +124,7 @@ export interface ProfilerConfig extends AuthenticationConfig { // Default values for configuration for a profiler. export const defaultConfig = { - logLevel: 1, + logLevel: 2, serviceContext: {}, disableHeap: false, disableTime: false, diff --git a/handwritten/cloud-profiler/ts/src/index.ts b/handwritten/cloud-profiler/ts/src/index.ts index 53e962071bb..089a140ca45 100644 --- a/handwritten/cloud-profiler/ts/src/index.ts +++ b/handwritten/cloud-profiler/ts/src/index.ts @@ -18,12 +18,16 @@ import * as delay from 'delay'; import * as extend from 'extend'; import * as gcpMetadata from 'gcp-metadata'; import * as path from 'path'; +import {normalize} from 'path'; import * as pify from 'pify'; + import {AuthenticationConfig, Common, ServiceConfig} from '../third_party/types/common-types'; + import {Config, defaultConfig, ProfilerConfig} from './config'; import {Profiler} from './profiler'; const common: Common = require('@google-cloud/common'); +const pjson = require('../../package.json'); /** * @return value of metadata field. @@ -118,7 +122,15 @@ let profiler: Profiler|undefined = undefined; * */ export async function start(config: Config = {}): Promise { - const normalizedConfig = await initConfig(config); + let normalizedConfig: ProfilerConfig; + try { + normalizedConfig = await initConfig(config); + } catch (e) { + const logger = new common.logger( + {level: common.logger.LEVELS[config.logLevel || 2], tag: pjson.name}); + logger.error(`Could not start profiler: ${e}`); + return; + } profiler = new Profiler(normalizedConfig); profiler.start(); } diff --git a/handwritten/cloud-profiler/ts/test/test-init-config.ts b/handwritten/cloud-profiler/ts/test/test-init-config.ts index 80b10dad47e..3ccefe50dc9 100644 --- a/handwritten/cloud-profiler/ts/test/test-init-config.ts +++ b/handwritten/cloud-profiler/ts/test/test-init-config.ts @@ -129,7 +129,7 @@ describe('initConfig', () => { serviceContext: {service: 'fake-service'} }; const expConfig = { - logLevel: 1, + logLevel: 2, serviceContext: {service: 'fake-service'}, disableHeap: false, disableTime: false, From 67b03d22859ba7539aaaeaeab093a43223954a2a Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 3 Jan 2018 11:28:48 -0800 Subject: [PATCH 063/632] fix: upgrade clang dependency (#98) --- handwritten/cloud-profiler/package-lock.json | 735 +++++++++---------- handwritten/cloud-profiler/package.json | 1 - 2 files changed, 334 insertions(+), 402 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 66597185643..45a69233414 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.6", + "version": "0.1.9", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -16,51 +16,17 @@ "duplexify": "3.5.1", "ent": "2.2.0", "extend": "3.0.1", - "google-auto-auth": "0.8.0", + "google-auto-auth": "0.8.2", "is": "3.2.1", "log-driver": "1.2.5", "methmeth": "1.1.0", "modelo": "4.2.0", "request": "2.83.0", - "retry-request": "3.1.1", + "retry-request": "3.3.1", "split-array-stream": "1.0.3", "stream-events": "1.0.2", "string-format-obj": "1.1.0", "through2": "2.0.3" - }, - "dependencies": { - "gcp-metadata": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.3.1.tgz", - "integrity": "sha512-5kJPX/RXuqoLmHiOOgkSDk/LI0QaXpEvZ3pvQP4ifjGGDKZKVSOjL/GcDjXA5kLxppFCOjmmsu0Uoop9d1upaQ==", - "requires": { - "extend": "3.0.1", - "retry-request": "3.1.1" - } - }, - "google-auth-library": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-0.12.0.tgz", - "integrity": "sha512-79qCXtJ1VweBmmLr4yLq9S4clZB2p5Y+iACvuKk9gu4JitEnPc+bQFmYvtCYehVR44MQzD1J8DVmYW2w677IEw==", - "requires": { - "gtoken": "1.2.3", - "jws": "3.1.4", - "lodash.isstring": "4.0.1", - "lodash.merge": "4.6.0", - "request": "2.83.0" - } - }, - "google-auto-auth": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.8.0.tgz", - "integrity": "sha512-ul3Bvh+3S83xSrD7KjD8xyJIVPx95Yb5yd7y5P+c2Ip2zlQIbDXw0lFyfswUJQEnPmh6iWQw8oQcfgrgbGF3VA==", - "requires": { - "async": "2.6.0", - "gcp-metadata": "0.3.1", - "google-auth-library": "0.12.0", - "request": "2.83.0" - } - } } }, "@protobufjs/aspromise": { @@ -130,12 +96,12 @@ "dev": true }, "@types/form-data": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.0.tgz", - "integrity": "sha512-vm5OGsKc61Sx/GTRMQ9d0H0PYCDebT78/bdIBPCoPEHdgp0etaH1RzMmkDygymUmyXTj3rdWQn0sRUpYKZzljA==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz", + "integrity": "sha512-JAMFhOaHIciYVh8fb5/83nmuO/AHwmto+Hq7a9y8FzLDcC1KCU344XDOMEmahnrTFlHjgh4L0WJFczNIX2GxnQ==", "dev": true, "requires": { - "@types/node": "8.0.49" + "@types/node": "8.5.2" } }, "@types/long": { @@ -144,25 +110,27 @@ "integrity": "sha512-ZXyOOm83p7X8p3s0IYM3VeueNmHpkk/yMlP8CLeOnEcu6hIwPH7YjZBvhQkR0ZFS2DqZAxKtJ/M5fcuv3OU5BA==" }, "@types/mocha": { - "version": "2.2.44", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.44.tgz", - "integrity": "sha512-k2tWTQU8G4+iSMvqKi0Q9IIsWAp/n8xzdZS4Q4YVIltApoMA00wFBFdlJnmoaK1/z7B0Cy0yPe6GgXteSmdUNw==", - "dev": true + "version": "2.2.45", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.45.tgz", + "integrity": "sha512-tE1SYtNG3I3atRVPELSGN2FJJJtPg3O/G0tycYSyzeDqdAbdLPRH089LhpWYA5M/iHeWHkVZq/b0OVKngcK0Eg==", + "dev": true, + "requires": { + "@types/node": "8.5.2" + } }, "@types/nock": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/@types/nock/-/nock-8.2.1.tgz", - "integrity": "sha1-H75b3suUPBCad4VT+k0kAcuTlLQ=", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/@types/nock/-/nock-9.1.0.tgz", + "integrity": "sha512-Ykk50z1MKpHDRmnBJb6kn3rU03cCsbjHmqCzY3eyeDNxdz3mrgbbwwXRXzBnPXkD9qzGh1ZU9XLdbQVp6i0+gQ==", "dev": true, "requires": { - "@types/node": "8.0.49" + "@types/node": "8.5.2" } }, "@types/node": { - "version": "8.0.49", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.49.tgz", - "integrity": "sha512-Oq3cV/mrMKy6Tv42llfS8YIH30ooDdhbJ40h1zoWl+goOJw8Kjy8j8RfjGZtZIUDO0gLwCfcbYM7+LModnbeMw==", - "dev": true + "version": "8.5.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.2.tgz", + "integrity": "sha512-KA4GKOpgXnrqEH2eCVhiv2CsxgXGQJgV1X0vsGlh+WCnxbeAE1GT44ZsTU1IN5dEeV/gDupKa7gWo08V5IxWVQ==" }, "@types/pify": { "version": "3.0.0", @@ -177,25 +145,25 @@ "dev": true }, "@types/request": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/@types/request/-/request-2.0.7.tgz", - "integrity": "sha512-hlkmO+M7Xxx13YZwqQtXGC03KxcYbqmDQg3oHMRVODfSk2u0BELK7RfTNROisvrLRGOYdGoZPpnHwaPoKrPMbA==", + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/@types/request/-/request-2.0.9.tgz", + "integrity": "sha512-IWq4Uhm7dShxPdnfbGtIv9ImhGFJ3HugoIfugUd+jt40Oxe6ZfWIEaHFvp4QmRNZVDj0G6dZfa+u0U0PF3bYpg==", "dev": true, "requires": { - "@types/form-data": "2.2.0", - "@types/node": "8.0.49" + "@types/form-data": "2.2.1", + "@types/node": "8.5.2" } }, "@types/sinon": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.0.0.tgz", - "integrity": "sha512-cuK4xM8Lg2wd8cxshcQa8RG4IK/xfyB6TNE6tNVvkrShR4xdrYgsV04q6Dp6v1Lp6biEFdzD8k8zg/ujQeiw+A==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.1.2.tgz", + "integrity": "sha512-fL6bJHYRzbw/7ofbKiJ65SOAasoe5mZhHNSYKxWsF3sGl/arhRwDPwXJqM1xofKNTQD14HNX9VruicM7pm++mQ==", "dev": true }, "ajv": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz", - "integrity": "sha1-RBT/dKUIecII7l/cgm4ywwNUnto=", + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "requires": { "co": "4.6.0", "fast-deep-equal": "1.0.0", @@ -230,7 +198,7 @@ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "dev": true, "requires": { - "color-convert": "1.9.0" + "color-convert": "1.9.1" } }, "argv": { @@ -381,9 +349,9 @@ } }, "boxen": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.2.2.tgz", - "integrity": "sha1-Px1AMsMP/qnUsCwyLq8up0HcvOU=", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.3.0.tgz", + "integrity": "sha512-TNPjfTr432qx7yOjQyaXm3dSR0MH9vXp7eT1BFSl/C51g+EFnOR9hTg1IreahGBmDNCehscshe45f+C1TBZbLw==", "dev": true, "requires": { "ansi-align": "2.0.0", @@ -392,15 +360,7 @@ "cli-boxes": "1.0.0", "string-width": "2.1.1", "term-size": "1.2.0", - "widest-line": "1.0.0" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", - "dev": true - } + "widest-line": "2.0.0" } }, "brace-expansion": { @@ -431,19 +391,20 @@ "dev": true }, "camelcase": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", - "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true }, "camelcase-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", - "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", + "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", "dev": true, "requires": { - "camelcase": "2.1.1", - "map-obj": "1.0.1" + "camelcase": "4.1.0", + "map-obj": "2.0.0", + "quick-lru": "1.1.0" } }, "capture-stack-trace": { @@ -478,10 +439,16 @@ "supports-color": "4.5.0" } }, + "chardet": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", + "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "dev": true + }, "clang-format": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.1.0.tgz", - "integrity": "sha512-0Aru49uTLoROl4sPTyO3fvF/NZ+fnGEy5i7bsRwA/bAYT+eWaAxK3sDxRvm/AW7Nwq83BvARH/npeF8OIAaGVQ==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.2.1.tgz", + "integrity": "sha512-AdmYODau6wAdbZtMMeq0kICR3VTEPO4austhr1+U1izMlgz3mnFRBhXTE98Bq+q2Xf+xpzaW9geqdsJRL9ML7Q==", "dev": true, "requires": { "async": "1.5.2", @@ -523,12 +490,6 @@ "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, "codecov": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/codecov/-/codecov-3.0.0.tgz", @@ -690,9 +651,9 @@ } }, "color-convert": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", - "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", + "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", "dev": true, "requires": { "color-name": "1.1.3" @@ -713,9 +674,9 @@ } }, "commander": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "version": "2.12.2", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.12.2.tgz", + "integrity": "sha512-BFnaq5ZOGcDN7FlrtBT4xxkgIToalIIxwjxLWVJ8bGTpe1LroqMiqQXdA7ygc7CRvaYS+9zfPGFnJqFSayx+AA==", "dev": true }, "concat-map": { @@ -828,6 +789,24 @@ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, + "decamelize-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", + "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", + "dev": true, + "requires": { + "decamelize": "1.2.0", + "map-obj": "1.0.1" + }, + "dependencies": { + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + } + } + }, "deep-eql": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", @@ -975,13 +954,13 @@ "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" }, "external-editor": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.5.tgz", - "integrity": "sha512-Msjo64WT5W+NhOpQXh0nOHm+n0RfU1QUwDnKYvJ8dEJ8zlwLrqXNTv5mSUTJpepf41PDJGyhueTw2vNZW+Fr/w==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.1.0.tgz", + "integrity": "sha512-E44iT5QVOUJBKij4IIV3uvxuNlbKS38Tw1HiupxEIHPv9qtC2PrDYohbXV5U+1jnfIXttny8gUhj+oZvflFlzA==", "dev": true, "requires": { + "chardet": "0.4.2", "iconv-lite": "0.4.19", - "jschardet": "1.6.0", "tmp": "0.0.33" } }, @@ -1010,13 +989,12 @@ } }, "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "2.0.1" + "locate-path": "2.0.0" } }, "forever-agent": { @@ -1055,15 +1033,9 @@ "integrity": "sha512-yFE7v+NyoMiTOi2L6r8q87eVbiZCKooJNPKXTHhBStga8pwwgWofK9iHl00qd0XevZxcpk7ORaEL/ALuTvlaGQ==", "requires": { "extend": "3.0.1", - "retry-request": "3.1.1" + "retry-request": "3.3.1" } }, - "get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", - "dev": true - }, "get-stream": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", @@ -1093,12 +1065,46 @@ } }, "global-dirs": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.0.tgz", - "integrity": "sha1-ENNAOeDfBCcuJizyQiT3IJQ0308=", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", + "integrity": "sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU=", "dev": true, "requires": { - "ini": "1.3.4" + "ini": "1.3.5" + } + }, + "google-auth-library": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-0.12.0.tgz", + "integrity": "sha512-79qCXtJ1VweBmmLr4yLq9S4clZB2p5Y+iACvuKk9gu4JitEnPc+bQFmYvtCYehVR44MQzD1J8DVmYW2w677IEw==", + "requires": { + "gtoken": "1.2.3", + "jws": "3.1.4", + "lodash.isstring": "4.0.1", + "lodash.merge": "4.6.0", + "request": "2.83.0" + } + }, + "google-auto-auth": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.8.2.tgz", + "integrity": "sha512-W91J1paFbyG45gpDWdTu9tKDxbiTDWYkOAxytNVF4oHVVgTCBV/8+lWdjj/6ldjN3eb+sEd9PKJBjm0kmCxvcw==", + "requires": { + "async": "2.6.0", + "gcp-metadata": "0.3.1", + "google-auth-library": "0.12.0", + "request": "2.83.0" + }, + "dependencies": { + "gcp-metadata": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.3.1.tgz", + "integrity": "sha512-5kJPX/RXuqoLmHiOOgkSDk/LI0QaXpEvZ3pvQP4ifjGGDKZKVSOjL/GcDjXA5kLxppFCOjmmsu0Uoop9d1upaQ==", + "requires": { + "extend": "3.0.1", + "retry-request": "3.3.1" + } + } } }, "google-p12-pem": { @@ -1147,20 +1153,20 @@ "requires": { "google-p12-pem": "0.1.2", "jws": "3.1.4", - "mime": "1.4.1", + "mime": "1.6.0", "request": "2.83.0" } }, "gts": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/gts/-/gts-0.5.0.tgz", - "integrity": "sha512-UP38al3ZmgBXjTjHKpVFdxLVt+rA9meuvRvfETsKUyd9fWmOTbOD92DT3DViWY8FaXMPwe/EzJdPSTWGhoU0YA==", + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/gts/-/gts-0.5.2.tgz", + "integrity": "sha512-XnsRWIBBAwXx+ta/ra0foqQ7D1nUqZ0GbL2I5vJK96wK14X16xl3uaMGb1D+DZDWfaQAH7h+R1F7KEuUfvDsNQ==", "dev": true, "requires": { "chalk": "2.3.0", - "clang-format": "1.1.0", + "clang-format": "1.2.1", "inquirer": "3.3.0", - "meow": "3.7.0", + "meow": "4.0.0", "pify": "3.0.0", "rimraf": "2.6.2", "tslint": "5.8.0", @@ -1178,7 +1184,7 @@ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "requires": { - "ajv": "5.3.0", + "ajv": "5.5.2", "har-schema": "2.0.0" } }, @@ -1262,13 +1268,10 @@ "dev": true }, "indent-string": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", - "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", - "dev": true, - "requires": { - "repeating": "2.0.1" - } + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true }, "inflight": { "version": "1.0.6", @@ -1286,9 +1289,9 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "ini": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", - "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=", + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true }, "inquirer": { @@ -1301,7 +1304,7 @@ "chalk": "2.3.0", "cli-cursor": "2.1.0", "cli-width": "2.2.0", - "external-editor": "2.0.5", + "external-editor": "2.1.0", "figures": "2.0.0", "lodash": "4.17.4", "mute-stream": "0.0.7", @@ -1338,15 +1341,6 @@ "builtin-modules": "1.1.1" } }, - "is-finite": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", - "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } - }, "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", @@ -1359,8 +1353,8 @@ "integrity": "sha1-Df2Y9akRFxbdU13aZJL2e/PSWoA=", "dev": true, "requires": { - "global-dirs": "0.1.0", - "is-path-inside": "1.0.0" + "global-dirs": "0.1.1", + "is-path-inside": "1.0.1" } }, "is-npm": { @@ -1376,14 +1370,20 @@ "dev": true }, "is-path-inside": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", - "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", "dev": true, "requires": { "path-is-inside": "1.0.2" } }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true + }, "is-promise": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", @@ -1418,12 +1418,6 @@ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true - }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -1452,10 +1446,10 @@ "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", "optional": true }, - "jschardet": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.6.0.tgz", - "integrity": "sha512-xYuhvQ7I9PDJIGBWev9xm0+SMSed3ZDBAmvVjbFR1ZRLAF+vlXcQu6cRI9uAlj81rzikElRVteehwV7DuX2ZmQ==", + "json-parse-better-errors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz", + "integrity": "sha512-xyQpxeWWMKyJps9CuGJYeng6ssI5bpqS9ltQpdVQ90t4ql6NdnxFKh95JcRt2cun/DjMVNrdjniLPuMA69xmCw==", "dev": true }, "json-schema": { @@ -1536,24 +1530,25 @@ } }, "load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", "dev": true, "requires": { "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "strip-bom": "2.0.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } + "parse-json": "4.0.0", + "pify": "3.0.0", + "strip-bom": "3.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "2.0.0", + "path-exists": "3.0.0" } }, "lodash": { @@ -1583,9 +1578,9 @@ "integrity": "sha1-euTsJXMC/XkNVXyxDJcQDYV7AFY=" }, "lolex": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.1.3.tgz", - "integrity": "sha512-BdHq78SeI+6PAUtl4atDuCt7L6E4fab3mSRtqxm4ywaXe4uP7jZ0TTcFNuU20syUjxZc2l7jFqKVMJ+AX0LnpQ==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.1.tgz", + "integrity": "sha512-mQuW55GhduF3ppo+ZRUTz1PRjEh1hS5BbqU7d8D0ez2OKxHDod7StPPeAVKisZR5aLkHZjdGWSL42LSONUJsZw==", "dev": true }, "long": { @@ -1629,27 +1624,26 @@ } }, "map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", "dev": true }, "meow": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", - "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-4.0.0.tgz", + "integrity": "sha512-Me/kel335m6vMKmEmA6c87Z6DUFW3JqkINRnxkbC+A/PUm0D5Fl2dEBQrPKnqCL9Te/CIa1MUt/0InMJhuC/sw==", "dev": true, "requires": { - "camelcase-keys": "2.1.0", - "decamelize": "1.2.0", + "camelcase-keys": "4.2.0", + "decamelize-keys": "1.1.0", "loud-rejection": "1.6.0", - "map-obj": "1.0.1", "minimist": "1.2.0", + "minimist-options": "3.0.2", "normalize-package-data": "2.4.0", - "object-assign": "4.1.1", - "read-pkg-up": "1.0.1", - "redent": "1.0.0", - "trim-newlines": "1.0.0" + "read-pkg-up": "3.0.0", + "redent": "2.0.0", + "trim-newlines": "2.0.0" } }, "methmeth": { @@ -1658,9 +1652,9 @@ "integrity": "sha1-6AomYY5S9cQiKGG7dIUQvRDikIk=" }, "mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" }, "mime-db": { "version": "1.30.0", @@ -1696,6 +1690,16 @@ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, + "minimist-options": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz", + "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", + "dev": true, + "requires": { + "arrify": "1.0.1", + "is-plain-obj": "1.1.0" + } + }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", @@ -1714,9 +1718,9 @@ } }, "mocha": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.0.1.tgz", - "integrity": "sha512-evDmhkoA+cBNiQQQdSKZa2b9+W2mpLoj50367lhy+Klnx9OV8XlCIhigUnn1gaTFLQCa0kdNhEGDr0hCXOQFDw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.1.0.tgz", + "integrity": "sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA==", "dev": true, "requires": { "browser-stdout": "1.3.0", @@ -1731,6 +1735,12 @@ "supports-color": "4.4.0" }, "dependencies": { + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "dev": true + }, "diff": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", @@ -1792,9 +1802,9 @@ } }, "nock": { - "version": "9.0.28", - "resolved": "https://registry.npmjs.org/nock/-/nock-9.0.28.tgz", - "integrity": "sha512-MXGP3NA+I8BpwF8r2LnK9N1Dwz69N82peP9Ht3G9EMUAKHK73relYI8Pjik9AwvGSVV0kAo6KA20IbKsCjNyIA==", + "version": "9.1.5", + "resolved": "https://registry.npmjs.org/nock/-/nock-9.1.5.tgz", + "integrity": "sha512-ukkBUhGU73CmSKTpTl6N/Qjvb7Hev4rCEjgOuEBKvHmsOqz7jGh2vUXL3dPnX3ndfcmVjsFBPfKpNuJbK94SKg==", "dev": true, "requires": { "chai": "3.5.0", @@ -1845,22 +1855,16 @@ "path-key": "2.0.1" } }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, "nyc": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/nyc/-/nyc-11.3.0.tgz", - "integrity": "sha512-oUu0WHt1k/JMIODvAYXX6C50Mupw2GO34P/Jdg2ty9xrLufBthHiKR2gf08aF+9S0abW1fl24R7iKRBXzibZmg==", + "version": "11.4.1", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-11.4.1.tgz", + "integrity": "sha512-5eCZpvaksFVjP2rt1r60cfXmt3MUtsQDw8bAzNqNEr4WLvUMLgiVENMf/B9bE9YAX0mGVvaGA3v9IS9ekNqB1Q==", "dev": true, "requires": { "archy": "1.0.0", "arrify": "1.0.1", "caching-transform": "1.0.1", - "convert-source-map": "1.5.0", + "convert-source-map": "1.5.1", "debug-log": "1.0.1", "default-require-extensions": "1.0.0", "find-cache-dir": "0.1.1", @@ -1880,7 +1884,7 @@ "resolve-from": "2.0.0", "rimraf": "2.6.2", "signal-exit": "3.0.2", - "spawn-wrap": "1.3.8", + "spawn-wrap": "1.4.2", "test-exclude": "4.1.1", "yargs": "10.0.3", "yargs-parser": "8.0.0" @@ -2005,8 +2009,8 @@ "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "dev": true, "requires": { - "core-js": "2.5.1", - "regenerator-runtime": "0.11.0" + "core-js": "2.5.3", + "regenerator-runtime": "0.11.1" } }, "babel-template": { @@ -2172,15 +2176,15 @@ "dev": true }, "convert-source-map": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", - "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", + "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=", "dev": true }, "core-js": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", - "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=", + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.3.tgz", + "integrity": "sha1-isw4NFgk8W2DZbfJtCWRaOjtYD4=", "dev": true }, "cross-spawn": { @@ -2523,9 +2527,9 @@ "dev": true }, "is-buffer": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", - "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, "is-builtin-module": { @@ -2749,7 +2753,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.5" + "is-buffer": "1.1.6" } }, "lazy-cache": { @@ -3167,7 +3171,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.5" + "is-buffer": "1.1.6" } } } @@ -3178,7 +3182,7 @@ "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, "requires": { - "is-buffer": "1.1.5" + "is-buffer": "1.1.6" } } } @@ -3217,9 +3221,9 @@ } }, "regenerator-runtime": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", - "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==", + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", "dev": true }, "regex-cache": { @@ -3341,9 +3345,9 @@ "dev": true }, "spawn-wrap": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-1.3.8.tgz", - "integrity": "sha512-Yfkd7Yiwz4RcBPrDWzvhnTzQINBHNqOEhUzOdWZ67Y9b4wzs3Gz6ymuptQmRBpzlpOzroM7jwzmBdRec7JJ0UA==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-1.4.2.tgz", + "integrity": "sha512-vMwR3OmmDhnxCVxM8M+xO/FtIp6Ju/mNaDfCMMW7FDcLRTPFWUswec4LXJHTJE2hwTI9O0YBfygu4DalFl7Ylg==", "dev": true, "requires": { "foreground-child": "1.5.6", @@ -3657,12 +3661,6 @@ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -3697,6 +3695,21 @@ "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, + "p-limit": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", + "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=", + "dev": true + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "1.1.0" + } + }, "package-json": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", @@ -3715,12 +3728,13 @@ "integrity": "sha1-ExFN3JiRwezSgANiRFVN5DZHoiY=" }, "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", "dev": true, "requires": { - "error-ex": "1.3.1" + "error-ex": "1.3.1", + "json-parse-better-errors": "1.0.1" } }, "parse-ms": { @@ -3729,13 +3743,10 @@ "integrity": "sha1-VjRtR0nXjyNDDKDHE4UK75GqNh0=" }, "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "dev": true, - "requires": { - "pinkie-promise": "2.0.1" - } + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true }, "path-is-absolute": { "version": "1.0.1", @@ -3779,22 +3790,12 @@ } }, "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } + "pify": "3.0.0" } }, "performance-now": { @@ -3807,21 +3808,6 @@ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dev": true, - "requires": { - "pinkie": "2.0.4" - } - }, "plur": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/plur/-/plur-2.1.2.tgz", @@ -3857,9 +3843,9 @@ "dev": true }, "protobufjs": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.0.tgz", - "integrity": "sha512-47Y49f5JN5Qsbxas2TyI2zFO8j9GpQAQm5thf54fr2O8qcP/jkIXYxmYx1hN2WQFAhESU1xpVn5NWVDBB8WFnw==", + "version": "6.8.3", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.3.tgz", + "integrity": "sha512-/iQhTYnSniRNmdRF9Kvw8odMSokwNOWVDOmMJjW64+EVE6igcdj/82Op/4MJ/WimgMRNac7gChlSVX4Gep/tHg==", "requires": { "@protobufjs/aspromise": "1.1.2", "@protobufjs/base64": "1.1.2", @@ -3872,15 +3858,8 @@ "@protobufjs/pool": "1.1.0", "@protobufjs/utf8": "1.1.0", "@types/long": "3.0.32", - "@types/node": "7.0.46", + "@types/node": "8.5.2", "long": "3.2.0" - }, - "dependencies": { - "@types/node": { - "version": "7.0.46", - "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.46.tgz", - "integrity": "sha512-u+JAi1KtmaUoU/EHJkxoiuvzyo91FCE41Z9TZWWcOUU3P8oUdlDLdrGzCGWySPgbRMD17B0B+1aaJLYI9egQ6A==" - } } }, "pseudomap": { @@ -3899,6 +3878,12 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" }, + "quick-lru": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", + "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", + "dev": true + }, "rc": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.2.tgz", @@ -3906,30 +3891,30 @@ "dev": true, "requires": { "deep-extend": "0.4.2", - "ini": "1.3.4", + "ini": "1.3.5", "minimist": "1.2.0", "strip-json-comments": "2.0.1" } }, "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", "dev": true, "requires": { - "load-json-file": "1.1.0", + "load-json-file": "4.0.0", "normalize-package-data": "2.4.0", - "path-type": "1.1.0" + "path-type": "3.0.0" } }, "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", "dev": true, "requires": { - "find-up": "1.1.2", - "read-pkg": "1.1.0" + "find-up": "2.1.0", + "read-pkg": "3.0.0" } }, "readable-stream": { @@ -3947,13 +3932,13 @@ } }, "redent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", - "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", + "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", "dev": true, "requires": { - "indent-string": "2.1.0", - "strip-indent": "1.0.1" + "indent-string": "3.2.0", + "strip-indent": "2.0.0" } }, "registry-auth-token": { @@ -3975,15 +3960,6 @@ "rc": "1.2.2" } }, - "repeating": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "dev": true, - "requires": { - "is-finite": "1.0.2" - } - }, "request": { "version": "2.83.0", "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", @@ -4033,9 +4009,9 @@ } }, "retry-request": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-3.1.1.tgz", - "integrity": "sha512-Sj3M3bC8ODJT+jfVxbTwvORRkFtc/AlDhhiMch5RJalLMAjz6+lIf5Q/Ox2esAM4tXcAYfG4ecNHPtaGNWIqvQ==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-3.3.1.tgz", + "integrity": "sha512-PjAmtWIxjNj4Co/6FRtBl8afRP3CxrrIAnUzb1dzydfROd+6xt7xAebFeskgQgkfFf8NmzrXIoaB3HxmswXyxw==", "requires": { "request": "2.83.0", "through2": "2.0.3" @@ -4122,24 +4098,24 @@ "dev": true }, "sinon": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.1.1.tgz", - "integrity": "sha512-l+74gYEaCH967jIfuLCsBxmAW88/6+y+dzr6HJqOuKdGFYA5JQWOxYcyF6aBd49v8/QOIIQYwzcfaTP9FQawdg==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.1.3.tgz", + "integrity": "sha512-c7u0ZuvBRX1eXuB4jN3BRCAOGiUTlM8SE3TxbJHrNiHUKL7wonujMOB6Fi1gQc00U91IscFORQHDga/eccqpbw==", "dev": true, "requires": { "diff": "3.4.0", "formatio": "1.2.0", "lodash.get": "4.4.2", - "lolex": "2.1.3", + "lolex": "2.3.1", "nise": "1.2.0", "supports-color": "4.5.0", - "type-detect": "4.0.3" + "type-detect": "4.0.5" }, "dependencies": { "type-detect": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", - "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.5.tgz", + "integrity": "sha512-N9IvkQslUGYGC24RkJk1ba99foK6TkwC2FHAEBlQFBP0RxQZS8ZpJuAZcwiY/w9ZJHFQb1aOXBI60OdxhTrwEQ==", "dev": true } } @@ -4248,13 +4224,10 @@ } }, "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dev": true, - "requires": { - "is-utf8": "0.2.1" - } + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true }, "strip-eof": { "version": "1.0.0", @@ -4263,13 +4236,10 @@ "dev": true }, "strip-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", - "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", - "dev": true, - "requires": { - "get-stdin": "4.0.1" - } + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", + "dev": true }, "strip-json-comments": { "version": "2.0.1", @@ -4345,24 +4315,24 @@ } }, "trim-newlines": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", - "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", + "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=", "dev": true }, "ts-mockito": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/ts-mockito/-/ts-mockito-2.2.5.tgz", - "integrity": "sha512-cIdDMSOq9Eg06pQro2I+ZBOwqs663lIqJDQgGfi/MRs/05ENSlMCpDX9CwYlgux0MesLEUFEB8RSKcq6BeI2yg==", + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/ts-mockito/-/ts-mockito-2.2.7.tgz", + "integrity": "sha512-QS4hn2qFC+lkt/TiHKy5TmCuwF+XuNqDE0LgpgTFmck6Vw+SUYkufNMkidNYedQkAracoN77q1Umc+bdxHQndQ==", "dev": true, "requires": { "lodash": "4.17.4" } }, "tslib": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz", - "integrity": "sha512-ymKWWZJST0/CkgduC2qkzjMOWr4bouhuURNXCn/inEX0L57BnRG6FhX76o7FOnsjHazCjfU2LKeSrlS2sIKQJg==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.1.tgz", + "integrity": "sha1-aUavLR1lGnsYY7Ux1uWvpBqkTqw=", "dev": true }, "tslint": { @@ -4374,23 +4344,23 @@ "babel-code-frame": "6.26.0", "builtin-modules": "1.1.1", "chalk": "2.3.0", - "commander": "2.11.0", + "commander": "2.12.2", "diff": "3.4.0", "glob": "7.1.2", "minimatch": "3.0.4", "resolve": "1.5.0", "semver": "5.4.1", - "tslib": "1.8.0", - "tsutils": "2.12.2" + "tslib": "1.8.1", + "tsutils": "2.15.0" } }, "tsutils": { - "version": "2.12.2", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.12.2.tgz", - "integrity": "sha1-rVikhl0X7D3bZjG2ylO+FKVlb/M=", + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.15.0.tgz", + "integrity": "sha512-kKb1mSqRMwF0GHKya5/hZsI2m7Flg4ONZDeYu4e6Gx+kYAu86zsLNCHcUmNWhCRaUcKshNI272hOzuaCQDzJ2g==", "dev": true, "requires": { - "tslib": "1.8.0" + "tslib": "1.8.1" } }, "tunnel-agent": { @@ -4419,9 +4389,9 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, "typescript": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.1.tgz", - "integrity": "sha1-7znN6ierrAtQAkLWcmq5DgyEZjE=", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.2.tgz", + "integrity": "sha1-PFtv1/beCRQmkCfwPAlGdY92c6Q=", "dev": true }, "unique-string": { @@ -4445,7 +4415,7 @@ "integrity": "sha1-TognpruRUUCrCTVZ1wFOPruDdFE=", "dev": true, "requires": { - "boxen": "1.2.2", + "boxen": "1.3.0", "chalk": "2.3.0", "configstore": "3.1.1", "import-lazy": "2.1.0", @@ -4511,49 +4481,12 @@ } }, "widest-line": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-1.0.0.tgz", - "integrity": "sha1-DAnIXCqUaD0Nfq+O4JfVZL8OEFw=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.0.tgz", + "integrity": "sha1-AUKk6KJD+IgsAjOqDgKBqnYVInM=", "dev": true, "requires": { - "string-width": "1.0.2" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - } + "string-width": "2.1.1" } }, "wrappy": { diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index d5d8b594587..cdf36d67b89 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -49,7 +49,6 @@ "@types/pretty-ms": "^3.0.0", "@types/request": "^2.0.7", "@types/sinon": "^4.0.0", - "clang-format": "^1.0.33", "codecov": "^3.0.0", "gts": "^0.5.0", "mocha": "^4.0.1", From 081f0832fed6b57c0b530425f24b84db7a674fe6 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 3 Jan 2018 12:15:05 -0800 Subject: [PATCH 064/632] chore: update gts dependency (#99) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index cdf36d67b89..0186fc579fc 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -50,7 +50,7 @@ "@types/request": "^2.0.7", "@types/sinon": "^4.0.0", "codecov": "^3.0.0", - "gts": "^0.5.0", + "gts": "^0.5.3", "mocha": "^4.0.1", "nock": "^9.0.22", "nyc": "^11.2.1", From 9047dedf89fc40e3aa36ca3d6b04a9543d0ef5fe Mon Sep 17 00:00:00 2001 From: Jinwoo Lee Date: Mon, 8 Jan 2018 09:45:48 -0800 Subject: [PATCH 065/632] chore: license check in posttest (#103) The `log-driver` package must be whitelisted, which is a dep of `@google-cloud/common`. --- .../cloud-profiler/js-green-licenses.json | 5 + handwritten/cloud-profiler/package-lock.json | 166 +++++++++++++++++- handwritten/cloud-profiler/package.json | 6 +- 3 files changed, 171 insertions(+), 6 deletions(-) create mode 100644 handwritten/cloud-profiler/js-green-licenses.json diff --git a/handwritten/cloud-profiler/js-green-licenses.json b/handwritten/cloud-profiler/js-green-licenses.json new file mode 100644 index 00000000000..11f9bca2527 --- /dev/null +++ b/handwritten/cloud-profiler/js-green-licenses.json @@ -0,0 +1,5 @@ +{ + "packageWhitelist": [ + "log-driver" + ] +} diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 45a69233414..cb89a5463d5 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.9", + "version": "0.1.6", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -201,6 +201,15 @@ "color-convert": "1.9.1" } }, + "argparse": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "dev": true, + "requires": { + "sprintf-js": "1.0.3" + } + }, "argv": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/argv/-/argv-0.0.2.tgz", @@ -262,6 +271,16 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" }, + "axios": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.17.1.tgz", + "integrity": "sha1-LY4+XQvb1zJ/kbyBT1xXZg+Bgk0=", + "dev": true, + "requires": { + "follow-redirects": "1.3.0", + "is-buffer": "1.1.6" + } + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -390,6 +409,12 @@ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, + "builtins": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", + "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=", + "dev": true + }, "camelcase": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", @@ -997,6 +1022,15 @@ "locate-path": "2.0.0" } }, + "follow-redirects": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.3.0.tgz", + "integrity": "sha1-9oSHH8EW0uMp/aVe9naH9Pq8kFw=", + "dev": true, + "requires": { + "debug": "3.1.0" + } + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -1158,9 +1192,9 @@ } }, "gts": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/gts/-/gts-0.5.2.tgz", - "integrity": "sha512-XnsRWIBBAwXx+ta/ra0foqQ7D1nUqZ0GbL2I5vJK96wK14X16xl3uaMGb1D+DZDWfaQAH7h+R1F7KEuUfvDsNQ==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/gts/-/gts-0.5.3.tgz", + "integrity": "sha512-MiC5I1cAYjuGq68Xc9esn1qQcfl/on154+Oux8y6xWv03Ql9DGGsAokFVzgqNFDV65wd38uXYcPNaeeIl/EOjg==", "dev": true, "requires": { "chalk": "2.3.0", @@ -1332,6 +1366,12 @@ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, "is-builtin-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", @@ -1434,6 +1474,49 @@ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, + "js-green-licenses": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/js-green-licenses/-/js-green-licenses-0.2.0.tgz", + "integrity": "sha512-AkUDqKfvOREpd+ZbZRIdP5YRbEyNsyxMBgvMrfjs4zk5TpYJondN+Xcvm57tj7e1cgYaoBg5yx9g99eXEoYuqA==", + "dev": true, + "requires": { + "argparse": "1.0.9", + "axios": "0.17.1", + "npm-package-arg": "6.0.0", + "package-json": "4.0.1", + "pify": "3.0.0", + "spdx-correct": "2.0.4", + "spdx-satisfies": "0.1.3" + }, + "dependencies": { + "spdx-correct": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-2.0.4.tgz", + "integrity": "sha512-c+4gPpt9YDhz7cHlz5UrsHzxxRi4ksclxnEEKsuGT9JdwSC+ZNmsGbYRzzgxyZaBYpcWnlu+4lPcdLKx4DOCmA==", + "dev": true, + "requires": { + "spdx-expression-parse": "2.0.2", + "spdx-license-ids": "2.0.1" + } + }, + "spdx-expression-parse": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-2.0.2.tgz", + "integrity": "sha512-oFxOkWCfFS0ltNp0H66gXlU4NF6bxg7RkoTYR0413t+yTY9zyj+AIWsjtN8dcVp6703ijDYBWBIARlJ7DkyP9Q==", + "dev": true, + "requires": { + "spdx-exceptions": "2.0.0", + "spdx-license-ids": "2.0.1" + } + }, + "spdx-license-ids": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-2.0.1.tgz", + "integrity": "sha1-AgF7zDU07k/+9tWNIOfT6aHDyOw=", + "dev": true + } + } + }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", @@ -1846,6 +1929,18 @@ "validate-npm-package-license": "3.0.1" } }, + "npm-package-arg": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.0.0.tgz", + "integrity": "sha512-hwC7g81KLgRmchv9ol6f3Fx4Yyc9ARX5X5niDHVILgpuvf08JRIgOZcEfpFXli3BgESoTrkauqorXm6UbvSgSg==", + "dev": true, + "requires": { + "hosted-git-info": "2.5.0", + "osenv": "0.1.4", + "semver": "5.4.1", + "validate-npm-package-name": "3.0.0" + } + }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -3678,12 +3773,28 @@ "mimic-fn": "1.1.0" } }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, + "osenv": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz", + "integrity": "sha1-Qv5tWVPfBsgGS+bxdsPQWqqjRkQ=", + "dev": true, + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, "p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", @@ -4128,6 +4239,16 @@ "hoek": "4.2.0" } }, + "spdx-compare": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/spdx-compare/-/spdx-compare-0.1.2.tgz", + "integrity": "sha1-sGrz6jSvdDfZGp9Enq8tLpPDyPs=", + "dev": true, + "requires": { + "spdx-expression-parse": "1.0.4", + "spdx-ranges": "1.0.1" + } + }, "spdx-correct": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", @@ -4137,6 +4258,12 @@ "spdx-license-ids": "1.2.2" } }, + "spdx-exceptions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.0.0.tgz", + "integrity": "sha1-aoDpnx8z5ArPSX9qQwz0mWnwE6g=", + "dev": true + }, "spdx-expression-parse": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", @@ -4149,6 +4276,22 @@ "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", "dev": true }, + "spdx-ranges": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/spdx-ranges/-/spdx-ranges-1.0.1.tgz", + "integrity": "sha1-D07se46kjtIC43S7iULo0Y3AET4=", + "dev": true + }, + "spdx-satisfies": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/spdx-satisfies/-/spdx-satisfies-0.1.3.tgz", + "integrity": "sha1-Z6HydOYRXUquKK/kdNt2FkvhC9w=", + "dev": true, + "requires": { + "spdx-compare": "0.1.2", + "spdx-expression-parse": "1.0.4" + } + }, "split-array-stream": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/split-array-stream/-/split-array-stream-1.0.3.tgz", @@ -4158,6 +4301,12 @@ "is-stream-ended": "0.1.3" } }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, "sshpk": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", @@ -4461,6 +4610,15 @@ "spdx-expression-parse": "1.0.4" } }, + "validate-npm-package-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", + "integrity": "sha1-X6kS2B630MdK/BQN5zF/DKffQ34=", + "dev": true, + "requires": { + "builtins": "1.0.3" + } + }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 0186fc579fc..31abbeb7c5b 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -15,10 +15,11 @@ "fix": "gts fix", "prepare": "npm run compile", "pretest": "npm run compile", - "posttest": "npm run check", + "posttest": "npm run check && npm run license-check", "proto": "npm run proto:profile && npm run proto:profiler", "proto:profile": "mkdir -p proto && pbjs -t static-module -w commonjs -o proto/profile.js third_party/proto/profile.proto && pbts -o proto/profile.d.ts proto/profile.js", - "proto:profiler": "mkdir -p proto && pbjs -t static-module -w commonjs -o proto/profiler.js third_party/googleapis/google/devtools/cloudprofiler/v2/profiler.proto && pbts -o proto/profiler.d.ts proto/profiler.js" + "proto:profiler": "mkdir -p proto && pbjs -t static-module -w commonjs -o proto/profiler.js third_party/googleapis/google/devtools/cloudprofiler/v2/profiler.proto && pbts -o proto/profiler.d.ts proto/profiler.js", + "license-check": "jsgl --local ." }, "author": { "name": "Google Inc." @@ -51,6 +52,7 @@ "@types/sinon": "^4.0.0", "codecov": "^3.0.0", "gts": "^0.5.3", + "js-green-licenses": "^0.2.0", "mocha": "^4.0.1", "nock": "^9.0.22", "nyc": "^11.2.1", From 621f6f37c6e6922ef890ac0bf17f8f9da61fc880 Mon Sep 17 00:00:00 2001 From: chenyumic Date: Mon, 8 Jan 2018 15:47:48 -0800 Subject: [PATCH 066/632] Update LICENSE (#105) As requested in b/70893145, any repository that is expected to be Apache 2.0 should have the exact license file from Apache with no modifications. --- handwritten/cloud-profiler/LICENSE | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/LICENSE b/handwritten/cloud-profiler/LICENSE index a4c5efd822f..261eeb9e9f8 100644 --- a/handwritten/cloud-profiler/LICENSE +++ b/handwritten/cloud-profiler/LICENSE @@ -1,4 +1,3 @@ - Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -187,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2014 Google Inc. + 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. From 5cc0f8f5dd6cdb0efd7fb0b99df274051a92ae82 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Tue, 9 Jan 2018 12:01:04 -0800 Subject: [PATCH 067/632] fix: fix incorrect time profile duration (#101) * fix: correct time profile duration * modify so tests pass --- handwritten/cloud-profiler/ts/src/index.ts | 2 +- .../cloud-profiler/ts/src/profilers/profile-serializer.ts | 2 +- handwritten/cloud-profiler/ts/test/profiles-for-tests.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/handwritten/cloud-profiler/ts/src/index.ts b/handwritten/cloud-profiler/ts/src/index.ts index 089a140ca45..84488ba3907 100644 --- a/handwritten/cloud-profiler/ts/src/index.ts +++ b/handwritten/cloud-profiler/ts/src/index.ts @@ -71,7 +71,7 @@ export async function initConfig(config: Config): Promise { } let envSetConfig: Config = {}; - if (process.env.hasOwnProperty('GCLOUD_PROFILER_CONFIG')) { + if (process.env.GCLOUD_PROFILER_CONFIG) { envSetConfig = require(path.resolve(process.env.GCLOUD_PROFILER_CONFIG)) as Config; } diff --git a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts index abada940037..0454e19fb39 100644 --- a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts +++ b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts @@ -225,7 +225,7 @@ export function serializeTimeProfile( const profile = { sampleType: [sampleValueType, timeValueType], timeNanos: Date.now() * 1000 * 1000, - durationNanos: (prof.endTime - prof.startTime) * 1000 * 1000, + durationNanos: (prof.endTime - prof.startTime) * 1000, periodType: timeValueType, period: intervalMicros, }; diff --git a/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts index 1f404297c62..26c285b5827 100644 --- a/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts +++ b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts @@ -79,7 +79,7 @@ const timeRoot = { export const v8TimeProfile: TimeProfile = { startTime: 0, - endTime: 10 * 1000, + endTime: 10 * 1000 * 1000, topDownRoot: timeRoot, }; @@ -344,7 +344,7 @@ const anonymousFunctionTimeRoot = { export const v8AnonymousFunctionTimeProfile: TimeProfile = { startTime: 0, - endTime: 10 * 1000, + endTime: 10 * 1000 * 1000, topDownRoot: anonymousFunctionTimeRoot, }; From 4aa400fca8342e83cbadf62a822916955142da35 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Tue, 9 Jan 2018 12:54:56 -0800 Subject: [PATCH 068/632] 0.1.9 (#96) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 31abbeb7c5b..d134909335c 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.6", + "version": "0.1.9", "description": "Adds support for Google Cloud Profiler to node.js applications", "repository": "GoogleCloudPlatform/cloud-profiler-nodejs", "main": "out/src/index.js", From 27d812e14b0be45eaecdd0f9912fca2c3f3e7b48 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 10 Jan 2018 11:10:51 -0800 Subject: [PATCH 069/632] feat: add source mapping to tests for better stack traces (#107) --- handwritten/cloud-profiler/package-lock.json | 25 ++++++++++++++++++- handwritten/cloud-profiler/package.json | 3 ++- handwritten/cloud-profiler/ts/src/profiler.ts | 9 +++++-- .../cloud-profiler/ts/test/test-profiler.ts | 12 ++------- 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index cb89a5463d5..7885a0871e7 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.6", + "version": "0.1.9", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -160,6 +160,14 @@ "integrity": "sha512-fL6bJHYRzbw/7ofbKiJ65SOAasoe5mZhHNSYKxWsF3sGl/arhRwDPwXJqM1xofKNTQD14HNX9VruicM7pm++mQ==", "dev": true }, + "@types/source-map-support": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@types/source-map-support/-/source-map-support-0.4.0.tgz", + "integrity": "sha512-9oVAi1Jlr274pbMGPEe0S3IPImV9knVNafa6E4MookD/fjOZAE6EmLkFX5ZjtZ9OXNPi2FCIZzUSMvwAUUKeSg==", + "requires": { + "@types/node": "8.5.2" + } + }, "ajv": { "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", @@ -4239,6 +4247,21 @@ "hoek": "4.2.0" } }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.0.tgz", + "integrity": "sha512-vUoN3I7fHQe0R/SJLKRdKYuEdRGogsviXFkHHo17AWaTGv17VLnxw+CFXvqy+y4ORZ3doWLQcxRYfwKrsd/H7Q==", + "dev": true, + "requires": { + "source-map": "0.6.1" + } + }, "spdx-compare": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/spdx-compare/-/spdx-compare-0.1.2.tgz", diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index d134909335c..cf169f926b7 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -7,7 +7,7 @@ "types": "out/src/index.d.ts", "scripts": { "install": "node-gyp rebuild", - "test": "nyc mocha out/test/test-*.js && nyc --no-clean mocha out/system-test/test-*.js --timeout=60000", + "test": "nyc mocha --require source-map-support/register out/test/test-*.js && nyc --no-clean mocha --require source-map-support/register out/system-test/test-*.js --timeout=60000", "check": "gts check", "clean": "gts clean", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json", @@ -57,6 +57,7 @@ "nock": "^9.0.22", "nyc": "^11.2.1", "sinon": "^4.0.1", + "source-map-support": "^0.5.0", "ts-mockito": "^2.2.5", "typescript": "~2.6.x" }, diff --git a/handwritten/cloud-profiler/ts/src/profiler.ts b/handwritten/cloud-profiler/ts/src/profiler.ts index 742877ccae5..164dcfce0ce 100644 --- a/handwritten/cloud-profiler/ts/src/profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profiler.ts @@ -159,13 +159,18 @@ function isBackoffResponseError(err: Error): err is BackoffResponseError { */ export class Retryer { private nextBackoffMillis: number; + + // For testing. Allows Math.random() to be replaced with non-random function. + private random: () => number; + constructor( readonly initialBackoffMillis: number, readonly backoffCapMillis: number, - readonly backoffMultiplier: number) { + readonly backoffMultiplier: number, random = Math.random) { this.nextBackoffMillis = this.initialBackoffMillis; + this.random = random; } getBackoff(): number { - const curBackoff = Math.random() * this.nextBackoffMillis; + const curBackoff = this.random() * this.nextBackoffMillis; this.nextBackoffMillis = Math.min( this.backoffMultiplier * this.nextBackoffMillis, this.backoffCapMillis); return curBackoff; diff --git a/handwritten/cloud-profiler/ts/test/test-profiler.ts b/handwritten/cloud-profiler/ts/test/test-profiler.ts index e6b5047b32b..ee297590a85 100644 --- a/handwritten/cloud-profiler/ts/test/test-profiler.ts +++ b/handwritten/cloud-profiler/ts/test/test-profiler.ts @@ -82,18 +82,10 @@ function nockOauth2(): nock.Scope { }); } + describe('Retryer', () => { - let randomStub: sinon.SinonStub|undefined; - before(() => { - randomStub = sinon.stub(Math, 'random').returns(0.5); - }); - after(() => { - if (randomStub) { - randomStub.restore(); - } - }); it('should backoff until max-backoff reached', () => { - const retryer = new Retryer(1000, 1000000, 5); + const retryer = new Retryer(1000, 1000000, 5, () => 0.5); assert.equal(retryer.getBackoff(), 0.5 * 1000); assert.equal(retryer.getBackoff(), 0.5 * 5000); assert.equal(retryer.getBackoff(), 0.5 * 25000); From ea1c1840b15d92596ccf7ab6c4ff001864ac49b8 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 10 Jan 2018 11:25:31 -0800 Subject: [PATCH 070/632] chore: Update @types/node to the latest version (#108) --- handwritten/cloud-profiler/package.json | 2 +- handwritten/cloud-profiler/ts/src/index.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index cf169f926b7..d2454a3eb0c 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -45,7 +45,7 @@ "@types/long": "^3.0.32", "@types/mocha": "^2.2.43", "@types/nock": "^9.1.0", - "@types/node": "^8.0.30", + "@types/node": "^9.3.0", "@types/pify": "^3.0.0", "@types/pretty-ms": "^3.0.0", "@types/request": "^2.0.7", diff --git a/handwritten/cloud-profiler/ts/src/index.ts b/handwritten/cloud-profiler/ts/src/index.ts index 84488ba3907..29cdadee38d 100644 --- a/handwritten/cloud-profiler/ts/src/index.ts +++ b/handwritten/cloud-profiler/ts/src/index.ts @@ -71,9 +71,9 @@ export async function initConfig(config: Config): Promise { } let envSetConfig: Config = {}; - if (process.env.GCLOUD_PROFILER_CONFIG) { - envSetConfig = - require(path.resolve(process.env.GCLOUD_PROFILER_CONFIG)) as Config; + const val = process.env.GCLOUD_PROFILER_CONFIG; + if (val) { + envSetConfig = require(path.resolve(val)) as Config; } const mergedConfig = From 709059b74239f4b9298c6233f9560474b2bda095 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Thu, 11 Jan 2018 09:49:26 -0800 Subject: [PATCH 071/632] chore(package): update js-green-licenses to version 0.3.1 (#110) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index d2454a3eb0c..e2a670fb886 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -52,7 +52,7 @@ "@types/sinon": "^4.0.0", "codecov": "^3.0.0", "gts": "^0.5.3", - "js-green-licenses": "^0.2.0", + "js-green-licenses": "^0.3.1", "mocha": "^4.0.1", "nock": "^9.0.22", "nyc": "^11.2.1", From b0b59f7fa5464c93e8f4377e80452cea9af27bb9 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 11 Jan 2018 10:14:04 -0800 Subject: [PATCH 072/632] 0.1.10 (#111) --- handwritten/cloud-profiler/package-lock.json | 2 +- handwritten/cloud-profiler/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 7885a0871e7..41aa1490717 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.9", + "version": "0.1.10", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index e2a670fb886..1cfd43c32ef 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.9", + "version": "0.1.10", "description": "Adds support for Google Cloud Profiler to node.js applications", "repository": "GoogleCloudPlatform/cloud-profiler-nodejs", "main": "out/src/index.js", From d624f03f7b9dfa7438e7e323d8a2af17c5e9b102 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Wed, 17 Jan 2018 13:33:39 -0800 Subject: [PATCH 073/632] chore(package): update js-green-licenses to version 0.4.0 (#113) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 1cfd43c32ef..934677f728d 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -52,7 +52,7 @@ "@types/sinon": "^4.0.0", "codecov": "^3.0.0", "gts": "^0.5.3", - "js-green-licenses": "^0.3.1", + "js-green-licenses": "^0.4.0", "mocha": "^4.0.1", "nock": "^9.0.22", "nyc": "^11.2.1", From 1d94dbeb9463a015823824256dae85250d5fd394 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Wed, 17 Jan 2018 20:40:45 -0800 Subject: [PATCH 074/632] chore(package): update mocha to version 5.0.0 (#114) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 934677f728d..a6855eada1e 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -53,7 +53,7 @@ "codecov": "^3.0.0", "gts": "^0.5.3", "js-green-licenses": "^0.4.0", - "mocha": "^4.0.1", + "mocha": "^5.0.0", "nock": "^9.0.22", "nyc": "^11.2.1", "sinon": "^4.0.1", From 06a57149f46b78f355255b190f2b824fd825f731 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Mon, 22 Jan 2018 11:09:52 -0800 Subject: [PATCH 075/632] fix: use delete instead of free in sampling-heap-profiler.cc (#117) * fix: use delete instead of free in sampling-heap-profiler.cc * use automatic memory management --- .../cloud-profiler/bindings/sampling-heap-profiler.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/bindings/sampling-heap-profiler.cc b/handwritten/cloud-profiler/bindings/sampling-heap-profiler.cc index f806350b31a..0cd25af8614 100644 --- a/handwritten/cloud-profiler/bindings/sampling-heap-profiler.cc +++ b/handwritten/cloud-profiler/bindings/sampling-heap-profiler.cc @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include "v8-profiler.h" #include "nan.h" @@ -74,10 +75,10 @@ NAN_METHOD(StopSamplingHeapProfiler) { } NAN_METHOD(GetAllocationProfile) { - AllocationProfile* profile = info.GetIsolate()->GetHeapProfiler()->GetAllocationProfile(); + std::unique_ptr profile( + info.GetIsolate()->GetHeapProfiler()->GetAllocationProfile()); AllocationProfile::Node* root = profile->GetRootNode(); info.GetReturnValue().Set(TranslateAllocationProfile(root)); - free(profile); } NAN_MODULE_INIT(InitAll) { From d14d64ee889acead9283f6ccd19bea84b6565f7c Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Tue, 23 Jan 2018 09:05:23 -0800 Subject: [PATCH 076/632] chore: add circle-ci config (#118) --- .../cloud-profiler/.circleci/config.yml | 76 +++++++++++++++++++ handwritten/cloud-profiler/.travis.yml | 22 ------ 2 files changed, 76 insertions(+), 22 deletions(-) create mode 100644 handwritten/cloud-profiler/.circleci/config.yml delete mode 100644 handwritten/cloud-profiler/.travis.yml diff --git a/handwritten/cloud-profiler/.circleci/config.yml b/handwritten/cloud-profiler/.circleci/config.yml new file mode 100644 index 00000000000..6cc1dbbd751 --- /dev/null +++ b/handwritten/cloud-profiler/.circleci/config.yml @@ -0,0 +1,76 @@ +--- +release_tags: &release_tags + tags: + only: /^v\d+(\.\d+){2}(-.*)?$/ + +# "Include" for unit tests definition. +unit_tests: &unit_tests + steps: + - checkout + - run: + name: Install modules and dependencies. + command: npm install + - run: + name: Compiles typescript to javascript. + command: npm run compile + - run: + name: Run unit tests. + command: npm run test + - run: + name: Submit coverage data to codecov. + command: npm run codecov + when: always + +version: 2.0 +workflows: + version: 2 + tests: + jobs: + - node6: + filters: *release_tags + - node8: + filters: *release_tags + - node9: + filters: *release_tags + - publish_npm: + requires: + - node6 + - node8 + - node9 + filters: + branches: + ignore: /.*/ + <<: *release_tags + +jobs: + node6: + docker: + - image: node:6 + user: node + <<: *unit_tests + node8: + docker: + - image: node:8 + user: node + <<: *unit_tests + node9: + docker: + - image: node:9 + user: node + <<: *unit_tests + + publish_npm: + docker: + - image: node:8 + user: node + steps: + - checkout + - run: + name: Set NPM authentication. + command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc + - run: + name: Install modules and dependencies. + command: npm install + - run: + name: Publish the module to npm. + command: npm publish diff --git a/handwritten/cloud-profiler/.travis.yml b/handwritten/cloud-profiler/.travis.yml deleted file mode 100644 index 238b3eb2f5c..00000000000 --- a/handwritten/cloud-profiler/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -sudo: false - -language: node_js - -node_js: - - "6" - - "8" - - "9" - -env: - - CXX=g++-4.8 - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-4.8 - -script: - - npm run test - - npm run codecov From a61cec372ec6b518a350f0d1316a782553a5afb2 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Tue, 23 Jan 2018 13:16:07 -0800 Subject: [PATCH 077/632] Update version to 0.1.11 (#119) --- handwritten/cloud-profiler/package-lock.json | 2 +- handwritten/cloud-profiler/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 41aa1490717..d27de331def 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.10", + "version": "0.1.11", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index a6855eada1e..596bec2f73c 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.10", + "version": "0.1.11", "description": "Adds support for Google Cloud Profiler to node.js applications", "repository": "GoogleCloudPlatform/cloud-profiler-nodejs", "main": "out/src/index.js", From cb12f4d2858943678fede100c54ba546ae7e7590 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Tue, 6 Feb 2018 13:47:54 -0800 Subject: [PATCH 078/632] fix(package): update @google-cloud/common to version 0.16.0 (#124) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 596bec2f73c..f46add42fbd 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -26,7 +26,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/common": "^0.15.0", + "@google-cloud/common": "^0.16.0", "bindings": "^1.2.1", "delay": "^2.0.0", "extend": "^3.0.1", From 293cd5414ab20f573d3b030b4ee63dedd1109370 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 7 Feb 2018 14:53:25 -0800 Subject: [PATCH 079/632] Revert "fix(package): update @google-cloud/common to version 0.16.0 (#124)" (#126) This reverts commit 24cf63bbb86f8db29c621c888c44d024e0ba5ec4. --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index f46add42fbd..596bec2f73c 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -26,7 +26,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/common": "^0.16.0", + "@google-cloud/common": "^0.15.0", "bindings": "^1.2.1", "delay": "^2.0.0", "extend": "^3.0.1", From 01e5d6e089d8678e07e07bb311482b4b2578e80d Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Tue, 13 Feb 2018 13:17:40 -0800 Subject: [PATCH 080/632] feat: add field to config so user can use test API (#131) feat: add field to config so user can use test API --- handwritten/cloud-profiler/package-lock.json | 47 ++++++------- handwritten/cloud-profiler/ts/src/config.ts | 6 ++ handwritten/cloud-profiler/ts/src/profiler.ts | 6 +- .../ts/test/test-init-config.ts | 25 ++++++- .../cloud-profiler/ts/test/test-profiler.ts | 67 ++++++++++++++++++- 5 files changed, 121 insertions(+), 30 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index d27de331def..4ca8751b178 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -101,7 +101,7 @@ "integrity": "sha512-JAMFhOaHIciYVh8fb5/83nmuO/AHwmto+Hq7a9y8FzLDcC1KCU344XDOMEmahnrTFlHjgh4L0WJFczNIX2GxnQ==", "dev": true, "requires": { - "@types/node": "8.5.2" + "@types/node": "9.4.5" } }, "@types/long": { @@ -115,7 +115,7 @@ "integrity": "sha512-tE1SYtNG3I3atRVPELSGN2FJJJtPg3O/G0tycYSyzeDqdAbdLPRH089LhpWYA5M/iHeWHkVZq/b0OVKngcK0Eg==", "dev": true, "requires": { - "@types/node": "8.5.2" + "@types/node": "9.4.5" } }, "@types/nock": { @@ -124,13 +124,14 @@ "integrity": "sha512-Ykk50z1MKpHDRmnBJb6kn3rU03cCsbjHmqCzY3eyeDNxdz3mrgbbwwXRXzBnPXkD9qzGh1ZU9XLdbQVp6i0+gQ==", "dev": true, "requires": { - "@types/node": "8.5.2" + "@types/node": "9.4.5" } }, "@types/node": { - "version": "8.5.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.2.tgz", - "integrity": "sha512-KA4GKOpgXnrqEH2eCVhiv2CsxgXGQJgV1X0vsGlh+WCnxbeAE1GT44ZsTU1IN5dEeV/gDupKa7gWo08V5IxWVQ==" + "version": "9.4.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.4.5.tgz", + "integrity": "sha512-DvC7bzO5797bkApgukxouHmkOdYN2D0yL5olw0RncDpXUa6n39qTVsUi/5g2QJjPgl8qn4zh+4h0sofNoWGLRg==", + "dev": true }, "@types/pify": { "version": "3.0.0", @@ -151,7 +152,7 @@ "dev": true, "requires": { "@types/form-data": "2.2.1", - "@types/node": "8.5.2" + "@types/node": "9.4.5" } }, "@types/sinon": { @@ -160,14 +161,6 @@ "integrity": "sha512-fL6bJHYRzbw/7ofbKiJ65SOAasoe5mZhHNSYKxWsF3sGl/arhRwDPwXJqM1xofKNTQD14HNX9VruicM7pm++mQ==", "dev": true }, - "@types/source-map-support": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@types/source-map-support/-/source-map-support-0.4.0.tgz", - "integrity": "sha512-9oVAi1Jlr274pbMGPEe0S3IPImV9knVNafa6E4MookD/fjOZAE6EmLkFX5ZjtZ9OXNPi2FCIZzUSMvwAUUKeSg==", - "requires": { - "@types/node": "8.5.2" - } - }, "ajv": { "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", @@ -1483,9 +1476,9 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, "js-green-licenses": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/js-green-licenses/-/js-green-licenses-0.2.0.tgz", - "integrity": "sha512-AkUDqKfvOREpd+ZbZRIdP5YRbEyNsyxMBgvMrfjs4zk5TpYJondN+Xcvm57tj7e1cgYaoBg5yx9g99eXEoYuqA==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/js-green-licenses/-/js-green-licenses-0.4.0.tgz", + "integrity": "sha512-LpkL/9coWxNUmJ9/jxng3uvcLK6Qso2yaz7QBjO+atwtX/xmt8MrCtbkolYdhPZl/fq5dRs7Q7BLA8Ne3DKZ2w==", "dev": true, "requires": { "argparse": "1.0.9", @@ -1494,7 +1487,8 @@ "package-json": "4.0.1", "pify": "3.0.0", "spdx-correct": "2.0.4", - "spdx-satisfies": "0.1.3" + "spdx-satisfies": "0.1.3", + "strip-json-comments": "2.0.1" }, "dependencies": { "spdx-correct": { @@ -1809,9 +1803,9 @@ } }, "mocha": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.1.0.tgz", - "integrity": "sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.0.0.tgz", + "integrity": "sha512-ukB2dF+u4aeJjc6IGtPNnJXfeby5d4ZqySlIBT0OEyva/DrMjVm5HkQxKnHDLKEfEQBsEnwTg9HHhtPHJdTd8w==", "dev": true, "requires": { "browser-stdout": "1.3.0", @@ -3977,8 +3971,15 @@ "@protobufjs/pool": "1.1.0", "@protobufjs/utf8": "1.1.0", "@types/long": "3.0.32", - "@types/node": "8.5.2", + "@types/node": "8.9.3", "long": "3.2.0" + }, + "dependencies": { + "@types/node": { + "version": "8.9.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.9.3.tgz", + "integrity": "sha512-wqrPE4Uvj2fmL0E5JFQiY7D/5bAKvVUfWTnQ5NEV35ULkAU0j3QuqIi9Qyrytz8M5hsrh8Kijt+FsdLQaZR+IA==" + } } }, "pseudomap": { diff --git a/handwritten/cloud-profiler/ts/src/config.ts b/handwritten/cloud-profiler/ts/src/config.ts index 290fd4e9873..64808eae06f 100644 --- a/handwritten/cloud-profiler/ts/src/config.ts +++ b/handwritten/cloud-profiler/ts/src/config.ts @@ -102,6 +102,10 @@ export interface Config extends AuthenticationConfig { // too large. // https://nodejs.org/dist/latest-v9.x/docs/api/timers.html#timers_settimeout_callback_delay_args. serverBackoffCapMillis?: number; + + // Allows user to specify API URL other than + // https://cloudprofiler.googleapis.com/v2. + baseApiUrl?: string; } // Interface for an initialized config. @@ -120,6 +124,7 @@ export interface ProfilerConfig extends AuthenticationConfig { backoffCapMillis: number; backoffMultiplier: number; serverBackoffCapMillis: number; + baseApiUrl: string; } // Default values for configuration for a profiler. @@ -134,6 +139,7 @@ export const defaultConfig = { initialBackoffMillis: 1000, backoffCapMillis: parseDuration('1h'), backoffMultiplier: 1.3, + baseApiUrl: 'https://cloudprofiler.googleapis.com/v2', // This is the largest duration for setTimeout which does not cause it to // run immediately. diff --git a/handwritten/cloud-profiler/ts/src/profiler.ts b/handwritten/cloud-profiler/ts/src/profiler.ts index 164dcfce0ce..2abd290af80 100644 --- a/handwritten/cloud-profiler/ts/src/profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profiler.ts @@ -30,7 +30,6 @@ import {TimeProfiler} from './profilers/time-profiler'; export const common: Common = require('@google-cloud/common'); const parseDuration: (str: string) => number = require('parse-duration'); const pjson = require('../../package.json'); -const API = 'https://cloudprofiler.googleapis.com/v2'; const SCOPE = 'https://www.googleapis.com/auth/monitoring.write'; const gzip = pify(zlib.gzip); @@ -223,12 +222,11 @@ export class Profiler extends common.ServiceObject { constructor(config: ProfilerConfig) { config = common.util.normalizeArguments(null, config); const serviceConfig = { - baseUrl: API, + baseUrl: config.baseApiUrl, scopes: [SCOPE], packageJson: pjson, }; super({parent: new common.Service(serviceConfig, config), baseUrl: '/'}); - this.config = config; this.logger = new common.logger({ @@ -390,7 +388,7 @@ export class Profiler extends common.ServiceObject { } const options = { method: 'PATCH', - uri: API + '/' + prof.name, + uri: this.config.baseApiUrl + '/' + prof.name, body: prof, json: true, }; diff --git a/handwritten/cloud-profiler/ts/test/test-init-config.ts b/handwritten/cloud-profiler/ts/test/test-init-config.ts index 3ccefe50dc9..732989b5861 100644 --- a/handwritten/cloud-profiler/ts/test/test-init-config.ts +++ b/handwritten/cloud-profiler/ts/test/test-init-config.ts @@ -50,7 +50,8 @@ describe('initConfig', () => { initialBackoffMillis: 1000, backoffCapMillis: 60 * 60 * 1000, backoffMultiplier: 1.3, - serverBackoffCapMillis: 2147483647 + serverBackoffCapMillis: 2147483647, + baseApiUrl: 'https://cloudprofiler.googleapis.com/v2', }; it('should not modify specified fields when not on GCE', async () => { @@ -175,6 +176,28 @@ describe('initConfig', () => { assert.deepEqual(initializedConfig, extend(config, internalConfigParams)); }); + it('should set baseApiUrl to non-default value', async () => { + metadataStub = sinon.stub(gcpMetadata, 'instance'); + metadataStub.throwsException('cannot access metadata'); + + const config = { + serviceContext: {version: '', service: 'fake-service'}, + baseApiUrl: 'https://test-cloudprofiler.sandbox.googleapis.com/v2' + }; + const expConfig = extend( + { + serviceContext: {version: '', service: 'fake-service'}, + disableHeap: false, + disableTime: false, + logLevel: 2 + }, + internalConfigParams); + expConfig.baseApiUrl = + 'https://test-cloudprofiler.sandbox.googleapis.com/v2'; + const initializedConfig = await initConfig(config); + assert.deepEqual(initializedConfig, expConfig); + }); + it('should get values from from environment variable when not specified in config or environment variables', async () => { process.env.GCLOUD_PROJECT = 'process-projectId'; diff --git a/handwritten/cloud-profiler/ts/test/test-profiler.ts b/handwritten/cloud-profiler/ts/test/test-profiler.ts index ee297590a85..680e4b484e3 100644 --- a/handwritten/cloud-profiler/ts/test/test-profiler.ts +++ b/handwritten/cloud-profiler/ts/test/test-profiler.ts @@ -38,6 +38,9 @@ const parseDuration: (str: string) => number = require('parse-duration'); const fakeCredentials = require('../../ts/test/fixtures/gcloud-credentials.json'); +const API = 'https://cloudprofiler.googleapis.com/v2'; +const TEST_API = 'https://test-cloudprofiler.sandbox.googleapis.com/v2'; + const testConfig: ProfilerConfig = { projectId: 'test-projectId', logLevel: 0, @@ -53,10 +56,10 @@ const testConfig: ProfilerConfig = { initialBackoffMillis: 1000, backoffCapMillis: parseDuration('1h'), backoffMultiplier: 1.3, - serverBackoffCapMillis: parseDuration('7d') + serverBackoffCapMillis: parseDuration('7d'), + baseApiUrl: API }; -const API = 'https://cloudprofiler.googleapis.com/v2'; const mockTimeProfiler = mock(TimeProfiler); when(mockTimeProfiler.profile(10 * 1000)).thenReturn(new Promise((resolve) => { @@ -359,6 +362,40 @@ describe('Profiler', () => { profiler.timeProfiler = instance(mockTimeProfiler); await profiler.profileAndUpload(requestProf); }); + it('should send request to upload profile to default API without error.', + async () => { + const requestProf = { + name: 'projects/12345678901/test-projectId', + duration: '10s', + profileType: 'HEAP', + labels: {instance: 'test-instance'} + }; + nockOauth2(); + const apiMock = + nock(API).patch('/' + requestProf.name).once().reply(200); + const profiler = new Profiler(testConfig); + profiler.heapProfiler = instance(mockHeapProfiler); + await profiler.profileAndUpload(requestProf); + assert.equal(apiMock.isDone(), true, 'completed call to real API'); + }); + it('should send request to upload profile to non-default API without error.', + async () => { + const requestProf = { + name: 'projects/12345678901/test-projectId', + duration: '10s', + profileType: 'HEAP', + labels: {instance: 'test-instance'} + }; + nockOauth2(); + const apiMock = + nock(TEST_API).patch('/' + requestProf.name).once().reply(200); + const config = extend(true, {}, testConfig); + config.baseApiUrl = TEST_API; + const profiler = new Profiler(config); + profiler.heapProfiler = instance(mockHeapProfiler); + await profiler.profileAndUpload(requestProf); + assert.equal(apiMock.isDone(), true, 'completed call to test API'); + }); }); describe('createProfile', () => { let requestStub: undefined|sinon.SinonStub; @@ -392,6 +429,32 @@ describe('Profiler', () => { assert.deepEqual(response, actualResponse); assert.ok(requestProfileMock.isDone(), 'expected call to create profile'); }); + it('should successfully create profile using non-default api', async () => { + const config = extend(true, {}, testConfig); + config.disableHeap = true; + config.baseApiUrl = TEST_API; + const response = { + name: 'projects/12345678901/test-projectId', + profileType: 'WALL', + duration: '10s', + deployment: { + labels: {version: 'test-version'}, + projectId: 'test-projectId', + target: 'test-service' + }, + labels: {version: config.serviceContext.version} + }; + nockOauth2(); + const requestProfileMock = + nock(TEST_API) + .post('/projects/' + config.projectId + '/profiles') + .once() + .reply(200, response); + const profiler = new Profiler(config); + const actualResponse = await profiler.createProfile(); + assert.deepEqual(response, actualResponse); + assert.ok(requestProfileMock.isDone(), 'expected call to create profile'); + }); it('should successfully create heap profile', async () => { const config = extend(true, {}, testConfig); config.disableHeap = true; From 78cbb2ae125e537fdf0fe11b588118e26536dafb Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Tue, 13 Feb 2018 13:33:19 -0800 Subject: [PATCH 081/632] chore: update gcp-metadata (#127) --- handwritten/cloud-profiler/package-lock.json | 23 ++++++++++--------- handwritten/cloud-profiler/package.json | 2 +- handwritten/cloud-profiler/ts/src/index.ts | 5 ++-- .../ts/test/test-init-config.ts | 20 +++++++--------- 4 files changed, 23 insertions(+), 27 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 4ca8751b178..5d7da3c5c10 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -276,7 +276,6 @@ "version": "0.17.1", "resolved": "https://registry.npmjs.org/axios/-/axios-0.17.1.tgz", "integrity": "sha1-LY4+XQvb1zJ/kbyBT1xXZg+Bgk0=", - "dev": true, "requires": { "follow-redirects": "1.3.0", "is-buffer": "1.1.6" @@ -804,7 +803,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, "requires": { "ms": "2.0.0" } @@ -1027,7 +1025,6 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.3.0.tgz", "integrity": "sha1-9oSHH8EW0uMp/aVe9naH9Pq8kFw=", - "dev": true, "requires": { "debug": "3.1.0" } @@ -1063,12 +1060,13 @@ "dev": true }, "gcp-metadata": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.4.1.tgz", - "integrity": "sha512-yFE7v+NyoMiTOi2L6r8q87eVbiZCKooJNPKXTHhBStga8pwwgWofK9iHl00qd0XevZxcpk7ORaEL/ALuTvlaGQ==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.5.0.tgz", + "integrity": "sha512-G+haBuoUrnLzzJfnAuefG2yR0TC7Pgn8iw9L7YgacbBeQYx+/QiTulmYfetj923HMz0nWNW7Q7/fmNCLFMMN4Q==", "requires": { + "axios": "0.17.1", "extend": "3.0.1", - "retry-request": "3.3.1" + "retry-axios": "0.3.0" } }, "get-stream": { @@ -1370,8 +1368,7 @@ "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" }, "is-builtin-module": { "version": "1.0.0", @@ -1851,8 +1848,7 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "mute-stream": { "version": "0.0.7", @@ -4128,6 +4124,11 @@ "signal-exit": "3.0.2" } }, + "retry-axios": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/retry-axios/-/retry-axios-0.3.0.tgz", + "integrity": "sha512-6vOCghodB5p5N/ZOqug7A3WsT42TULZ7NErUi4lP3KtwtXgz4hE/43LWHsFuHuBfXRmOm/tjXBWAjnObrcy+yg==" + }, "retry-request": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-3.3.1.tgz", diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 596bec2f73c..717685e0e64 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -30,7 +30,7 @@ "bindings": "^1.2.1", "delay": "^2.0.0", "extend": "^3.0.1", - "gcp-metadata": "^0.4.0", + "gcp-metadata": "^0.5.0", "nan": "^2.8.0", "parse-duration": "^0.1.1", "pify": "^3.0.0", diff --git a/handwritten/cloud-profiler/ts/src/index.ts b/handwritten/cloud-profiler/ts/src/index.ts index 29cdadee38d..931bcb1a9b9 100644 --- a/handwritten/cloud-profiler/ts/src/index.ts +++ b/handwritten/cloud-profiler/ts/src/index.ts @@ -34,9 +34,8 @@ const pjson = require('../../package.json'); * Throws error if there is a problem accessing metadata API. */ async function getMetadataInstanceField(field: string): Promise { - const [response, metadata] = - await pify(gcpMetadata.instance, {multiArgs: true})(field); - return metadata; + const res = await gcpMetadata.instance(field); + return res.data; } function hasService(config: Config): diff --git a/handwritten/cloud-profiler/ts/test/test-init-config.ts b/handwritten/cloud-profiler/ts/test/test-init-config.ts index 732989b5861..7a60195a3d1 100644 --- a/handwritten/cloud-profiler/ts/test/test-init-config.ts +++ b/handwritten/cloud-profiler/ts/test/test-init-config.ts @@ -74,10 +74,9 @@ describe('initConfig', () => { it('should not modify specified fields when on GCE', async () => { metadataStub = sinon.stub(gcpMetadata, 'instance'); metadataStub.withArgs('name') - .callsArgWith(1, null, undefined, 'gce-instance') + .resolves({data: 'gce-instance'}) .withArgs('zone') - .callsArgWith( - 1, null, undefined, 'projects/123456789012/zones/gce-zone'); + .resolves({data: 'projects/123456789012/zones/gce-zone'}); const config = { logLevel: 2, @@ -95,10 +94,9 @@ describe('initConfig', () => { it('should get zone and instance from GCE', async () => { metadataStub = sinon.stub(gcpMetadata, 'instance'); metadataStub.withArgs('name') - .callsArgWith(1, null, undefined, 'gce-instance') + .resolves({data: 'gce-instance'}) .withArgs('zone') - .callsArgWith( - 1, null, undefined, 'projects/123456789012/zones/gce-zone'); + .resolves({data: 'projects/123456789012/zones/gce-zone'}); const config = { projectId: 'projectId', @@ -208,10 +206,9 @@ describe('initConfig', () => { './ts/test/fixtures/test-config.json'; metadataStub = sinon.stub(gcpMetadata, 'instance'); metadataStub.withArgs('name') - .callsArgWith(1, null, undefined, 'gce-instance') + .resolves({data: 'gce-instance'}) .withArgs('zone') - .callsArgWith( - 1, null, undefined, 'projects/123456789012/zones/gce-zone'); + .resolves({data: 'projects/123456789012/zones/gce-zone'}); const config = {}; const expConfig = { projectId: 'process-projectId', @@ -238,10 +235,9 @@ describe('initConfig', () => { './ts/test/fixtures/test-config.json'; metadataStub = sinon.stub(gcpMetadata, 'instance'); metadataStub.withArgs('name') - .callsArgWith(1, null, undefined, 'gce-instance') + .resolves({data: 'gce-instance'}) .withArgs('zone') - .callsArgWith( - 1, null, undefined, 'projects/123456789012/zones/gce-zone'); + .resolves({data: 'projects/123456789012/zones/gce-zone'}); const config = { projectId: 'config-projectId', From cc8c4de711df4a7b1710a48be54f90acccebd3f5 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 21 Feb 2018 10:20:48 -0800 Subject: [PATCH 082/632] fix: update type field used for value types used (#137) fix: update type field used for value types --- .../cloud-profiler/ts/src/profilers/profile-serializer.ts | 8 ++++---- handwritten/cloud-profiler/ts/system-test/test-start.ts | 4 ++-- handwritten/cloud-profiler/ts/test/profiles-for-tests.ts | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts index 0454e19fb39..bc39bc84c70 100644 --- a/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts +++ b/handwritten/cloud-profiler/ts/src/profilers/profile-serializer.ts @@ -153,24 +153,24 @@ function serialize( } /** - * @return value type for samples counts (type:samples, units:count), and + * @return value type for sample counts (type:sample, units:count), and * adds strings used in this value type to the table. */ function createSampleCountValueType(table: StringTable): perftools.profiles.ValueType { return new perftools.profiles.ValueType({ - type: table.getIndexOrAdd('samples'), + type: table.getIndexOrAdd('sample'), unit: table.getIndexOrAdd('count') }); } /** - * @return value type for time samples (type:time, units:microseconds), and + * @return value type for time samples (type:wall, units:microseconds), and * adds strings used in this value type to the table. */ function createTimeValueType(table: StringTable): perftools.profiles.ValueType { return new perftools.profiles.ValueType({ - type: table.getIndexOrAdd('time'), + type: table.getIndexOrAdd('wall'), unit: table.getIndexOrAdd('microseconds') }); } diff --git a/handwritten/cloud-profiler/ts/system-test/test-start.ts b/handwritten/cloud-profiler/ts/system-test/test-start.ts index 13f411d8b01..0257db22bc3 100644 --- a/handwritten/cloud-profiler/ts/system-test/test-start.ts +++ b/handwritten/cloud-profiler/ts/system-test/test-start.ts @@ -120,10 +120,10 @@ describe('start', () => { assert.equal(wall.profileType, 'WALL'); assert.equal( outProfile.stringTable[outProfile.sampleType[0].type as number], - 'samples'); + 'sample'); assert.equal( outProfile.stringTable[outProfile.sampleType[1].type as number], - 'time'); + 'wall'); assert.equal( outProfile.stringTable[outProfile.sampleType[0].unit as number], 'count'); diff --git a/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts index 26c285b5827..f47f94c37b8 100644 --- a/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts +++ b/handwritten/cloud-profiler/ts/test/profiles-for-tests.ts @@ -135,9 +135,9 @@ export const timeProfile: perftools.profiles.IProfile = { function: timeFunctions, stringTable: [ '', - 'samples', + 'sample', 'count', - 'time', + 'wall', 'microseconds', 'function2', 'script2', @@ -376,9 +376,9 @@ export const anonymousFunctionTimeProfile: perftools.profiles.IProfile = { function: anonymousFunctionTimeFunctions, stringTable: [ '', - 'samples', + 'sample', 'count', - 'time', + 'wall', 'microseconds', '(anonymous)', 'main', From 881aafcdd4990a589354255f73601999636ef8a5 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 21 Feb 2018 10:29:33 -0800 Subject: [PATCH 083/632] chore: release 0.1.12 (#138) --- handwritten/cloud-profiler/package-lock.json | 2 +- handwritten/cloud-profiler/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 5d7da3c5c10..fe5e63e829e 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.11", + "version": "0.1.12", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 717685e0e64..18d1de51f5c 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.11", + "version": "0.1.12", "description": "Adds support for Google Cloud Profiler to node.js applications", "repository": "GoogleCloudPlatform/cloud-profiler-nodejs", "main": "out/src/index.js", From 56ecd3101027a643e6afc3425e12258f0257c3fc Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 21 Feb 2018 16:47:59 -0800 Subject: [PATCH 084/632] chore: update README.md (#139) chore: update README.md --- handwritten/cloud-profiler/README.md | 256 ++++++++++++++++++++++++++- 1 file changed, 248 insertions(+), 8 deletions(-) diff --git a/handwritten/cloud-profiler/README.md b/handwritten/cloud-profiler/README.md index 4f170bd8ccb..347e34cfc98 100644 --- a/handwritten/cloud-profiler/README.md +++ b/handwritten/cloud-profiler/README.md @@ -1,21 +1,261 @@ # Google Cloud Profiler [![Greenkeeper badge](https://badges.greenkeeper.io/GoogleCloudPlatform/cloud-profiler-nodejs.svg)](https://greenkeeper.io/) - +[![NPM Version][npm-image]][npm-url] [![Dependency Status][david-image]][david-url] [![devDependency Status][david-dev-image]][david-dev-url] +[![Known Vulnerabilities][snyk-image]][snyk-url] + +> **Alpha**. *This is an Alpha release of Stackdriver Profiler Node.js +profiling agent. This feature might be changed in backward-incompatible ways +and is not recommended for production use. It is not subject to any SLA or +deprecation policy.* + + +## Prerequisites + +1. Your application will need to be using Node.js version 6.12.3 or greater, +or Node.js 8.9.4 or greater. +1. You will need a project in the [Google Developers Console][cloud-console]. +Your application can run anywhere, but the profiler data is associated with a +particular project. +1. You will need to enable the Stackdriver Profiler API for your project. + +## Basic Set-up + +1. Install `@google-cloud/profiler` with [`npm`](https://www.npmjs.com) or add +to your [`package.json`](https://docs.npmjs.com/files/package.json#dependencies). + + ```sh + # Install through npm while saving to the local 'package.json' + npm install --save @google-cloud/profiler + ``` + +2. Include and start the profiler at the beginning of your application: + + ```js + var profiler = require('@google-cloud/profiler').start(); + ``` + + Some environments require a configuration to be passed to the `start()` + function. For more details on this, see instructions for running + [outside of Google Cloud Platform](#running-elsewhere), on + [App Engine flexible environment](#running-on-app-engine-flexible-environment), + on [Google Compute Engine](#running-on-google-compute-engine), + and on [Google Container Engine](#running-on-google-container-engine). + +3. If you are running your application locally, or on a machine where you are +using the [Google Cloud SDK][gcloud-sdk], make sure to log in with the +application default credentials: + + ```sh + gcloud beta auth application-default login + ``` + + Alternatively, you can set `GOOGLE_APPLICATION_CREDENTIALS`. For more + details on this, see [Running elsewhere](#running-elsewhere) + +## Configuration + +See [the default configuration](ts/src/config.ts) for a list of possible +configuration options. These options can be passed to the agent through the +object argument to the start command shown below: + +```js +require('@google-cloud/profiler').start({disableTime: true}); +``` + +Alternatively, you can provide the configuration through a config file. This +can be useful if you want to load our module using `--require` on the command +line (which requires and starts the agent) instead of editing your main script. +The `GCLOUD_PROFILER_CONFIG` environment variable should point to your +configuration file. + +```bash +export GCLOUD_PROFILER_CONFIG=./path/to/your/profiler/configuration.js +``` + +### Changing log level + +The profiler writes log statements to the console log. By default, the log +level is set to warn. You can adjust this by setting `logLevel` in the config. +Setting `logLevel` to 0 will disable logging, 1 sets log level to error, 2 sets +it to warn, 3 sets it to info, and 4 sets it to debug. + +So, for example, to start the profiler with the log level at debug, you would +do this: + +```js +require('@google-cloud/profiler').start({logLevel: 4}); +``` + +### Disabling heap or time profile collection + +By default, the profiler collects both heap profiles, which show memory +allocations, and time profiles, which capture how much wall-clock time is spent +in different locations of the code. Using the configuration, it is possible to +disable the collection of either type of profile. + +To disable time profile collection, set `disableTime` to true: + +```js +require('@google-cloud/profiler').start({disableTime: true}); +``` + +To disable heap profile collection, set `disableHeap` to true: + +```js +require('@google-cloud/profiler').start({disableHeap: true}); +``` + +## Running on Google Cloud Platform + +There are three different services that can host Node.js applications within +Google Cloud Platform: Google App Engine flexible environment, Google Compute +Engine, and Google Container Engine. After installing `@google-cloud/profiler` +in your project and ensuring that the environment you are using uses Node.js +version 6.12.3 or greater, or Node.js 8.9.4 or greater, follow the +service-specific instructions to enable the profiler. + +### Running on App Engine flexible environment + +To enable the profiling agent for a Node.js program running in the App Engine +flexible environment, import the agent at the top of your application’s main +script or entry point by including the following code snippet: + + ```js + var profiler = require('@google-cloud/profiler').start(); + ``` + +You can specify which version of Node.js you're using by adding a snippet like +the following to your `package.json`: + +```json + "engines": { + "node": ">=8.9.4" + } +``` +The above snippet will ensure that you're using 8.9.4 or greater. + +Deploy your application to App Engine Flexible environment as usual. + +### Running on Google Compute Engine + +To enable the profiling agent for a Node.js program running in the Google +Compute Engine environment, import the agent at the top of your application’s +main script or entry point by including the following code snippet: + +```js +require('@google-cloud/profiler').start({ + serviceContext: { + service: 'your-service', + version: '1.0.0' + } +}); +``` + +You may also need to download `build-essential`. An example of this would be: + +```sh +apt-get update +apt-get install build-essential +``` + +### Running on Google Container Engine + +To enable the profiling agent for a Node.js program running in the Google +Container Engine environment, import the agent at the top of your application’s +main script or entry point by including the following code snippet: + +```js +require('@google-cloud/profiler').start({ + serviceContext: { + service: 'your-service', + version: '1.0.0' + } +}); +``` + +You may also need to add `build-essential` to your environment. + +## Running elsewhere + +You can still use `@google-cloud/profiler` if your application is running +outside of Google Cloud Platform, for example, running locally, on-premise, or +on another cloud provider. + +1. You will need to specify your project id and the service you want the +collected profiles to be associated with, and (optionally) the version of +the service when starting the profiler: -This module implements experimental support for profiling Node.js apps. -This module is under development and is not suitable for production -use at this point. + ```js + require('@google-cloud/profiler').start({ + projectId: 'project-id', + serviceContext: { + service: 'your-service', + version: '1.0.0' + } + }); + ``` +2. You will need to provide credential for your application. + + * If you are running your application on a development machine or test + environment where you are using the [`gcloud` command line tools][gcloud-sdk], + and are logged using `gcloud beta auth application-default login`, you + already have sufficient credentials, and a service account key is not + required. -This module uses APIs there are undocumented and are not covered by any -deprecation policy, and this may be subject to change without notice. + * You can provide credentials via + [Application Default Credentials][app-default-credentials]. This is the + reccomended method. + 1. [Create a new JSON service account key][service-account]. + 2. Copy the key somewhere your application can access it. Be sure not + to expose the key publicly. + 3. Set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` to + the full path to the key. The profiler will automatically look for + this environment variable. -The API this module exports is experimental and is not covered by any -deprecation policy, and may be changed without notice. + * You may set the `keyFilename` or `credentials` configuration field to the + full path or contents to the key file, respectively. Setting either of these + fields will override either setting `GOOGLE_APPLICATION_CREDENTIALS` or + logging in using `gcloud`. + + This is how you would set `keyFilename`: + ```js + require('@google-cloud/profiler').start({ + projectId: 'project-id', + serviceContext: { + service: 'your-service', + version: '1.0.0' + }, + keyFilename: '/path/to/keyfile' + }); + ``` + This is how you would set `credentials`: + ```js + require('@google-cloud/profiler').start({ + projectId: 'project-id', + serviceContext: { + service: 'your-service', + version: '1.0.0' + }, + credentials: { + client_email: 'email', + private_key: 'private_key' + } + }); + ``` +[app-default-credentials]: https://developers.google.com/identity/protocols/application-default-credentials +[cloud-console]: https://console.cloud.google.com +[coveralls-image]: https://coveralls.io/repos/GoogleCloudPlatform/cloud-profiler-nodejs/badge.svg?branch=master&service=github [david-image]: https://david-dm.org/GoogleCloudPlatform/cloud-profiler-nodejs.svg [david-url]: https://david-dm.org/GoogleCloudPlatform/cloud-profiler-nodejs [david-dev-image]: https://david-dm.org/GoogleCloudPlatform/cloud-profiler-nodejs/dev-status.svg [david-dev-url]: https://david-dm.org/GoogleCloudPlatform/cloud-profiler-nodejs#info=devDependencies +[gcloud-sdk]: https://cloud.google.com/sdk/gcloud/ +[npm-image]: https://badge.fury.io/js/%40google-cloud%2Fprofiler.svg +[npm-url]: https://npmjs.org/package/@google-cloud/profiler +[service-account]: https://console.developers.google.com/apis/credentials/serviceaccountkey +[snyk-image]: https://snyk.io/test/github/GoogleCloudPlatform/cloud-profiler-nodejs/badge.svg +[snyk-url]: https://snyk.io/test/github/GoogleCloudPlatform/cloud-profiler-nodejs \ No newline at end of file From 798236eba8a108b768854636e61e920c76599a27 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 22 Feb 2018 08:15:14 -0800 Subject: [PATCH 085/632] chore: clarify that logging is for diagnostic purposes (#140) --- handwritten/cloud-profiler/README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/handwritten/cloud-profiler/README.md b/handwritten/cloud-profiler/README.md index 347e34cfc98..eac96e81505 100644 --- a/handwritten/cloud-profiler/README.md +++ b/handwritten/cloud-profiler/README.md @@ -77,10 +77,11 @@ export GCLOUD_PROFILER_CONFIG=./path/to/your/profiler/configuration.js ### Changing log level -The profiler writes log statements to the console log. By default, the log -level is set to warn. You can adjust this by setting `logLevel` in the config. -Setting `logLevel` to 0 will disable logging, 1 sets log level to error, 2 sets -it to warn, 3 sets it to info, and 4 sets it to debug. +The profiler writes log statements to the console log for diagnostic purposes. +By default, the log level is set to warn. You can adjust this by setting +`logLevel` in the config. Setting `logLevel` to 0 will disable logging, 1 sets +log level to error, 2 sets it to warn, 3 sets it to info, and 4 sets it to +debug. So, for example, to start the profiler with the log level at debug, you would do this: From 0ceab46be4038e3b6cd593118475073bba3a3b5f Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 22 Feb 2018 10:36:01 -0800 Subject: [PATCH 086/632] fix: don't run profiler if incompatible version of node is used (#141) fix: don't run profiler if incompatible version of node is used --- handwritten/cloud-profiler/package-lock.json | 25 ++++++++++++-------- handwritten/cloud-profiler/package.json | 7 +++++- handwritten/cloud-profiler/ts/src/index.ts | 18 +++++++++++--- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index fe5e63e829e..bcf131a3829 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -155,6 +155,12 @@ "@types/node": "9.4.5" } }, + "@types/semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ==", + "dev": true + }, "@types/sinon": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.1.2.tgz", @@ -1896,7 +1902,7 @@ "mkdirp": "0.5.1", "propagate": "0.4.0", "qs": "6.5.1", - "semver": "5.4.1" + "semver": "5.5.0" }, "dependencies": { "debug": { @@ -1923,7 +1929,7 @@ "requires": { "hosted-git-info": "2.5.0", "is-builtin-module": "1.0.0", - "semver": "5.4.1", + "semver": "5.5.0", "validate-npm-package-license": "3.0.1" } }, @@ -1935,7 +1941,7 @@ "requires": { "hosted-git-info": "2.5.0", "osenv": "0.1.4", - "semver": "5.4.1", + "semver": "5.5.0", "validate-npm-package-name": "3.0.0" } }, @@ -3828,7 +3834,7 @@ "got": "6.7.1", "registry-auth-token": "3.3.1", "registry-url": "3.1.0", - "semver": "5.4.1" + "semver": "5.5.0" } }, "parse-duration": { @@ -4183,10 +4189,9 @@ "dev": true }, "semver": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", - "dev": true + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==" }, "semver-diff": { "version": "2.1.0", @@ -4194,7 +4199,7 @@ "integrity": "sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=", "dev": true, "requires": { - "semver": "5.4.1" + "semver": "5.5.0" } }, "shebang-command": { @@ -4523,7 +4528,7 @@ "glob": "7.1.2", "minimatch": "3.0.4", "resolve": "1.5.0", - "semver": "5.4.1", + "semver": "5.5.0", "tslib": "1.8.1", "tsutils": "2.15.0" } diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 18d1de51f5c..43618be2f8c 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -37,7 +37,8 @@ "pretty-ms": "^3.1.0", "protobufjs": "~6.8.0", "request": "^2.83.0", - "retry-request": "^3.0.1" + "retry-request": "^3.0.1", + "semver": "^5.5.0" }, "devDependencies": { "@types/delay": "^2.0.0", @@ -49,6 +50,7 @@ "@types/pify": "^3.0.0", "@types/pretty-ms": "^3.0.0", "@types/request": "^2.0.7", + "@types/semver": "^5.5.0", "@types/sinon": "^4.0.0", "codecov": "^3.0.0", "gts": "^0.5.3", @@ -76,5 +78,8 @@ "out/test", "out/system-test" ] + }, + "engines": { + "node": "6.12.3 - 7.0.0 || >=8.9.4" } } diff --git a/handwritten/cloud-profiler/ts/src/index.ts b/handwritten/cloud-profiler/ts/src/index.ts index 931bcb1a9b9..bd0b9ade1af 100644 --- a/handwritten/cloud-profiler/ts/src/index.ts +++ b/handwritten/cloud-profiler/ts/src/index.ts @@ -20,6 +20,7 @@ import * as gcpMetadata from 'gcp-metadata'; import * as path from 'path'; import {normalize} from 'path'; import * as pify from 'pify'; +import * as semver from 'semver'; import {AuthenticationConfig, Common, ServiceConfig} from '../third_party/types/common-types'; @@ -121,19 +122,30 @@ let profiler: Profiler|undefined = undefined; * */ export async function start(config: Config = {}): Promise { + if (!semver.satisfies(process.version, pjson.engines.node)) { + logError( + `Could not start profiler: node version ${process.version}` + + ` does not satisfies "${pjson.engines.node}"`, + config); + return; + } let normalizedConfig: ProfilerConfig; try { normalizedConfig = await initConfig(config); } catch (e) { - const logger = new common.logger( - {level: common.logger.LEVELS[config.logLevel || 2], tag: pjson.name}); - logger.error(`Could not start profiler: ${e}`); + logError(`Could not start profiler: ${e}`, config); return; } profiler = new Profiler(normalizedConfig); profiler.start(); } +function logError(msg: string, config: Config) { + const logger = new common.logger( + {level: common.logger.LEVELS[config.logLevel || 2], tag: pjson.name}); + logger.error(msg); +} + /** * For debugging purposes. Collects profiles and discards the collected From 81e736f0583b7a9a00d51907f800284c6dcd4857 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 1 Mar 2018 08:16:13 -0800 Subject: [PATCH 087/632] chore: add benchmark which will be used for e2e testing (#142) --- .../cloud-profiler/testing/busybench.js | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 handwritten/cloud-profiler/testing/busybench.js diff --git a/handwritten/cloud-profiler/testing/busybench.js b/handwritten/cloud-profiler/testing/busybench.js new file mode 100644 index 00000000000..18d55203781 --- /dev/null +++ b/handwritten/cloud-profiler/testing/busybench.js @@ -0,0 +1,34 @@ +/** + * Copyright 2018 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. + */ + +const startTime = Date.now(); + +/** + * Repeatedly fills a buffer, then calls itself with setImmediate. + * It continues to do this until durationSeconds after the startTime. + */ +function benchmark(durationSeconds) { + var buffer = new Buffer(1e4); + for (var k = 0; k < 1e4; k++) { + buffer.fill(0); + } + if (Date.now() - startTime < 1000 * durationSeconds) { + setImmediate(() => benchmark(durationSeconds)); + } +} + +const durationSeconds = process.argv.length > 2 ? process.argv[2] : 600; +benchmark(durationSeconds); From ecdd50618adaa52221d42276a31851dd05213d9c Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Tue, 6 Mar 2018 17:40:39 -0800 Subject: [PATCH 088/632] feat: add test cases for integration test (#144) feat: add test cases for e2e test --- .../cloud-profiler/.circleci/config.yml | 21 +- handwritten/cloud-profiler/testing/README.md | 17 ++ .../testing/integration_test.go | 248 ++++++++++++++++++ .../testing/integration_test.sh | 29 ++ 4 files changed, 314 insertions(+), 1 deletion(-) create mode 100644 handwritten/cloud-profiler/testing/README.md create mode 100644 handwritten/cloud-profiler/testing/integration_test.go create mode 100644 handwritten/cloud-profiler/testing/integration_test.sh diff --git a/handwritten/cloud-profiler/.circleci/config.yml b/handwritten/cloud-profiler/.circleci/config.yml index 6cc1dbbd751..5cbc761395a 100644 --- a/handwritten/cloud-profiler/.circleci/config.yml +++ b/handwritten/cloud-profiler/.circleci/config.yml @@ -20,6 +20,19 @@ unit_tests: &unit_tests name: Submit coverage data to codecov. command: npm run codecov when: always + +gochecks: &gochecks + steps: + - checkout + - run: + name: Check that code is formatted. + command: gofmtdiff=$(gofmt -s -d .) && if [ -n "$gofmtdiff" ]; then printf 'gofmt -s found:\n%s\n' "$gofmtdiff" && exit 1; fi + - run: + name: Install golint. + command: go get -u github.com/golang/lint/golint + - run: + name: Run lint check. + command: golintlint=$(golint ./...) && if [ -n "$golintlint" ]; then printf 'golint found:\n%s\n' "$golintlint" && exit 1; fi version: 2.0 workflows: @@ -32,11 +45,14 @@ workflows: filters: *release_tags - node9: filters: *release_tags + - gocheck: + filters: *release_tags - publish_npm: requires: - node6 - node8 - node9 + - gocheck filters: branches: ignore: /.*/ @@ -58,7 +74,10 @@ jobs: - image: node:9 user: node <<: *unit_tests - + gocheck: + docker: + - image: circleci/golang:1.9 + <<: *gochecks publish_npm: docker: - image: node:8 diff --git a/handwritten/cloud-profiler/testing/README.md b/handwritten/cloud-profiler/testing/README.md new file mode 100644 index 00000000000..61394ab530f --- /dev/null +++ b/handwritten/cloud-profiler/testing/README.md @@ -0,0 +1,17 @@ +This directory contains an integration test that confirms the basic functionality +of the profiler works on Compute Engine. In particular, this test confirms that +the agent can create and upload profiles from a Comput Engine VM, and that +these profiles contain symbolized samples from the benchmark application. + +More specifically, this test: +1. Starts 3 Compute Engine VMs, one to test Node.js versions 6, 8, and 9. + Each Compute Engine VM then: + 1. Downloads the desired version of Node.js, github, and build-essentials + (the dependencies needed to run the test). + 2. Clones the agent source code at the revision of interest. + 3. Runs the benchmark application, busybench.js (which repeatedly calls + a function which creates and fills a buffer) with the agent attached. +2. Waits for the application in each Compute Engine VM to finish. +3. Queries the Stackdriver Profiler API to confirm that both heap and wall + profiles have been uploaded to the API and that the profiles contain + symbolized samples which include the name of the function in the benchmark. diff --git a/handwritten/cloud-profiler/testing/integration_test.go b/handwritten/cloud-profiler/testing/integration_test.go new file mode 100644 index 00000000000..4f1d2b5b3b8 --- /dev/null +++ b/handwritten/cloud-profiler/testing/integration_test.go @@ -0,0 +1,248 @@ +// Copyright 2018 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. + +// +build integration,go1.7 + +package profiler + +import ( + "bytes" + "flag" + "fmt" + "os" + "strings" + "testing" + "text/template" + "time" + + "cloud.google.com/go/profiler/proftest" + "golang.org/x/net/context" + "golang.org/x/oauth2/google" + compute "google.golang.org/api/compute/v1" +) + +var ( + repo = flag.String("repo", "", "git repo to test") + branch = flag.String("branch", "", "git branch to test") + commit = flag.String("commit", "", "git commit to test") + runID = time.Now().Unix() +) + +const cloudScope = "https://www.googleapis.com/auth/cloud-platform" + +const startupTemplate = ` +#! /bin/bash + +# Shut down the VM in 5 minutes after this script exits +# to stop accounting the VM for billing and cores quota. +trap "sleep 300 && poweroff" EXIT + +# Fail on any error +set -eo pipefail + +# Display commands being run +set -x +# Install git +apt-get update +apt-get -y -q install git-all build-essential + +# Install desired version of Node.js +curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +nvm install {{.NodeVersion}} +npm -v +node -v + +# Install agent +git clone https://github.com/GoogleCloudPlatform/cloud-profiler-nodejs.git +cd cloud-profiler-nodejs +git pull {{.Repo}} {{.Branch}} +git reset --hard {{.Commit}} +npm install +npm run compile +npm pack +VERSION=$(node -e "console.log(require('./package.json').version);") +PROFILER="$HOME/cloud-profiler-nodejs/google-cloud-profiler-$VERSION.tgz" + +TESTDIR="$HOME/test" +mkdir -p "$TESTDIR" +cp "testing/busybench.js" "$TESTDIR" +cd "$TESTDIR" + +npm install "$PROFILER" + +# Run benchmark with agent +GCLOUD_PROFILER_LOGLEVEL=5 GAE_SERVICE={{.Service}} node --require @google-cloud/profiler busybench.js 600 + +# Indicate to test that script has finished running +echo "busybench finished profiling" +` + +type nodeGCETestCase struct { + proftest.GCETestConfig + name string + nodeVersion string + wantProfileTypes []string +} + +func (inst *nodeGCETestCase) initializeStartUpScript(template *template.Template) error { + var buf bytes.Buffer + err := template.Execute(&buf, + struct { + Service string + NodeVersion string + Repo string + Branch string + Commit string + }{ + Service: inst.service, + NodeVersion: inst.nodeVersion, + Repo: *repo, + Branch: *branch, + Commit: *commit, + }) + if err != nil { + return fmt.Errorf("failed to render startup script for %s: %v", inst.Name, err) + } + inst.StartupScript = buf.String() + return nil +} + +func TestAgentIntegration(t *testing.T) { + projectID := os.Getenv("GCLOUD_TESTS_NODEJS_PROJECT_ID") + if projectID == "" { + t.Fatalf("Getenv(GCLOUD_TESTS_NODEJS_PROJECT_ID) got empty string") + } + + zone := os.Getenv("GCLOUD_TESTS_NODEJS_ZONE") + if zone == "" { + t.Fatalf("Getenv(GCLOUD_TESTS_NODEJS_ZONE) got empty string") + } + + if *commit == "" { + t.Fatal("commit flag is not set") + } + + ctx := context.Background() + + client, err := google.DefaultClient(ctx, cloudScope) + if err != nil { + t.Fatalf("failed to get default client: %v", err) + } + + computeService, err := compute.New(client) + if err != nil { + t.Fatalf("failed to initialize compute Service: %v", err) + } + + template, err := template.New("startupScript").Parse(startupTemplate) + if err != nil { + t.Fatalf("failed to parse startup script template: %v", err) + } + + gceTr := proftest.GCETestRunner{ + TestRunner: proftest.TestRunner{ + Client: client, + }, + ComputeService: computeService, + } + + testcases := []nodeGCETestCase{ + { + InstanceConfig: proftest.InstanceConfig{ + ProjectID: projectID, + Zone: zone, + Name: fmt.Sprintf("profiler-test-node6-%d", runID), + }, + name: fmt.Sprintf("profiler-test-node6-%d-gce", runID), + wantProfileTypes: []string{"CPU", "HEAP"}, + nodeVersion: "6", + }, + { + InstanceConfig: proftest.InstanceConfig{ + ProjectID: projectID, + Zone: zone, + Name: fmt.Sprintf("profiler-test-node8-%d", runID), + }, + name: fmt.Sprintf("profiler-test-node8-%d-gce", runID), + wantProfileTypes: []string{"CPU", "HEAP"}, + nodeVersion: "8", + }, + { + InstanceConfig: proftest.InstanceConfig{ + ProjectID: projectID, + Zone: zone, + Name: fmt.Sprintf("profiler-test-node9-%d", runID), + }, + name: fmt.Sprintf("profiler-test-node9-%d-gce", runID), + wantProfileTypes: []string{"CPU", "HEAP"}, + nodeVersion: "9", + }, + } + for _, tc := range testcases { + tc := tc // capture range variable + t.Run(tc.Service, func(t *testing.T) { + t.Parallel() + if err := tc.initializeStartUpScript(template); err != nil { + t.Fatalf("failed to initialize startup script") + } + + gceTr.StartInstance(ctx, &tc.InstanceConfig) + defer func() { + if gceTr.DeleteInstance(ctx, &tcInstanceConfig); err != nil { + t.Fatal(err) + } + }() + + timeoutCtx, cancel := context.WithTimeout(ctx, time.Minute*25) + defer cancel() + if err := gceTr.PollForSerialOutput(timeoutCtx, &tc.InstanceConfig, "busybench finished profiling"); err != nil { + t.Fatal(err) + } + + timeNow := time.Now() + endTime := timeNow.Format(time.RFC3339) + startTime := timeNow.Add(-1 * time.Hour).Format(time.RFC3339) + + for _, pType := range tc.expProfileTypes { + pr, err := tr.QueryProfiles(tc.ProjectID, tc.Service, startTime, endTime, pType) + if err != nil { + t.Fatalf("QueryProfiles(%s, %s, %s, %s, %s) got error: %v", tc.ProjectID, tc.Service, startTime, endTime, pType, err) + } + + if pr.NumProfiles == 0 { + t.Fatalf("profile response contains zero profiles: %v", pr) + } + if len(pr.Deployments) == 0 { + t.Fatalf("profile response contains zero deployments: %v", pr) + } + if len(pr.Profile.Functions.Name) == 0 { + t.Fatalf("profile does not have function data") + } + + functionFound := false + for _, name := range pr.Profile.Functions.Name { + if strings.Contains(name, "benchmark") { + functionFound = true + break + } + } + if !functionFound { + t.Errorf("wanted function name %s not found in profile", "benchmark") + } + } + }) + } +} diff --git a/handwritten/cloud-profiler/testing/integration_test.sh b/handwritten/cloud-profiler/testing/integration_test.sh new file mode 100644 index 00000000000..e146ad80a56 --- /dev/null +++ b/handwritten/cloud-profiler/testing/integration_test.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Fail on any error. +set -eo pipefail + +# Display commands being run. +set -x + +cd github/cloud-profiler-nodejs + +SERVICE_KEY="${KOKORO_KEYSTORE_DIR}/72935_cloud-profiler-e2e-service-account-key" +COMMIT=$(git rev-parse HEAD) +BRANCH=$(git rev-parse --abbrev-ref HEAD) +REPO = $(git config --get remote.origin.url) + + +export GCLOUD_TESTS_NODEJS_PROJECT_ID="cloud-profiler-e2e" +export GCLOUD_TESTS_NODEJS_ZONE="us-east1-a" +export GOOGLE_APPLICATION_CREDENTIALS="${SERVICE_KEY}" + +# Move test to go path. +export GOPATH="$HOME/go" +mkdir -p "$GOPATH/src" +cp -R "integration_test" "$GOPATH/src" + +# Run test. +cd "$GOPATH/src/integration_test" +go get -d -t ./ +go test -timeout=30m -parallel=3 -run TestAgentIntegration -commit="$COMMIT" -branch="$BRANCH" -repo="$REPO" From 300cc244aa154433863a31075fbbb0707c531ba2 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 7 Mar 2018 12:24:04 -0800 Subject: [PATCH 089/632] chore: added kokoro configurations (#147) --- .../cloud-profiler/testing/kokoro/common.cfg | 22 +++++++++++++++++++ .../testing/kokoro/continuous.cfg | 16 ++++++++++++++ .../testing/kokoro/presubmit.cfg | 16 ++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 handwritten/cloud-profiler/testing/kokoro/common.cfg create mode 100644 handwritten/cloud-profiler/testing/kokoro/continuous.cfg create mode 100644 handwritten/cloud-profiler/testing/kokoro/presubmit.cfg diff --git a/handwritten/cloud-profiler/testing/kokoro/common.cfg b/handwritten/cloud-profiler/testing/kokoro/common.cfg new file mode 100644 index 00000000000..f82020fb58d --- /dev/null +++ b/handwritten/cloud-profiler/testing/kokoro/common.cfg @@ -0,0 +1,22 @@ +# Copyright 2018 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. + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 72935 + keyname: "cloud-profiler-e2e-service-account-key" + } + } +} diff --git a/handwritten/cloud-profiler/testing/kokoro/continuous.cfg b/handwritten/cloud-profiler/testing/kokoro/continuous.cfg new file mode 100644 index 00000000000..afdff385d97 --- /dev/null +++ b/handwritten/cloud-profiler/testing/kokoro/continuous.cfg @@ -0,0 +1,16 @@ +# Copyright 2018 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. + +# Location of the build script in this repository. +build_file: "cloud-profiler-nodejs/testing/integration_test.sh" diff --git a/handwritten/cloud-profiler/testing/kokoro/presubmit.cfg b/handwritten/cloud-profiler/testing/kokoro/presubmit.cfg new file mode 100644 index 00000000000..afdff385d97 --- /dev/null +++ b/handwritten/cloud-profiler/testing/kokoro/presubmit.cfg @@ -0,0 +1,16 @@ +# Copyright 2018 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. + +# Location of the build script in this repository. +build_file: "cloud-profiler-nodejs/testing/integration_test.sh" From 024b72e3ef404b16266ec207fb7aa0e5cd18d686 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 7 Mar 2018 12:48:14 -0800 Subject: [PATCH 090/632] fix: remove unnecessary spaces from integration_test.sh (#149) --- handwritten/cloud-profiler/testing/integration_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/testing/integration_test.sh b/handwritten/cloud-profiler/testing/integration_test.sh index e146ad80a56..4db1e864acd 100644 --- a/handwritten/cloud-profiler/testing/integration_test.sh +++ b/handwritten/cloud-profiler/testing/integration_test.sh @@ -11,7 +11,7 @@ cd github/cloud-profiler-nodejs SERVICE_KEY="${KOKORO_KEYSTORE_DIR}/72935_cloud-profiler-e2e-service-account-key" COMMIT=$(git rev-parse HEAD) BRANCH=$(git rev-parse --abbrev-ref HEAD) -REPO = $(git config --get remote.origin.url) +REPO=$(git config --get remote.origin.url) export GCLOUD_TESTS_NODEJS_PROJECT_ID="cloud-profiler-e2e" From feed662afd0df644098448973df6735989cf5bf7 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 7 Mar 2018 13:03:21 -0800 Subject: [PATCH 091/632] fix: update file names in integration_test.sh (#150) --- handwritten/cloud-profiler/testing/integration_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/testing/integration_test.sh b/handwritten/cloud-profiler/testing/integration_test.sh index 4db1e864acd..1df803bb363 100644 --- a/handwritten/cloud-profiler/testing/integration_test.sh +++ b/handwritten/cloud-profiler/testing/integration_test.sh @@ -21,9 +21,9 @@ export GOOGLE_APPLICATION_CREDENTIALS="${SERVICE_KEY}" # Move test to go path. export GOPATH="$HOME/go" mkdir -p "$GOPATH/src" -cp -R "integration_test" "$GOPATH/src" +cp -R "testing" "$GOPATH/src" # Run test. -cd "$GOPATH/src/integration_test" +cd "$GOPATH/src/testing" go get -d -t ./ go test -timeout=30m -parallel=3 -run TestAgentIntegration -commit="$COMMIT" -branch="$BRANCH" -repo="$REPO" From ac8317d39f129bb7564f6c1e4a2bd359f3c59702 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 7 Mar 2018 15:59:08 -0800 Subject: [PATCH 092/632] chore: add appveyor.yml (#146) --- handwritten/cloud-profiler/appveyor.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 handwritten/cloud-profiler/appveyor.yml diff --git a/handwritten/cloud-profiler/appveyor.yml b/handwritten/cloud-profiler/appveyor.yml new file mode 100644 index 00000000000..a966d65e063 --- /dev/null +++ b/handwritten/cloud-profiler/appveyor.yml @@ -0,0 +1,16 @@ +environment: + matrix: + - nodejs_version: "6" + - nodejs_version: "8" + - nodejs_version: "9" + +install: + - ps: Install-Product node $env:nodejs_version + - npm install + +test_script: + - node --version + - npm --version + - npm test + +build: off From c18b97eb79d3c6adc3e454066efc84e37dc3f46d Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 7 Mar 2018 19:42:14 -0800 Subject: [PATCH 093/632] fix: do not ask CPU profiler for individual samples (#148) fix: stop recording samples with time profile --- handwritten/cloud-profiler/bindings/time-profiler.cc | 8 ++++---- .../cloud-profiler/ts/src/profilers/time-profiler.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/handwritten/cloud-profiler/bindings/time-profiler.cc b/handwritten/cloud-profiler/bindings/time-profiler.cc index 76edcbacb5c..9380055e4c2 100644 --- a/handwritten/cloud-profiler/bindings/time-profiler.cc +++ b/handwritten/cloud-profiler/bindings/time-profiler.cc @@ -49,8 +49,6 @@ Local TranslateTimeProfile(const CpuProfile* profile) { profile->GetTitle()); js_profile->Set(Nan::New("topDownRoot").ToLocalChecked(), TranslateTimeProfileNode(profile->GetTopDownRoot())); - js_profile->Set(Nan::New("samplesCount").ToLocalChecked(), - Nan::New(profile->GetSamplesCount())); js_profile->Set(Nan::New("startTime").ToLocalChecked(), Nan::New(profile->GetStartTime())); js_profile->Set(Nan::New("endTime").ToLocalChecked(), @@ -60,8 +58,10 @@ Local TranslateTimeProfile(const CpuProfile* profile) { NAN_METHOD(StartProfiling) { Local name = info[0].As(); - bool record_samples = info[1].As()->BooleanValue(); - info.GetIsolate()->GetCpuProfiler()->StartProfiling(name, record_samples); + + // Sample counts and timestamps are not used, so we do not need to record + // samples. + info.GetIsolate()->GetCpuProfiler()->StartProfiling(name, false); } NAN_METHOD(StopProfiling) { diff --git a/handwritten/cloud-profiler/ts/src/profilers/time-profiler.ts b/handwritten/cloud-profiler/ts/src/profilers/time-profiler.ts index 129e1e07723..6cfa3a5a37e 100644 --- a/handwritten/cloud-profiler/ts/src/profilers/time-profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profilers/time-profiler.ts @@ -36,7 +36,7 @@ export class TimeProfiler { */ async profile(durationMillis: number): Promise { const runName = 'stackdriver-profiler-' + Date.now() + '-' + Math.random(); - profiler.startProfiling(runName, true); + profiler.startProfiling(runName); await delay(durationMillis); const result = profiler.stopProfiling(runName); return serializeTimeProfile(result, this.intervalMicros); From db0048c96e2332095aebecaf40126d509bdf4053 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 8 Mar 2018 09:36:36 -0800 Subject: [PATCH 094/632] fix: fix errors in integration test (#151) fix: fix errors in integration test --- .../testing/integration_test.go | 76 ++++++++----------- .../testing/integration_test.sh | 8 +- 2 files changed, 34 insertions(+), 50 deletions(-) diff --git a/handwritten/cloud-profiler/testing/integration_test.go b/handwritten/cloud-profiler/testing/integration_test.go index 4f1d2b5b3b8..65bbbd13221 100644 --- a/handwritten/cloud-profiler/testing/integration_test.go +++ b/handwritten/cloud-profiler/testing/integration_test.go @@ -14,14 +14,13 @@ // +build integration,go1.7 -package profiler +package testing import ( "bytes" "flag" "fmt" "os" - "strings" "testing" "text/template" "time" @@ -91,13 +90,13 @@ echo "busybench finished profiling" ` type nodeGCETestCase struct { - proftest.GCETestConfig + proftest.InstanceConfig name string nodeVersion string wantProfileTypes []string } -func (inst *nodeGCETestCase) initializeStartUpScript(template *template.Template) error { +func (tc *nodeGCETestCase) initializeStartUpScript(template *template.Template) error { var buf bytes.Buffer err := template.Execute(&buf, struct { @@ -107,16 +106,16 @@ func (inst *nodeGCETestCase) initializeStartUpScript(template *template.Template Branch string Commit string }{ - Service: inst.service, - NodeVersion: inst.nodeVersion, + Service: tc.name, + NodeVersion: tc.nodeVersion, Repo: *repo, Branch: *branch, Commit: *commit, }) if err != nil { - return fmt.Errorf("failed to render startup script for %s: %v", inst.Name, err) + return fmt.Errorf("failed to render startup script for %s: %v", tc.name, err) } - inst.StartupScript = buf.String() + tc.StartupScript = buf.String() return nil } @@ -162,38 +161,41 @@ func TestAgentIntegration(t *testing.T) { testcases := []nodeGCETestCase{ { InstanceConfig: proftest.InstanceConfig{ - ProjectID: projectID, - Zone: zone, - Name: fmt.Sprintf("profiler-test-node6-%d", runID), + ProjectID: projectID, + Zone: zone, + Name: fmt.Sprintf("profiler-test-node6-%d", runID), + MachineType: "n1-standard-1", }, name: fmt.Sprintf("profiler-test-node6-%d-gce", runID), - wantProfileTypes: []string{"CPU", "HEAP"}, + wantProfileTypes: []string{"WALL", "HEAP"}, nodeVersion: "6", }, { InstanceConfig: proftest.InstanceConfig{ - ProjectID: projectID, - Zone: zone, - Name: fmt.Sprintf("profiler-test-node8-%d", runID), + ProjectID: projectID, + Zone: zone, + Name: fmt.Sprintf("profiler-test-node8-%d", runID), + MachineType: "n1-standard-1", }, name: fmt.Sprintf("profiler-test-node8-%d-gce", runID), - wantProfileTypes: []string{"CPU", "HEAP"}, + wantProfileTypes: []string{"WALL", "HEAP"}, nodeVersion: "8", }, { InstanceConfig: proftest.InstanceConfig{ - ProjectID: projectID, - Zone: zone, - Name: fmt.Sprintf("profiler-test-node9-%d", runID), + ProjectID: projectID, + Zone: zone, + Name: fmt.Sprintf("profiler-test-node9-%d", runID), + MachineType: "n1-standard-1", }, name: fmt.Sprintf("profiler-test-node9-%d-gce", runID), - wantProfileTypes: []string{"CPU", "HEAP"}, + wantProfileTypes: []string{"WALL", "HEAP"}, nodeVersion: "9", }, } for _, tc := range testcases { tc := tc // capture range variable - t.Run(tc.Service, func(t *testing.T) { + t.Run(tc.name, func(t *testing.T) { t.Parallel() if err := tc.initializeStartUpScript(template); err != nil { t.Fatalf("failed to initialize startup script") @@ -201,7 +203,7 @@ func TestAgentIntegration(t *testing.T) { gceTr.StartInstance(ctx, &tc.InstanceConfig) defer func() { - if gceTr.DeleteInstance(ctx, &tcInstanceConfig); err != nil { + if gceTr.DeleteInstance(ctx, &tc.InstanceConfig); err != nil { t.Fatal(err) } }() @@ -215,32 +217,14 @@ func TestAgentIntegration(t *testing.T) { timeNow := time.Now() endTime := timeNow.Format(time.RFC3339) startTime := timeNow.Add(-1 * time.Hour).Format(time.RFC3339) - - for _, pType := range tc.expProfileTypes { - pr, err := tr.QueryProfiles(tc.ProjectID, tc.Service, startTime, endTime, pType) + for _, pType := range tc.wantProfileTypes { + pr, err := gceTr.TestRunner.QueryProfiles(tc.ProjectID, tc.name, startTime, endTime, pType) if err != nil { - t.Fatalf("QueryProfiles(%s, %s, %s, %s, %s) got error: %v", tc.ProjectID, tc.Service, startTime, endTime, pType, err) - } - - if pr.NumProfiles == 0 { - t.Fatalf("profile response contains zero profiles: %v", pr) - } - if len(pr.Deployments) == 0 { - t.Fatalf("profile response contains zero deployments: %v", pr) - } - if len(pr.Profile.Functions.Name) == 0 { - t.Fatalf("profile does not have function data") - } - - functionFound := false - for _, name := range pr.Profile.Functions.Name { - if strings.Contains(name, "benchmark") { - functionFound = true - break - } + t.Errorf("QueryProfiles(%s, %s, %s, %s, %s) got error: %v", tc.ProjectID, tc.name, startTime, endTime, pType, err) + continue } - if !functionFound { - t.Errorf("wanted function name %s not found in profile", "benchmark") + if err := pr.HasFunction("benchmark"); err != nil { + t.Error(err) } } }) diff --git a/handwritten/cloud-profiler/testing/integration_test.sh b/handwritten/cloud-profiler/testing/integration_test.sh index 1df803bb363..3f58ca176e3 100644 --- a/handwritten/cloud-profiler/testing/integration_test.sh +++ b/handwritten/cloud-profiler/testing/integration_test.sh @@ -21,9 +21,9 @@ export GOOGLE_APPLICATION_CREDENTIALS="${SERVICE_KEY}" # Move test to go path. export GOPATH="$HOME/go" mkdir -p "$GOPATH/src" -cp -R "testing" "$GOPATH/src" +cp -R "testing" "$GOPATH/src/proftest" # Run test. -cd "$GOPATH/src/testing" -go get -d -t ./ -go test -timeout=30m -parallel=3 -run TestAgentIntegration -commit="$COMMIT" -branch="$BRANCH" -repo="$REPO" +cd "$GOPATH/src/proftest" +go get -t -tags=integration . +go test -timeout=30m -parallel=3 -tags=integration -run TestAgentIntegration -commit="$COMMIT" -branch="$BRANCH" -repo="$REPO" From 49ebf4e654feaeb3abf4b8564ca7ef8a4effccc2 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 8 Mar 2018 15:08:05 -0800 Subject: [PATCH 095/632] fix: update integration test so it runs successfully. (#155) * fix: retrieve proftest go package from github * fix: stop using Buffer.fill() in busybench.js * fix: use value zone in integration_test.sh --- handwritten/cloud-profiler/testing/busybench.js | 4 +++- handwritten/cloud-profiler/testing/integration_test.go | 2 +- handwritten/cloud-profiler/testing/integration_test.sh | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/handwritten/cloud-profiler/testing/busybench.js b/handwritten/cloud-profiler/testing/busybench.js index 18d55203781..a12d9dde796 100644 --- a/handwritten/cloud-profiler/testing/busybench.js +++ b/handwritten/cloud-profiler/testing/busybench.js @@ -23,7 +23,9 @@ const startTime = Date.now(); function benchmark(durationSeconds) { var buffer = new Buffer(1e4); for (var k = 0; k < 1e4; k++) { - buffer.fill(0); + for (var j = 0; j < buffer.length; j++) { + buffer[j] = 0; + } } if (Date.now() - startTime < 1000 * durationSeconds) { setImmediate(() => benchmark(durationSeconds)); diff --git a/handwritten/cloud-profiler/testing/integration_test.go b/handwritten/cloud-profiler/testing/integration_test.go index 65bbbd13221..5c8ef4f9cf9 100644 --- a/handwritten/cloud-profiler/testing/integration_test.go +++ b/handwritten/cloud-profiler/testing/integration_test.go @@ -25,7 +25,7 @@ import ( "text/template" "time" - "cloud.google.com/go/profiler/proftest" + "github.com/GoogleCloudPlatform/google-cloud-go/profiler/proftest" "golang.org/x/net/context" "golang.org/x/oauth2/google" compute "google.golang.org/api/compute/v1" diff --git a/handwritten/cloud-profiler/testing/integration_test.sh b/handwritten/cloud-profiler/testing/integration_test.sh index 3f58ca176e3..6b0f719ec3b 100644 --- a/handwritten/cloud-profiler/testing/integration_test.sh +++ b/handwritten/cloud-profiler/testing/integration_test.sh @@ -15,7 +15,7 @@ REPO=$(git config --get remote.origin.url) export GCLOUD_TESTS_NODEJS_PROJECT_ID="cloud-profiler-e2e" -export GCLOUD_TESTS_NODEJS_ZONE="us-east1-a" +export GCLOUD_TESTS_NODEJS_ZONE="us-east1-b" export GOOGLE_APPLICATION_CREDENTIALS="${SERVICE_KEY}" # Move test to go path. From 224a88801eddb7ae3876dd8ecad0472789bc95a0 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Fri, 9 Mar 2018 10:01:09 -0800 Subject: [PATCH 096/632] chore: Update @google-cloud/common to ^0.16.1 (#156) * chore: Update @google-cloud/common to ^0.16.1 * only mock https://www.googleapis.com, not accounts.google.com --- handwritten/cloud-profiler/package-lock.json | 292 +++++++++++------- handwritten/cloud-profiler/package.json | 2 +- .../ts/system-test/test-start.ts | 4 +- .../cloud-profiler/ts/test/test-profiler.ts | 9 +- 4 files changed, 180 insertions(+), 127 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index bcf131a3829..864c39a0adf 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -5,27 +5,27 @@ "requires": true, "dependencies": { "@google-cloud/common": { - "version": "0.15.1", - "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.15.1.tgz", - "integrity": "sha512-cnVtHLvyiSQvb1RzXWDp7PA1sA8Jmc47+wp/xwHwdGOlQZfKog5iluZ0C/LB8iklFXpcTwlNMorqLuZ/qH0DDA==", + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.16.1.tgz", + "integrity": "sha512-1sufDsSfgJ7fuBLq+ux8t3TlydMlyWl9kPZx2WdLINkGtf5RjvXX6EWYZiCMKe8flJ3oC0l95j5atN2uX5n3rg==", "requires": { "array-uniq": "1.0.3", "arrify": "1.0.1", - "concat-stream": "1.6.0", + "concat-stream": "1.6.1", "create-error-class": "3.0.2", - "duplexify": "3.5.1", + "duplexify": "3.5.4", "ent": "2.2.0", "extend": "3.0.1", - "google-auto-auth": "0.8.2", + "google-auto-auth": "0.9.7", "is": "3.2.1", "log-driver": "1.2.5", "methmeth": "1.1.0", - "modelo": "4.2.0", + "modelo": "4.2.3", "request": "2.83.0", "retry-request": "3.3.1", "split-array-stream": "1.0.3", "stream-events": "1.0.2", - "string-format-obj": "1.1.0", + "string-format-obj": "1.1.1", "through2": "2.0.3" } }, @@ -448,17 +448,6 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, - "chai": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-3.5.0.tgz", - "integrity": "sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc=", - "dev": true, - "requires": { - "assertion-error": "1.0.2", - "deep-eql": "0.1.3", - "type-detect": "1.0.0" - } - }, "chalk": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", @@ -476,6 +465,12 @@ "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", "dev": true }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, "clang-format": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.2.1.tgz", @@ -717,9 +712,9 @@ "dev": true }, "concat-stream": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", - "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.1.tgz", + "integrity": "sha512-gslSSJx03QKa59cIKqeJO9HQ/WZMotvYJCuaUULrLpjj8oG40kV2Z+gz82pVxlTkOADi4PJxQPPfhl1ELYrrXw==", "requires": { "inherits": "2.0.3", "readable-stream": "2.3.3", @@ -837,23 +832,6 @@ } } }, - "deep-eql": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", - "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", - "dev": true, - "requires": { - "type-detect": "0.1.1" - }, - "dependencies": { - "type-detect": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz", - "integrity": "sha1-C6XsKohWQORw6k6FBZcZANrFiCI=", - "dev": true - } - } - }, "deep-equal": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", @@ -901,11 +879,11 @@ "dev": true }, "duplexify": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.1.tgz", - "integrity": "sha512-j5goxHTwVED1Fpe5hh3q9R93Kip0Bg2KVAt4f8CEYM3UEwYcPSvWbXaUQOzdX/HtiNomipv+gU7ASQPDbV7pGQ==", + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.4.tgz", + "integrity": "sha512-JzYSLYMhoVVBe8+mbHQ4KgpvHpm0DZpJuL8PY93Vyv1fW7jYJ90LoXa1di/CVbJM+TgMs91rbDapE/RNIfnJsA==", "requires": { - "end-of-stream": "1.4.0", + "end-of-stream": "1.4.1", "inherits": "2.0.3", "readable-stream": "2.3.3", "stream-shift": "1.0.0" @@ -930,9 +908,9 @@ } }, "end-of-stream": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.0.tgz", - "integrity": "sha1-epDYM+/abPpurA9JSduw+tOmMgY=", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "requires": { "once": "1.4.0" } @@ -1075,6 +1053,12 @@ "retry-axios": "0.3.0" } }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, "get-stream": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", @@ -1113,45 +1097,89 @@ } }, "google-auth-library": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-0.12.0.tgz", - "integrity": "sha512-79qCXtJ1VweBmmLr4yLq9S4clZB2p5Y+iACvuKk9gu4JitEnPc+bQFmYvtCYehVR44MQzD1J8DVmYW2w677IEw==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-1.3.1.tgz", + "integrity": "sha512-NcAzFY+ScalfjmFTHnCXInuivtbIfib9irJ5H8AHONy3eA56YW1Tu5X1dtbjw5TNBgP+BMu+nIrglJsAlfZ/Hg==", "requires": { - "gtoken": "1.2.3", + "axios": "0.18.0", + "gcp-metadata": "0.6.2", + "gtoken": "2.1.1", "jws": "3.1.4", "lodash.isstring": "4.0.1", - "lodash.merge": "4.6.0", - "request": "2.83.0" + "lru-cache": "4.1.1", + "retry-axios": "0.3.2" + }, + "dependencies": { + "axios": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", + "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", + "requires": { + "follow-redirects": "1.3.0", + "is-buffer": "1.1.6" + } + }, + "gcp-metadata": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.6.2.tgz", + "integrity": "sha512-TlOa8HhM5klcBxBNazZUMeI9UZJoKJ4ceiBLPQoJIWNFeC/CqxjlaFE+/YnFQudqG5inhaaNtvoFVm/ZCbBFQQ==", + "requires": { + "axios": "0.18.0", + "extend": "3.0.1", + "retry-axios": "0.3.2" + } + }, + "retry-axios": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/retry-axios/-/retry-axios-0.3.2.tgz", + "integrity": "sha512-jp4YlI0qyDFfXiXGhkCOliBN1G7fRH03Nqy8YdShzGqbY5/9S2x/IR6C88ls2DFkbWuL3ASkP7QD3pVrNpPgwQ==" + } } }, "google-auto-auth": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.8.2.tgz", - "integrity": "sha512-W91J1paFbyG45gpDWdTu9tKDxbiTDWYkOAxytNVF4oHVVgTCBV/8+lWdjj/6ldjN3eb+sEd9PKJBjm0kmCxvcw==", + "version": "0.9.7", + "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.9.7.tgz", + "integrity": "sha512-Nro7aIFrL2NP0G7PoGrJqXGMZj8AjdBOcbZXRRm/8T3w08NUHIiNN3dxpuUYzDsZizslH+c8e+7HXL8vh3JXTQ==", "requires": { "async": "2.6.0", - "gcp-metadata": "0.3.1", - "google-auth-library": "0.12.0", + "gcp-metadata": "0.6.2", + "google-auth-library": "1.3.1", "request": "2.83.0" }, "dependencies": { + "axios": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", + "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", + "requires": { + "follow-redirects": "1.3.0", + "is-buffer": "1.1.6" + } + }, "gcp-metadata": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.3.1.tgz", - "integrity": "sha512-5kJPX/RXuqoLmHiOOgkSDk/LI0QaXpEvZ3pvQP4ifjGGDKZKVSOjL/GcDjXA5kLxppFCOjmmsu0Uoop9d1upaQ==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.6.2.tgz", + "integrity": "sha512-TlOa8HhM5klcBxBNazZUMeI9UZJoKJ4ceiBLPQoJIWNFeC/CqxjlaFE+/YnFQudqG5inhaaNtvoFVm/ZCbBFQQ==", "requires": { + "axios": "0.18.0", "extend": "3.0.1", - "retry-request": "3.3.1" + "retry-axios": "0.3.2" } + }, + "retry-axios": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/retry-axios/-/retry-axios-0.3.2.tgz", + "integrity": "sha512-jp4YlI0qyDFfXiXGhkCOliBN1G7fRH03Nqy8YdShzGqbY5/9S2x/IR6C88ls2DFkbWuL3ASkP7QD3pVrNpPgwQ==" } } }, "google-p12-pem": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-0.1.2.tgz", - "integrity": "sha1-M8RqsCGqc0+gMys5YKmj/8svMXc=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-1.0.1.tgz", + "integrity": "sha512-6Gb+R8wKs0uGWHYH8US1q4IGYEMKPzg/ty2A/AevGaVDMzPIqNOKFmDxZHsHwda2438u99CkU0HdatsKXOUtcg==", "requires": { - "node-forge": "0.7.1" + "node-forge": "0.7.4", + "pify": "3.0.0" } }, "got": { @@ -1186,14 +1214,26 @@ "dev": true }, "gtoken": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-1.2.3.tgz", - "integrity": "sha512-wQAJflfoqSgMWrSBk9Fg86q+sd6s7y6uJhIvvIPz++RElGlMtEqsdAR2oWwZ/WTEtp7P9xFbJRrT976oRgzJ/w==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-2.1.1.tgz", + "integrity": "sha512-9wUP0Gb06lEJxX0w/w+n5Ghxh+/To0rbZSRCOu4Pih2sSDYXJwV4T7q6MPLW31cuKz0wqFQ60mW9nIKc8IgoyA==", "requires": { - "google-p12-pem": "0.1.2", + "axios": "0.18.0", + "google-p12-pem": "1.0.1", "jws": "3.1.4", - "mime": "1.6.0", - "request": "2.83.0" + "mime": "2.2.0", + "pify": "3.0.0" + }, + "dependencies": { + "axios": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", + "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", + "requires": { + "follow-redirects": "1.3.0", + "is-buffer": "1.1.6" + } + } } }, "gts": { @@ -1655,11 +1695,6 @@ "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" }, - "lodash.merge": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.0.tgz", - "integrity": "sha1-aYhLoUSsM/5plzemCG3v+t0PicU=" - }, "log-driver": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.5.tgz", @@ -1696,7 +1731,6 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", - "dev": true, "requires": { "pseudomap": "1.0.2", "yallist": "2.1.2" @@ -1740,9 +1774,9 @@ "integrity": "sha1-6AomYY5S9cQiKGG7dIUQvRDikIk=" }, "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.2.0.tgz", + "integrity": "sha512-0Qz9uF1ATtl8RKJG4VRfOymh7PyEor6NbrI/61lRfuRe4vx9SNATrvAeTj2EWVRKjEQGskrzWkJBBY5NbaVHIA==" }, "mime-db": { "version": "1.30.0", @@ -1847,9 +1881,9 @@ } }, "modelo": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/modelo/-/modelo-4.2.0.tgz", - "integrity": "sha1-O0tCACOmbKfjK9uhbnEJN+FNGws=" + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/modelo/-/modelo-4.2.3.tgz", + "integrity": "sha512-9DITV2YEMcw7XojdfvGl3gDD8J9QjZTJ7ZOUuSAkP+F3T6rDbzMJuPktxptsdHYEvZcmXrCD3LMOhdSAEq6zKA==" }, "ms": { "version": "2.0.0", @@ -1889,37 +1923,69 @@ } }, "nock": { - "version": "9.1.5", - "resolved": "https://registry.npmjs.org/nock/-/nock-9.1.5.tgz", - "integrity": "sha512-ukkBUhGU73CmSKTpTl6N/Qjvb7Hev4rCEjgOuEBKvHmsOqz7jGh2vUXL3dPnX3ndfcmVjsFBPfKpNuJbK94SKg==", + "version": "9.2.3", + "resolved": "https://registry.npmjs.org/nock/-/nock-9.2.3.tgz", + "integrity": "sha512-4XYNSJDJ/PvNoH+cCRWcGOOFsq3jtZdNTRIlPIBA7CopGWJO56m5OaPEjjJ3WddxNYfe5HL9sQQAtMt8oyR9AA==", "dev": true, "requires": { - "chai": "3.5.0", - "debug": "2.6.9", + "chai": "4.1.2", + "debug": "3.1.0", "deep-equal": "1.0.1", "json-stringify-safe": "5.0.1", - "lodash": "4.17.4", + "lodash": "4.17.5", "mkdirp": "0.5.1", - "propagate": "0.4.0", + "propagate": "1.0.0", "qs": "6.5.1", "semver": "5.5.0" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "chai": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", + "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", "dev": true, "requires": { - "ms": "2.0.0" + "assertion-error": "1.0.2", + "check-error": "1.0.2", + "deep-eql": "3.0.1", + "get-func-name": "2.0.0", + "pathval": "1.1.0", + "type-detect": "4.0.8" + } + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "requires": { + "type-detect": "4.0.8" } + }, + "lodash": { + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", + "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==", + "dev": true + }, + "propagate": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/propagate/-/propagate-1.0.0.tgz", + "integrity": "sha1-AMLa7t2iDofjeCs0Stuhzd1q1wk=", + "dev": true + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true } } }, "node-forge": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.1.tgz", - "integrity": "sha1-naYR6giYL0uUIGs760zJZl8gwwA=" + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.4.tgz", + "integrity": "sha512-8Df0906+tq/omxuCZD6PqhPaQDYuyJ1d+VITgxoIA8zvQd1ru+nMJcDChHH324MWitIgbVkAkQoGEEVJNpn/PA==" }, "normalize-package-data": { "version": "2.4.0", @@ -3913,6 +3979,12 @@ "pify": "3.0.0" } }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", + "dev": true + }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -3951,12 +4023,6 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" }, - "propagate": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/propagate/-/propagate-0.4.0.tgz", - "integrity": "sha1-8/zKCm/gZzanulcpZgaWF8EwtIE=", - "dev": true - }, "protobufjs": { "version": "6.8.3", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.3.tgz", @@ -3987,8 +4053,7 @@ "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" }, "punycode": { "version": "1.4.1", @@ -4366,9 +4431,9 @@ "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=" }, "string-format-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/string-format-obj/-/string-format-obj-1.1.0.tgz", - "integrity": "sha1-djVhCx7zlwE+hHi+mKFw4EmD0Gg=" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string-format-obj/-/string-format-obj-1.1.1.tgz", + "integrity": "sha512-Mm+sROy+pHJmx0P/0Bs1uxIX6UhGJGj6xDGQZ5zh9v/SZRmLGevp+p0VJxV7lirrkAmQ2mvva/gHKpnF/pTb+Q==" }, "string-width": { "version": "2.1.1", @@ -4556,12 +4621,6 @@ "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", "optional": true }, - "type-detect": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-1.0.0.tgz", - "integrity": "sha1-diIXzAbbJY7EiQihKY6LlRIejqI=", - "dev": true - }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -4707,8 +4766,7 @@ "yallist": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" } } } diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 43618be2f8c..3dbe11452f1 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -26,7 +26,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/common": "^0.15.0", + "@google-cloud/common": "^0.16.1", "bindings": "^1.2.1", "delay": "^2.0.0", "extend": "^3.0.1", diff --git a/handwritten/cloud-profiler/ts/system-test/test-start.ts b/handwritten/cloud-profiler/ts/system-test/test-start.ts index 0257db22bc3..b6beb0a0c36 100644 --- a/handwritten/cloud-profiler/ts/system-test/test-start.ts +++ b/handwritten/cloud-profiler/ts/system-test/test-start.ts @@ -73,9 +73,9 @@ before(async () => { .reply(200, (request: RequestProfile, body: RequestProfile) => { tempUploadedProfiles.push(body); }); - nock('https://accounts.google.com') + nock('https://www.googleapis.com') .post( - '/o/oauth2/token', + /\/oauth2.*token/, (body: {}) => { return true; }) diff --git a/handwritten/cloud-profiler/ts/test/test-profiler.ts b/handwritten/cloud-profiler/ts/test/test-profiler.ts index 680e4b484e3..f0f9a564db0 100644 --- a/handwritten/cloud-profiler/ts/test/test-profiler.ts +++ b/handwritten/cloud-profiler/ts/test/test-profiler.ts @@ -71,12 +71,8 @@ when(mockHeapProfiler.profile()).thenReturn(heapProfile); nock.disableNetConnect(); function nockOauth2(): nock.Scope { - return nock('https://accounts.google.com') - .post( - '/o/oauth2/token', - (body: {}) => { - return true; - }) + return nock('https://www.googleapis.com') + .post(/\/oauth2.*token/, () => true) .once() .reply(200, { refresh_token: 'hello', @@ -85,7 +81,6 @@ function nockOauth2(): nock.Scope { }); } - describe('Retryer', () => { it('should backoff until max-backoff reached', () => { const retryer = new Retryer(1000, 1000000, 5, () => 0.5); From f8f5ac85b0b3f298fd6ed06d5c14cc1176475c7f Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Mon, 12 Mar 2018 16:17:25 -0700 Subject: [PATCH 097/632] chore(package): update js-green-licenses to version 0.5.0 (#153) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 3dbe11452f1..03b0521240c 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -54,7 +54,7 @@ "@types/sinon": "^4.0.0", "codecov": "^3.0.0", "gts": "^0.5.3", - "js-green-licenses": "^0.4.0", + "js-green-licenses": "^0.5.0", "mocha": "^5.0.0", "nock": "^9.0.22", "nyc": "^11.2.1", From 8467c05a085da0f1e9c07877d2aaa663153c378e Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Tue, 13 Mar 2018 08:21:52 -0700 Subject: [PATCH 098/632] fix: modify benchmark so that it fills arrays, rather than a buffer (#158) --- .../cloud-profiler/testing/busybench.js | 20 ++++++---- .../testing/integration_test.go | 39 +++++++++++-------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/handwritten/cloud-profiler/testing/busybench.js b/handwritten/cloud-profiler/testing/busybench.js index a12d9dde796..cfe628d4de7 100644 --- a/handwritten/cloud-profiler/testing/busybench.js +++ b/handwritten/cloud-profiler/testing/busybench.js @@ -15,22 +15,28 @@ */ const startTime = Date.now(); +const testArr = []; /** - * Repeatedly fills a buffer, then calls itself with setImmediate. + * Fills several arrays, then calls itself with setImmediate. * It continues to do this until durationSeconds after the startTime. */ function benchmark(durationSeconds) { - var buffer = new Buffer(1e4); - for (var k = 0; k < 1e4; k++) { - for (var j = 0; j < buffer.length; j++) { - buffer[j] = 0; + for (let i = 0; i < 200; i++) { + testArr[i] = new Array(512 * 1024); + for (let j=0; j < testArr[i].length; j++) { + testArr[i][j] = i * j; + } + } + for (let i = 0; i < testArr.length; i++) { + for (let j = 0; j < testArr[i].length; j++) { + testArr[i][j] = Math.sqrt(j * testArr[i][j]); } } if (Date.now() - startTime < 1000 * durationSeconds) { - setImmediate(() => benchmark(durationSeconds)); + setTimeout(() => benchmark(durationSeconds), 5); } } const durationSeconds = process.argv.length > 2 ? process.argv[2] : 600; -benchmark(durationSeconds); +benchmark(durationSeconds); \ No newline at end of file diff --git a/handwritten/cloud-profiler/testing/integration_test.go b/handwritten/cloud-profiler/testing/integration_test.go index 5c8ef4f9cf9..b0e5fc042de 100644 --- a/handwritten/cloud-profiler/testing/integration_test.go +++ b/handwritten/cloud-profiler/testing/integration_test.go @@ -89,11 +89,16 @@ GCLOUD_PROFILER_LOGLEVEL=5 GAE_SERVICE={{.Service}} node --require @google-cloud echo "busybench finished profiling" ` +type profileSummary struct { + profileType string + functionName string +} + type nodeGCETestCase struct { proftest.InstanceConfig - name string - nodeVersion string - wantProfileTypes []string + name string + nodeVersion string + wantProfiles []profileSummary } func (tc *nodeGCETestCase) initializeStartUpScript(template *template.Template) error { @@ -166,9 +171,9 @@ func TestAgentIntegration(t *testing.T) { Name: fmt.Sprintf("profiler-test-node6-%d", runID), MachineType: "n1-standard-1", }, - name: fmt.Sprintf("profiler-test-node6-%d-gce", runID), - wantProfileTypes: []string{"WALL", "HEAP"}, - nodeVersion: "6", + name: fmt.Sprintf("profiler-test-node6-%d-gce", runID), + wantProfiles: []profileSummary{{"WALL", "benchmark"}, {"HEAP", "benchmark"}}, + nodeVersion: "6", }, { InstanceConfig: proftest.InstanceConfig{ @@ -177,9 +182,9 @@ func TestAgentIntegration(t *testing.T) { Name: fmt.Sprintf("profiler-test-node8-%d", runID), MachineType: "n1-standard-1", }, - name: fmt.Sprintf("profiler-test-node8-%d-gce", runID), - wantProfileTypes: []string{"WALL", "HEAP"}, - nodeVersion: "8", + name: fmt.Sprintf("profiler-test-node8-%d-gce", runID), + wantProfiles: []profileSummary{{"WALL", "benchmark"}, {"HEAP", "benchmark"}}, + nodeVersion: "8", }, { InstanceConfig: proftest.InstanceConfig{ @@ -188,9 +193,9 @@ func TestAgentIntegration(t *testing.T) { Name: fmt.Sprintf("profiler-test-node9-%d", runID), MachineType: "n1-standard-1", }, - name: fmt.Sprintf("profiler-test-node9-%d-gce", runID), - wantProfileTypes: []string{"WALL", "HEAP"}, - nodeVersion: "9", + name: fmt.Sprintf("profiler-test-node9-%d-gce", runID), + wantProfiles: []profileSummary{{"WALL", "benchmark"}, {"HEAP", "benchmark"}}, + nodeVersion: "9", }, } for _, tc := range testcases { @@ -217,14 +222,14 @@ func TestAgentIntegration(t *testing.T) { timeNow := time.Now() endTime := timeNow.Format(time.RFC3339) startTime := timeNow.Add(-1 * time.Hour).Format(time.RFC3339) - for _, pType := range tc.wantProfileTypes { - pr, err := gceTr.TestRunner.QueryProfiles(tc.ProjectID, tc.name, startTime, endTime, pType) + for _, wantProfile := range tc.wantProfiles { + pr, err := gceTr.TestRunner.QueryProfiles(tc.ProjectID, tc.name, startTime, endTime, wantProfile.profileType) if err != nil { - t.Errorf("QueryProfiles(%s, %s, %s, %s, %s) got error: %v", tc.ProjectID, tc.name, startTime, endTime, pType, err) + t.Errorf("QueryProfiles(%s, %s, %s, %s, %s) got error: %v", tc.ProjectID, tc.name, startTime, endTime, wantProfile.profileType, err) continue } - if err := pr.HasFunction("benchmark"); err != nil { - t.Error(err) + if err := pr.HasFunction(wantProfile.functionName); err != nil { + t.Errorf("Function %s not found in profiles of type %s: %v", wantProfile.profileType, wantProfile.functionName, err) } } }) From 6451acc70741c8c28b02f740dd271a9d0735f96f Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Tue, 13 Mar 2018 13:43:29 -0700 Subject: [PATCH 099/632] v0.1.13 (#159) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 03b0521240c..9d4ffad7bec 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.12", + "version": "0.1.13", "description": "Adds support for Google Cloud Profiler to node.js applications", "repository": "GoogleCloudPlatform/cloud-profiler-nodejs", "main": "out/src/index.js", From 9f6f8fbf90c5f19f14b81a8d9397891bea0563b2 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Mon, 19 Mar 2018 14:46:46 -0700 Subject: [PATCH 100/632] fix: update integration test to work as presubmit check (#162) * fix: update integration test to work as presubmit check --- .../cloud-profiler/testing/integration_test.go | 14 +++++++++----- .../cloud-profiler/testing/integration_test.sh | 7 +++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/handwritten/cloud-profiler/testing/integration_test.go b/handwritten/cloud-profiler/testing/integration_test.go index b0e5fc042de..c5ad82315cd 100644 --- a/handwritten/cloud-profiler/testing/integration_test.go +++ b/handwritten/cloud-profiler/testing/integration_test.go @@ -32,9 +32,10 @@ import ( ) var ( - repo = flag.String("repo", "", "git repo to test") + repo = flag.String("repo", "https://github.com/GoogleCloudPlatform/cloud-profiler-nodejs.git", "git repo to test") branch = flag.String("branch", "", "git branch to test") commit = flag.String("commit", "", "git commit to test") + pr = flag.Int("pr", 0, "git pull request to test") runID = time.Now().Unix() ) @@ -54,7 +55,7 @@ set -eo pipefail set -x # Install git apt-get update -apt-get -y -q install git-all build-essential +apt-get -y -q install git build-essential # Install desired version of Node.js curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash @@ -65,9 +66,10 @@ npm -v node -v # Install agent -git clone https://github.com/GoogleCloudPlatform/cloud-profiler-nodejs.git +git clone {{.Repo}} cd cloud-profiler-nodejs -git pull {{.Repo}} {{.Branch}} +git fetch origin {{if .PR}}pull/{{.PR}}/head{{else}}{{.Branch}}{{end}}:pull_branch +git checkout pull_branch git reset --hard {{.Commit}} npm install npm run compile @@ -108,12 +110,14 @@ func (tc *nodeGCETestCase) initializeStartUpScript(template *template.Template) Service string NodeVersion string Repo string + PR int Branch string Commit string }{ Service: tc.name, NodeVersion: tc.nodeVersion, Repo: *repo, + PR: *pr, Branch: *branch, Commit: *commit, }) @@ -203,7 +207,7 @@ func TestAgentIntegration(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() if err := tc.initializeStartUpScript(template); err != nil { - t.Fatalf("failed to initialize startup script") + t.Fatalf("failed to initialize startup script: %v", err) } gceTr.StartInstance(ctx, &tc.InstanceConfig) diff --git a/handwritten/cloud-profiler/testing/integration_test.sh b/handwritten/cloud-profiler/testing/integration_test.sh index 6b0f719ec3b..0b73861a584 100644 --- a/handwritten/cloud-profiler/testing/integration_test.sh +++ b/handwritten/cloud-profiler/testing/integration_test.sh @@ -13,7 +13,6 @@ COMMIT=$(git rev-parse HEAD) BRANCH=$(git rev-parse --abbrev-ref HEAD) REPO=$(git config --get remote.origin.url) - export GCLOUD_TESTS_NODEJS_PROJECT_ID="cloud-profiler-e2e" export GCLOUD_TESTS_NODEJS_ZONE="us-east1-b" export GOOGLE_APPLICATION_CREDENTIALS="${SERVICE_KEY}" @@ -26,4 +25,8 @@ cp -R "testing" "$GOPATH/src/proftest" # Run test. cd "$GOPATH/src/proftest" go get -t -tags=integration . -go test -timeout=30m -parallel=3 -tags=integration -run TestAgentIntegration -commit="$COMMIT" -branch="$BRANCH" -repo="$REPO" +if [-z "$KOKORO_GITHUB_PULL_REQUEST_NUMBER"]; then + go test -timeout=30m -parallel=3 -tags=integration -run TestAgentIntegration -commit="$COMMIT" -pr="$KOKORO_GITHUB_PULL_REQUEST_NUMBER" +else + go test -timeout=30m -parallel=3 -tags=integration -run TestAgentIntegration -commit="$COMMIT" -branch="$BRANCH" -repo="$REPO" +fi From 936b3ec019806b5d62903623d99e556370cbf4b7 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Mon, 19 Mar 2018 15:58:59 -0700 Subject: [PATCH 101/632] fix: fix build script for presubmit tests (#163) --- handwritten/cloud-profiler/testing/integration_test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handwritten/cloud-profiler/testing/integration_test.sh b/handwritten/cloud-profiler/testing/integration_test.sh index 0b73861a584..4f18166b20d 100644 --- a/handwritten/cloud-profiler/testing/integration_test.sh +++ b/handwritten/cloud-profiler/testing/integration_test.sh @@ -25,8 +25,8 @@ cp -R "testing" "$GOPATH/src/proftest" # Run test. cd "$GOPATH/src/proftest" go get -t -tags=integration . -if [-z "$KOKORO_GITHUB_PULL_REQUEST_NUMBER"]; then - go test -timeout=30m -parallel=3 -tags=integration -run TestAgentIntegration -commit="$COMMIT" -pr="$KOKORO_GITHUB_PULL_REQUEST_NUMBER" -else +if ["$KOKORO_GITHUB_PULL_REQUEST_NUMBER" == ""]; then go test -timeout=30m -parallel=3 -tags=integration -run TestAgentIntegration -commit="$COMMIT" -branch="$BRANCH" -repo="$REPO" +else + go test -timeout=30m -parallel=3 -tags=integration -run TestAgentIntegration -commit="$COMMIT" -pr="$KOKORO_GITHUB_PULL_REQUEST_NUMBER" fi From 1cc3ff1559ac90bcd4a389af6985d169382110b6 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Tue, 20 Mar 2018 18:29:17 -0700 Subject: [PATCH 102/632] chore: update gcp-metadata (#165) --- handwritten/cloud-profiler/package-lock.json | 162 ++++++++++-------- handwritten/cloud-profiler/package.json | 4 +- .../ts/src/profilers/heap-profiler.ts | 2 +- 3 files changed, 91 insertions(+), 77 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 864c39a0adf..851f34e3dc6 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.12", + "version": "0.1.13", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -278,15 +278,6 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" }, - "axios": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.17.1.tgz", - "integrity": "sha1-LY4+XQvb1zJ/kbyBT1xXZg+Bgk0=", - "requires": { - "follow-redirects": "1.3.0", - "is-buffer": "1.1.6" - } - }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -1044,13 +1035,29 @@ "dev": true }, "gcp-metadata": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.5.0.tgz", - "integrity": "sha512-G+haBuoUrnLzzJfnAuefG2yR0TC7Pgn8iw9L7YgacbBeQYx+/QiTulmYfetj923HMz0nWNW7Q7/fmNCLFMMN4Q==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.6.3.tgz", + "integrity": "sha512-MSmczZctbz91AxCvqp9GHBoZOSbJKAICV7Ow/AIWSJZRrRchUd5NL1b2P4OfP+4m490BEUPhhARfpHdqCxuCvg==", "requires": { - "axios": "0.17.1", + "axios": "0.18.0", "extend": "3.0.1", - "retry-axios": "0.3.0" + "retry-axios": "0.3.2" + }, + "dependencies": { + "axios": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", + "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", + "requires": { + "follow-redirects": "1.3.0", + "is-buffer": "1.1.6" + } + }, + "retry-axios": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/retry-axios/-/retry-axios-0.3.2.tgz", + "integrity": "sha512-jp4YlI0qyDFfXiXGhkCOliBN1G7fRH03Nqy8YdShzGqbY5/9S2x/IR6C88ls2DFkbWuL3ASkP7QD3pVrNpPgwQ==" + } } }, "get-func-name": { @@ -1519,46 +1526,90 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, "js-green-licenses": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/js-green-licenses/-/js-green-licenses-0.4.0.tgz", - "integrity": "sha512-LpkL/9coWxNUmJ9/jxng3uvcLK6Qso2yaz7QBjO+atwtX/xmt8MrCtbkolYdhPZl/fq5dRs7Q7BLA8Ne3DKZ2w==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/js-green-licenses/-/js-green-licenses-0.5.0.tgz", + "integrity": "sha512-HM/SKwAl1R0y9kkBili6GqKc31ZnjzY7JHC2uO9bAHJNRmY5c/s+2cETyaqX0kBD8gX8QVhS4dJjRtY1nAwb4w==", "dev": true, "requires": { "argparse": "1.0.9", - "axios": "0.17.1", + "axios": "0.18.0", "npm-package-arg": "6.0.0", "package-json": "4.0.1", "pify": "3.0.0", - "spdx-correct": "2.0.4", - "spdx-satisfies": "0.1.3", + "spdx-correct": "3.0.0", + "spdx-satisfies": "4.0.0", "strip-json-comments": "2.0.1" }, "dependencies": { + "axios": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", + "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", + "dev": true, + "requires": { + "follow-redirects": "1.3.0", + "is-buffer": "1.1.6" + } + }, + "spdx-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/spdx-compare/-/spdx-compare-1.0.0.tgz", + "integrity": "sha512-C1mDZOX0hnu0ep9dfmuoi03+eOdDoz2yvK79RxbcrVEG1NO1Ph35yW102DHWKN4pk80nwCgeMmSY5L25VE4D9A==", + "dev": true, + "requires": { + "array-find-index": "1.0.2", + "spdx-expression-parse": "3.0.0", + "spdx-ranges": "2.0.0" + } + }, "spdx-correct": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-2.0.4.tgz", - "integrity": "sha512-c+4gPpt9YDhz7cHlz5UrsHzxxRi4ksclxnEEKsuGT9JdwSC+ZNmsGbYRzzgxyZaBYpcWnlu+4lPcdLKx4DOCmA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz", + "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==", "dev": true, "requires": { - "spdx-expression-parse": "2.0.2", - "spdx-license-ids": "2.0.1" + "spdx-expression-parse": "3.0.0", + "spdx-license-ids": "3.0.0" } }, + "spdx-exceptions": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", + "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", + "dev": true + }, "spdx-expression-parse": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-2.0.2.tgz", - "integrity": "sha512-oFxOkWCfFS0ltNp0H66gXlU4NF6bxg7RkoTYR0413t+yTY9zyj+AIWsjtN8dcVp6703ijDYBWBIARlJ7DkyP9Q==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", "dev": true, "requires": { - "spdx-exceptions": "2.0.0", - "spdx-license-ids": "2.0.1" + "spdx-exceptions": "2.1.0", + "spdx-license-ids": "3.0.0" } }, "spdx-license-ids": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-2.0.1.tgz", - "integrity": "sha1-AgF7zDU07k/+9tWNIOfT6aHDyOw=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", + "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==", "dev": true + }, + "spdx-ranges": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/spdx-ranges/-/spdx-ranges-2.0.0.tgz", + "integrity": "sha512-AUUXLfqkwD7GlzZkXv8ePPCpPjeVWI9xJCfysL8re/uKb6H10umMnC7bFRsHmLJan4fslUtekAgpHlSgLc/7mA==", + "dev": true + }, + "spdx-satisfies": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/spdx-satisfies/-/spdx-satisfies-4.0.0.tgz", + "integrity": "sha512-OcARj6U1OuVv98SVrRqgrR30sVocONtoPpnX8Xz4vXNrFVedqtbgkA+0KmQoXIQ2xjfltPPRVIMeNzKEFLWWKQ==", + "dev": true, + "requires": { + "spdx-compare": "1.0.0", + "spdx-expression-parse": "3.0.0", + "spdx-ranges": "2.0.0" + } } } }, @@ -4195,11 +4246,6 @@ "signal-exit": "3.0.2" } }, - "retry-axios": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/retry-axios/-/retry-axios-0.3.0.tgz", - "integrity": "sha512-6vOCghodB5p5N/ZOqug7A3WsT42TULZ7NErUi4lP3KtwtXgz4hE/43LWHsFuHuBfXRmOm/tjXBWAjnObrcy+yg==" - }, "retry-request": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-3.3.1.tgz", @@ -4334,16 +4380,6 @@ "source-map": "0.6.1" } }, - "spdx-compare": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/spdx-compare/-/spdx-compare-0.1.2.tgz", - "integrity": "sha1-sGrz6jSvdDfZGp9Enq8tLpPDyPs=", - "dev": true, - "requires": { - "spdx-expression-parse": "1.0.4", - "spdx-ranges": "1.0.1" - } - }, "spdx-correct": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", @@ -4353,12 +4389,6 @@ "spdx-license-ids": "1.2.2" } }, - "spdx-exceptions": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.0.0.tgz", - "integrity": "sha1-aoDpnx8z5ArPSX9qQwz0mWnwE6g=", - "dev": true - }, "spdx-expression-parse": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", @@ -4371,22 +4401,6 @@ "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", "dev": true }, - "spdx-ranges": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/spdx-ranges/-/spdx-ranges-1.0.1.tgz", - "integrity": "sha1-D07se46kjtIC43S7iULo0Y3AET4=", - "dev": true - }, - "spdx-satisfies": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/spdx-satisfies/-/spdx-satisfies-0.1.3.tgz", - "integrity": "sha1-Z6HydOYRXUquKK/kdNt2FkvhC9w=", - "dev": true, - "requires": { - "spdx-compare": "0.1.2", - "spdx-expression-parse": "1.0.4" - } - }, "split-array-stream": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/split-array-stream/-/split-array-stream-1.0.3.tgz", @@ -4627,9 +4641,9 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, "typescript": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.2.tgz", - "integrity": "sha1-PFtv1/beCRQmkCfwPAlGdY92c6Q=", + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", + "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", "dev": true }, "unique-string": { diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 9d4ffad7bec..0450010306c 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -30,7 +30,7 @@ "bindings": "^1.2.1", "delay": "^2.0.0", "extend": "^3.0.1", - "gcp-metadata": "^0.5.0", + "gcp-metadata": "^0.6.1", "nan": "^2.8.0", "parse-duration": "^0.1.1", "pify": "^3.0.0", @@ -61,7 +61,7 @@ "sinon": "^4.0.1", "source-map-support": "^0.5.0", "ts-mockito": "^2.2.5", - "typescript": "~2.6.x" + "typescript": "~2.7.x" }, "files": [ "out/src", diff --git a/handwritten/cloud-profiler/ts/src/profilers/heap-profiler.ts b/handwritten/cloud-profiler/ts/src/profilers/heap-profiler.ts index 5c9bdcc7536..4db198e25bb 100644 --- a/handwritten/cloud-profiler/ts/src/profilers/heap-profiler.ts +++ b/handwritten/cloud-profiler/ts/src/profilers/heap-profiler.ts @@ -20,7 +20,7 @@ import {serializeHeapProfile} from './profile-serializer'; const profiler = require('bindings')('sampling_heap_profiler'); export class HeapProfiler { - private enabled: boolean; + private enabled = false; /** * @param intervalBytes - average bytes between samples. From 25386f4fc7571e054cd475fac3365f0c8d537e07 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Wed, 21 Mar 2018 11:01:55 -0700 Subject: [PATCH 103/632] chore(package): update sinon to version 5.0.0 (#166) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 0450010306c..c8f700e3e6c 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -58,7 +58,7 @@ "mocha": "^5.0.0", "nock": "^9.0.22", "nyc": "^11.2.1", - "sinon": "^4.0.1", + "sinon": "^5.0.0", "source-map-support": "^0.5.0", "ts-mockito": "^2.2.5", "typescript": "~2.7.x" From 3c1dd7b8b26ee6564733aff4d29d3e6afef679d1 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Thu, 22 Mar 2018 10:52:13 -0700 Subject: [PATCH 104/632] fix(package): update @google-cloud/common to version 0.17.0 (#167) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index c8f700e3e6c..29f5e41ceda 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -26,7 +26,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@google-cloud/common": "^0.16.1", + "@google-cloud/common": "^0.17.0", "bindings": "^1.2.1", "delay": "^2.0.0", "extend": "^3.0.1", From 39abb226dc3fd186ea0f442a6b1f1e94db479f82 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Thu, 22 Mar 2018 13:19:11 -0700 Subject: [PATCH 105/632] chore(package): update @types/mocha to version 5.0.0 (#168) --- handwritten/cloud-profiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 29f5e41ceda..eb21c094bdb 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -44,7 +44,7 @@ "@types/delay": "^2.0.0", "@types/extend": "^3.0.0", "@types/long": "^3.0.32", - "@types/mocha": "^2.2.43", + "@types/mocha": "^5.0.0", "@types/nock": "^9.1.0", "@types/node": "^9.3.0", "@types/pify": "^3.0.0", From 2894743e06d8c6e4e83cec54a88c7158617601f2 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 29 Mar 2018 16:43:12 -0700 Subject: [PATCH 106/632] fix: common-types should be part of package (#170) --- handwritten/cloud-profiler/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index eb21c094bdb..2f8ef90f6c5 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -65,6 +65,7 @@ }, "files": [ "out/src", + "out/third_party/types", "bindings", "proto", "binding.gyp", From 69928f9fccd97e60d2ec30a6bcc9710db3ae0e73 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 29 Mar 2018 17:06:12 -0700 Subject: [PATCH 107/632] v0.1.14 (#172) --- handwritten/cloud-profiler/package-lock.json | 369 +++++++++---------- handwritten/cloud-profiler/package.json | 2 +- 2 files changed, 173 insertions(+), 198 deletions(-) diff --git a/handwritten/cloud-profiler/package-lock.json b/handwritten/cloud-profiler/package-lock.json index 851f34e3dc6..8f0fffaf7f5 100644 --- a/handwritten/cloud-profiler/package-lock.json +++ b/handwritten/cloud-profiler/package-lock.json @@ -1,24 +1,24 @@ { "name": "@google-cloud/profiler", - "version": "0.1.13", + "version": "0.1.14", "lockfileVersion": 1, "requires": true, "dependencies": { "@google-cloud/common": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.16.1.tgz", - "integrity": "sha512-1sufDsSfgJ7fuBLq+ux8t3TlydMlyWl9kPZx2WdLINkGtf5RjvXX6EWYZiCMKe8flJ3oC0l95j5atN2uX5n3rg==", + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.17.0.tgz", + "integrity": "sha512-HRZLSU762E6HaKoGfJGa8W95yRjb9rY7LePhjaHK9ILAnFacMuUGVamDbTHu1csZomm1g3tZTtXfX/aAhtie/Q==", "requires": { "array-uniq": "1.0.3", "arrify": "1.0.1", - "concat-stream": "1.6.1", + "concat-stream": "1.6.2", "create-error-class": "3.0.2", "duplexify": "3.5.4", "ent": "2.2.0", "extend": "3.0.1", - "google-auto-auth": "0.9.7", + "google-auto-auth": "0.10.0", "is": "3.2.1", - "log-driver": "1.2.5", + "log-driver": "1.2.7", "methmeth": "1.1.0", "modelo": "4.2.3", "request": "2.83.0", @@ -83,6 +83,15 @@ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" }, + "@sinonjs/formatio": { + "version": "2.0.0", + "resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", + "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", + "dev": true, + "requires": { + "samsam": "1.3.0" + } + }, "@types/delay": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/delay/-/delay-2.0.1.tgz", @@ -110,13 +119,10 @@ "integrity": "sha512-ZXyOOm83p7X8p3s0IYM3VeueNmHpkk/yMlP8CLeOnEcu6hIwPH7YjZBvhQkR0ZFS2DqZAxKtJ/M5fcuv3OU5BA==" }, "@types/mocha": { - "version": "2.2.45", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.45.tgz", - "integrity": "sha512-tE1SYtNG3I3atRVPELSGN2FJJJtPg3O/G0tycYSyzeDqdAbdLPRH089LhpWYA5M/iHeWHkVZq/b0OVKngcK0Eg==", - "dev": true, - "requires": { - "@types/node": "9.4.5" - } + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.0.0.tgz", + "integrity": "sha512-ZS0vBV7Jn5Z/Q4T3VXauEKMDCV8nWOtJJg90OsDylkYJiQwcWtKuLzohWzrthBkerUF7DLMmJcwOPEP0i/AOXw==", + "dev": true }, "@types/nock": { "version": "9.1.0", @@ -209,9 +215,9 @@ } }, "argparse": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", - "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { "sprintf-js": "1.0.3" @@ -278,6 +284,15 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" }, + "axios": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", + "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", + "requires": { + "follow-redirects": "1.4.1", + "is-buffer": "1.1.6" + } + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -400,6 +415,11 @@ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" }, + "buffer-from": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.0.0.tgz", + "integrity": "sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA==" + }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", @@ -703,10 +723,11 @@ "dev": true }, "concat-stream": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.1.tgz", - "integrity": "sha512-gslSSJx03QKa59cIKqeJO9HQ/WZMotvYJCuaUULrLpjj8oG40kV2Z+gz82pVxlTkOADi4PJxQPPfhl1ELYrrXw==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", "requires": { + "buffer-from": "1.0.0", "inherits": "2.0.3", "readable-stream": "2.3.3", "typedarray": "0.0.6" @@ -997,9 +1018,9 @@ } }, "follow-redirects": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.3.0.tgz", - "integrity": "sha1-9oSHH8EW0uMp/aVe9naH9Pq8kFw=", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.4.1.tgz", + "integrity": "sha512-uxYePVPogtya1ktGnAAXOacnbIuRMB4dkvqeNz2qTtTQsuzSfbDolV+wMMKxAmCx0bLgAKLbBOkjItMbbkR1vg==", "requires": { "debug": "3.1.0" } @@ -1042,22 +1063,6 @@ "axios": "0.18.0", "extend": "3.0.1", "retry-axios": "0.3.2" - }, - "dependencies": { - "axios": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", - "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", - "requires": { - "follow-redirects": "1.3.0", - "is-buffer": "1.1.6" - } - }, - "retry-axios": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/retry-axios/-/retry-axios-0.3.2.tgz", - "integrity": "sha512-jp4YlI0qyDFfXiXGhkCOliBN1G7fRH03Nqy8YdShzGqbY5/9S2x/IR6C88ls2DFkbWuL3ASkP7QD3pVrNpPgwQ==" - } } }, "get-func-name": { @@ -1104,86 +1109,45 @@ } }, "google-auth-library": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-1.3.1.tgz", - "integrity": "sha512-NcAzFY+ScalfjmFTHnCXInuivtbIfib9irJ5H8AHONy3eA56YW1Tu5X1dtbjw5TNBgP+BMu+nIrglJsAlfZ/Hg==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-1.3.2.tgz", + "integrity": "sha512-aRz0om4Bs85uyR2Ousk3Gb8Nffx2Sr2RoKts1smg1MhRwrehE1aD1HC4RmprNt1HVJ88IDnQ8biJQ/aXjiIxlQ==", "requires": { "axios": "0.18.0", - "gcp-metadata": "0.6.2", - "gtoken": "2.1.1", + "gcp-metadata": "0.6.3", + "gtoken": "2.2.0", "jws": "3.1.4", "lodash.isstring": "4.0.1", - "lru-cache": "4.1.1", + "lru-cache": "4.1.2", "retry-axios": "0.3.2" }, "dependencies": { - "axios": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", - "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", - "requires": { - "follow-redirects": "1.3.0", - "is-buffer": "1.1.6" - } - }, - "gcp-metadata": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.6.2.tgz", - "integrity": "sha512-TlOa8HhM5klcBxBNazZUMeI9UZJoKJ4ceiBLPQoJIWNFeC/CqxjlaFE+/YnFQudqG5inhaaNtvoFVm/ZCbBFQQ==", + "lru-cache": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.2.tgz", + "integrity": "sha512-wgeVXhrDwAWnIF/yZARsFnMBtdFXOg1b8RIrhilp+0iDYN4mdQcNZElDZ0e4B64BhaxeQ5zN7PMyvu7we1kPeQ==", "requires": { - "axios": "0.18.0", - "extend": "3.0.1", - "retry-axios": "0.3.2" + "pseudomap": "1.0.2", + "yallist": "2.1.2" } - }, - "retry-axios": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/retry-axios/-/retry-axios-0.3.2.tgz", - "integrity": "sha512-jp4YlI0qyDFfXiXGhkCOliBN1G7fRH03Nqy8YdShzGqbY5/9S2x/IR6C88ls2DFkbWuL3ASkP7QD3pVrNpPgwQ==" } } }, "google-auto-auth": { - "version": "0.9.7", - "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.9.7.tgz", - "integrity": "sha512-Nro7aIFrL2NP0G7PoGrJqXGMZj8AjdBOcbZXRRm/8T3w08NUHIiNN3dxpuUYzDsZizslH+c8e+7HXL8vh3JXTQ==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/google-auto-auth/-/google-auto-auth-0.10.0.tgz", + "integrity": "sha512-R6m473OqgZacPvlidJ0aownTlUWyLy654ugjKSXyi1ffIicXlXg3wMfse9T9zxqG6w01q6K1iG+b7dImMkVJ2Q==", "requires": { "async": "2.6.0", - "gcp-metadata": "0.6.2", - "google-auth-library": "1.3.1", + "gcp-metadata": "0.6.3", + "google-auth-library": "1.3.2", "request": "2.83.0" - }, - "dependencies": { - "axios": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", - "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", - "requires": { - "follow-redirects": "1.3.0", - "is-buffer": "1.1.6" - } - }, - "gcp-metadata": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-0.6.2.tgz", - "integrity": "sha512-TlOa8HhM5klcBxBNazZUMeI9UZJoKJ4ceiBLPQoJIWNFeC/CqxjlaFE+/YnFQudqG5inhaaNtvoFVm/ZCbBFQQ==", - "requires": { - "axios": "0.18.0", - "extend": "3.0.1", - "retry-axios": "0.3.2" - } - }, - "retry-axios": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/retry-axios/-/retry-axios-0.3.2.tgz", - "integrity": "sha512-jp4YlI0qyDFfXiXGhkCOliBN1G7fRH03Nqy8YdShzGqbY5/9S2x/IR6C88ls2DFkbWuL3ASkP7QD3pVrNpPgwQ==" - } } }, "google-p12-pem": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-1.0.1.tgz", - "integrity": "sha512-6Gb+R8wKs0uGWHYH8US1q4IGYEMKPzg/ty2A/AevGaVDMzPIqNOKFmDxZHsHwda2438u99CkU0HdatsKXOUtcg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-1.0.2.tgz", + "integrity": "sha512-+EuKr4CLlGsnXx4XIJIVkcKYrsa2xkAmCvxRhX2HsazJzUBAJ35wARGeApHUn4nNfPD03Vl057FskNr20VaCyg==", "requires": { "node-forge": "0.7.4", "pify": "3.0.0" @@ -1221,26 +1185,15 @@ "dev": true }, "gtoken": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-2.1.1.tgz", - "integrity": "sha512-9wUP0Gb06lEJxX0w/w+n5Ghxh+/To0rbZSRCOu4Pih2sSDYXJwV4T7q6MPLW31cuKz0wqFQ60mW9nIKc8IgoyA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-2.2.0.tgz", + "integrity": "sha512-tvQs8B1z5+I1FzMPZnq/OCuxTWFOkvy7cUJcpNdBOK2L7yEtPZTVCPtZU181sSDF+isUPebSqFTNTkIejFASAQ==", "requires": { "axios": "0.18.0", - "google-p12-pem": "1.0.1", + "google-p12-pem": "1.0.2", "jws": "3.1.4", "mime": "2.2.0", "pify": "3.0.0" - }, - "dependencies": { - "axios": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", - "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", - "requires": { - "follow-redirects": "1.3.0", - "is-buffer": "1.1.6" - } - } } }, "gts": { @@ -1531,7 +1484,7 @@ "integrity": "sha512-HM/SKwAl1R0y9kkBili6GqKc31ZnjzY7JHC2uO9bAHJNRmY5c/s+2cETyaqX0kBD8gX8QVhS4dJjRtY1nAwb4w==", "dev": true, "requires": { - "argparse": "1.0.9", + "argparse": "1.0.10", "axios": "0.18.0", "npm-package-arg": "6.0.0", "package-json": "4.0.1", @@ -1541,27 +1494,6 @@ "strip-json-comments": "2.0.1" }, "dependencies": { - "axios": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", - "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", - "dev": true, - "requires": { - "follow-redirects": "1.3.0", - "is-buffer": "1.1.6" - } - }, - "spdx-compare": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/spdx-compare/-/spdx-compare-1.0.0.tgz", - "integrity": "sha512-C1mDZOX0hnu0ep9dfmuoi03+eOdDoz2yvK79RxbcrVEG1NO1Ph35yW102DHWKN4pk80nwCgeMmSY5L25VE4D9A==", - "dev": true, - "requires": { - "array-find-index": "1.0.2", - "spdx-expression-parse": "3.0.0", - "spdx-ranges": "2.0.0" - } - }, "spdx-correct": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz", @@ -1572,12 +1504,6 @@ "spdx-license-ids": "3.0.0" } }, - "spdx-exceptions": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", - "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", - "dev": true - }, "spdx-expression-parse": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", @@ -1593,23 +1519,6 @@ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==", "dev": true - }, - "spdx-ranges": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/spdx-ranges/-/spdx-ranges-2.0.0.tgz", - "integrity": "sha512-AUUXLfqkwD7GlzZkXv8ePPCpPjeVWI9xJCfysL8re/uKb6H10umMnC7bFRsHmLJan4fslUtekAgpHlSgLc/7mA==", - "dev": true - }, - "spdx-satisfies": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/spdx-satisfies/-/spdx-satisfies-4.0.0.tgz", - "integrity": "sha512-OcARj6U1OuVv98SVrRqgrR30sVocONtoPpnX8Xz4vXNrFVedqtbgkA+0KmQoXIQ2xjfltPPRVIMeNzKEFLWWKQ==", - "dev": true, - "requires": { - "spdx-compare": "1.0.0", - "spdx-expression-parse": "3.0.0", - "spdx-ranges": "2.0.0" - } } } }, @@ -1747,14 +1656,14 @@ "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" }, "log-driver": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.5.tgz", - "integrity": "sha1-euTsJXMC/XkNVXyxDJcQDYV7AFY=" + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", + "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==" }, "lolex": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.1.tgz", - "integrity": "sha512-mQuW55GhduF3ppo+ZRUTz1PRjEh1hS5BbqU7d8D0ez2OKxHDod7StPPeAVKisZR5aLkHZjdGWSL42LSONUJsZw==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.2.tgz", + "integrity": "sha512-A5pN2tkFj7H0dGIAM6MFvHKMJcPnjZsOMvR7ujCjfgW5TbV6H9vb1PgxLtHvjqNZTHsUolz+6/WEO0N1xNx2ng==", "dev": true }, "long": { @@ -1782,6 +1691,7 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "dev": true, "requires": { "pseudomap": "1.0.2", "yallist": "2.1.2" @@ -1953,24 +1863,16 @@ "integrity": "sha1-7XFfP+neArV6XmJS2QqWZ14fCFo=" }, "nise": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/nise/-/nise-1.2.0.tgz", - "integrity": "sha512-q9jXh3UNsMV28KeqI43ILz5+c3l+RiNW8mhurEwCKckuHQbL+hTJIKKTiUlCPKlgQ/OukFvSnKB/Jk3+sFbkGA==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/nise/-/nise-1.3.2.tgz", + "integrity": "sha512-KPKb+wvETBiwb4eTwtR/OsA2+iijXP+VnlSFYJo3EHjm2yjek1NWxHOUQat3i7xNLm1Bm18UA5j5Wor0yO2GtA==", "dev": true, "requires": { - "formatio": "1.2.0", + "@sinonjs/formatio": "2.0.0", "just-extend": "1.1.27", - "lolex": "1.6.0", + "lolex": "2.3.2", "path-to-regexp": "1.7.0", "text-encoding": "0.6.4" - }, - "dependencies": { - "lolex": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.6.0.tgz", - "integrity": "sha1-OpoCg0UqR9dDnnJzG54H1zhuSfY=", - "dev": true - } } }, "nock": { @@ -2057,7 +1959,7 @@ "dev": true, "requires": { "hosted-git-info": "2.5.0", - "osenv": "0.1.4", + "osenv": "0.1.5", "semver": "5.5.0", "validate-npm-package-name": "3.0.0" } @@ -3907,9 +3809,9 @@ "dev": true }, "osenv": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz", - "integrity": "sha1-Qv5tWVPfBsgGS+bxdsPQWqqjRkQ=", + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "dev": true, "requires": { "os-homedir": "1.0.2", @@ -4246,6 +4148,11 @@ "signal-exit": "3.0.2" } }, + "retry-axios": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/retry-axios/-/retry-axios-0.3.2.tgz", + "integrity": "sha512-jp4YlI0qyDFfXiXGhkCOliBN1G7fRH03Nqy8YdShzGqbY5/9S2x/IR6C88ls2DFkbWuL3ASkP7QD3pVrNpPgwQ==" + }, "retry-request": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-3.3.1.tgz", @@ -4335,26 +4242,18 @@ "dev": true }, "sinon": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.1.3.tgz", - "integrity": "sha512-c7u0ZuvBRX1eXuB4jN3BRCAOGiUTlM8SE3TxbJHrNiHUKL7wonujMOB6Fi1gQc00U91IscFORQHDga/eccqpbw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-5.0.0.tgz", + "integrity": "sha512-dMX7ZB2E1iQ5DOEOePoNJQp03uyhdMfb+kLXlNPbquv2FwfezD+0GbbHSgCw4MFhpSSS9NMoYJfOPMjCMJtXWA==", "dev": true, "requires": { "diff": "3.4.0", "formatio": "1.2.0", "lodash.get": "4.4.2", - "lolex": "2.3.1", - "nise": "1.2.0", + "lolex": "2.3.2", + "nise": "1.3.2", "supports-color": "4.5.0", - "type-detect": "4.0.5" - }, - "dependencies": { - "type-detect": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.5.tgz", - "integrity": "sha512-N9IvkQslUGYGC24RkJk1ba99foK6TkwC2FHAEBlQFBP0RxQZS8ZpJuAZcwiY/w9ZJHFQb1aOXBI60OdxhTrwEQ==", - "dev": true - } + "type-detect": "4.0.8" } }, "sntp": { @@ -4380,6 +4279,35 @@ "source-map": "0.6.1" } }, + "spdx-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/spdx-compare/-/spdx-compare-1.0.0.tgz", + "integrity": "sha512-C1mDZOX0hnu0ep9dfmuoi03+eOdDoz2yvK79RxbcrVEG1NO1Ph35yW102DHWKN4pk80nwCgeMmSY5L25VE4D9A==", + "dev": true, + "requires": { + "array-find-index": "1.0.2", + "spdx-expression-parse": "3.0.0", + "spdx-ranges": "2.0.0" + }, + "dependencies": { + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "2.1.0", + "spdx-license-ids": "3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", + "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==", + "dev": true + } + } + }, "spdx-correct": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", @@ -4389,6 +4317,12 @@ "spdx-license-ids": "1.2.2" } }, + "spdx-exceptions": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", + "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", + "dev": true + }, "spdx-expression-parse": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", @@ -4401,6 +4335,41 @@ "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", "dev": true }, + "spdx-ranges": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/spdx-ranges/-/spdx-ranges-2.0.0.tgz", + "integrity": "sha512-AUUXLfqkwD7GlzZkXv8ePPCpPjeVWI9xJCfysL8re/uKb6H10umMnC7bFRsHmLJan4fslUtekAgpHlSgLc/7mA==", + "dev": true + }, + "spdx-satisfies": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/spdx-satisfies/-/spdx-satisfies-4.0.0.tgz", + "integrity": "sha512-OcARj6U1OuVv98SVrRqgrR30sVocONtoPpnX8Xz4vXNrFVedqtbgkA+0KmQoXIQ2xjfltPPRVIMeNzKEFLWWKQ==", + "dev": true, + "requires": { + "spdx-compare": "1.0.0", + "spdx-expression-parse": "3.0.0", + "spdx-ranges": "2.0.0" + }, + "dependencies": { + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "2.1.0", + "spdx-license-ids": "3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", + "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==", + "dev": true + } + } + }, "split-array-stream": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/split-array-stream/-/split-array-stream-1.0.3.tgz", @@ -4635,6 +4604,12 @@ "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", "optional": true }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", diff --git a/handwritten/cloud-profiler/package.json b/handwritten/cloud-profiler/package.json index 2f8ef90f6c5..779be51d75d 100644 --- a/handwritten/cloud-profiler/package.json +++ b/handwritten/cloud-profiler/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/profiler", - "version": "0.1.13", + "version": "0.1.14", "description": "Adds support for Google Cloud Profiler to node.js applications", "repository": "GoogleCloudPlatform/cloud-profiler-nodejs", "main": "out/src/index.js", From 5fec815777a41d5f8aca55024aa4b56c2f0bdbba Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 4 Apr 2018 10:24:17 -0700 Subject: [PATCH 108/632] chore: reduce verbosity of e2e test output (#173) --- .../testing/integration_test.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/handwritten/cloud-profiler/testing/integration_test.go b/handwritten/cloud-profiler/testing/integration_test.go index c5ad82315cd..227c620e319 100644 --- a/handwritten/cloud-profiler/testing/integration_test.go +++ b/handwritten/cloud-profiler/testing/integration_test.go @@ -44,6 +44,7 @@ const cloudScope = "https://www.googleapis.com/auth/cloud-platform" const startupTemplate = ` #! /bin/bash +( # Shut down the VM in 5 minutes after this script exits # to stop accounting the VM for billing and cores quota. trap "sleep 300 && poweroff" EXIT @@ -54,14 +55,14 @@ set -eo pipefail # Display commands being run set -x # Install git -apt-get update -apt-get -y -q install git build-essential +apt-get update >/dev/null +apt-get -y -q install git build-essential >/dev/null # Install desired version of Node.js -curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash -export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm -nvm install {{.NodeVersion}} +curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash >/dev/null +export NVM_DIR="$HOME/.nvm" >/dev/null +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" >/dev/null +nvm install {{.NodeVersion}} >/dev/null npm -v node -v @@ -71,7 +72,7 @@ cd cloud-profiler-nodejs git fetch origin {{if .PR}}pull/{{.PR}}/head{{else}}{{.Branch}}{{end}}:pull_branch git checkout pull_branch git reset --hard {{.Commit}} -npm install +npm install >/dev/null npm run compile npm pack VERSION=$(node -e "console.log(require('./package.json').version);") @@ -87,8 +88,8 @@ npm install "$PROFILER" # Run benchmark with agent GCLOUD_PROFILER_LOGLEVEL=5 GAE_SERVICE={{.Service}} node --require @google-cloud/profiler busybench.js 600 -# Indicate to test that script has finished running -echo "busybench finished profiling" +# Write output to serial port 2 with timestamp. +) 2>&1 | while read line; do echo "$(date): ${line}"; done >/dev/ttyS1 ` type profileSummary struct { From 522072dffda915ae0ffade54d89dadf439afb4f0 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Wed, 4 Apr 2018 16:09:38 -0700 Subject: [PATCH 109/632] fix: fix e2e test (#174) --- handwritten/cloud-profiler/testing/integration_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/handwritten/cloud-profiler/testing/integration_test.go b/handwritten/cloud-profiler/testing/integration_test.go index 227c620e319..d2de44ac19e 100644 --- a/handwritten/cloud-profiler/testing/integration_test.go +++ b/handwritten/cloud-profiler/testing/integration_test.go @@ -74,7 +74,7 @@ git checkout pull_branch git reset --hard {{.Commit}} npm install >/dev/null npm run compile -npm pack +npm pack >/dev/null VERSION=$(node -e "console.log(require('./package.json').version);") PROFILER="$HOME/cloud-profiler-nodejs/google-cloud-profiler-$VERSION.tgz" @@ -83,11 +83,14 @@ mkdir -p "$TESTDIR" cp "testing/busybench.js" "$TESTDIR" cd "$TESTDIR" -npm install "$PROFILER" +npm install "$PROFILER" >/dev/null # Run benchmark with agent GCLOUD_PROFILER_LOGLEVEL=5 GAE_SERVICE={{.Service}} node --require @google-cloud/profiler busybench.js 600 +# Indicate to test that script has finished running +echo "busybench finished profiling" + # Write output to serial port 2 with timestamp. ) 2>&1 | while read line; do echo "$(date): ${line}"; done >/dev/ttyS1 ` From ee8a41a056f2f75a6b6293d221a1d29bd330db3a Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Thu, 5 Apr 2018 10:03:17 -0700 Subject: [PATCH 110/632] chore: reduce verbosity of e2e test (#175) --- handwritten/cloud-profiler/testing/integration_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/testing/integration_test.go b/handwritten/cloud-profiler/testing/integration_test.go index d2de44ac19e..63615ad7b66 100644 --- a/handwritten/cloud-profiler/testing/integration_test.go +++ b/handwritten/cloud-profiler/testing/integration_test.go @@ -62,7 +62,10 @@ apt-get -y -q install git build-essential >/dev/null curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash >/dev/null export NVM_DIR="$HOME/.nvm" >/dev/null [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" >/dev/null -nvm install {{.NodeVersion}} >/dev/null + +# nvm install writes to stderr and stdout on successful install, so both are +# redirected. +nvm install {{.NodeVersion}} &>/dev/null npm -v node -v From 94ce7fc7f8539a0cf6532c9ea5a5ca75d013cd2a Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Fri, 6 Apr 2018 11:01:24 -0700 Subject: [PATCH 111/632] fix: make fix to integration_test.sh (#177) --- handwritten/cloud-profiler/testing/integration_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwritten/cloud-profiler/testing/integration_test.sh b/handwritten/cloud-profiler/testing/integration_test.sh index 4f18166b20d..059f116a4fe 100644 --- a/handwritten/cloud-profiler/testing/integration_test.sh +++ b/handwritten/cloud-profiler/testing/integration_test.sh @@ -25,7 +25,7 @@ cp -R "testing" "$GOPATH/src/proftest" # Run test. cd "$GOPATH/src/proftest" go get -t -tags=integration . -if ["$KOKORO_GITHUB_PULL_REQUEST_NUMBER" == ""]; then +if [ "$KOKORO_GITHUB_PULL_REQUEST_NUMBER" == "" ]; then go test -timeout=30m -parallel=3 -tags=integration -run TestAgentIntegration -commit="$COMMIT" -branch="$BRANCH" -repo="$REPO" else go test -timeout=30m -parallel=3 -tags=integration -run TestAgentIntegration -commit="$COMMIT" -pr="$KOKORO_GITHUB_PULL_REQUEST_NUMBER" From c5a8f81ea6784fd1fe5a639ac1a33b97ebf41185 Mon Sep 17 00:00:00 2001 From: Margaret Nolan Date: Fri, 6 Apr 2018 19:32:43 -0700 Subject: [PATCH 112/632] Add googletest as subtree (#176) * Squashed 'third_party/gtest/' content from commit 82febb8 git-subtree-dir: third_party/gtest git-subtree-split: 82febb8eafc0425601b0d46567dc66c7750233ff * chore: add README.google to third_party/gtest --- .../third_party/gtest/.gitignore | 40 + .../third_party/gtest/.travis.yml | 79 + .../third_party/gtest/BUILD.bazel | 175 + .../third_party/gtest/CMakeLists.txt | 33 + .../third_party/gtest/CONTRIBUTING.md | 160 + .../cloud-profiler/third_party/gtest/LICENSE | 28 + .../third_party/gtest/Makefile.am | 14 + .../third_party/gtest/README.google | 15 + .../third_party/gtest/README.md | 122 + .../third_party/gtest/WORKSPACE | 8 + .../third_party/gtest/appveyor.yml | 99 + .../gtest/ci/build-linux-autotools.sh | 44 + .../third_party/gtest/ci/build-linux-bazel.sh | 36 + .../third_party/gtest/ci/env-linux.sh | 41 + .../third_party/gtest/ci/env-osx.sh | 40 + .../third_party/gtest/ci/get-nprocessors.sh | 48 + .../third_party/gtest/ci/install-linux.sh | 49 + .../third_party/gtest/ci/install-osx.sh | 39 + .../third_party/gtest/ci/log-config.sh | 51 + .../third_party/gtest/ci/travis.sh | 36 + .../third_party/gtest/configure.ac | 16 + .../third_party/gtest/googlemock/CHANGES | 126 + .../gtest/googlemock/CMakeLists.txt | 242 + .../third_party/gtest/googlemock/CONTRIBUTORS | 40 + .../third_party/gtest/googlemock/LICENSE | 28 + .../third_party/gtest/googlemock/Makefile.am | 224 + .../third_party/gtest/googlemock/README.md | 344 + .../gtest/googlemock/build-aux/.keep | 0 .../gtest/googlemock/cmake/gmock.pc.in | 9 + .../gtest/googlemock/cmake/gmock_main.pc.in | 9 + .../third_party/gtest/googlemock/configure.ac | 146 + .../gtest/googlemock/docs/CheatSheet.md | 564 ++ .../gtest/googlemock/docs/CookBook.md | 3679 ++++++++ .../gtest/googlemock/docs/DesignDoc.md | 280 + .../gtest/googlemock/docs/Documentation.md | 15 + .../gtest/googlemock/docs/ForDummies.md | 447 + .../docs/FrequentlyAskedQuestions.md | 628 ++ .../gtest/googlemock/docs/KnownIssues.md | 19 + .../googlemock/include/gmock/gmock-actions.h | 1206 +++ .../include/gmock/gmock-cardinalities.h | 147 + .../include/gmock/gmock-generated-actions.h | 2377 +++++ .../gmock/gmock-generated-actions.h.pump | 794 ++ .../gmock/gmock-generated-function-mockers.h | 1160 +++ .../gmock-generated-function-mockers.h.pump | 291 + .../include/gmock/gmock-generated-matchers.h | 2191 +++++ .../gmock/gmock-generated-matchers.h.pump | 673 ++ .../gmock/gmock-generated-nice-strict.h | 427 + .../gmock/gmock-generated-nice-strict.h.pump | 161 + .../googlemock/include/gmock/gmock-matchers.h | 5273 +++++++++++ .../include/gmock/gmock-more-actions.h | 246 + .../include/gmock/gmock-more-matchers.h | 83 + .../include/gmock/gmock-spec-builders.h | 1857 ++++ .../gtest/googlemock/include/gmock/gmock.h | 95 + .../internal/custom/gmock-generated-actions.h | 8 + .../custom/gmock-generated-actions.h.pump | 10 + .../gmock/internal/custom/gmock-matchers.h | 38 + .../gmock/internal/custom/gmock-port.h | 46 + .../internal/gmock-generated-internal-utils.h | 286 + .../gmock-generated-internal-utils.h.pump | 136 + .../gmock/internal/gmock-internal-utils.h | 545 ++ .../include/gmock/internal/gmock-port.h | 87 + .../gtest/googlemock/make/Makefile | 101 + .../gtest/googlemock/msvc/2005/gmock.sln | 32 + .../gtest/googlemock/msvc/2005/gmock.vcproj | 191 + .../googlemock/msvc/2005/gmock_config.vsprops | 15 + .../googlemock/msvc/2005/gmock_main.vcproj | 187 + .../googlemock/msvc/2005/gmock_test.vcproj | 201 + .../gtest/googlemock/msvc/2010/gmock.sln | 46 + .../gtest/googlemock/msvc/2010/gmock.vcxproj | 145 + .../googlemock/msvc/2010/gmock_config.props | 19 + .../googlemock/msvc/2010/gmock_main.vcxproj | 151 + .../googlemock/msvc/2010/gmock_test.vcxproj | 176 + .../gtest/googlemock/msvc/2015/gmock.sln | 46 + .../gtest/googlemock/msvc/2015/gmock.vcxproj | 145 + .../googlemock/msvc/2015/gmock_config.props | 19 + .../googlemock/msvc/2015/gmock_main.vcxproj | 151 + .../googlemock/msvc/2015/gmock_test.vcxproj | 176 + .../googlemock/scripts/fuse_gmock_files.py | 240 + .../googlemock/scripts/generator/LICENSE | 203 + .../gtest/googlemock/scripts/generator/README | 35 + .../scripts/generator/README.cppclean | 115 + .../scripts/generator/cpp/__init__.py | 0 .../googlemock/scripts/generator/cpp/ast.py | 1733 ++++ .../scripts/generator/cpp/gmock_class.py | 227 + .../scripts/generator/cpp/gmock_class_test.py | 448 + .../scripts/generator/cpp/keywords.py | 59 + .../scripts/generator/cpp/tokenize.py | 287 + .../googlemock/scripts/generator/cpp/utils.py | 41 + .../googlemock/scripts/generator/gmock_gen.py | 31 + .../gtest/googlemock/scripts/gmock-config.in | 303 + .../gtest/googlemock/scripts/gmock_doctor.py | 640 ++ .../gtest/googlemock/scripts/upload.py | 1387 +++ .../gtest/googlemock/scripts/upload_gmock.py | 78 + .../gtest/googlemock/src/gmock-all.cc | 47 + .../googlemock/src/gmock-cardinalities.cc | 156 + .../googlemock/src/gmock-internal-utils.cc | 202 + .../gtest/googlemock/src/gmock-matchers.cc | 573 ++ .../googlemock/src/gmock-spec-builders.cc | 868 ++ .../third_party/gtest/googlemock/src/gmock.cc | 205 + .../gtest/googlemock/src/gmock_main.cc | 54 + .../gtest/googlemock/test/BUILD.bazel | 123 + .../googlemock/test/gmock-actions_test.cc | 1416 +++ .../test/gmock-cardinalities_test.cc | 428 + .../test/gmock-generated-actions_test.cc | 1228 +++ .../gmock-generated-function-mockers_test.cc | 624 ++ .../gmock-generated-internal-utils_test.cc | 127 + .../test/gmock-generated-matchers_test.cc | 1286 +++ .../test/gmock-internal-utils_test.cc | 718 ++ .../googlemock/test/gmock-matchers_test.cc | 6696 ++++++++++++++ .../test/gmock-more-actions_test.cc | 711 ++ .../googlemock/test/gmock-nice-strict_test.cc | 446 + .../gtest/googlemock/test/gmock-port_test.cc | 43 + .../test/gmock-spec-builders_test.cc | 2699 ++++++ .../gtest/googlemock/test/gmock_all_test.cc | 51 + .../gtest/googlemock/test/gmock_ex_test.cc | 81 + .../gtest/googlemock/test/gmock_leak_test.py | 108 + .../gtest/googlemock/test/gmock_leak_test_.cc | 100 + .../gtest/googlemock/test/gmock_link2_test.cc | 40 + .../gtest/googlemock/test/gmock_link_test.cc | 40 + .../gtest/googlemock/test/gmock_link_test.h | 691 ++ .../googlemock/test/gmock_output_test.py | 183 + .../googlemock/test/gmock_output_test_.cc | 300 + .../test/gmock_output_test_golden.txt | 317 + .../googlemock/test/gmock_stress_test.cc | 323 + .../gtest/googlemock/test/gmock_test.cc | 262 + .../gtest/googlemock/test/gmock_test_utils.py | 110 + .../third_party/gtest/googletest/CHANGES | 157 + .../gtest/googletest/CMakeLists.txt | 312 + .../third_party/gtest/googletest/CONTRIBUTORS | 37 + .../third_party/gtest/googletest/LICENSE | 28 + .../third_party/gtest/googletest/Makefile.am | 339 + .../third_party/gtest/googletest/README.md | 360 + .../gtest/googletest/cmake/gtest.pc.in | 9 + .../gtest/googletest/cmake/gtest_main.pc.in | 10 + .../googletest/cmake/internal_utils.cmake | 280 + .../gtest/googletest/codegear/gtest.cbproj | 138 + .../gtest/googletest/codegear/gtest.groupproj | 54 + .../gtest/googletest/codegear/gtest_all.cc | 38 + .../gtest/googletest/codegear/gtest_link.cc | 40 + .../googletest/codegear/gtest_main.cbproj | 82 + .../googletest/codegear/gtest_unittest.cbproj | 88 + .../third_party/gtest/googletest/configure.ac | 68 + .../gtest/googletest/docs/AdvancedGuide.md | 2416 +++++ .../gtest/googletest/docs/Documentation.md | 16 + .../third_party/gtest/googletest/docs/FAQ.md | 1092 +++ .../gtest/googletest/docs/Pkgconfig.md | 146 + .../gtest/googletest/docs/Primer.md | 536 ++ .../gtest/googletest/docs/PumpManual.md | 177 + .../gtest/googletest/docs/Samples.md | 14 + .../gtest/googletest/docs/XcodeGuide.md | 93 + .../include/gtest/gtest-death-test.h | 342 + .../googletest/include/gtest/gtest-message.h | 249 + .../include/gtest/gtest-param-test.h | 1438 +++ .../include/gtest/gtest-param-test.h.pump | 501 ++ .../googletest/include/gtest/gtest-printers.h | 1078 +++ .../googletest/include/gtest/gtest-spi.h | 231 + .../include/gtest/gtest-test-part.h | 179 + .../include/gtest/gtest-typed-test.h | 264 + .../gtest/googletest/include/gtest/gtest.h | 2317 +++++ .../include/gtest/gtest_pred_impl.h | 357 + .../googletest/include/gtest/gtest_prod.h | 61 + .../gtest/internal/custom/gtest-port.h | 75 + .../gtest/internal/custom/gtest-printers.h | 42 + .../include/gtest/internal/custom/gtest.h | 45 + .../internal/gtest-death-test-internal.h | 275 + .../include/gtest/internal/gtest-filepath.h | 205 + .../include/gtest/internal/gtest-internal.h | 1277 +++ .../include/gtest/internal/gtest-linked_ptr.h | 243 + .../internal/gtest-param-util-generated.h | 5139 +++++++++++ .../gtest-param-util-generated.h.pump | 279 + .../include/gtest/internal/gtest-param-util.h | 723 ++ .../include/gtest/internal/gtest-port-arch.h | 100 + .../include/gtest/internal/gtest-port.h | 2686 ++++++ .../include/gtest/internal/gtest-string.h | 167 + .../include/gtest/internal/gtest-tuple.h | 1020 +++ .../include/gtest/internal/gtest-tuple.h.pump | 347 + .../include/gtest/internal/gtest-type-util.h | 3331 +++++++ .../gtest/internal/gtest-type-util.h.pump | 297 + .../gtest/googletest/m4/acx_pthread.m4 | 363 + .../third_party/gtest/googletest/m4/gtest.m4 | 74 + .../gtest/googletest/make/Makefile | 82 + .../gtest/googletest/msvc/2010/gtest-md.sln | 55 + .../googletest/msvc/2010/gtest-md.vcxproj | 149 + .../msvc/2010/gtest-md.vcxproj.filters | 18 + .../gtest/googletest/msvc/2010/gtest.sln | 55 + .../gtest/googletest/msvc/2010/gtest.vcxproj | 149 + .../msvc/2010/gtest.vcxproj.filters | 18 + .../msvc/2010/gtest_main-md.vcxproj | 154 + .../msvc/2010/gtest_main-md.vcxproj.filters | 18 + .../googletest/msvc/2010/gtest_main.vcxproj | 162 + .../msvc/2010/gtest_main.vcxproj.filters | 18 + .../msvc/2010/gtest_prod_test-md.vcxproj | 199 + .../2010/gtest_prod_test-md.vcxproj.filters | 26 + .../msvc/2010/gtest_prod_test.vcxproj | 191 + .../msvc/2010/gtest_prod_test.vcxproj.filters | 26 + .../msvc/2010/gtest_unittest-md.vcxproj | 188 + .../2010/gtest_unittest-md.vcxproj.filters | 18 + .../msvc/2010/gtest_unittest.vcxproj | 180 + .../msvc/2010/gtest_unittest.vcxproj.filters | 18 + .../gtest/googletest/samples/prime_tables.h | 127 + .../gtest/googletest/samples/sample1.cc | 68 + .../gtest/googletest/samples/sample1.h | 43 + .../googletest/samples/sample10_unittest.cc | 140 + .../googletest/samples/sample1_unittest.cc | 154 + .../gtest/googletest/samples/sample2.cc | 56 + .../gtest/googletest/samples/sample2.h | 85 + .../googletest/samples/sample2_unittest.cc | 110 + .../gtest/googletest/samples/sample3-inl.h | 172 + .../googletest/samples/sample3_unittest.cc | 152 + .../gtest/googletest/samples/sample4.cc | 46 + .../gtest/googletest/samples/sample4.h | 53 + .../googletest/samples/sample4_unittest.cc | 49 + .../googletest/samples/sample5_unittest.cc | 199 + .../googletest/samples/sample6_unittest.cc | 225 + .../googletest/samples/sample7_unittest.cc | 118 + .../googletest/samples/sample8_unittest.cc | 174 + .../googletest/samples/sample9_unittest.cc | 157 + .../gtest/googletest/scripts/common.py | 83 + .../googletest/scripts/fuse_gtest_files.py | 253 + .../googletest/scripts/gen_gtest_pred_impl.py | 730 ++ .../gtest/googletest/scripts/gtest-config.in | 274 + .../gtest/googletest/scripts/pump.py | 855 ++ .../gtest/googletest/scripts/release_docs.py | 158 + .../gtest/googletest/scripts/test/Makefile | 59 + .../gtest/googletest/scripts/upload.py | 1387 +++ .../gtest/googletest/scripts/upload_gtest.py | 78 + .../gtest/googletest/src/gtest-all.cc | 48 + .../gtest/googletest/src/gtest-death-test.cc | 1346 +++ .../gtest/googletest/src/gtest-filepath.cc | 385 + .../gtest/googletest/src/gtest-internal-inl.h | 1175 +++ .../gtest/googletest/src/gtest-port.cc | 1253 +++ .../gtest/googletest/src/gtest-printers.cc | 458 + .../gtest/googletest/src/gtest-test-part.cc | 102 + .../gtest/googletest/src/gtest-typed-test.cc | 119 + .../third_party/gtest/googletest/src/gtest.cc | 5841 +++++++++++++ .../gtest/googletest/src/gtest_main.cc | 38 + .../gtest/googletest/test/BUILD.bazel | 380 + .../test/gtest-death-test_ex_test.cc | 93 + .../googletest/test/gtest-death-test_test.cc | 1423 +++ .../googletest/test/gtest-filepath_test.cc | 652 ++ .../googletest/test/gtest-linked_ptr_test.cc | 154 + .../googletest/test/gtest-listener_test.cc | 311 + .../googletest/test/gtest-message_test.cc | 159 + .../googletest/test/gtest-options_test.cc | 207 + .../googletest/test/gtest-param-test2_test.cc | 61 + .../googletest/test/gtest-param-test_test.cc | 1110 +++ .../googletest/test/gtest-param-test_test.h | 53 + .../gtest/googletest/test/gtest-port_test.cc | 1303 +++ .../googletest/test/gtest-printers_test.cc | 1731 ++++ .../googletest/test/gtest-test-part_test.cc | 208 + .../gtest/googletest/test/gtest-tuple_test.cc | 320 + .../googletest/test/gtest-typed-test2_test.cc | 45 + .../googletest/test/gtest-typed-test_test.cc | 380 + .../googletest/test/gtest-typed-test_test.h | 66 + .../test/gtest-unittest-api_test.cc | 341 + .../gtest/googletest/test/gtest_all_test.cc | 47 + .../test/gtest_assert_by_exception_test.cc | 119 + .../test/gtest_break_on_failure_unittest.py | 210 + .../test/gtest_break_on_failure_unittest_.cc | 87 + .../test/gtest_catch_exceptions_test.py | 235 + .../test/gtest_catch_exceptions_test_.cc | 311 + .../gtest/googletest/test/gtest_color_test.py | 129 + .../googletest/test/gtest_color_test_.cc | 63 + .../googletest/test/gtest_env_var_test.py | 119 + .../googletest/test/gtest_env_var_test_.cc | 124 + .../googletest/test/gtest_environment_test.cc | 189 + .../googletest/test/gtest_filter_unittest.py | 638 ++ .../googletest/test/gtest_filter_unittest_.cc | 138 + .../gtest/googletest/test/gtest_help_test.py | 172 + .../gtest/googletest/test/gtest_help_test_.cc | 46 + .../test/gtest_json_outfiles_test.py | 162 + .../test/gtest_json_output_unittest.py | 611 ++ .../googletest/test/gtest_json_test_utils.py | 60 + .../test/gtest_list_tests_unittest.py | 207 + .../test/gtest_list_tests_unittest_.cc | 157 + .../googletest/test/gtest_main_unittest.cc | 45 + .../googletest/test/gtest_no_test_unittest.cc | 56 + .../googletest/test/gtest_output_test.py | 344 + .../googletest/test/gtest_output_test_.cc | 1067 +++ .../test/gtest_output_test_golden_lin.txt | 781 ++ .../test/gtest_pred_impl_unittest.cc | 2427 ++++++ .../test/gtest_premature_exit_test.cc | 127 + .../gtest/googletest/test/gtest_prod_test.cc | 57 + .../googletest/test/gtest_repeat_test.cc | 236 + .../googletest/test/gtest_shuffle_test.py | 325 + .../googletest/test/gtest_shuffle_test_.cc | 103 + .../googletest/test/gtest_sole_header_test.cc | 57 + .../googletest/test/gtest_stress_test.cc | 250 + .../gtest/googletest/test/gtest_test_utils.py | 318 + .../test/gtest_throw_on_failure_ex_test.cc | 92 + .../test/gtest_throw_on_failure_test.py | 171 + .../test/gtest_throw_on_failure_test_.cc | 72 + .../test/gtest_uninitialized_test.py | 69 + .../test/gtest_uninitialized_test_.cc | 43 + .../gtest/googletest/test/gtest_unittest.cc | 7750 +++++++++++++++++ .../test/gtest_xml_outfile1_test_.cc | 48 + .../test/gtest_xml_outfile2_test_.cc | 48 + .../test/gtest_xml_outfiles_test.py | 140 + .../test/gtest_xml_output_unittest.py | 378 + .../test/gtest_xml_output_unittest_.cc | 179 + .../googletest/test/gtest_xml_test_utils.py | 196 + .../gtest/googletest/test/production.cc | 36 + .../gtest/googletest/test/production.h | 55 + .../xcode/Config/DebugProject.xcconfig | 30 + .../xcode/Config/FrameworkTarget.xcconfig | 17 + .../googletest/xcode/Config/General.xcconfig | 41 + .../xcode/Config/ReleaseProject.xcconfig | 32 + .../xcode/Config/StaticLibraryTarget.xcconfig | 18 + .../xcode/Config/TestTarget.xcconfig | 8 + .../googletest/xcode/Resources/Info.plist | 30 + .../xcode/Samples/FrameworkSample/Info.plist | 28 + .../WidgetFramework.xcodeproj/project.pbxproj | 457 + .../xcode/Samples/FrameworkSample/runtests.sh | 62 + .../xcode/Samples/FrameworkSample/widget.cc | 63 + .../xcode/Samples/FrameworkSample/widget.h | 59 + .../Samples/FrameworkSample/widget_test.cc | 68 + .../googletest/xcode/Scripts/runtests.sh | 65 + .../xcode/Scripts/versiongenerate.py | 100 + .../xcode/gtest.xcodeproj/project.pbxproj | 1182 +++ 319 files changed, 134274 insertions(+) create mode 100644 handwritten/cloud-profiler/third_party/gtest/.gitignore create mode 100644 handwritten/cloud-profiler/third_party/gtest/.travis.yml create mode 100644 handwritten/cloud-profiler/third_party/gtest/BUILD.bazel create mode 100644 handwritten/cloud-profiler/third_party/gtest/CMakeLists.txt create mode 100644 handwritten/cloud-profiler/third_party/gtest/CONTRIBUTING.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/LICENSE create mode 100644 handwritten/cloud-profiler/third_party/gtest/Makefile.am create mode 100644 handwritten/cloud-profiler/third_party/gtest/README.google create mode 100644 handwritten/cloud-profiler/third_party/gtest/README.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/WORKSPACE create mode 100644 handwritten/cloud-profiler/third_party/gtest/appveyor.yml create mode 100755 handwritten/cloud-profiler/third_party/gtest/ci/build-linux-autotools.sh create mode 100755 handwritten/cloud-profiler/third_party/gtest/ci/build-linux-bazel.sh create mode 100755 handwritten/cloud-profiler/third_party/gtest/ci/env-linux.sh create mode 100755 handwritten/cloud-profiler/third_party/gtest/ci/env-osx.sh create mode 100755 handwritten/cloud-profiler/third_party/gtest/ci/get-nprocessors.sh create mode 100755 handwritten/cloud-profiler/third_party/gtest/ci/install-linux.sh create mode 100755 handwritten/cloud-profiler/third_party/gtest/ci/install-osx.sh create mode 100755 handwritten/cloud-profiler/third_party/gtest/ci/log-config.sh create mode 100755 handwritten/cloud-profiler/third_party/gtest/ci/travis.sh create mode 100644 handwritten/cloud-profiler/third_party/gtest/configure.ac create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/CHANGES create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/CMakeLists.txt create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/CONTRIBUTORS create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/LICENSE create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/Makefile.am create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/README.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/build-aux/.keep create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/cmake/gmock.pc.in create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/cmake/gmock_main.pc.in create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/configure.ac create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/docs/CheatSheet.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/docs/CookBook.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/docs/DesignDoc.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/docs/Documentation.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/docs/ForDummies.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/docs/FrequentlyAskedQuestions.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/docs/KnownIssues.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-actions.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-cardinalities.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-actions.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-matchers.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-matchers.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-more-actions.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-more-matchers.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-spec-builders.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/internal/custom/gmock-port.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/internal/gmock-internal-utils.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/internal/gmock-port.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/make/Makefile create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/msvc/2005/gmock.sln create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/msvc/2005/gmock.vcproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/msvc/2005/gmock_config.vsprops create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/msvc/2005/gmock_main.vcproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/msvc/2005/gmock_test.vcproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/msvc/2010/gmock.sln create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/msvc/2010/gmock.vcxproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/msvc/2010/gmock_config.props create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/msvc/2010/gmock_main.vcxproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/msvc/2010/gmock_test.vcxproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/msvc/2015/gmock.sln create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/msvc/2015/gmock.vcxproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/msvc/2015/gmock_config.props create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/msvc/2015/gmock_main.vcxproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/msvc/2015/gmock_test.vcxproj create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/fuse_gmock_files.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/generator/LICENSE create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/generator/README create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/generator/README.cppclean create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/generator/cpp/__init__.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/generator/cpp/ast.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/generator/cpp/gmock_class.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/generator/cpp/gmock_class_test.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/generator/cpp/keywords.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/generator/cpp/tokenize.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/generator/cpp/utils.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/generator/gmock_gen.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/gmock-config.in create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/gmock_doctor.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/upload.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/scripts/upload_gmock.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/src/gmock-all.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/src/gmock-cardinalities.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/src/gmock-internal-utils.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/src/gmock-matchers.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/src/gmock-spec-builders.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/src/gmock.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/src/gmock_main.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/BUILD.bazel create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock-actions_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock-cardinalities_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock-generated-actions_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock-generated-function-mockers_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock-generated-internal-utils_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock-generated-matchers_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock-internal-utils_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock-matchers_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock-more-actions_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock-nice-strict_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock-port_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock-spec-builders_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock_all_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock_ex_test.cc create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock_leak_test.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock_leak_test_.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock_link2_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock_link_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock_link_test.h create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock_output_test.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock_output_test_.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock_output_test_golden.txt create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock_stress_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock_test.cc create mode 100755 handwritten/cloud-profiler/third_party/gtest/googlemock/test/gmock_test_utils.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/CHANGES create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/CMakeLists.txt create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/CONTRIBUTORS create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/LICENSE create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/Makefile.am create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/README.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/cmake/gtest.pc.in create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/cmake/gtest_main.pc.in create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/cmake/internal_utils.cmake create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/codegear/gtest.cbproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/codegear/gtest.groupproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/codegear/gtest_all.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/codegear/gtest_link.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/codegear/gtest_main.cbproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/codegear/gtest_unittest.cbproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/configure.ac create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/docs/AdvancedGuide.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/docs/Documentation.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/docs/FAQ.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/docs/Pkgconfig.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/docs/Primer.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/docs/PumpManual.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/docs/Samples.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/docs/XcodeGuide.md create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/gtest-death-test.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/gtest-message.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/gtest-param-test.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/gtest-param-test.h.pump create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/gtest-printers.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/gtest-spi.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/gtest-test-part.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/gtest-typed-test.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/gtest.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/gtest_pred_impl.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/gtest_prod.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/custom/gtest-port.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/custom/gtest-printers.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/custom/gtest.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/gtest-death-test-internal.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/gtest-filepath.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/gtest-internal.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/gtest-linked_ptr.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h.pump create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/gtest-param-util.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/gtest-port-arch.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/gtest-port.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/gtest-string.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/gtest-tuple.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/gtest-tuple.h.pump create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/gtest-type-util.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/include/gtest/internal/gtest-type-util.h.pump create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/m4/acx_pthread.m4 create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/m4/gtest.m4 create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/make/Makefile create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest-md.sln create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest-md.vcxproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest-md.vcxproj.filters create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest.sln create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest.vcxproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest.vcxproj.filters create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest_main-md.vcxproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest_main-md.vcxproj.filters create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest_main.vcxproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest_main.vcxproj.filters create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj.filters create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj.filters create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj.filters create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest_unittest.vcxproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/msvc/2010/gtest_unittest.vcxproj.filters create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/prime_tables.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample1.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample1.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample10_unittest.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample1_unittest.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample2.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample2.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample2_unittest.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample3-inl.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample3_unittest.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample4.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample4.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample4_unittest.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample5_unittest.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample6_unittest.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample7_unittest.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample8_unittest.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/samples/sample9_unittest.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/scripts/common.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/scripts/fuse_gtest_files.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/scripts/gen_gtest_pred_impl.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/scripts/gtest-config.in create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/scripts/pump.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/scripts/release_docs.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/scripts/test/Makefile create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/scripts/upload.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/scripts/upload_gtest.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/src/gtest-all.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/src/gtest-death-test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/src/gtest-filepath.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/src/gtest-internal-inl.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/src/gtest-port.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/src/gtest-printers.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/src/gtest-test-part.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/src/gtest-typed-test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/src/gtest.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/src/gtest_main.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/BUILD.bazel create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-death-test_ex_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-death-test_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-filepath_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-linked_ptr_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-listener_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-message_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-options_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-param-test2_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-param-test_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-param-test_test.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-port_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-printers_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-test-part_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-tuple_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-typed-test2_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-typed-test_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-typed-test_test.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest-unittest-api_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_all_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_assert_by_exception_test.cc create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_break_on_failure_unittest.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_break_on_failure_unittest_.cc create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_catch_exceptions_test.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_catch_exceptions_test_.cc create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_color_test.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_color_test_.cc create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_env_var_test.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_env_var_test_.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_environment_test.cc create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_filter_unittest.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_filter_unittest_.cc create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_help_test.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_help_test_.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_json_outfiles_test.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_json_output_unittest.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_json_test_utils.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_list_tests_unittest.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_list_tests_unittest_.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_main_unittest.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_no_test_unittest.cc create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_output_test.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_output_test_.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_output_test_golden_lin.txt create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_pred_impl_unittest.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_premature_exit_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_prod_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_repeat_test.cc create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_shuffle_test.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_shuffle_test_.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_sole_header_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_stress_test.cc create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_test_utils.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_throw_on_failure_ex_test.cc create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_throw_on_failure_test.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_throw_on_failure_test_.cc create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_uninitialized_test.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_uninitialized_test_.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_unittest.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_xml_outfile1_test_.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_xml_outfile2_test_.cc create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_xml_outfiles_test.py create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_xml_output_unittest.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_xml_output_unittest_.cc create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/test/gtest_xml_test_utils.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/production.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/test/production.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/Config/DebugProject.xcconfig create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/Config/FrameworkTarget.xcconfig create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/Config/General.xcconfig create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/Config/ReleaseProject.xcconfig create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/Config/StaticLibraryTarget.xcconfig create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/Config/TestTarget.xcconfig create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/Resources/Info.plist create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/Samples/FrameworkSample/Info.plist create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/Samples/FrameworkSample/runtests.sh create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/Samples/FrameworkSample/widget.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/Samples/FrameworkSample/widget.h create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/Samples/FrameworkSample/widget_test.cc create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/Scripts/runtests.sh create mode 100755 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/Scripts/versiongenerate.py create mode 100644 handwritten/cloud-profiler/third_party/gtest/googletest/xcode/gtest.xcodeproj/project.pbxproj diff --git a/handwritten/cloud-profiler/third_party/gtest/.gitignore b/handwritten/cloud-profiler/third_party/gtest/.gitignore new file mode 100644 index 00000000000..b294d3b6022 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/.gitignore @@ -0,0 +1,40 @@ +# Ignore CI build directory +build/ +xcuserdata +cmake-build-debug/ +.idea/ +bazel-bin +bazel-genfiles +bazel-googletest +bazel-out +bazel-testlogs +# python +*.pyc + +# Visual Studio files +*.sdf +*.opensdf +*.VC.opendb +*.suo +*.user +_ReSharper.Caches/ +Win32-Debug/ +Win32-Release/ +x64-Debug/ +x64-Release/ + +# Ignore autoconf / automake files +Makefile.in +aclocal.m4 +configure +build-aux/ +autom4te.cache/ +googletest/m4/libtool.m4 +googletest/m4/ltoptions.m4 +googletest/m4/ltsugar.m4 +googletest/m4/ltversion.m4 +googletest/m4/lt~obsolete.m4 + +# Ignore generated directories. +googlemock/fused-src/ +googletest/fused-src/ diff --git a/handwritten/cloud-profiler/third_party/gtest/.travis.yml b/handwritten/cloud-profiler/third_party/gtest/.travis.yml new file mode 100644 index 00000000000..8913e89a3de --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/.travis.yml @@ -0,0 +1,79 @@ +# Build matrix / environment variable are explained on: +# http://about.travis-ci.org/docs/user/build-configuration/ +# This file can be validated on: +# http://lint.travis-ci.org/ + +sudo: false +language: cpp + +# Define the matrix explicitly, manually expanding the combinations of (os, compiler, env). +# It is more tedious, but grants us far more flexibility. +matrix: + include: + - os: linux + compiler: gcc + sudo : true + install: ./ci/install-linux.sh && ./ci/log-config.sh + script: ./ci/build-linux-bazel.sh + - os: linux + compiler: clang + sudo : true + install: ./ci/install-linux.sh && ./ci/log-config.sh + script: ./ci/build-linux-bazel.sh + - os: linux + group: deprecated-2017Q4 + compiler: gcc + install: ./ci/install-linux.sh && ./ci/log-config.sh + script: ./ci/build-linux-autotools.sh + - os: linux + group: deprecated-2017Q4 + compiler: gcc + env: BUILD_TYPE=Debug VERBOSE=1 CXX_FLAGS=-std=c++11 + - os: linux + group: deprecated-2017Q4 + compiler: clang + env: BUILD_TYPE=Debug VERBOSE=1 + - os: linux + group: deprecated-2017Q4 + compiler: clang + env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 + - os: osx + compiler: gcc + env: BUILD_TYPE=Debug VERBOSE=1 + - os: osx + compiler: gcc + env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 + if: type != pull_request + - os: osx + compiler: clang + env: BUILD_TYPE=Debug VERBOSE=1 + if: type != pull_request + - os: osx + env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 + if: type != pull_request + +# These are the install and build (script) phases for the most common entries in the matrix. They could be included +# in each entry in the matrix, but that is just repetitive. +install: + - ./ci/install-${TRAVIS_OS_NAME}.sh + - . ./ci/env-${TRAVIS_OS_NAME}.sh + - ./ci/log-config.sh + +script: ./ci/travis.sh + +# For sudo=false builds this section installs the necessary dependencies. +addons: + apt: + # List of whitelisted in travis packages for ubuntu-precise can be found here: + # https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise + # List of whitelisted in travis apt-sources: + # https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-precise-3.7 + packages: + - g++-4.9 + - clang-3.7 + +notifications: + email: false diff --git a/handwritten/cloud-profiler/third_party/gtest/BUILD.bazel b/handwritten/cloud-profiler/third_party/gtest/BUILD.bazel new file mode 100644 index 00000000000..6d828294c05 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/BUILD.bazel @@ -0,0 +1,175 @@ +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Author: misterg@google.com (Gennadiy Civil) +# +# Bazel Build for Google C++ Testing Framework(Google Test) + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +config_setting( + name = "windows", + values = { "cpu": "x64_windows" }, +) + +config_setting( + name = "windows_msvc", + values = {"cpu": "x64_windows_msvc"}, +) + +config_setting( + name = "has_absl", + values = {"define": "absl=1"}, +) + + +# Google Test including Google Mock +cc_library( + name = "gtest", + srcs = glob( + include = [ + "googletest/src/*.cc", + "googletest/src/*.h", + "googletest/include/gtest/**/*.h", + "googlemock/src/*.cc", + "googlemock/include/gmock/**/*.h", + ], + exclude = [ + "googletest/src/gtest-all.cc", + "googletest/src/gtest_main.cc", + "googlemock/src/gmock-all.cc", + "googlemock/src/gmock_main.cc", + ], + ), + hdrs =glob([ + "googletest/include/gtest/*.h", + "googlemock/include/gmock/*.h", + ]), + copts = select( + { + ":windows": [], + ":windows_msvc": [], + "//conditions:default": ["-pthread"], + }, + ), + includes = [ + "googlemock", + "googlemock/include", + "googletest", + "googletest/include", + ], + linkopts = select({ + ":windows": [], + ":windows_msvc": [], + "//conditions:default": [ + "-pthread", + ], + }), + defines = select ({ + ":has_absl": [ + "GTEST_HAS_ABSL=1", + ], + "//conditions:default": [], + } + ), + deps = select ({ + ":has_absl": [ + "@com_google_absl//absl/types:optional", + "@com_google_absl//absl/strings" + ], + "//conditions:default": [], + } + ) +) + +cc_library( + name = "gtest_main", + srcs = [ + "googlemock/src/gmock_main.cc", + ], + deps = [":gtest"], +) + +# The following rules build samples of how to use gTest. +cc_library( + name = "gtest_sample_lib", + srcs = [ + "googletest/samples/sample1.cc", + "googletest/samples/sample2.cc", + "googletest/samples/sample4.cc", + ], + hdrs = [ + "googletest/samples/prime_tables.h", + "googletest/samples/sample1.h", + "googletest/samples/sample2.h", + "googletest/samples/sample3-inl.h", + "googletest/samples/sample4.h", + ], +) + +cc_test( + name = "gtest_samples", + size = "small", + #All Samples except: + #sample9 ( main ) + #sample10 (main and takes a command line option and needs to be separate) + srcs = [ + "googletest/samples/sample1_unittest.cc", + "googletest/samples/sample2_unittest.cc", + "googletest/samples/sample3_unittest.cc", + "googletest/samples/sample4_unittest.cc", + "googletest/samples/sample5_unittest.cc", + "googletest/samples/sample6_unittest.cc", + "googletest/samples/sample7_unittest.cc", + "googletest/samples/sample8_unittest.cc", + ], + deps = [ + "gtest_sample_lib", + ":gtest_main", + ], +) + +cc_test( + name = "sample9_unittest", + size = "small", + srcs = ["googletest/samples/sample9_unittest.cc"], + deps = [":gtest"], +) + +cc_test( + name = "sample10_unittest", + size = "small", + srcs = ["googletest/samples/sample10_unittest.cc"], + deps = [ + ":gtest", + ], +) diff --git a/handwritten/cloud-profiler/third_party/gtest/CMakeLists.txt b/handwritten/cloud-profiler/third_party/gtest/CMakeLists.txt new file mode 100644 index 00000000000..f8a97faaeb8 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 2.6.4) + +if (POLICY CMP0048) + cmake_policy(SET CMP0048 NEW) +endif (POLICY CMP0048) + +project( googletest-distribution ) + +enable_testing() + +include(CMakeDependentOption) +if (CMAKE_VERSION VERSION_LESS 2.8.5) + set(CMAKE_INSTALL_BINDIR "bin" CACHE STRING "User executables (bin)") + set(CMAKE_INSTALL_LIBDIR "lib${LIB_SUFFIX}" CACHE STRING "Object code libraries (lib)") + set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE STRING "C header files (include)") + mark_as_advanced(CMAKE_INSTALL_BINDIR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR) +else() + include(GNUInstallDirs) +endif() + +option(BUILD_GTEST "Builds the googletest subproject" OFF) + +#Note that googlemock target already builds googletest +option(BUILD_GMOCK "Builds the googlemock subproject" ON) + +cmake_dependent_option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON "BUILD_GTEST OR BUILD_GMOCK" OFF) +cmake_dependent_option(INSTALL_GMOCK "Enable installation of googlemock. (Projects embedding googlemock may want to turn this OFF.)" ON "BUILD_GMOCK" OFF) + +if(BUILD_GMOCK) + add_subdirectory( googlemock ) +elseif(BUILD_GTEST) + add_subdirectory( googletest ) +endif() diff --git a/handwritten/cloud-profiler/third_party/gtest/CONTRIBUTING.md b/handwritten/cloud-profiler/third_party/gtest/CONTRIBUTING.md new file mode 100644 index 00000000000..0ebdfcc6f07 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/CONTRIBUTING.md @@ -0,0 +1,160 @@ +# How to become a contributor and submit your own code + +## Contributor License Agreements + +We'd love to accept your patches! Before we can take them, we +have to jump a couple of legal hurdles. + +Please fill out either the individual or corporate Contributor License Agreement +(CLA). + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an + [individual CLA](https://developers.google.com/open-source/cla/individual). + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a + [corporate CLA](https://developers.google.com/open-source/cla/corporate). + +Follow either of the two links above to access the appropriate CLA and +instructions for how to sign and return it. Once we receive it, we'll be able to +accept your pull requests. + +## Contributing A Patch + +1. Submit an issue describing your proposed change to the + [issue tracker](https://github.com/google/googletest). +1. Please don't mix more than one logical change per submittal, + because it makes the history hard to follow. If you want to make a + change that doesn't have a corresponding issue in the issue + tracker, please create one. +1. Also, coordinate with team members that are listed on the issue in + question. This ensures that work isn't being duplicated and + communicating your plan early also generally leads to better + patches. +1. If your proposed change is accepted, and you haven't already done so, sign a + Contributor License Agreement (see details above). +1. Fork the desired repo, develop and test your code changes. +1. Ensure that your code adheres to the existing style in the sample to which + you are contributing. +1. Ensure that your code has an appropriate set of unit tests which all pass. +1. Submit a pull request. + +If you are a Googler, it is preferable to first create an internal change and +have it reviewed and submitted, and then create an upstreaming pull +request here. + +## The Google Test and Google Mock Communities ## + +The Google Test community exists primarily through the +[discussion group](http://groups.google.com/group/googletestframework) +and the GitHub repository. +Likewise, the Google Mock community exists primarily through their own +[discussion group](http://groups.google.com/group/googlemock). +You are definitely encouraged to contribute to the +discussion and you can also help us to keep the effectiveness of the +group high by following and promoting the guidelines listed here. + +### Please Be Friendly ### + +Showing courtesy and respect to others is a vital part of the Google +culture, and we strongly encourage everyone participating in Google +Test development to join us in accepting nothing less. Of course, +being courteous is not the same as failing to constructively disagree +with each other, but it does mean that we should be respectful of each +other when enumerating the 42 technical reasons that a particular +proposal may not be the best choice. There's never a reason to be +antagonistic or dismissive toward anyone who is sincerely trying to +contribute to a discussion. + +Sure, C++ testing is serious business and all that, but it's also +a lot of fun. Let's keep it that way. Let's strive to be one of the +friendliest communities in all of open source. + +As always, discuss Google Test in the official GoogleTest discussion group. +You don't have to actually submit code in order to sign up. Your participation +itself is a valuable contribution. + +## Style + +To keep the source consistent, readable, diffable and easy to merge, +we use a fairly rigid coding style, as defined by the [google-styleguide](https://github.com/google/styleguide) project. All patches will be expected +to conform to the style outlined [here](https://google.github.io/styleguide/cppguide.html). + +## Requirements for Contributors ### + +If you plan to contribute a patch, you need to build Google Test, +Google Mock, and their own tests from a git checkout, which has +further requirements: + + * [Python](https://www.python.org/) v2.3 or newer (for running some of + the tests and re-generating certain source files from templates) + * [CMake](https://cmake.org/) v2.6.4 or newer + * [GNU Build System](https://en.wikipedia.org/wiki/GNU_Build_System) + including automake (>= 1.9), autoconf (>= 2.59), and + libtool / libtoolize. + +## Developing Google Test ## + +This section discusses how to make your own changes to Google Test. + +### Testing Google Test Itself ### + +To make sure your changes work as intended and don't break existing +functionality, you'll want to compile and run Google Test's own tests. +For that you can use CMake: + + mkdir mybuild + cd mybuild + cmake -Dgtest_build_tests=ON ${GTEST_DIR} + +Make sure you have Python installed, as some of Google Test's tests +are written in Python. If the cmake command complains about not being +able to find Python (`Could NOT find PythonInterp (missing: +PYTHON_EXECUTABLE)`), try telling it explicitly where your Python +executable can be found: + + cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR} + +Next, you can build Google Test and all of its own tests. On \*nix, +this is usually done by 'make'. To run the tests, do + + make test + +All tests should pass. + +### Regenerating Source Files ## + +Some of Google Test's source files are generated from templates (not +in the C++ sense) using a script. +For example, the +file include/gtest/internal/gtest-type-util.h.pump is used to generate +gtest-type-util.h in the same directory. + +You don't need to worry about regenerating the source files +unless you need to modify them. You would then modify the +corresponding `.pump` files and run the '[pump.py](googletest/scripts/pump.py)' +generator script. See the [Pump Manual](googletest/docs/PumpManual.md). + +## Developing Google Mock ### + +This section discusses how to make your own changes to Google Mock. + +#### Testing Google Mock Itself #### + +To make sure your changes work as intended and don't break existing +functionality, you'll want to compile and run Google Test's own tests. +For that you'll need Autotools. First, make sure you have followed +the instructions above to configure Google Mock. +Then, create a build output directory and enter it. Next, + + ${GMOCK_DIR}/configure # try --help for more info + +Once you have successfully configured Google Mock, the build steps are +standard for GNU-style OSS packages. + + make # Standard makefile following GNU conventions + make check # Builds and runs all tests - all should pass. + +Note that when building your project against Google Mock, you are building +against Google Test as well. There is no need to configure Google Test +separately. diff --git a/handwritten/cloud-profiler/third_party/gtest/LICENSE b/handwritten/cloud-profiler/third_party/gtest/LICENSE new file mode 100644 index 00000000000..1941a11f8ce --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/LICENSE @@ -0,0 +1,28 @@ +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/handwritten/cloud-profiler/third_party/gtest/Makefile.am b/handwritten/cloud-profiler/third_party/gtest/Makefile.am new file mode 100644 index 00000000000..433eefeb080 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/Makefile.am @@ -0,0 +1,14 @@ +## Process this file with automake to produce Makefile.in +ACLOCAL_AMFLAGS = -I m4 + +AUTOMAKE_OPTIONS = foreign + +# Build . before src so that our all-local and clean-local hooks kicks in at +# the right time. +SUBDIRS = googletest googlemock + +EXTRA_DIST = \ + BUILD.bazel \ + CMakeLists.txt \ + README.md \ + WORKSPACE diff --git a/handwritten/cloud-profiler/third_party/gtest/README.google b/handwritten/cloud-profiler/third_party/gtest/README.google new file mode 100644 index 00000000000..09ce1011017 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/README.google @@ -0,0 +1,15 @@ +URL: https://github.com/google/googletest/commit/82febb8eafc0425601b0d46567dc66c7750233ff +Version: https://github.com/google/googletest/commit/82febb8eafc0425601b0d46567dc66c7750233ff +License: BSD 3-clause +License File: # LICENSE +Description: + A C++ testing framework. +Local Modifications: + Imported as a git-subtree. + + $ git remote add -f gtest https://github.com/google/googletest.git + $ git subtree add --prefix third_party/gtest gtest master --squash + + To update from remote on an ongoing basis: + $ git fetch gtest + $ git subtree pull --prefix third_party/gtest gtest master --squash diff --git a/handwritten/cloud-profiler/third_party/gtest/README.md b/handwritten/cloud-profiler/third_party/gtest/README.md new file mode 100644 index 00000000000..157316c03f4 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/README.md @@ -0,0 +1,122 @@ + +# Google Test # + +[![Build Status](https://travis-ci.org/google/googletest.svg?branch=master)](https://travis-ci.org/google/googletest) +[![Build status](https://ci.appveyor.com/api/projects/status/4o38plt0xbo1ubc8/branch/master?svg=true)](https://ci.appveyor.com/project/GoogleTestAppVeyor/googletest/branch/master) + +Welcome to **Google Test**, Google's C++ test framework! + +This repository is a merger of the formerly separate GoogleTest and +GoogleMock projects. These were so closely related that it makes sense to +maintain and release them together. + +Please see the project page above for more information as well as the +mailing list for questions, discussions, and development. There is +also an IRC channel on [OFTC](https://webchat.oftc.net/) (irc.oftc.net) #gtest available. Please +join us! + +Getting started information for **Google Test** is available in the +[Google Test Primer](googletest/docs/Primer.md) documentation. + +**Google Mock** is an extension to Google Test for writing and using C++ mock +classes. See the separate [Google Mock documentation](googlemock/README.md). + +More detailed documentation for googletest (including build instructions) are +in its interior [googletest/README.md](googletest/README.md) file. + +## Features ## + + * An [xUnit](https://en.wikipedia.org/wiki/XUnit) test framework. + * Test discovery. + * A rich set of assertions. + * User-defined assertions. + * Death tests. + * Fatal and non-fatal failures. + * Value-parameterized tests. + * Type-parameterized tests. + * Various options for running the tests. + * XML test report generation. + +## Platforms ## + +Google test has been used on a variety of platforms: + + * Linux + * Mac OS X + * Windows + * Cygwin + * MinGW + * Windows Mobile + * Symbian + +## Who Is Using Google Test? ## + +In addition to many internal projects at Google, Google Test is also used by +the following notable projects: + + * The [Chromium projects](http://www.chromium.org/) (behind the Chrome + browser and Chrome OS). + * The [LLVM](http://llvm.org/) compiler. + * [Protocol Buffers](https://github.com/google/protobuf), Google's data + interchange format. + * The [OpenCV](http://opencv.org/) computer vision library. + * [tiny-dnn](https://github.com/tiny-dnn/tiny-dnn): header only, dependency-free deep learning framework in C++11. + +## Related Open Source Projects ## + +[GTest Runner](https://github.com/nholthaus/gtest-runner) is a Qt5 based automated test-runner and Graphical User Interface with powerful features for Windows and Linux platforms. + +[Google Test UI](https://github.com/ospector/gtest-gbar) is test runner that runs +your test binary, allows you to track its progress via a progress bar, and +displays a list of test failures. Clicking on one shows failure text. Google +Test UI is written in C#. + +[GTest TAP Listener](https://github.com/kinow/gtest-tap-listener) is an event +listener for Google Test that implements the +[TAP protocol](https://en.wikipedia.org/wiki/Test_Anything_Protocol) for test +result output. If your test runner understands TAP, you may find it useful. + +[gtest-parallel](https://github.com/google/gtest-parallel) is a test runner that +runs tests from your binary in parallel to provide significant speed-up. + +## Requirements ## + +Google Test is designed to have fairly minimal requirements to build +and use with your projects, but there are some. Currently, we support +Linux, Windows, Mac OS X, and Cygwin. We will also make our best +effort to support other platforms (e.g. Solaris, AIX, and z/OS). +However, since core members of the Google Test project have no access +to these platforms, Google Test may have outstanding issues there. If +you notice any problems on your platform, please notify +[googletestframework@googlegroups.com](https://groups.google.com/forum/#!forum/googletestframework). Patches for fixing them are +even more welcome! + +### Linux Requirements ### + +These are the base requirements to build and use Google Test from a source +package (as described below): + + * GNU-compatible Make or gmake + * POSIX-standard shell + * POSIX(-2) Regular Expressions (regex.h) + * A C++98-standard-compliant compiler + +### Windows Requirements ### + + * Microsoft Visual C++ 2015 or newer + +### Cygwin Requirements ### + + * Cygwin v1.5.25-14 or newer + +### Mac OS X Requirements ### + + * Mac OS X v10.4 Tiger or newer + * Xcode Developer Tools + +## Contributing change + +Please read the [`CONTRIBUTING.md`](CONTRIBUTING.md) for details on +how to contribute to this project. + +Happy testing! diff --git a/handwritten/cloud-profiler/third_party/gtest/WORKSPACE b/handwritten/cloud-profiler/third_party/gtest/WORKSPACE new file mode 100644 index 00000000000..1d5d3886238 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/WORKSPACE @@ -0,0 +1,8 @@ +workspace(name = "com_google_googletest") + +# Abseil +http_archive( + name = "com_google_absl", + urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"], + strip_prefix = "abseil-cpp-master", +) diff --git a/handwritten/cloud-profiler/third_party/gtest/appveyor.yml b/handwritten/cloud-profiler/third_party/gtest/appveyor.yml new file mode 100644 index 00000000000..94b1c3a40c8 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/appveyor.yml @@ -0,0 +1,99 @@ +version: '{build}' + +os: Visual Studio 2015 + +environment: + matrix: + - compiler: msvc-15-seh + generator: "Visual Studio 15 2017" + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + + - compiler: msvc-15-seh + generator: "Visual Studio 15 2017 Win64" + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + enabled_on_pr: yes + + - compiler: msvc-14-seh + generator: "Visual Studio 14 2015" + enabled_on_pr: yes + + - compiler: msvc-14-seh + generator: "Visual Studio 14 2015 Win64" + + - compiler: gcc-5.3.0-posix + generator: "MinGW Makefiles" + cxx_path: 'C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin' + + - compiler: gcc-6.3.0-posix + generator: "MinGW Makefiles" + cxx_path: 'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin' + +configuration: + - Debug + +build: + verbosity: minimal + +install: +- ps: | + Write-Output "Compiler: $env:compiler" + Write-Output "Generator: $env:generator" + if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)) { + Write-Output "This is *NOT* a pull request build" + } else { + Write-Output "This is a pull request build" + if (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes") { + Write-Output "PR builds are *NOT* explicitly enabled" + } + } + + # git bash conflicts with MinGW makefiles + if ($env:generator -eq "MinGW Makefiles") { + $env:path = $env:path.replace("C:\Program Files\Git\usr\bin;", "") + if ($env:cxx_path -ne "") { + $env:path += ";$env:cxx_path" + } + } + +build_script: +- ps: | + # Only enable some builds for pull requests, the AppVeyor queue is too long. + if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) { + return + } + md _build -Force | Out-Null + cd _build + + $conf = if ($env:generator -eq "MinGW Makefiles") {"-DCMAKE_BUILD_TYPE=$env:configuration"} else {"-DCMAKE_CONFIGURATION_TYPES=Debug;Release"} + # Disable test for MinGW (gtest tests fail, gmock tests can not build) + $gtest_build_tests = if ($env:generator -eq "MinGW Makefiles") {"-Dgtest_build_tests=OFF"} else {"-Dgtest_build_tests=ON"} + $gmock_build_tests = if ($env:generator -eq "MinGW Makefiles") {"-Dgmock_build_tests=OFF"} else {"-Dgmock_build_tests=ON"} + & cmake -G "$env:generator" $conf -Dgtest_build_samples=ON $gtest_build_tests $gmock_build_tests .. + if ($LastExitCode -ne 0) { + throw "Exec: $ErrorMessage" + } + $cmake_parallel = if ($env:generator -eq "MinGW Makefiles") {"-j2"} else {"/m"} + & cmake --build . --config $env:configuration -- $cmake_parallel + if ($LastExitCode -ne 0) { + throw "Exec: $ErrorMessage" + } + +test_script: +- ps: | + # Only enable some builds for pull requests, the AppVeyor queue is too long. + if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) { + return + } + if ($env:generator -eq "MinGW Makefiles") { + return # No test available for MinGW + } + & ctest -C $env:configuration --timeout 600 --output-on-failure + if ($LastExitCode -ne 0) { + throw "Exec: $ErrorMessage" + } + +artifacts: + - path: '_build/CMakeFiles/*.log' + name: logs + - path: '_build/Testing/**/*.xml' + name: test_results diff --git a/handwritten/cloud-profiler/third_party/gtest/ci/build-linux-autotools.sh b/handwritten/cloud-profiler/third_party/gtest/ci/build-linux-autotools.sh new file mode 100755 index 00000000000..cc404e9b242 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/ci/build-linux-autotools.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -e + +. ci/get-nprocessors.sh + +# Create the configuration script +autoreconf -i + +# Run in a subdirectory to keep the sources clean +mkdir build || true +cd build +../configure + +make -j ${NPROCESSORS:-2} diff --git a/handwritten/cloud-profiler/third_party/gtest/ci/build-linux-bazel.sh b/handwritten/cloud-profiler/third_party/gtest/ci/build-linux-bazel.sh new file mode 100755 index 00000000000..3f1c7849551 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/ci/build-linux-bazel.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -e + +bazel build --curses=no //...:all +bazel test --curses=no //...:all +bazel test --curses=no //...:all --define absl=1 diff --git a/handwritten/cloud-profiler/third_party/gtest/ci/env-linux.sh b/handwritten/cloud-profiler/third_party/gtest/ci/env-linux.sh new file mode 100755 index 00000000000..9086b1f9869 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/ci/env-linux.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# +# This file should be sourced, and not executed as a standalone script. +# + +# TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}. + +if [ "${TRAVIS_OS_NAME}" = "linux" ]; then + if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi + if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi +fi diff --git a/handwritten/cloud-profiler/third_party/gtest/ci/env-osx.sh b/handwritten/cloud-profiler/third_party/gtest/ci/env-osx.sh new file mode 100755 index 00000000000..31c88357d70 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/ci/env-osx.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# +# This file should be sourced, and not executed as a standalone script. +# + +# TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}. + +if [ "${TRAVIS_OS_NAME}" = "linux" ]; then + if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi +fi diff --git a/handwritten/cloud-profiler/third_party/gtest/ci/get-nprocessors.sh b/handwritten/cloud-profiler/third_party/gtest/ci/get-nprocessors.sh new file mode 100755 index 00000000000..43635e761e2 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/ci/get-nprocessors.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# This file is typically sourced by another script. +# if possible, ask for the precise number of processors, +# otherwise take 2 processors as reasonable default; see +# https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization +if [ -x /usr/bin/getconf ]; then + NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN) +else + NPROCESSORS=2 +fi + +# as of 2017-09-04 Travis CI reports 32 processors, but GCC build +# crashes if parallelized too much (maybe memory consumption problem), +# so limit to 4 processors for the time being. +if [ $NPROCESSORS -gt 4 ] ; then + echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4." + NPROCESSORS=4 +fi diff --git a/handwritten/cloud-profiler/third_party/gtest/ci/install-linux.sh b/handwritten/cloud-profiler/third_party/gtest/ci/install-linux.sh new file mode 100755 index 00000000000..02a19439191 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/ci/install-linux.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -eu + +if [ "${TRAVIS_OS_NAME}" != linux ]; then + echo "Not a Linux build; skipping installation" + exit 0 +fi + + +if [ "${TRAVIS_SUDO}" = "true" ]; then + echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | \ + sudo tee /etc/apt/sources.list.d/bazel.list + curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - + sudo apt-get update && sudo apt-get install -y bazel gcc-4.9 g++-4.9 clang-3.7 +elif [ "${CXX}" = "clang++" ]; then + # Use ccache, assuming $HOME/bin is in the path, which is true in the Travis build environment. + ln -sf /usr/bin/ccache $HOME/bin/${CXX}; + ln -sf /usr/bin/ccache $HOME/bin/${CC}; +fi diff --git a/handwritten/cloud-profiler/third_party/gtest/ci/install-osx.sh b/handwritten/cloud-profiler/third_party/gtest/ci/install-osx.sh new file mode 100755 index 00000000000..6550ff514f2 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/ci/install-osx.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -eu + +if [ "${TRAVIS_OS_NAME}" != "osx" ]; then + echo "Not a macOS build; skipping installation" + exit 0 +fi + +brew install ccache diff --git a/handwritten/cloud-profiler/third_party/gtest/ci/log-config.sh b/handwritten/cloud-profiler/third_party/gtest/ci/log-config.sh new file mode 100755 index 00000000000..5fef11948b1 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/ci/log-config.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -e + +# ccache on OS X needs installation first +# reset ccache statistics +ccache --zero-stats + +echo PATH=${PATH} + +echo "Compiler configuration:" +echo CXX=${CXX} +echo CC=${CC} +echo CXXFLAGS=${CXXFLAGS} + +echo "C++ compiler version:" +${CXX} --version || echo "${CXX} does not seem to support the --version flag" +${CXX} -v || echo "${CXX} does not seem to support the -v flag" + +echo "C compiler version:" +${CC} --version || echo "${CXX} does not seem to support the --version flag" +${CC} -v || echo "${CXX} does not seem to support the -v flag" diff --git a/handwritten/cloud-profiler/third_party/gtest/ci/travis.sh b/handwritten/cloud-profiler/third_party/gtest/ci/travis.sh new file mode 100755 index 00000000000..2dda68fdace --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/ci/travis.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env sh +set -evx + +. ci/get-nprocessors.sh + +# if possible, ask for the precise number of processors, +# otherwise take 2 processors as reasonable default; see +# https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization +if [ -x /usr/bin/getconf ]; then + NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN) +else + NPROCESSORS=2 +fi +# as of 2017-09-04 Travis CI reports 32 processors, but GCC build +# crashes if parallelized too much (maybe memory consumption problem), +# so limit to 4 processors for the time being. +if [ $NPROCESSORS -gt 4 ] ; then + echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4." + NPROCESSORS=4 +fi +# Tell make to use the processors. No preceding '-' required. +MAKEFLAGS="j${NPROCESSORS}" +export MAKEFLAGS + +env | sort + +mkdir build || true +cd build +cmake -Dgtest_build_samples=ON \ + -Dgtest_build_tests=ON \ + -Dgmock_build_tests=ON \ + -DCMAKE_CXX_FLAGS=$CXX_FLAGS \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + .. +make +CTEST_OUTPUT_ON_FAILURE=1 make test diff --git a/handwritten/cloud-profiler/third_party/gtest/configure.ac b/handwritten/cloud-profiler/third_party/gtest/configure.ac new file mode 100644 index 00000000000..751b9ba8f03 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/configure.ac @@ -0,0 +1,16 @@ +AC_INIT([Google C++ Mocking and Testing Frameworks], + [1.8.0], + [googlemock@googlegroups.com], + [googletest]) + +# Provide various options to initialize the Autoconf and configure processes. +AC_PREREQ([2.59]) +AC_CONFIG_SRCDIR([./README.md]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_SUBDIRS([googletest googlemock]) + +AM_INIT_AUTOMAKE + +# Output the generated files. No further autoconf macros may be used. +AC_OUTPUT diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/CHANGES b/handwritten/cloud-profiler/third_party/gtest/googlemock/CHANGES new file mode 100644 index 00000000000..4328ece3d3a --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/CHANGES @@ -0,0 +1,126 @@ +Changes for 1.7.0: + +* All new improvements in Google Test 1.7.0. +* New feature: matchers DoubleNear(), FloatNear(), + NanSensitiveDoubleNear(), NanSensitiveFloatNear(), + UnorderedElementsAre(), UnorderedElementsAreArray(), WhenSorted(), + WhenSortedBy(), IsEmpty(), and SizeIs(). +* Improvement: Google Mock can now be built as a DLL. +* Improvement: when compiled by a C++11 compiler, matchers AllOf() + and AnyOf() can accept an arbitrary number of matchers. +* Improvement: when compiled by a C++11 compiler, matchers + ElementsAreArray() can accept an initializer list. +* Improvement: when exceptions are enabled, a mock method with no + default action now throws instead crashing the test. +* Improvement: added class testing::StringMatchResultListener to aid + definition of composite matchers. +* Improvement: function return types used in MOCK_METHOD*() macros can + now contain unprotected commas. +* Improvement (potentially breaking): EXPECT_THAT() and ASSERT_THAT() + are now more strict in ensuring that the value type and the matcher + type are compatible, catching potential bugs in tests. +* Improvement: Pointee() now works on an optional. +* Improvement: the ElementsAreArray() matcher can now take a vector or + iterator range as input, and makes a copy of its input elements + before the conversion to a Matcher. +* Improvement: the Google Mock Generator can now generate mocks for + some class templates. +* Bug fix: mock object destruction triggerred by another mock object's + destruction no longer hangs. +* Improvement: Google Mock Doctor works better with newer Clang and + GCC now. +* Compatibility fixes. +* Bug/warning fixes. + +Changes for 1.6.0: + +* Compilation is much faster and uses much less memory, especially + when the constructor and destructor of a mock class are moved out of + the class body. +* New matchers: Pointwise(), Each(). +* New actions: ReturnPointee() and ReturnRefOfCopy(). +* CMake support. +* Project files for Visual Studio 2010. +* AllOf() and AnyOf() can handle up-to 10 arguments now. +* Google Mock doctor understands Clang error messages now. +* SetArgPointee<> now accepts string literals. +* gmock_gen.py handles storage specifier macros and template return + types now. +* Compatibility fixes. +* Bug fixes and implementation clean-ups. +* Potentially incompatible changes: disables the harmful 'make install' + command in autotools. + +Potentially breaking changes: + +* The description string for MATCHER*() changes from Python-style + interpolation to an ordinary C++ string expression. +* SetArgumentPointee is deprecated in favor of SetArgPointee. +* Some non-essential project files for Visual Studio 2005 are removed. + +Changes for 1.5.0: + + * New feature: Google Mock can be safely used in multi-threaded tests + on platforms having pthreads. + * New feature: function for printing a value of arbitrary type. + * New feature: function ExplainMatchResult() for easy definition of + composite matchers. + * The new matcher API lets user-defined matchers generate custom + explanations more directly and efficiently. + * Better failure messages all around. + * NotNull() and IsNull() now work with smart pointers. + * Field() and Property() now work when the matcher argument is a pointer + passed by reference. + * Regular expression matchers on all platforms. + * Added GCC 4.0 support for Google Mock Doctor. + * Added gmock_all_test.cc for compiling most Google Mock tests + in a single file. + * Significantly cleaned up compiler warnings. + * Bug fixes, better test coverage, and implementation clean-ups. + + Potentially breaking changes: + + * Custom matchers defined using MatcherInterface or MakePolymorphicMatcher() + need to be updated after upgrading to Google Mock 1.5.0; matchers defined + using MATCHER or MATCHER_P* aren't affected. + * Dropped support for 'make install'. + +Changes for 1.4.0 (we skipped 1.2.* and 1.3.* to match the version of +Google Test): + + * Works in more environments: Symbian and minGW, Visual C++ 7.1. + * Lighter weight: comes with our own implementation of TR1 tuple (no + more dependency on Boost!). + * New feature: --gmock_catch_leaked_mocks for detecting leaked mocks. + * New feature: ACTION_TEMPLATE for defining templatized actions. + * New feature: the .After() clause for specifying expectation order. + * New feature: the .With() clause for specifying inter-argument + constraints. + * New feature: actions ReturnArg(), ReturnNew(...), and + DeleteArg(). + * New feature: matchers Key(), Pair(), Args<...>(), AllArgs(), IsNull(), + and Contains(). + * New feature: utility class MockFunction, useful for checkpoints, etc. + * New feature: functions Value(x, m) and SafeMatcherCast(m). + * New feature: copying a mock object is rejected at compile time. + * New feature: a script for fusing all Google Mock and Google Test + source files for easy deployment. + * Improved the Google Mock doctor to diagnose more diseases. + * Improved the Google Mock generator script. + * Compatibility fixes for Mac OS X and gcc. + * Bug fixes and implementation clean-ups. + +Changes for 1.1.0: + + * New feature: ability to use Google Mock with any testing framework. + * New feature: macros for easily defining new matchers + * New feature: macros for easily defining new actions. + * New feature: more container matchers. + * New feature: actions for accessing function arguments and throwing + exceptions. + * Improved the Google Mock doctor script for diagnosing compiler errors. + * Bug fixes and implementation clean-ups. + +Changes for 1.0.0: + + * Initial Open Source release of Google Mock diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/CMakeLists.txt b/handwritten/cloud-profiler/third_party/gtest/googlemock/CMakeLists.txt new file mode 100644 index 00000000000..bac2e3bf90c --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/CMakeLists.txt @@ -0,0 +1,242 @@ +######################################################################## +# CMake build script for Google Mock. +# +# To run the tests for Google Mock itself on Linux, use 'make test' or +# ctest. You can select which tests to run using 'ctest -R regex'. +# For more options, run 'ctest --help'. + +# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to +# make it prominent in the GUI. +option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF) + +option(gmock_build_tests "Build all of Google Mock's own tests." OFF) + +# A directory to find Google Test sources. +if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt") + set(gtest_dir gtest) +else() + set(gtest_dir ../googletest) +endif() + +# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build(). +include("${gtest_dir}/cmake/hermetic_build.cmake" OPTIONAL) + +if (COMMAND pre_project_set_up_hermetic_build) + # Google Test also calls hermetic setup functions from add_subdirectory, + # although its changes will not affect things at the current scope. + pre_project_set_up_hermetic_build() +endif() + +######################################################################## +# +# Project-wide settings + +# Name of the project. +# +# CMake files in this project can refer to the root source directory +# as ${gmock_SOURCE_DIR} and to the root binary directory as +# ${gmock_BINARY_DIR}. +# Language "C" is required for find_package(Threads). +if (CMAKE_VERSION VERSION_LESS 3.0) + project(gmock CXX C) +else() + cmake_policy(SET CMP0048 NEW) + project(gmock VERSION 1.9.0 LANGUAGES CXX C) +endif() +cmake_minimum_required(VERSION 2.6.4) + +if (COMMAND set_up_hermetic_build) + set_up_hermetic_build() +endif() + +# Instructs CMake to process Google Test's CMakeLists.txt and add its +# targets to the current scope. We are placing Google Test's binary +# directory in a subdirectory of our own as VC compilation may break +# if they are the same (the default). +add_subdirectory("${gtest_dir}" "${gmock_BINARY_DIR}/gtest") + +# Although Google Test's CMakeLists.txt calls this function, the +# changes there don't affect the current scope. Therefore we have to +# call it again here. +config_compiler_and_linker() # from ${gtest_dir}/cmake/internal_utils.cmake + +# Adds Google Mock's and Google Test's header directories to the search path. +include_directories("${gmock_SOURCE_DIR}/include" + "${gmock_SOURCE_DIR}" + "${gtest_SOURCE_DIR}/include" + # This directory is needed to build directly from Google + # Test sources. + "${gtest_SOURCE_DIR}") + +# Summary of tuple support for Microsoft Visual Studio: +# Compiler version(MS) version(cmake) Support +# ---------- ----------- -------------- ----------------------------- +# <= VS 2010 <= 10 <= 1600 Use Google Tests's own tuple. +# VS 2012 11 1700 std::tr1::tuple + _VARIADIC_MAX=10 +# VS 2013 12 1800 std::tr1::tuple +# VS 2015 14 1900 std::tuple +# VS 2017 15 >= 1910 std::tuple +if (MSVC AND MSVC_VERSION EQUAL 1700) + add_definitions(/D _VARIADIC_MAX=10) +endif() + +######################################################################## +# +# Defines the gmock & gmock_main libraries. User tests should link +# with one of them. + +# Google Mock libraries. We build them using more strict warnings than what +# are used for other targets, to ensure that Google Mock can be compiled by +# a user aggressive about warnings. +if (MSVC) + cxx_library(gmock + "${cxx_strict}" + "${gtest_dir}/src/gtest-all.cc" + src/gmock-all.cc) + + cxx_library(gmock_main + "${cxx_strict}" + "${gtest_dir}/src/gtest-all.cc" + src/gmock-all.cc + src/gmock_main.cc) +else() + cxx_library(gmock "${cxx_strict}" src/gmock-all.cc) + target_link_libraries(gmock gtest) + cxx_library(gmock_main "${cxx_strict}" src/gmock_main.cc) + target_link_libraries(gmock_main gmock) +endif() + +# If the CMake version supports it, attach header directory information +# to the targets for when we are part of a parent build (ie being pulled +# in via add_subdirectory() rather than being a standalone build). +if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") + target_include_directories(gmock SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include") + target_include_directories(gmock_main SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include") +endif() + +######################################################################## +# +# Install rules +if(INSTALL_GMOCK) + install(TARGETS gmock gmock_main + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") + install(DIRECTORY "${gmock_SOURCE_DIR}/include/gmock" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + + # configure and install pkgconfig files + configure_file( + cmake/gmock.pc.in + "${CMAKE_BINARY_DIR}/gmock.pc" + @ONLY) + configure_file( + cmake/gmock_main.pc.in + "${CMAKE_BINARY_DIR}/gmock_main.pc" + @ONLY) + install(FILES "${CMAKE_BINARY_DIR}/gmock.pc" "${CMAKE_BINARY_DIR}/gmock_main.pc" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") +endif() + +######################################################################## +# +# Google Mock's own tests. +# +# You can skip this section if you aren't interested in testing +# Google Mock itself. +# +# The tests are not built by default. To build them, set the +# gmock_build_tests option to ON. You can do it by running ccmake +# or specifying the -Dgmock_build_tests=ON flag when running cmake. + +if (gmock_build_tests) + # This must be set in the root directory for the tests to be run by + # 'make test' or ctest. + enable_testing() + + ############################################################ + # C++ tests built with standard compiler flags. + + cxx_test(gmock-actions_test gmock_main) + cxx_test(gmock-cardinalities_test gmock_main) + cxx_test(gmock_ex_test gmock_main) + cxx_test(gmock-generated-actions_test gmock_main) + cxx_test(gmock-generated-function-mockers_test gmock_main) + cxx_test(gmock-generated-internal-utils_test gmock_main) + cxx_test(gmock-generated-matchers_test gmock_main) + cxx_test(gmock-internal-utils_test gmock_main) + cxx_test(gmock-matchers_test gmock_main) + cxx_test(gmock-more-actions_test gmock_main) + cxx_test(gmock-nice-strict_test gmock_main) + cxx_test(gmock-port_test gmock_main) + cxx_test(gmock-spec-builders_test gmock_main) + cxx_test(gmock_link_test gmock_main test/gmock_link2_test.cc) + cxx_test(gmock_test gmock_main) + + if (DEFINED GTEST_HAS_PTHREAD) + cxx_test(gmock_stress_test gmock) + endif() + + # gmock_all_test is commented to save time building and running tests. + # Uncomment if necessary. + # cxx_test(gmock_all_test gmock_main) + + ############################################################ + # C++ tests built with non-standard compiler flags. + + if (MSVC) + cxx_library(gmock_main_no_exception "${cxx_no_exception}" + "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) + + cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" + "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) + + if (MSVC_VERSION LESS 1600) # 1600 is Visual Studio 2010. + # Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that + # conflict with our own definitions. Therefore using our own tuple does not + # work on those compilers. + cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}" + "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) + + cxx_test_with_flags(gmock_use_own_tuple_test "${cxx_use_own_tuple}" + gmock_main_use_own_tuple test/gmock-spec-builders_test.cc) + endif() + else() + cxx_library(gmock_main_no_exception "${cxx_no_exception}" src/gmock_main.cc) + target_link_libraries(gmock_main_no_exception gmock) + + cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" src/gmock_main.cc) + target_link_libraries(gmock_main_no_rtti gmock) + + cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}" src/gmock_main.cc) + target_link_libraries(gmock_main_use_own_tuple gmock) + endif() + cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}" + gmock_main_no_exception test/gmock-more-actions_test.cc) + + cxx_test_with_flags(gmock_no_rtti_test "${cxx_no_rtti}" + gmock_main_no_rtti test/gmock-spec-builders_test.cc) + + cxx_shared_library(shared_gmock_main "${cxx_default}" + "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) + + # Tests that a binary can be built with Google Mock as a shared library. On + # some system configurations, it may not possible to run the binary without + # knowing more details about the system configurations. We do not try to run + # this binary. To get a more robust shared library coverage, configure with + # -DBUILD_SHARED_LIBS=ON. + cxx_executable_with_flags(shared_gmock_test_ "${cxx_default}" + shared_gmock_main test/gmock-spec-builders_test.cc) + set_target_properties(shared_gmock_test_ + PROPERTIES + COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") + + ############################################################ + # Python tests. + + cxx_executable(gmock_leak_test_ test gmock_main) + py_test(gmock_leak_test) + + cxx_executable(gmock_output_test_ test gmock) + py_test(gmock_output_test) +endif() diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/CONTRIBUTORS b/handwritten/cloud-profiler/third_party/gtest/googlemock/CONTRIBUTORS new file mode 100644 index 00000000000..6e9ae362b60 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/CONTRIBUTORS @@ -0,0 +1,40 @@ +# This file contains a list of people who've made non-trivial +# contribution to the Google C++ Mocking Framework project. People +# who commit code to the project are encouraged to add their names +# here. Please keep the list sorted by first names. + +Benoit Sigoure +Bogdan Piloca +Chandler Carruth +Dave MacLachlan +David Anderson +Dean Sturtevant +Gene Volovich +Hal Burch +Jeffrey Yasskin +Jim Keller +Joe Walnes +Jon Wray +Keir Mierle +Keith Ray +Kostya Serebryany +Lev Makhlis +Manuel Klimek +Mario Tanev +Mark Paskin +Markus Heule +Matthew Simmons +Mike Bland +Neal Norwitz +Nermin Ozkiranartli +Owen Carlsen +Paneendra Ba +Paul Menage +Piotr Kaminski +Russ Rufer +Sverre Sundsdal +Takeshi Yoshino +Vadim Berman +Vlad Losev +Wolfgang Klier +Zhanyong Wan diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/LICENSE b/handwritten/cloud-profiler/third_party/gtest/googlemock/LICENSE new file mode 100644 index 00000000000..1941a11f8ce --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/LICENSE @@ -0,0 +1,28 @@ +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/Makefile.am b/handwritten/cloud-profiler/third_party/gtest/googlemock/Makefile.am new file mode 100644 index 00000000000..9adbc5163dd --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/Makefile.am @@ -0,0 +1,224 @@ +# Automake file + +# Nonstandard package files for distribution. +EXTRA_DIST = LICENSE + +# We may need to build our internally packaged gtest. If so, it will be +# included in the 'subdirs' variable. +SUBDIRS = $(subdirs) + +# This is generated by the configure script, so clean it for distribution. +DISTCLEANFILES = scripts/gmock-config + +# We define the global AM_CPPFLAGS as everything we compile includes from these +# directories. +AM_CPPFLAGS = $(GTEST_CPPFLAGS) -I$(srcdir)/include + +# Modifies compiler and linker flags for pthreads compatibility. +if HAVE_PTHREADS + AM_CXXFLAGS = @PTHREAD_CFLAGS@ -DGTEST_HAS_PTHREAD=1 + AM_LIBS = @PTHREAD_LIBS@ +endif + +# Build rules for libraries. +lib_LTLIBRARIES = lib/libgmock.la lib/libgmock_main.la + +lib_libgmock_la_SOURCES = src/gmock-all.cc + +pkginclude_HEADERS = \ + include/gmock/gmock-actions.h \ + include/gmock/gmock-cardinalities.h \ + include/gmock/gmock-generated-actions.h \ + include/gmock/gmock-generated-function-mockers.h \ + include/gmock/gmock-generated-matchers.h \ + include/gmock/gmock-generated-nice-strict.h \ + include/gmock/gmock-matchers.h \ + include/gmock/gmock-more-actions.h \ + include/gmock/gmock-more-matchers.h \ + include/gmock/gmock-spec-builders.h \ + include/gmock/gmock.h + +pkginclude_internaldir = $(pkgincludedir)/internal +pkginclude_internal_HEADERS = \ + include/gmock/internal/gmock-generated-internal-utils.h \ + include/gmock/internal/gmock-internal-utils.h \ + include/gmock/internal/gmock-port.h \ + include/gmock/internal/custom/gmock-generated-actions.h \ + include/gmock/internal/custom/gmock-matchers.h \ + include/gmock/internal/custom/gmock-port.h + +lib_libgmock_main_la_SOURCES = src/gmock_main.cc +lib_libgmock_main_la_LIBADD = lib/libgmock.la + +# Build rules for tests. Automake's naming for some of these variables isn't +# terribly obvious, so this is a brief reference: +# +# TESTS -- Programs run automatically by "make check" +# check_PROGRAMS -- Programs built by "make check" but not necessarily run + +TESTS= +check_PROGRAMS= +AM_LDFLAGS = $(GTEST_LDFLAGS) + +# This exercises all major components of Google Mock. It also +# verifies that libgmock works. +TESTS += test/gmock-spec-builders_test +check_PROGRAMS += test/gmock-spec-builders_test +test_gmock_spec_builders_test_SOURCES = test/gmock-spec-builders_test.cc +test_gmock_spec_builders_test_LDADD = $(GTEST_LIBS) lib/libgmock.la + +# This tests using Google Mock in multiple translation units. It also +# verifies that libgmock_main and libgmock work. +TESTS += test/gmock_link_test +check_PROGRAMS += test/gmock_link_test +test_gmock_link_test_SOURCES = \ + test/gmock_link2_test.cc \ + test/gmock_link_test.cc \ + test/gmock_link_test.h +test_gmock_link_test_LDADD = $(GTEST_LIBS) lib/libgmock_main.la lib/libgmock.la + +if HAVE_PYTHON + # Tests that fused gmock files compile and work. + TESTS += test/gmock_fused_test + check_PROGRAMS += test/gmock_fused_test + test_gmock_fused_test_SOURCES = \ + fused-src/gmock-gtest-all.cc \ + fused-src/gmock/gmock.h \ + fused-src/gmock_main.cc \ + fused-src/gtest/gtest.h \ + test/gmock_test.cc + test_gmock_fused_test_CPPFLAGS = -I"$(srcdir)/fused-src" +endif + +# Google Mock source files that we don't compile directly. +GMOCK_SOURCE_INGLUDES = \ + src/gmock-cardinalities.cc \ + src/gmock-internal-utils.cc \ + src/gmock-matchers.cc \ + src/gmock-spec-builders.cc \ + src/gmock.cc + +EXTRA_DIST += $(GMOCK_SOURCE_INGLUDES) + +# C++ tests that we don't compile using autotools. +EXTRA_DIST += \ + test/gmock-actions_test.cc \ + test/gmock_all_test.cc \ + test/gmock-cardinalities_test.cc \ + test/gmock_ex_test.cc \ + test/gmock-generated-actions_test.cc \ + test/gmock-generated-function-mockers_test.cc \ + test/gmock-generated-internal-utils_test.cc \ + test/gmock-generated-matchers_test.cc \ + test/gmock-internal-utils_test.cc \ + test/gmock-matchers_test.cc \ + test/gmock-more-actions_test.cc \ + test/gmock-nice-strict_test.cc \ + test/gmock-port_test.cc \ + test/gmock_stress_test.cc + +# Python tests, which we don't run using autotools. +EXTRA_DIST += \ + test/gmock_leak_test.py \ + test/gmock_leak_test_.cc \ + test/gmock_output_test.py \ + test/gmock_output_test_.cc \ + test/gmock_output_test_golden.txt \ + test/gmock_test_utils.py + +# Nonstandard package files for distribution. +EXTRA_DIST += \ + CHANGES \ + CONTRIBUTORS \ + make/Makefile + +# Pump scripts for generating Google Mock headers. +# TODO(chandlerc@google.com): automate the generation of *.h from *.h.pump. +EXTRA_DIST += \ + include/gmock/gmock-generated-actions.h.pump \ + include/gmock/gmock-generated-function-mockers.h.pump \ + include/gmock/gmock-generated-matchers.h.pump \ + include/gmock/gmock-generated-nice-strict.h.pump \ + include/gmock/internal/gmock-generated-internal-utils.h.pump \ + include/gmock/internal/custom/gmock-generated-actions.h.pump + +# Script for fusing Google Mock and Google Test source files. +EXTRA_DIST += scripts/fuse_gmock_files.py + +# The Google Mock Generator tool from the cppclean project. +EXTRA_DIST += \ + scripts/generator/LICENSE \ + scripts/generator/README \ + scripts/generator/README.cppclean \ + scripts/generator/cpp/__init__.py \ + scripts/generator/cpp/ast.py \ + scripts/generator/cpp/gmock_class.py \ + scripts/generator/cpp/keywords.py \ + scripts/generator/cpp/tokenize.py \ + scripts/generator/cpp/utils.py \ + scripts/generator/gmock_gen.py + +# Script for diagnosing compiler errors in programs that use Google +# Mock. +EXTRA_DIST += scripts/gmock_doctor.py + +# CMake scripts. +EXTRA_DIST += \ + CMakeLists.txt + +# Microsoft Visual Studio 2005 projects. +EXTRA_DIST += \ + msvc/2005/gmock.sln \ + msvc/2005/gmock.vcproj \ + msvc/2005/gmock_config.vsprops \ + msvc/2005/gmock_main.vcproj \ + msvc/2005/gmock_test.vcproj + +# Microsoft Visual Studio 2010 projects. +EXTRA_DIST += \ + msvc/2010/gmock.sln \ + msvc/2010/gmock.vcxproj \ + msvc/2010/gmock_config.props \ + msvc/2010/gmock_main.vcxproj \ + msvc/2010/gmock_test.vcxproj + +if HAVE_PYTHON +# gmock_test.cc does not really depend on files generated by the +# fused-gmock-internal rule. However, gmock_test.o does, and it is +# important to include test/gmock_test.cc as part of this rule in order to +# prevent compiling gmock_test.o until all dependent files have been +# generated. +$(test_gmock_fused_test_SOURCES): fused-gmock-internal + +# TODO(vladl@google.com): Find a way to add Google Tests's sources here. +fused-gmock-internal: $(pkginclude_HEADERS) $(pkginclude_internal_HEADERS) \ + $(lib_libgmock_la_SOURCES) $(GMOCK_SOURCE_INGLUDES) \ + $(lib_libgmock_main_la_SOURCES) \ + scripts/fuse_gmock_files.py + mkdir -p "$(srcdir)/fused-src" + chmod -R u+w "$(srcdir)/fused-src" + rm -f "$(srcdir)/fused-src/gtest/gtest.h" + rm -f "$(srcdir)/fused-src/gmock/gmock.h" + rm -f "$(srcdir)/fused-src/gmock-gtest-all.cc" + "$(srcdir)/scripts/fuse_gmock_files.py" "$(srcdir)/fused-src" + cp -f "$(srcdir)/src/gmock_main.cc" "$(srcdir)/fused-src" + +maintainer-clean-local: + rm -rf "$(srcdir)/fused-src" +endif + +# Death tests may produce core dumps in the build directory. In case +# this happens, clean them to keep distcleancheck happy. +CLEANFILES = core + +# Disables 'make install' as installing a compiled version of Google +# Mock can lead to undefined behavior due to violation of the +# One-Definition Rule. + +install-exec-local: + echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Mock into your build system." + false + +install-data-local: + echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Mock into your build system." + false diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/README.md b/handwritten/cloud-profiler/third_party/gtest/googlemock/README.md new file mode 100644 index 00000000000..1170cfab718 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/README.md @@ -0,0 +1,344 @@ +## Google Mock ## + +The Google C++ mocking framework. + +### Overview ### + +Google's framework for writing and using C++ mock classes. +It can help you derive better designs of your system and write better tests. + +It is inspired by: + + * [jMock](http://www.jmock.org/), + * [EasyMock](http://www.easymock.org/), and + * [Hamcrest](http://code.google.com/p/hamcrest/), + +and designed with C++'s specifics in mind. + +Google mock: + + * lets you create mock classes trivially using simple macros. + * supports a rich set of matchers and actions. + * handles unordered, partially ordered, or completely ordered expectations. + * is extensible by users. + +We hope you find it useful! + +### Features ### + + * Provides a declarative syntax for defining mocks. + * Can easily define partial (hybrid) mocks, which are a cross of real + and mock objects. + * Handles functions of arbitrary types and overloaded functions. + * Comes with a rich set of matchers for validating function arguments. + * Uses an intuitive syntax for controlling the behavior of a mock. + * Does automatic verification of expectations (no record-and-replay needed). + * Allows arbitrary (partial) ordering constraints on + function calls to be expressed,. + * Lets an user extend it by defining new matchers and actions. + * Does not use exceptions. + * Is easy to learn and use. + +Please see the project page above for more information as well as the +mailing list for questions, discussions, and development. There is +also an IRC channel on OFTC (irc.oftc.net) #gtest available. Please +join us! + +Please note that code under [scripts/generator](scripts/generator/) is +from [cppclean](http://code.google.com/p/cppclean/) and released under +the Apache License, which is different from Google Mock's license. + +## Getting Started ## + +If you are new to the project, we suggest that you read the user +documentation in the following order: + + * Learn the [basics](../../master/googletest/docs/Primer.md) of + Google Test, if you choose to use Google Mock with it (recommended). + * Read [Google Mock for Dummies](../../master/googlemock/docs/ForDummies.md). + * Read the instructions below on how to build Google Mock. + +You can also watch Zhanyong's [talk](http://www.youtube.com/watch?v=sYpCyLI47rM) on Google Mock's usage and implementation. + +Once you understand the basics, check out the rest of the docs: + + * [CheatSheet](../../master/googlemock/docs/CheatSheet.md) - all the commonly used stuff + at a glance. + * [CookBook](../../master/googlemock/docs/CookBook.md) - recipes for getting things done, + including advanced techniques. + +If you need help, please check the +[KnownIssues](docs/KnownIssues.md) and +[FrequentlyAskedQuestions](docs/FrequentlyAskedQuestions.md) before +posting a question on the +[discussion group](http://groups.google.com/group/googlemock). + + +### Using Google Mock Without Google Test ### + +Google Mock is not a testing framework itself. Instead, it needs a +testing framework for writing tests. Google Mock works seamlessly +with [Google Test](https://github.com/google/googletest), but +you can also use it with [any C++ testing framework](../../master/googlemock/docs/ForDummies.md#using-google-mock-with-any-testing-framework). + +### Requirements for End Users ### + +Google Mock is implemented on top of [Google Test]( +http://github.com/google/googletest/), and depends on it. +You must use the bundled version of Google Test when using Google Mock. + +You can also easily configure Google Mock to work with another testing +framework, although it will still need Google Test. Please read +["Using_Google_Mock_with_Any_Testing_Framework"]( + ../../master/googlemock/docs/ForDummies.md#using-google-mock-with-any-testing-framework) +for instructions. + +Google Mock depends on advanced C++ features and thus requires a more +modern compiler. The following are needed to use Google Mock: + +#### Linux Requirements #### + + * GNU-compatible Make or "gmake" + * POSIX-standard shell + * POSIX(-2) Regular Expressions (regex.h) + * C++98-standard-compliant compiler (e.g. GCC 3.4 or newer) + +#### Windows Requirements #### + + * Microsoft Visual C++ 8.0 SP1 or newer + +#### Mac OS X Requirements #### + + * Mac OS X 10.4 Tiger or newer + * Developer Tools Installed + +### Requirements for Contributors ### + +We welcome patches. If you plan to contribute a patch, you need to +build Google Mock and its tests, which has further requirements: + + * Automake version 1.9 or newer + * Autoconf version 2.59 or newer + * Libtool / Libtoolize + * Python version 2.3 or newer (for running some of the tests and + re-generating certain source files from templates) + +### Building Google Mock ### + +#### Using CMake #### + +If you have CMake available, it is recommended that you follow the +[build instructions][gtest_cmakebuild] +as described for Google Test. + +If are using Google Mock with an +existing CMake project, the section +[Incorporating Into An Existing CMake Project][gtest_incorpcmake] +may be of particular interest. +To make it work for Google Mock you will need to change + + target_link_libraries(example gtest_main) + +to + + target_link_libraries(example gmock_main) + +This works because `gmock_main` library is compiled with Google Test. +However, it does not automatically add Google Test includes. +Therefore you will also have to change + + if (CMAKE_VERSION VERSION_LESS 2.8.11) + include_directories("${gtest_SOURCE_DIR}/include") + endif() + +to + + if (CMAKE_VERSION VERSION_LESS 2.8.11) + include_directories(BEFORE SYSTEM + "${gtest_SOURCE_DIR}/include" "${gmock_SOURCE_DIR}/include") + else() + target_include_directories(gmock_main SYSTEM BEFORE INTERFACE + "${gtest_SOURCE_DIR}/include" "${gmock_SOURCE_DIR}/include") + endif() + +This will addtionally mark Google Mock includes as system, which will +silence compiler warnings when compiling your tests using clang with +`-Wpedantic -Wall -Wextra -Wconversion`. + + +#### Preparing to Build (Unix only) #### + +If you are using a Unix system and plan to use the GNU Autotools build +system to build Google Mock (described below), you'll need to +configure it now. + +To prepare the Autotools build system: + + cd googlemock + autoreconf -fvi + +To build Google Mock and your tests that use it, you need to tell your +build system where to find its headers and source files. The exact +way to do it depends on which build system you use, and is usually +straightforward. + +This section shows how you can integrate Google Mock into your +existing build system. + +Suppose you put Google Mock in directory `${GMOCK_DIR}` and Google Test +in `${GTEST_DIR}` (the latter is `${GMOCK_DIR}/gtest` by default). To +build Google Mock, create a library build target (or a project as +called by Visual Studio and Xcode) to compile + + ${GTEST_DIR}/src/gtest-all.cc and ${GMOCK_DIR}/src/gmock-all.cc + +with + + ${GTEST_DIR}/include and ${GMOCK_DIR}/include + +in the system header search path, and + + ${GTEST_DIR} and ${GMOCK_DIR} + +in the normal header search path. Assuming a Linux-like system and gcc, +something like the following will do: + + g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \ + -isystem ${GMOCK_DIR}/include -I${GMOCK_DIR} \ + -pthread -c ${GTEST_DIR}/src/gtest-all.cc + g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \ + -isystem ${GMOCK_DIR}/include -I${GMOCK_DIR} \ + -pthread -c ${GMOCK_DIR}/src/gmock-all.cc + ar -rv libgmock.a gtest-all.o gmock-all.o + +(We need -pthread as Google Test and Google Mock use threads.) + +Next, you should compile your test source file with +${GTEST\_DIR}/include and ${GMOCK\_DIR}/include in the header search +path, and link it with gmock and any other necessary libraries: + + g++ -isystem ${GTEST_DIR}/include -isystem ${GMOCK_DIR}/include \ + -pthread path/to/your_test.cc libgmock.a -o your_test + +As an example, the make/ directory contains a Makefile that you can +use to build Google Mock on systems where GNU make is available +(e.g. Linux, Mac OS X, and Cygwin). It doesn't try to build Google +Mock's own tests. Instead, it just builds the Google Mock library and +a sample test. You can use it as a starting point for your own build +script. + +If the default settings are correct for your environment, the +following commands should succeed: + + cd ${GMOCK_DIR}/make + make + ./gmock_test + +If you see errors, try to tweak the contents of +[make/Makefile](make/Makefile) to make them go away. + +### Windows ### + +The msvc/2005 directory contains VC++ 2005 projects and the msvc/2010 +directory contains VC++ 2010 projects for building Google Mock and +selected tests. + +Change to the appropriate directory and run "msbuild gmock.sln" to +build the library and tests (or open the gmock.sln in the MSVC IDE). +If you want to create your own project to use with Google Mock, you'll +have to configure it to use the `gmock_config` propety sheet. For that: + + * Open the Property Manager window (View | Other Windows | Property Manager) + * Right-click on your project and select "Add Existing Property Sheet..." + * Navigate to `gmock_config.vsprops` or `gmock_config.props` and select it. + * In Project Properties | Configuration Properties | General | Additional + Include Directories, type /include. + +### Tweaking Google Mock ### + +Google Mock can be used in diverse environments. The default +configuration may not work (or may not work well) out of the box in +some environments. However, you can easily tweak Google Mock by +defining control macros on the compiler command line. Generally, +these macros are named like `GTEST_XYZ` and you define them to either 1 +or 0 to enable or disable a certain feature. + +We list the most frequently used macros below. For a complete list, +see file [${GTEST\_DIR}/include/gtest/internal/gtest-port.h]( +../googletest/include/gtest/internal/gtest-port.h). + +### Choosing a TR1 Tuple Library ### + +Google Mock uses the C++ Technical Report 1 (TR1) tuple library +heavily. Unfortunately TR1 tuple is not yet widely available with all +compilers. The good news is that Google Test 1.4.0+ implements a +subset of TR1 tuple that's enough for Google Mock's need. Google Mock +will automatically use that implementation when the compiler doesn't +provide TR1 tuple. + +Usually you don't need to care about which tuple library Google Test +and Google Mock use. However, if your project already uses TR1 tuple, +you need to tell Google Test and Google Mock to use the same TR1 tuple +library the rest of your project uses, or the two tuple +implementations will clash. To do that, add + + -DGTEST_USE_OWN_TR1_TUPLE=0 + +to the compiler flags while compiling Google Test, Google Mock, and +your tests. If you want to force Google Test and Google Mock to use +their own tuple library, just add + + -DGTEST_USE_OWN_TR1_TUPLE=1 + +to the compiler flags instead. + +If you want to use Boost's TR1 tuple library with Google Mock, please +refer to the Boost website (http://www.boost.org/) for how to obtain +it and set it up. + +### As a Shared Library (DLL) ### + +Google Mock is compact, so most users can build and link it as a static +library for the simplicity. Google Mock can be used as a DLL, but the +same DLL must contain Google Test as well. See +[Google Test's README][gtest_readme] +for instructions on how to set up necessary compiler settings. + +### Tweaking Google Mock ### + +Most of Google Test's control macros apply to Google Mock as well. +Please see [Google Test's README][gtest_readme] for how to tweak them. + +### Upgrading from an Earlier Version ### + +We strive to keep Google Mock releases backward compatible. +Sometimes, though, we have to make some breaking changes for the +users' long-term benefits. This section describes what you'll need to +do if you are upgrading from an earlier version of Google Mock. + +#### Upgrading from 1.1.0 or Earlier #### + +You may need to explicitly enable or disable Google Test's own TR1 +tuple library. See the instructions in section "[Choosing a TR1 Tuple +Library](../googletest/#choosing-a-tr1-tuple-library)". + +#### Upgrading from 1.4.0 or Earlier #### + +On platforms where the pthread library is available, Google Test and +Google Mock use it in order to be thread-safe. For this to work, you +may need to tweak your compiler and/or linker flags. Please see the +"[Multi-threaded Tests](../googletest#multi-threaded-tests +)" section in file Google Test's README for what you may need to do. + +If you have custom matchers defined using `MatcherInterface` or +`MakePolymorphicMatcher()`, you'll need to update their definitions to +use the new matcher API ( +[monomorphic](./docs/CookBook.md#writing-new-monomorphic-matchers), +[polymorphic](./docs/CookBook.md#writing-new-polymorphic-matchers)). +Matchers defined using `MATCHER()` or `MATCHER_P*()` aren't affected. + +Happy testing! + +[gtest_readme]: ../googletest/README.md "googletest" +[gtest_cmakebuild]: ../googletest/README.md#using-cmake "Using CMake" +[gtest_incorpcmake]: ../googletest/README.md#incorporating-into-an-existing-cmake-project "Incorporating Into An Existing CMake Project" diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/build-aux/.keep b/handwritten/cloud-profiler/third_party/gtest/googlemock/build-aux/.keep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/cmake/gmock.pc.in b/handwritten/cloud-profiler/third_party/gtest/googlemock/cmake/gmock.pc.in new file mode 100644 index 00000000000..c44164264ac --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/cmake/gmock.pc.in @@ -0,0 +1,9 @@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + +Name: gmock +Description: GoogleMock (without main() function) +Version: @PROJECT_VERSION@ +URL: https://github.com/google/googletest +Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@ +Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/cmake/gmock_main.pc.in b/handwritten/cloud-profiler/third_party/gtest/googlemock/cmake/gmock_main.pc.in new file mode 100644 index 00000000000..c377dba1e57 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/cmake/gmock_main.pc.in @@ -0,0 +1,9 @@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + +Name: gmock_main +Description: GoogleMock (with main() function) +Version: @PROJECT_VERSION@ +URL: https://github.com/google/googletest +Libs: -L${libdir} -lgmock_main @CMAKE_THREAD_LIBS_INIT@ +Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/configure.ac b/handwritten/cloud-profiler/third_party/gtest/googlemock/configure.ac new file mode 100644 index 00000000000..cb5e1a6a8ca --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/configure.ac @@ -0,0 +1,146 @@ +m4_include(../googletest/m4/acx_pthread.m4) + +AC_INIT([Google C++ Mocking Framework], + [1.8.0], + [googlemock@googlegroups.com], + [gmock]) + +# Provide various options to initialize the Autoconf and configure processes. +AC_PREREQ([2.59]) +AC_CONFIG_SRCDIR([./LICENSE]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_HEADERS([build-aux/config.h]) +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([scripts/gmock-config], [chmod +x scripts/gmock-config]) + +# Initialize Automake with various options. We require at least v1.9, prevent +# pedantic complaints about package files, and enable various distribution +# targets. +AM_INIT_AUTOMAKE([1.9 dist-bzip2 dist-zip foreign subdir-objects]) + +# Check for programs used in building Google Test. +AC_PROG_CC +AC_PROG_CXX +AC_LANG([C++]) +AC_PROG_LIBTOOL + +# TODO(chandlerc@google.com): Currently we aren't running the Python tests +# against the interpreter detected by AM_PATH_PYTHON, and so we condition +# HAVE_PYTHON by requiring "python" to be in the PATH, and that interpreter's +# version to be >= 2.3. This will allow the scripts to use a "/usr/bin/env" +# hashbang. +PYTHON= # We *do not* allow the user to specify a python interpreter +AC_PATH_PROG([PYTHON],[python],[:]) +AS_IF([test "$PYTHON" != ":"], + [AM_PYTHON_CHECK_VERSION([$PYTHON],[2.3],[:],[PYTHON=":"])]) +AM_CONDITIONAL([HAVE_PYTHON],[test "$PYTHON" != ":"]) + +# TODO(chandlerc@google.com) Check for the necessary system headers. + +# Configure pthreads. +AC_ARG_WITH([pthreads], + [AS_HELP_STRING([--with-pthreads], + [use pthreads (default is yes)])], + [with_pthreads=$withval], + [with_pthreads=check]) + +have_pthreads=no +AS_IF([test "x$with_pthreads" != "xno"], + [ACX_PTHREAD( + [], + [AS_IF([test "x$with_pthreads" != "xcheck"], + [AC_MSG_FAILURE( + [--with-pthreads was specified, but unable to be used])])]) + have_pthreads="$acx_pthread_ok"]) +AM_CONDITIONAL([HAVE_PTHREADS],[test "x$have_pthreads" == "xyes"]) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_LIBS) + +# GoogleMock currently has hard dependencies upon GoogleTest above and beyond +# running its own test suite, so we both provide our own version in +# a subdirectory and provide some logic to use a custom version or a system +# installed version. +AC_ARG_WITH([gtest], + [AS_HELP_STRING([--with-gtest], + [Specifies how to find the gtest package. If no + arguments are given, the default behavior, a + system installed gtest will be used if present, + and an internal version built otherwise. If a + path is provided, the gtest built or installed at + that prefix will be used.])], + [], + [with_gtest=yes]) +AC_ARG_ENABLE([external-gtest], + [AS_HELP_STRING([--disable-external-gtest], + [Disables any detection or use of a system + installed or user provided gtest. Any option to + '--with-gtest' is ignored. (Default is enabled.)]) + ], [], [enable_external_gtest=yes]) +AS_IF([test "x$with_gtest" == "xno"], + [AC_MSG_ERROR([dnl +Support for GoogleTest was explicitly disabled. Currently GoogleMock has a hard +dependency upon GoogleTest to build, please provide a version, or allow +GoogleMock to use any installed version and fall back upon its internal +version.])]) + +# Setup various GTEST variables. TODO(chandlerc@google.com): When these are +# used below, they should be used such that any pre-existing values always +# trump values we set them to, so that they can be used to selectively override +# details of the detection process. +AC_ARG_VAR([GTEST_CONFIG], + [The exact path of Google Test's 'gtest-config' script.]) +AC_ARG_VAR([GTEST_CPPFLAGS], + [C-like preprocessor flags for Google Test.]) +AC_ARG_VAR([GTEST_CXXFLAGS], + [C++ compile flags for Google Test.]) +AC_ARG_VAR([GTEST_LDFLAGS], + [Linker path and option flags for Google Test.]) +AC_ARG_VAR([GTEST_LIBS], + [Library linking flags for Google Test.]) +AC_ARG_VAR([GTEST_VERSION], + [The version of Google Test available.]) +HAVE_BUILT_GTEST="no" + +GTEST_MIN_VERSION="1.8.0" + +AS_IF([test "x${enable_external_gtest}" = "xyes"], + [# Begin filling in variables as we are able. + AS_IF([test "x${with_gtest}" != "xyes"], + [AS_IF([test -x "${with_gtest}/scripts/gtest-config"], + [GTEST_CONFIG="${with_gtest}/scripts/gtest-config"], + [GTEST_CONFIG="${with_gtest}/bin/gtest-config"]) + AS_IF([test -x "${GTEST_CONFIG}"], [], + [AC_MSG_ERROR([dnl +Unable to locate either a built or installed Google Test at '${with_gtest}'.]) + ])]) + + AS_IF([test -x "${GTEST_CONFIG}"], [], + [AC_PATH_PROG([GTEST_CONFIG], [gtest-config])]) + AS_IF([test -x "${GTEST_CONFIG}"], + [AC_MSG_CHECKING([for Google Test version >= ${GTEST_MIN_VERSION}]) + AS_IF([${GTEST_CONFIG} --min-version=${GTEST_MIN_VERSION}], + [AC_MSG_RESULT([yes]) + HAVE_BUILT_GTEST="yes"], + [AC_MSG_RESULT([no])])])]) + +AS_IF([test "x${HAVE_BUILT_GTEST}" = "xyes"], + [GTEST_CPPFLAGS=`${GTEST_CONFIG} --cppflags` + GTEST_CXXFLAGS=`${GTEST_CONFIG} --cxxflags` + GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags` + GTEST_LIBS=`${GTEST_CONFIG} --libs` + GTEST_VERSION=`${GTEST_CONFIG} --version`], + [ + # GTEST_CONFIG needs to be executable both in a Makefile environment and + # in a shell script environment, so resolve an absolute path for it here. + GTEST_CONFIG="`pwd -P`/../googletest/scripts/gtest-config" + GTEST_CPPFLAGS='-I$(top_srcdir)/../googletest/include' + GTEST_CXXFLAGS='-g' + GTEST_LDFLAGS='' + GTEST_LIBS='$(top_builddir)/../googletest/lib/libgtest.la' + GTEST_VERSION="${GTEST_MIN_VERSION}"]) + +# TODO(chandlerc@google.com) Check the types, structures, and other compiler +# and architecture characteristics. + +# Output the generated files. No further autoconf macros may be used. +AC_OUTPUT diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/CheatSheet.md b/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/CheatSheet.md new file mode 100644 index 00000000000..f8bbbfe6d08 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/CheatSheet.md @@ -0,0 +1,564 @@ + + +# Defining a Mock Class # + +## Mocking a Normal Class ## + +Given +``` +class Foo { + ... + virtual ~Foo(); + virtual int GetSize() const = 0; + virtual string Describe(const char* name) = 0; + virtual string Describe(int type) = 0; + virtual bool Process(Bar elem, int count) = 0; +}; +``` +(note that `~Foo()` **must** be virtual) we can define its mock as +``` +#include "gmock/gmock.h" + +class MockFoo : public Foo { + MOCK_CONST_METHOD0(GetSize, int()); + MOCK_METHOD1(Describe, string(const char* name)); + MOCK_METHOD1(Describe, string(int type)); + MOCK_METHOD2(Process, bool(Bar elem, int count)); +}; +``` + +To create a "nice" mock object which ignores all uninteresting calls, +or a "strict" mock object, which treats them as failures: +``` +NiceMock nice_foo; // The type is a subclass of MockFoo. +StrictMock strict_foo; // The type is a subclass of MockFoo. +``` + +## Mocking a Class Template ## + +To mock +``` +template +class StackInterface { + public: + ... + virtual ~StackInterface(); + virtual int GetSize() const = 0; + virtual void Push(const Elem& x) = 0; +}; +``` +(note that `~StackInterface()` **must** be virtual) just append `_T` to the `MOCK_*` macros: +``` +template +class MockStack : public StackInterface { + public: + ... + MOCK_CONST_METHOD0_T(GetSize, int()); + MOCK_METHOD1_T(Push, void(const Elem& x)); +}; +``` + +## Specifying Calling Conventions for Mock Functions ## + +If your mock function doesn't use the default calling convention, you +can specify it by appending `_WITH_CALLTYPE` to any of the macros +described in the previous two sections and supplying the calling +convention as the first argument to the macro. For example, +``` + MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, Foo, bool(int n)); + MOCK_CONST_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, Bar, int(double x, double y)); +``` +where `STDMETHODCALLTYPE` is defined by `` on Windows. + +# Using Mocks in Tests # + +The typical flow is: + 1. Import the Google Mock names you need to use. All Google Mock names are in the `testing` namespace unless they are macros or otherwise noted. + 1. Create the mock objects. + 1. Optionally, set the default actions of the mock objects. + 1. Set your expectations on the mock objects (How will they be called? What wil they do?). + 1. Exercise code that uses the mock objects; if necessary, check the result using [Google Test](../../googletest/) assertions. + 1. When a mock objects is destructed, Google Mock automatically verifies that all expectations on it have been satisfied. + +Here is an example: +``` +using ::testing::Return; // #1 + +TEST(BarTest, DoesThis) { + MockFoo foo; // #2 + + ON_CALL(foo, GetSize()) // #3 + .WillByDefault(Return(1)); + // ... other default actions ... + + EXPECT_CALL(foo, Describe(5)) // #4 + .Times(3) + .WillRepeatedly(Return("Category 5")); + // ... other expectations ... + + EXPECT_EQ("good", MyProductionFunction(&foo)); // #5 +} // #6 +``` + +# Setting Default Actions # + +Google Mock has a **built-in default action** for any function that +returns `void`, `bool`, a numeric value, or a pointer. + +To customize the default action for functions with return type `T` globally: +``` +using ::testing::DefaultValue; + +// Sets the default value to be returned. T must be CopyConstructible. +DefaultValue::Set(value); +// Sets a factory. Will be invoked on demand. T must be MoveConstructible. +// T MakeT(); +DefaultValue::SetFactory(&MakeT); +// ... use the mocks ... +// Resets the default value. +DefaultValue::Clear(); +``` + +To customize the default action for a particular method, use `ON_CALL()`: +``` +ON_CALL(mock_object, method(matchers)) + .With(multi_argument_matcher) ? + .WillByDefault(action); +``` + +# Setting Expectations # + +`EXPECT_CALL()` sets **expectations** on a mock method (How will it be +called? What will it do?): +``` +EXPECT_CALL(mock_object, method(matchers)) + .With(multi_argument_matcher) ? + .Times(cardinality) ? + .InSequence(sequences) * + .After(expectations) * + .WillOnce(action) * + .WillRepeatedly(action) ? + .RetiresOnSaturation(); ? +``` + +If `Times()` is omitted, the cardinality is assumed to be: + + * `Times(1)` when there is neither `WillOnce()` nor `WillRepeatedly()`; + * `Times(n)` when there are `n WillOnce()`s but no `WillRepeatedly()`, where `n` >= 1; or + * `Times(AtLeast(n))` when there are `n WillOnce()`s and a `WillRepeatedly()`, where `n` >= 0. + +A method with no `EXPECT_CALL()` is free to be invoked _any number of times_, and the default action will be taken each time. + +# Matchers # + +A **matcher** matches a _single_ argument. You can use it inside +`ON_CALL()` or `EXPECT_CALL()`, or use it to validate a value +directly: + +| `EXPECT_THAT(value, matcher)` | Asserts that `value` matches `matcher`. | +|:------------------------------|:----------------------------------------| +| `ASSERT_THAT(value, matcher)` | The same as `EXPECT_THAT(value, matcher)`, except that it generates a **fatal** failure. | + +Built-in matchers (where `argument` is the function argument) are +divided into several categories: + +## Wildcard ## +|`_`|`argument` can be any value of the correct type.| +|:--|:-----------------------------------------------| +|`A()` or `An()`|`argument` can be any value of type `type`. | + +## Generic Comparison ## + +|`Eq(value)` or `value`|`argument == value`| +|:---------------------|:------------------| +|`Ge(value)` |`argument >= value`| +|`Gt(value)` |`argument > value` | +|`Le(value)` |`argument <= value`| +|`Lt(value)` |`argument < value` | +|`Ne(value)` |`argument != value`| +|`IsNull()` |`argument` is a `NULL` pointer (raw or smart).| +|`NotNull()` |`argument` is a non-null pointer (raw or smart).| +|`VariantWith(m)` |`argument` is `variant<>` that holds the alternative of +type T with a value matching `m`.| +|`Ref(variable)` |`argument` is a reference to `variable`.| +|`TypedEq(value)`|`argument` has type `type` and is equal to `value`. You may need to use this instead of `Eq(value)` when the mock function is overloaded.| + +Except `Ref()`, these matchers make a _copy_ of `value` in case it's +modified or destructed later. If the compiler complains that `value` +doesn't have a public copy constructor, try wrap it in `ByRef()`, +e.g. `Eq(ByRef(non_copyable_value))`. If you do that, make sure +`non_copyable_value` is not changed afterwards, or the meaning of your +matcher will be changed. + +## Floating-Point Matchers ## + +|`DoubleEq(a_double)`|`argument` is a `double` value approximately equal to `a_double`, treating two NaNs as unequal.| +|:-------------------|:----------------------------------------------------------------------------------------------| +|`FloatEq(a_float)` |`argument` is a `float` value approximately equal to `a_float`, treating two NaNs as unequal. | +|`NanSensitiveDoubleEq(a_double)`|`argument` is a `double` value approximately equal to `a_double`, treating two NaNs as equal. | +|`NanSensitiveFloatEq(a_float)`|`argument` is a `float` value approximately equal to `a_float`, treating two NaNs as equal. | + +The above matchers use ULP-based comparison (the same as used in +[Google Test](../../googletest/)). They +automatically pick a reasonable error bound based on the absolute +value of the expected value. `DoubleEq()` and `FloatEq()` conform to +the IEEE standard, which requires comparing two NaNs for equality to +return false. The `NanSensitive*` version instead treats two NaNs as +equal, which is often what a user wants. + +|`DoubleNear(a_double, max_abs_error)`|`argument` is a `double` value close to `a_double` (absolute error <= `max_abs_error`), treating two NaNs as unequal.| +|:------------------------------------|:--------------------------------------------------------------------------------------------------------------------| +|`FloatNear(a_float, max_abs_error)` |`argument` is a `float` value close to `a_float` (absolute error <= `max_abs_error`), treating two NaNs as unequal. | +|`NanSensitiveDoubleNear(a_double, max_abs_error)`|`argument` is a `double` value close to `a_double` (absolute error <= `max_abs_error`), treating two NaNs as equal. | +|`NanSensitiveFloatNear(a_float, max_abs_error)`|`argument` is a `float` value close to `a_float` (absolute error <= `max_abs_error`), treating two NaNs as equal. | + +## String Matchers ## + +The `argument` can be either a C string or a C++ string object: + +|`ContainsRegex(string)`|`argument` matches the given regular expression.| +|:----------------------|:-----------------------------------------------| +|`EndsWith(suffix)` |`argument` ends with string `suffix`. | +|`HasSubstr(string)` |`argument` contains `string` as a sub-string. | +|`MatchesRegex(string)` |`argument` matches the given regular expression with the match starting at the first character and ending at the last character.| +|`StartsWith(prefix)` |`argument` starts with string `prefix`. | +|`StrCaseEq(string)` |`argument` is equal to `string`, ignoring case. | +|`StrCaseNe(string)` |`argument` is not equal to `string`, ignoring case.| +|`StrEq(string)` |`argument` is equal to `string`. | +|`StrNe(string)` |`argument` is not equal to `string`. | + +`ContainsRegex()` and `MatchesRegex()` use the regular expression +syntax defined +[here](../../googletest/docs/AdvancedGuide.md#regular-expression-syntax). +`StrCaseEq()`, `StrCaseNe()`, `StrEq()`, and `StrNe()` work for wide +strings as well. + +## Container Matchers ## + +Most STL-style containers support `==`, so you can use +`Eq(expected_container)` or simply `expected_container` to match a +container exactly. If you want to write the elements in-line, +match them more flexibly, or get more informative messages, you can use: + +| `ContainerEq(container)` | The same as `Eq(container)` except that the failure message also includes which elements are in one container but not the other. | +|:-------------------------|:---------------------------------------------------------------------------------------------------------------------------------| +| `Contains(e)` | `argument` contains an element that matches `e`, which can be either a value or a matcher. | +| `Each(e)` | `argument` is a container where _every_ element matches `e`, which can be either a value or a matcher. | +| `ElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, where the i-th element matches `ei`, which can be a value or a matcher. 0 to 10 arguments are allowed. | +| `ElementsAreArray({ e0, e1, ..., en })`, `ElementsAreArray(array)`, or `ElementsAreArray(array, count)` | The same as `ElementsAre()` except that the expected element values/matchers come from an initializer list, STL-style container, or C-style array. | +| `IsEmpty()` | `argument` is an empty container (`container.empty()`). | +| `Pointwise(m, container)` | `argument` contains the same number of elements as in `container`, and for all i, (the i-th element in `argument`, the i-th element in `container`) match `m`, which is a matcher on 2-tuples. E.g. `Pointwise(Le(), upper_bounds)` verifies that each element in `argument` doesn't exceed the corresponding element in `upper_bounds`. See more detail below. | +| `SizeIs(m)` | `argument` is a container whose size matches `m`. E.g. `SizeIs(2)` or `SizeIs(Lt(2))`. | +| `UnorderedElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, and under some permutation each element matches an `ei` (for a different `i`), which can be a value or a matcher. 0 to 10 arguments are allowed. | +| `UnorderedElementsAreArray({ e0, e1, ..., en })`, `UnorderedElementsAreArray(array)`, or `UnorderedElementsAreArray(array, count)` | The same as `UnorderedElementsAre()` except that the expected element values/matchers come from an initializer list, STL-style container, or C-style array. | +| `WhenSorted(m)` | When `argument` is sorted using the `<` operator, it matches container matcher `m`. E.g. `WhenSorted(ElementsAre(1, 2, 3))` verifies that `argument` contains elements `1`, `2`, and `3`, ignoring order. | +| `WhenSortedBy(comparator, m)` | The same as `WhenSorted(m)`, except that the given comparator instead of `<` is used to sort `argument`. E.g. `WhenSortedBy(std::greater(), ElementsAre(3, 2, 1))`. | + +Notes: + + * These matchers can also match: + 1. a native array passed by reference (e.g. in `Foo(const int (&a)[5])`), and + 1. an array passed as a pointer and a count (e.g. in `Bar(const T* buffer, int len)` -- see [Multi-argument Matchers](#Multiargument_Matchers.md)). + * The array being matched may be multi-dimensional (i.e. its elements can be arrays). + * `m` in `Pointwise(m, ...)` should be a matcher for `::testing::tuple` where `T` and `U` are the element type of the actual container and the expected container, respectively. For example, to compare two `Foo` containers where `Foo` doesn't support `operator==` but has an `Equals()` method, one might write: + +``` +using ::testing::get; +MATCHER(FooEq, "") { + return get<0>(arg).Equals(get<1>(arg)); +} +... +EXPECT_THAT(actual_foos, Pointwise(FooEq(), expected_foos)); +``` + +## Member Matchers ## + +|`Field(&class::field, m)`|`argument.field` (or `argument->field` when `argument` is a plain pointer) matches matcher `m`, where `argument` is an object of type _class_.| +|:------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------| +|`Key(e)` |`argument.first` matches `e`, which can be either a value or a matcher. E.g. `Contains(Key(Le(5)))` can verify that a `map` contains a key `<= 5`.| +|`Pair(m1, m2)` |`argument` is an `std::pair` whose `first` field matches `m1` and `second` field matches `m2`. | +|`Property(&class::property, m)`|`argument.property()` (or `argument->property()` when `argument` is a plain pointer) matches matcher `m`, where `argument` is an object of type _class_.| + +## Matching the Result of a Function or Functor ## + +|`ResultOf(f, m)`|`f(argument)` matches matcher `m`, where `f` is a function or functor.| +|:---------------|:---------------------------------------------------------------------| + +## Pointer Matchers ## + +|`Pointee(m)`|`argument` (either a smart pointer or a raw pointer) points to a value that matches matcher `m`.| +|:-----------|:-----------------------------------------------------------------------------------------------| +|`WhenDynamicCastTo(m)`| when `argument` is passed through `dynamic_cast()`, it matches matcher `m`. | + +## Multiargument Matchers ## + +Technically, all matchers match a _single_ value. A "multi-argument" +matcher is just one that matches a _tuple_. The following matchers can +be used to match a tuple `(x, y)`: + +|`Eq()`|`x == y`| +|:-----|:-------| +|`Ge()`|`x >= y`| +|`Gt()`|`x > y` | +|`Le()`|`x <= y`| +|`Lt()`|`x < y` | +|`Ne()`|`x != y`| + +You can use the following selectors to pick a subset of the arguments +(or reorder them) to participate in the matching: + +|`AllArgs(m)`|Equivalent to `m`. Useful as syntactic sugar in `.With(AllArgs(m))`.| +|:-----------|:-------------------------------------------------------------------| +|`Args(m)`|The tuple of the `k` selected (using 0-based indices) arguments matches `m`, e.g. `Args<1, 2>(Eq())`.| + +## Composite Matchers ## + +You can make a matcher from one or more other matchers: + +|`AllOf(m1, m2, ..., mn)`|`argument` matches all of the matchers `m1` to `mn`.| +|:-----------------------|:---------------------------------------------------| +|`AnyOf(m1, m2, ..., mn)`|`argument` matches at least one of the matchers `m1` to `mn`.| +|`Not(m)` |`argument` doesn't match matcher `m`. | + +## Adapters for Matchers ## + +|`MatcherCast(m)`|casts matcher `m` to type `Matcher`.| +|:------------------|:--------------------------------------| +|`SafeMatcherCast(m)`| [safely casts](CookBook.md#casting-matchers) matcher `m` to type `Matcher`. | +|`Truly(predicate)` |`predicate(argument)` returns something considered by C++ to be true, where `predicate` is a function or functor.| + +## Matchers as Predicates ## + +|`Matches(m)(value)`|evaluates to `true` if `value` matches `m`. You can use `Matches(m)` alone as a unary functor.| +|:------------------|:---------------------------------------------------------------------------------------------| +|`ExplainMatchResult(m, value, result_listener)`|evaluates to `true` if `value` matches `m`, explaining the result to `result_listener`. | +|`Value(value, m)` |evaluates to `true` if `value` matches `m`. | + +## Defining Matchers ## + +| `MATCHER(IsEven, "") { return (arg % 2) == 0; }` | Defines a matcher `IsEven()` to match an even number. | +|:-------------------------------------------------|:------------------------------------------------------| +| `MATCHER_P(IsDivisibleBy, n, "") { *result_listener << "where the remainder is " << (arg % n); return (arg % n) == 0; }` | Defines a macher `IsDivisibleBy(n)` to match a number divisible by `n`. | +| `MATCHER_P2(IsBetween, a, b, std::string(negation ? "isn't" : "is") + " between " + PrintToString(a) + " and " + PrintToString(b)) { return a <= arg && arg <= b; }` | Defines a matcher `IsBetween(a, b)` to match a value in the range [`a`, `b`]. | + +**Notes:** + + 1. The `MATCHER*` macros cannot be used inside a function or class. + 1. The matcher body must be _purely functional_ (i.e. it cannot have any side effect, and the result must not depend on anything other than the value being matched and the matcher parameters). + 1. You can use `PrintToString(x)` to convert a value `x` of any type to a string. + +## Matchers as Test Assertions ## + +|`ASSERT_THAT(expression, m)`|Generates a [fatal failure](../../googletest/docs/Primer.md#assertions) if the value of `expression` doesn't match matcher `m`.| +|:---------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------| +|`EXPECT_THAT(expression, m)`|Generates a non-fatal failure if the value of `expression` doesn't match matcher `m`. | + +# Actions # + +**Actions** specify what a mock function should do when invoked. + +## Returning a Value ## + +|`Return()`|Return from a `void` mock function.| +|:---------|:----------------------------------| +|`Return(value)`|Return `value`. If the type of `value` is different to the mock function's return type, `value` is converted to the latter type at the time the expectation is set, not when the action is executed.| +|`ReturnArg()`|Return the `N`-th (0-based) argument.| +|`ReturnNew(a1, ..., ak)`|Return `new T(a1, ..., ak)`; a different object is created each time.| +|`ReturnNull()`|Return a null pointer. | +|`ReturnPointee(ptr)`|Return the value pointed to by `ptr`.| +|`ReturnRef(variable)`|Return a reference to `variable`. | +|`ReturnRefOfCopy(value)`|Return a reference to a copy of `value`; the copy lives as long as the action.| + +## Side Effects ## + +|`Assign(&variable, value)`|Assign `value` to variable.| +|:-------------------------|:--------------------------| +| `DeleteArg()` | Delete the `N`-th (0-based) argument, which must be a pointer. | +| `SaveArg(pointer)` | Save the `N`-th (0-based) argument to `*pointer`. | +| `SaveArgPointee(pointer)` | Save the value pointed to by the `N`-th (0-based) argument to `*pointer`. | +| `SetArgReferee(value)` | Assign value to the variable referenced by the `N`-th (0-based) argument. | +|`SetArgPointee(value)` |Assign `value` to the variable pointed by the `N`-th (0-based) argument.| +|`SetArgumentPointee(value)`|Same as `SetArgPointee(value)`. Deprecated. Will be removed in v1.7.0.| +|`SetArrayArgument(first, last)`|Copies the elements in source range [`first`, `last`) to the array pointed to by the `N`-th (0-based) argument, which can be either a pointer or an iterator. The action does not take ownership of the elements in the source range.| +|`SetErrnoAndReturn(error, value)`|Set `errno` to `error` and return `value`.| +|`Throw(exception)` |Throws the given exception, which can be any copyable value. Available since v1.1.0.| + +## Using a Function or a Functor as an Action ## + +|`Invoke(f)`|Invoke `f` with the arguments passed to the mock function, where `f` can be a global/static function or a functor.| +|:----------|:-----------------------------------------------------------------------------------------------------------------| +|`Invoke(object_pointer, &class::method)`|Invoke the {method on the object with the arguments passed to the mock function. | +|`InvokeWithoutArgs(f)`|Invoke `f`, which can be a global/static function or a functor. `f` must take no arguments. | +|`InvokeWithoutArgs(object_pointer, &class::method)`|Invoke the method on the object, which takes no arguments. | +|`InvokeArgument(arg1, arg2, ..., argk)`|Invoke the mock function's `N`-th (0-based) argument, which must be a function or a functor, with the `k` arguments.| + +The return value of the invoked function is used as the return value +of the action. + +When defining a function or functor to be used with `Invoke*()`, you can declare any unused parameters as `Unused`: +``` + double Distance(Unused, double x, double y) { return sqrt(x*x + y*y); } + ... + EXPECT_CALL(mock, Foo("Hi", _, _)).WillOnce(Invoke(Distance)); +``` + +In `InvokeArgument(...)`, if an argument needs to be passed by reference, wrap it inside `ByRef()`. For example, +``` + InvokeArgument<2>(5, string("Hi"), ByRef(foo)) +``` +calls the mock function's #2 argument, passing to it `5` and `string("Hi")` by value, and `foo` by reference. + +## Default Action ## + +|`DoDefault()`|Do the default action (specified by `ON_CALL()` or the built-in one).| +|:------------|:--------------------------------------------------------------------| + +**Note:** due to technical reasons, `DoDefault()` cannot be used inside a composite action - trying to do so will result in a run-time error. + +## Composite Actions ## + +|`DoAll(a1, a2, ..., an)`|Do all actions `a1` to `an` and return the result of `an` in each invocation. The first `n - 1` sub-actions must return void. | +|:-----------------------|:-----------------------------------------------------------------------------------------------------------------------------| +|`IgnoreResult(a)` |Perform action `a` and ignore its result. `a` must not return void. | +|`WithArg(a)` |Pass the `N`-th (0-based) argument of the mock function to action `a` and perform it. | +|`WithArgs(a)`|Pass the selected (0-based) arguments of the mock function to action `a` and perform it. | +|`WithoutArgs(a)` |Perform action `a` without any arguments. | + +## Defining Actions ## + +| `ACTION(Sum) { return arg0 + arg1; }` | Defines an action `Sum()` to return the sum of the mock function's argument #0 and #1. | +|:--------------------------------------|:---------------------------------------------------------------------------------------| +| `ACTION_P(Plus, n) { return arg0 + n; }` | Defines an action `Plus(n)` to return the sum of the mock function's argument #0 and `n`. | +| `ACTION_Pk(Foo, p1, ..., pk) { statements; }` | Defines a parameterized action `Foo(p1, ..., pk)` to execute the given `statements`. | + +The `ACTION*` macros cannot be used inside a function or class. + +# Cardinalities # + +These are used in `Times()` to specify how many times a mock function will be called: + +|`AnyNumber()`|The function can be called any number of times.| +|:------------|:----------------------------------------------| +|`AtLeast(n)` |The call is expected at least `n` times. | +|`AtMost(n)` |The call is expected at most `n` times. | +|`Between(m, n)`|The call is expected between `m` and `n` (inclusive) times.| +|`Exactly(n) or n`|The call is expected exactly `n` times. In particular, the call should never happen when `n` is 0.| + +# Expectation Order # + +By default, the expectations can be matched in _any_ order. If some +or all expectations must be matched in a given order, there are two +ways to specify it. They can be used either independently or +together. + +## The After Clause ## + +``` +using ::testing::Expectation; +... +Expectation init_x = EXPECT_CALL(foo, InitX()); +Expectation init_y = EXPECT_CALL(foo, InitY()); +EXPECT_CALL(foo, Bar()) + .After(init_x, init_y); +``` +says that `Bar()` can be called only after both `InitX()` and +`InitY()` have been called. + +If you don't know how many pre-requisites an expectation has when you +write it, you can use an `ExpectationSet` to collect them: + +``` +using ::testing::ExpectationSet; +... +ExpectationSet all_inits; +for (int i = 0; i < element_count; i++) { + all_inits += EXPECT_CALL(foo, InitElement(i)); +} +EXPECT_CALL(foo, Bar()) + .After(all_inits); +``` +says that `Bar()` can be called only after all elements have been +initialized (but we don't care about which elements get initialized +before the others). + +Modifying an `ExpectationSet` after using it in an `.After()` doesn't +affect the meaning of the `.After()`. + +## Sequences ## + +When you have a long chain of sequential expectations, it's easier to +specify the order using **sequences**, which don't require you to given +each expectation in the chain a different name. All expected
+calls
in the same sequence must occur in the order they are +specified. + +``` +using ::testing::Sequence; +Sequence s1, s2; +... +EXPECT_CALL(foo, Reset()) + .InSequence(s1, s2) + .WillOnce(Return(true)); +EXPECT_CALL(foo, GetSize()) + .InSequence(s1) + .WillOnce(Return(1)); +EXPECT_CALL(foo, Describe(A())) + .InSequence(s2) + .WillOnce(Return("dummy")); +``` +says that `Reset()` must be called before _both_ `GetSize()` _and_ +`Describe()`, and the latter two can occur in any order. + +To put many expectations in a sequence conveniently: +``` +using ::testing::InSequence; +{ + InSequence dummy; + + EXPECT_CALL(...)...; + EXPECT_CALL(...)...; + ... + EXPECT_CALL(...)...; +} +``` +says that all expected calls in the scope of `dummy` must occur in +strict order. The name `dummy` is irrelevant.) + +# Verifying and Resetting a Mock # + +Google Mock will verify the expectations on a mock object when it is destructed, or you can do it earlier: +``` +using ::testing::Mock; +... +// Verifies and removes the expectations on mock_obj; +// returns true iff successful. +Mock::VerifyAndClearExpectations(&mock_obj); +... +// Verifies and removes the expectations on mock_obj; +// also removes the default actions set by ON_CALL(); +// returns true iff successful. +Mock::VerifyAndClear(&mock_obj); +``` + +You can also tell Google Mock that a mock object can be leaked and doesn't +need to be verified: +``` +Mock::AllowLeak(&mock_obj); +``` + +# Mock Classes # + +Google Mock defines a convenient mock class template +``` +class MockFunction { + public: + MOCK_METHODn(Call, R(A1, ..., An)); +}; +``` +See this [recipe](CookBook.md#using-check-points) for one application of it. + +# Flags # + +| `--gmock_catch_leaked_mocks=0` | Don't report leaked mock objects as failures. | +|:-------------------------------|:----------------------------------------------| +| `--gmock_verbose=LEVEL` | Sets the default verbosity level (`info`, `warning`, or `error`) of Google Mock messages. | diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/CookBook.md b/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/CookBook.md new file mode 100644 index 00000000000..c2565f1e184 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/CookBook.md @@ -0,0 +1,3679 @@ + + +You can find recipes for using Google Mock here. If you haven't yet, +please read the [ForDummies](ForDummies.md) document first to make sure you understand +the basics. + +**Note:** Google Mock lives in the `testing` name space. For +readability, it is recommended to write `using ::testing::Foo;` once in +your file before using the name `Foo` defined by Google Mock. We omit +such `using` statements in this page for brevity, but you should do it +in your own code. + +# Creating Mock Classes # + +## Mocking Private or Protected Methods ## + +You must always put a mock method definition (`MOCK_METHOD*`) in a +`public:` section of the mock class, regardless of the method being +mocked being `public`, `protected`, or `private` in the base class. +This allows `ON_CALL` and `EXPECT_CALL` to reference the mock function +from outside of the mock class. (Yes, C++ allows a subclass to specify +a different access level than the base class on a virtual function.) +Example: + +``` +class Foo { + public: + ... + virtual bool Transform(Gadget* g) = 0; + + protected: + virtual void Resume(); + + private: + virtual int GetTimeOut(); +}; + +class MockFoo : public Foo { + public: + ... + MOCK_METHOD1(Transform, bool(Gadget* g)); + + // The following must be in the public section, even though the + // methods are protected or private in the base class. + MOCK_METHOD0(Resume, void()); + MOCK_METHOD0(GetTimeOut, int()); +}; +``` + +## Mocking Overloaded Methods ## + +You can mock overloaded functions as usual. No special attention is required: + +``` +class Foo { + ... + + // Must be virtual as we'll inherit from Foo. + virtual ~Foo(); + + // Overloaded on the types and/or numbers of arguments. + virtual int Add(Element x); + virtual int Add(int times, Element x); + + // Overloaded on the const-ness of this object. + virtual Bar& GetBar(); + virtual const Bar& GetBar() const; +}; + +class MockFoo : public Foo { + ... + MOCK_METHOD1(Add, int(Element x)); + MOCK_METHOD2(Add, int(int times, Element x); + + MOCK_METHOD0(GetBar, Bar&()); + MOCK_CONST_METHOD0(GetBar, const Bar&()); +}; +``` + +**Note:** if you don't mock all versions of the overloaded method, the +compiler will give you a warning about some methods in the base class +being hidden. To fix that, use `using` to bring them in scope: + +``` +class MockFoo : public Foo { + ... + using Foo::Add; + MOCK_METHOD1(Add, int(Element x)); + // We don't want to mock int Add(int times, Element x); + ... +}; +``` + +## Mocking Class Templates ## + +To mock a class template, append `_T` to the `MOCK_*` macros: + +``` +template +class StackInterface { + ... + // Must be virtual as we'll inherit from StackInterface. + virtual ~StackInterface(); + + virtual int GetSize() const = 0; + virtual void Push(const Elem& x) = 0; +}; + +template +class MockStack : public StackInterface { + ... + MOCK_CONST_METHOD0_T(GetSize, int()); + MOCK_METHOD1_T(Push, void(const Elem& x)); +}; +``` + +## Mocking Nonvirtual Methods ## + +Google Mock can mock non-virtual functions to be used in what we call _hi-perf +dependency injection_. + +In this case, instead of sharing a common base class with the real +class, your mock class will be _unrelated_ to the real class, but +contain methods with the same signatures. The syntax for mocking +non-virtual methods is the _same_ as mocking virtual methods: + +``` +// A simple packet stream class. None of its members is virtual. +class ConcretePacketStream { + public: + void AppendPacket(Packet* new_packet); + const Packet* GetPacket(size_t packet_number) const; + size_t NumberOfPackets() const; + ... +}; + +// A mock packet stream class. It inherits from no other, but defines +// GetPacket() and NumberOfPackets(). +class MockPacketStream { + public: + MOCK_CONST_METHOD1(GetPacket, const Packet*(size_t packet_number)); + MOCK_CONST_METHOD0(NumberOfPackets, size_t()); + ... +}; +``` + +Note that the mock class doesn't define `AppendPacket()`, unlike the +real class. That's fine as long as the test doesn't need to call it. + +Next, you need a way to say that you want to use +`ConcretePacketStream` in production code and to use `MockPacketStream` +in tests. Since the functions are not virtual and the two classes are +unrelated, you must specify your choice at _compile time_ (as opposed +to run time). + +One way to do it is to templatize your code that needs to use a packet +stream. More specifically, you will give your code a template type +argument for the type of the packet stream. In production, you will +instantiate your template with `ConcretePacketStream` as the type +argument. In tests, you will instantiate the same template with +`MockPacketStream`. For example, you may write: + +``` +template +void CreateConnection(PacketStream* stream) { ... } + +template +class PacketReader { + public: + void ReadPackets(PacketStream* stream, size_t packet_num); +}; +``` + +Then you can use `CreateConnection()` and +`PacketReader` in production code, and use +`CreateConnection()` and +`PacketReader` in tests. + +``` + MockPacketStream mock_stream; + EXPECT_CALL(mock_stream, ...)...; + .. set more expectations on mock_stream ... + PacketReader reader(&mock_stream); + ... exercise reader ... +``` + +## Mocking Free Functions ## + +It's possible to use Google Mock to mock a free function (i.e. a +C-style function or a static method). You just need to rewrite your +code to use an interface (abstract class). + +Instead of calling a free function (say, `OpenFile`) directly, +introduce an interface for it and have a concrete subclass that calls +the free function: + +``` +class FileInterface { + public: + ... + virtual bool Open(const char* path, const char* mode) = 0; +}; + +class File : public FileInterface { + public: + ... + virtual bool Open(const char* path, const char* mode) { + return OpenFile(path, mode); + } +}; +``` + +Your code should talk to `FileInterface` to open a file. Now it's +easy to mock out the function. + +This may seem much hassle, but in practice you often have multiple +related functions that you can put in the same interface, so the +per-function syntactic overhead will be much lower. + +If you are concerned about the performance overhead incurred by +virtual functions, and profiling confirms your concern, you can +combine this with the recipe for [mocking non-virtual methods](#mocking-nonvirtual-methods). + +## The Nice, the Strict, and the Naggy ## + +If a mock method has no `EXPECT_CALL` spec but is called, Google Mock +will print a warning about the "uninteresting call". The rationale is: + + * New methods may be added to an interface after a test is written. We shouldn't fail a test just because a method it doesn't know about is called. + * However, this may also mean there's a bug in the test, so Google Mock shouldn't be silent either. If the user believes these calls are harmless, they can add an `EXPECT_CALL()` to suppress the warning. + +However, sometimes you may want to suppress all "uninteresting call" +warnings, while sometimes you may want the opposite, i.e. to treat all +of them as errors. Google Mock lets you make the decision on a +per-mock-object basis. + +Suppose your test uses a mock class `MockFoo`: + +``` +TEST(...) { + MockFoo mock_foo; + EXPECT_CALL(mock_foo, DoThis()); + ... code that uses mock_foo ... +} +``` + +If a method of `mock_foo` other than `DoThis()` is called, it will be +reported by Google Mock as a warning. However, if you rewrite your +test to use `NiceMock` instead, the warning will be gone, +resulting in a cleaner test output: + +``` +using ::testing::NiceMock; + +TEST(...) { + NiceMock mock_foo; + EXPECT_CALL(mock_foo, DoThis()); + ... code that uses mock_foo ... +} +``` + +`NiceMock` is a subclass of `MockFoo`, so it can be used +wherever `MockFoo` is accepted. + +It also works if `MockFoo`'s constructor takes some arguments, as +`NiceMock` "inherits" `MockFoo`'s constructors: + +``` +using ::testing::NiceMock; + +TEST(...) { + NiceMock mock_foo(5, "hi"); // Calls MockFoo(5, "hi"). + EXPECT_CALL(mock_foo, DoThis()); + ... code that uses mock_foo ... +} +``` + +The usage of `StrictMock` is similar, except that it makes all +uninteresting calls failures: + +``` +using ::testing::StrictMock; + +TEST(...) { + StrictMock mock_foo; + EXPECT_CALL(mock_foo, DoThis()); + ... code that uses mock_foo ... + + // The test will fail if a method of mock_foo other than DoThis() + // is called. +} +``` + +There are some caveats though (I don't like them just as much as the +next guy, but sadly they are side effects of C++'s limitations): + + 1. `NiceMock` and `StrictMock` only work for mock methods defined using the `MOCK_METHOD*` family of macros **directly** in the `MockFoo` class. If a mock method is defined in a **base class** of `MockFoo`, the "nice" or "strict" modifier may not affect it, depending on the compiler. In particular, nesting `NiceMock` and `StrictMock` (e.g. `NiceMock >`) is **not** supported. + 1. The constructors of the base mock (`MockFoo`) cannot have arguments passed by non-const reference, which happens to be banned by the [Google C++ style guide](https://google.github.io/styleguide/cppguide.html). + 1. During the constructor or destructor of `MockFoo`, the mock object is _not_ nice or strict. This may cause surprises if the constructor or destructor calls a mock method on `this` object. (This behavior, however, is consistent with C++'s general rule: if a constructor or destructor calls a virtual method of `this` object, that method is treated as non-virtual. In other words, to the base class's constructor or destructor, `this` object behaves like an instance of the base class, not the derived class. This rule is required for safety. Otherwise a base constructor may use members of a derived class before they are initialized, or a base destructor may use members of a derived class after they have been destroyed.) + +Finally, you should be **very cautious** about when to use naggy or strict mocks, as they tend to make tests more brittle and harder to maintain. When you refactor your code without changing its externally visible behavior, ideally you should't need to update any tests. If your code interacts with a naggy mock, however, you may start to get spammed with warnings as the result of your change. Worse, if your code interacts with a strict mock, your tests may start to fail and you'll be forced to fix them. Our general recommendation is to use nice mocks (not yet the default) most of the time, use naggy mocks (the current default) when developing or debugging tests, and use strict mocks only as the last resort. + +## Simplifying the Interface without Breaking Existing Code ## + +Sometimes a method has a long list of arguments that is mostly +uninteresting. For example, + +``` +class LogSink { + public: + ... + virtual void send(LogSeverity severity, const char* full_filename, + const char* base_filename, int line, + const struct tm* tm_time, + const char* message, size_t message_len) = 0; +}; +``` + +This method's argument list is lengthy and hard to work with (let's +say that the `message` argument is not even 0-terminated). If we mock +it as is, using the mock will be awkward. If, however, we try to +simplify this interface, we'll need to fix all clients depending on +it, which is often infeasible. + +The trick is to re-dispatch the method in the mock class: + +``` +class ScopedMockLog : public LogSink { + public: + ... + virtual void send(LogSeverity severity, const char* full_filename, + const char* base_filename, int line, const tm* tm_time, + const char* message, size_t message_len) { + // We are only interested in the log severity, full file name, and + // log message. + Log(severity, full_filename, std::string(message, message_len)); + } + + // Implements the mock method: + // + // void Log(LogSeverity severity, + // const string& file_path, + // const string& message); + MOCK_METHOD3(Log, void(LogSeverity severity, const string& file_path, + const string& message)); +}; +``` + +By defining a new mock method with a trimmed argument list, we make +the mock class much more user-friendly. + +## Alternative to Mocking Concrete Classes ## + +Often you may find yourself using classes that don't implement +interfaces. In order to test your code that uses such a class (let's +call it `Concrete`), you may be tempted to make the methods of +`Concrete` virtual and then mock it. + +Try not to do that. + +Making a non-virtual function virtual is a big decision. It creates an +extension point where subclasses can tweak your class' behavior. This +weakens your control on the class because now it's harder to maintain +the class' invariants. You should make a function virtual only when +there is a valid reason for a subclass to override it. + +Mocking concrete classes directly is problematic as it creates a tight +coupling between the class and the tests - any small change in the +class may invalidate your tests and make test maintenance a pain. + +To avoid such problems, many programmers have been practicing "coding +to interfaces": instead of talking to the `Concrete` class, your code +would define an interface and talk to it. Then you implement that +interface as an adaptor on top of `Concrete`. In tests, you can easily +mock that interface to observe how your code is doing. + +This technique incurs some overhead: + + * You pay the cost of virtual function calls (usually not a problem). + * There is more abstraction for the programmers to learn. + +However, it can also bring significant benefits in addition to better +testability: + + * `Concrete`'s API may not fit your problem domain very well, as you may not be the only client it tries to serve. By designing your own interface, you have a chance to tailor it to your need - you may add higher-level functionalities, rename stuff, etc instead of just trimming the class. This allows you to write your code (user of the interface) in a more natural way, which means it will be more readable, more maintainable, and you'll be more productive. + * If `Concrete`'s implementation ever has to change, you don't have to rewrite everywhere it is used. Instead, you can absorb the change in your implementation of the interface, and your other code and tests will be insulated from this change. + +Some people worry that if everyone is practicing this technique, they +will end up writing lots of redundant code. This concern is totally +understandable. However, there are two reasons why it may not be the +case: + + * Different projects may need to use `Concrete` in different ways, so the best interfaces for them will be different. Therefore, each of them will have its own domain-specific interface on top of `Concrete`, and they will not be the same code. + * If enough projects want to use the same interface, they can always share it, just like they have been sharing `Concrete`. You can check in the interface and the adaptor somewhere near `Concrete` (perhaps in a `contrib` sub-directory) and let many projects use it. + +You need to weigh the pros and cons carefully for your particular +problem, but I'd like to assure you that the Java community has been +practicing this for a long time and it's a proven effective technique +applicable in a wide variety of situations. :-) + +## Delegating Calls to a Fake ## + +Some times you have a non-trivial fake implementation of an +interface. For example: + +``` +class Foo { + public: + virtual ~Foo() {} + virtual char DoThis(int n) = 0; + virtual void DoThat(const char* s, int* p) = 0; +}; + +class FakeFoo : public Foo { + public: + virtual char DoThis(int n) { + return (n > 0) ? '+' : + (n < 0) ? '-' : '0'; + } + + virtual void DoThat(const char* s, int* p) { + *p = strlen(s); + } +}; +``` + +Now you want to mock this interface such that you can set expectations +on it. However, you also want to use `FakeFoo` for the default +behavior, as duplicating it in the mock object is, well, a lot of +work. + +When you define the mock class using Google Mock, you can have it +delegate its default action to a fake class you already have, using +this pattern: + +``` +using ::testing::_; +using ::testing::Invoke; + +class MockFoo : public Foo { + public: + // Normal mock method definitions using Google Mock. + MOCK_METHOD1(DoThis, char(int n)); + MOCK_METHOD2(DoThat, void(const char* s, int* p)); + + // Delegates the default actions of the methods to a FakeFoo object. + // This must be called *before* the custom ON_CALL() statements. + void DelegateToFake() { + ON_CALL(*this, DoThis(_)) + .WillByDefault(Invoke(&fake_, &FakeFoo::DoThis)); + ON_CALL(*this, DoThat(_, _)) + .WillByDefault(Invoke(&fake_, &FakeFoo::DoThat)); + } + private: + FakeFoo fake_; // Keeps an instance of the fake in the mock. +}; +``` + +With that, you can use `MockFoo` in your tests as usual. Just remember +that if you don't explicitly set an action in an `ON_CALL()` or +`EXPECT_CALL()`, the fake will be called upon to do it: + +``` +using ::testing::_; + +TEST(AbcTest, Xyz) { + MockFoo foo; + foo.DelegateToFake(); // Enables the fake for delegation. + + // Put your ON_CALL(foo, ...)s here, if any. + + // No action specified, meaning to use the default action. + EXPECT_CALL(foo, DoThis(5)); + EXPECT_CALL(foo, DoThat(_, _)); + + int n = 0; + EXPECT_EQ('+', foo.DoThis(5)); // FakeFoo::DoThis() is invoked. + foo.DoThat("Hi", &n); // FakeFoo::DoThat() is invoked. + EXPECT_EQ(2, n); +} +``` + +**Some tips:** + + * If you want, you can still override the default action by providing your own `ON_CALL()` or using `.WillOnce()` / `.WillRepeatedly()` in `EXPECT_CALL()`. + * In `DelegateToFake()`, you only need to delegate the methods whose fake implementation you intend to use. + * The general technique discussed here works for overloaded methods, but you'll need to tell the compiler which version you mean. To disambiguate a mock function (the one you specify inside the parentheses of `ON_CALL()`), see the "Selecting Between Overloaded Functions" section on this page; to disambiguate a fake function (the one you place inside `Invoke()`), use a `static_cast` to specify the function's type. For instance, if class `Foo` has methods `char DoThis(int n)` and `bool DoThis(double x) const`, and you want to invoke the latter, you need to write `Invoke(&fake_, static_cast(&FakeFoo::DoThis))` instead of `Invoke(&fake_, &FakeFoo::DoThis)` (The strange-looking thing inside the angled brackets of `static_cast` is the type of a function pointer to the second `DoThis()` method.). + * Having to mix a mock and a fake is often a sign of something gone wrong. Perhaps you haven't got used to the interaction-based way of testing yet. Or perhaps your interface is taking on too many roles and should be split up. Therefore, **don't abuse this**. We would only recommend to do it as an intermediate step when you are refactoring your code. + +Regarding the tip on mixing a mock and a fake, here's an example on +why it may be a bad sign: Suppose you have a class `System` for +low-level system operations. In particular, it does file and I/O +operations. And suppose you want to test how your code uses `System` +to do I/O, and you just want the file operations to work normally. If +you mock out the entire `System` class, you'll have to provide a fake +implementation for the file operation part, which suggests that +`System` is taking on too many roles. + +Instead, you can define a `FileOps` interface and an `IOOps` interface +and split `System`'s functionalities into the two. Then you can mock +`IOOps` without mocking `FileOps`. + +## Delegating Calls to a Real Object ## + +When using testing doubles (mocks, fakes, stubs, and etc), sometimes +their behaviors will differ from those of the real objects. This +difference could be either intentional (as in simulating an error such +that you can test the error handling code) or unintentional. If your +mocks have different behaviors than the real objects by mistake, you +could end up with code that passes the tests but fails in production. + +You can use the _delegating-to-real_ technique to ensure that your +mock has the same behavior as the real object while retaining the +ability to validate calls. This technique is very similar to the +delegating-to-fake technique, the difference being that we use a real +object instead of a fake. Here's an example: + +``` +using ::testing::_; +using ::testing::AtLeast; +using ::testing::Invoke; + +class MockFoo : public Foo { + public: + MockFoo() { + // By default, all calls are delegated to the real object. + ON_CALL(*this, DoThis()) + .WillByDefault(Invoke(&real_, &Foo::DoThis)); + ON_CALL(*this, DoThat(_)) + .WillByDefault(Invoke(&real_, &Foo::DoThat)); + ... + } + MOCK_METHOD0(DoThis, ...); + MOCK_METHOD1(DoThat, ...); + ... + private: + Foo real_; +}; +... + + MockFoo mock; + + EXPECT_CALL(mock, DoThis()) + .Times(3); + EXPECT_CALL(mock, DoThat("Hi")) + .Times(AtLeast(1)); + ... use mock in test ... +``` + +With this, Google Mock will verify that your code made the right calls +(with the right arguments, in the right order, called the right number +of times, etc), and a real object will answer the calls (so the +behavior will be the same as in production). This gives you the best +of both worlds. + +## Delegating Calls to a Parent Class ## + +Ideally, you should code to interfaces, whose methods are all pure +virtual. In reality, sometimes you do need to mock a virtual method +that is not pure (i.e, it already has an implementation). For example: + +``` +class Foo { + public: + virtual ~Foo(); + + virtual void Pure(int n) = 0; + virtual int Concrete(const char* str) { ... } +}; + +class MockFoo : public Foo { + public: + // Mocking a pure method. + MOCK_METHOD1(Pure, void(int n)); + // Mocking a concrete method. Foo::Concrete() is shadowed. + MOCK_METHOD1(Concrete, int(const char* str)); +}; +``` + +Sometimes you may want to call `Foo::Concrete()` instead of +`MockFoo::Concrete()`. Perhaps you want to do it as part of a stub +action, or perhaps your test doesn't need to mock `Concrete()` at all +(but it would be oh-so painful to have to define a new mock class +whenever you don't need to mock one of its methods). + +The trick is to leave a back door in your mock class for accessing the +real methods in the base class: + +``` +class MockFoo : public Foo { + public: + // Mocking a pure method. + MOCK_METHOD1(Pure, void(int n)); + // Mocking a concrete method. Foo::Concrete() is shadowed. + MOCK_METHOD1(Concrete, int(const char* str)); + + // Use this to call Concrete() defined in Foo. + int FooConcrete(const char* str) { return Foo::Concrete(str); } +}; +``` + +Now, you can call `Foo::Concrete()` inside an action by: + +``` +using ::testing::_; +using ::testing::Invoke; +... + EXPECT_CALL(foo, Concrete(_)) + .WillOnce(Invoke(&foo, &MockFoo::FooConcrete)); +``` + +or tell the mock object that you don't want to mock `Concrete()`: + +``` +using ::testing::Invoke; +... + ON_CALL(foo, Concrete(_)) + .WillByDefault(Invoke(&foo, &MockFoo::FooConcrete)); +``` + +(Why don't we just write `Invoke(&foo, &Foo::Concrete)`? If you do +that, `MockFoo::Concrete()` will be called (and cause an infinite +recursion) since `Foo::Concrete()` is virtual. That's just how C++ +works.) + +# Using Matchers # + +## Matching Argument Values Exactly ## + +You can specify exactly which arguments a mock method is expecting: + +``` +using ::testing::Return; +... + EXPECT_CALL(foo, DoThis(5)) + .WillOnce(Return('a')); + EXPECT_CALL(foo, DoThat("Hello", bar)); +``` + +## Using Simple Matchers ## + +You can use matchers to match arguments that have a certain property: + +``` +using ::testing::Ge; +using ::testing::NotNull; +using ::testing::Return; +... + EXPECT_CALL(foo, DoThis(Ge(5))) // The argument must be >= 5. + .WillOnce(Return('a')); + EXPECT_CALL(foo, DoThat("Hello", NotNull())); + // The second argument must not be NULL. +``` + +A frequently used matcher is `_`, which matches anything: + +``` +using ::testing::_; +using ::testing::NotNull; +... + EXPECT_CALL(foo, DoThat(_, NotNull())); +``` + +## Combining Matchers ## + +You can build complex matchers from existing ones using `AllOf()`, +`AnyOf()`, and `Not()`: + +``` +using ::testing::AllOf; +using ::testing::Gt; +using ::testing::HasSubstr; +using ::testing::Ne; +using ::testing::Not; +... + // The argument must be > 5 and != 10. + EXPECT_CALL(foo, DoThis(AllOf(Gt(5), + Ne(10)))); + + // The first argument must not contain sub-string "blah". + EXPECT_CALL(foo, DoThat(Not(HasSubstr("blah")), + NULL)); +``` + +## Casting Matchers ## + +Google Mock matchers are statically typed, meaning that the compiler +can catch your mistake if you use a matcher of the wrong type (for +example, if you use `Eq(5)` to match a `string` argument). Good for +you! + +Sometimes, however, you know what you're doing and want the compiler +to give you some slack. One example is that you have a matcher for +`long` and the argument you want to match is `int`. While the two +types aren't exactly the same, there is nothing really wrong with +using a `Matcher` to match an `int` - after all, we can first +convert the `int` argument to a `long` before giving it to the +matcher. + +To support this need, Google Mock gives you the +`SafeMatcherCast(m)` function. It casts a matcher `m` to type +`Matcher`. To ensure safety, Google Mock checks that (let `U` be the +type `m` accepts): + + 1. Type `T` can be implicitly cast to type `U`; + 1. When both `T` and `U` are built-in arithmetic types (`bool`, integers, and floating-point numbers), the conversion from `T` to `U` is not lossy (in other words, any value representable by `T` can also be represented by `U`); and + 1. When `U` is a reference, `T` must also be a reference (as the underlying matcher may be interested in the address of the `U` value). + +The code won't compile if any of these conditions aren't met. + +Here's one example: + +``` +using ::testing::SafeMatcherCast; + +// A base class and a child class. +class Base { ... }; +class Derived : public Base { ... }; + +class MockFoo : public Foo { + public: + MOCK_METHOD1(DoThis, void(Derived* derived)); +}; +... + + MockFoo foo; + // m is a Matcher we got from somewhere. + EXPECT_CALL(foo, DoThis(SafeMatcherCast(m))); +``` + +If you find `SafeMatcherCast(m)` too limiting, you can use a similar +function `MatcherCast(m)`. The difference is that `MatcherCast` works +as long as you can `static_cast` type `T` to type `U`. + +`MatcherCast` essentially lets you bypass C++'s type system +(`static_cast` isn't always safe as it could throw away information, +for example), so be careful not to misuse/abuse it. + +## Selecting Between Overloaded Functions ## + +If you expect an overloaded function to be called, the compiler may +need some help on which overloaded version it is. + +To disambiguate functions overloaded on the const-ness of this object, +use the `Const()` argument wrapper. + +``` +using ::testing::ReturnRef; + +class MockFoo : public Foo { + ... + MOCK_METHOD0(GetBar, Bar&()); + MOCK_CONST_METHOD0(GetBar, const Bar&()); +}; +... + + MockFoo foo; + Bar bar1, bar2; + EXPECT_CALL(foo, GetBar()) // The non-const GetBar(). + .WillOnce(ReturnRef(bar1)); + EXPECT_CALL(Const(foo), GetBar()) // The const GetBar(). + .WillOnce(ReturnRef(bar2)); +``` + +(`Const()` is defined by Google Mock and returns a `const` reference +to its argument.) + +To disambiguate overloaded functions with the same number of arguments +but different argument types, you may need to specify the exact type +of a matcher, either by wrapping your matcher in `Matcher()`, or +using a matcher whose type is fixed (`TypedEq`, `An()`, +etc): + +``` +using ::testing::An; +using ::testing::Lt; +using ::testing::Matcher; +using ::testing::TypedEq; + +class MockPrinter : public Printer { + public: + MOCK_METHOD1(Print, void(int n)); + MOCK_METHOD1(Print, void(char c)); +}; + +TEST(PrinterTest, Print) { + MockPrinter printer; + + EXPECT_CALL(printer, Print(An())); // void Print(int); + EXPECT_CALL(printer, Print(Matcher(Lt(5)))); // void Print(int); + EXPECT_CALL(printer, Print(TypedEq('a'))); // void Print(char); + + printer.Print(3); + printer.Print(6); + printer.Print('a'); +} +``` + +## Performing Different Actions Based on the Arguments ## + +When a mock method is called, the _last_ matching expectation that's +still active will be selected (think "newer overrides older"). So, you +can make a method do different things depending on its argument values +like this: + +``` +using ::testing::_; +using ::testing::Lt; +using ::testing::Return; +... + // The default case. + EXPECT_CALL(foo, DoThis(_)) + .WillRepeatedly(Return('b')); + + // The more specific case. + EXPECT_CALL(foo, DoThis(Lt(5))) + .WillRepeatedly(Return('a')); +``` + +Now, if `foo.DoThis()` is called with a value less than 5, `'a'` will +be returned; otherwise `'b'` will be returned. + +## Matching Multiple Arguments as a Whole ## + +Sometimes it's not enough to match the arguments individually. For +example, we may want to say that the first argument must be less than +the second argument. The `With()` clause allows us to match +all arguments of a mock function as a whole. For example, + +``` +using ::testing::_; +using ::testing::Lt; +using ::testing::Ne; +... + EXPECT_CALL(foo, InRange(Ne(0), _)) + .With(Lt()); +``` + +says that the first argument of `InRange()` must not be 0, and must be +less than the second argument. + +The expression inside `With()` must be a matcher of type +`Matcher< ::testing::tuple >`, where `A1`, ..., `An` are the +types of the function arguments. + +You can also write `AllArgs(m)` instead of `m` inside `.With()`. The +two forms are equivalent, but `.With(AllArgs(Lt()))` is more readable +than `.With(Lt())`. + +You can use `Args(m)` to match the `n` selected arguments +(as a tuple) against `m`. For example, + +``` +using ::testing::_; +using ::testing::AllOf; +using ::testing::Args; +using ::testing::Lt; +... + EXPECT_CALL(foo, Blah(_, _, _)) + .With(AllOf(Args<0, 1>(Lt()), Args<1, 2>(Lt()))); +``` + +says that `Blah()` will be called with arguments `x`, `y`, and `z` where +`x < y < z`. + +As a convenience and example, Google Mock provides some matchers for +2-tuples, including the `Lt()` matcher above. See the [CheatSheet](CheatSheet.md) for +the complete list. + +Note that if you want to pass the arguments to a predicate of your own +(e.g. `.With(Args<0, 1>(Truly(&MyPredicate)))`), that predicate MUST be +written to take a `::testing::tuple` as its argument; Google Mock will pass the `n` selected arguments as _one_ single tuple to the predicate. + +## Using Matchers as Predicates ## + +Have you noticed that a matcher is just a fancy predicate that also +knows how to describe itself? Many existing algorithms take predicates +as arguments (e.g. those defined in STL's `` header), and +it would be a shame if Google Mock matchers are not allowed to +participate. + +Luckily, you can use a matcher where a unary predicate functor is +expected by wrapping it inside the `Matches()` function. For example, + +``` +#include +#include + +std::vector v; +... +// How many elements in v are >= 10? +const int count = count_if(v.begin(), v.end(), Matches(Ge(10))); +``` + +Since you can build complex matchers from simpler ones easily using +Google Mock, this gives you a way to conveniently construct composite +predicates (doing the same using STL's `` header is just +painful). For example, here's a predicate that's satisfied by any +number that is >= 0, <= 100, and != 50: + +``` +Matches(AllOf(Ge(0), Le(100), Ne(50))) +``` + +## Using Matchers in Google Test Assertions ## + +Since matchers are basically predicates that also know how to describe +themselves, there is a way to take advantage of them in +[Google Test](../../googletest/) assertions. It's +called `ASSERT_THAT` and `EXPECT_THAT`: + +``` + ASSERT_THAT(value, matcher); // Asserts that value matches matcher. + EXPECT_THAT(value, matcher); // The non-fatal version. +``` + +For example, in a Google Test test you can write: + +``` +#include "gmock/gmock.h" + +using ::testing::AllOf; +using ::testing::Ge; +using ::testing::Le; +using ::testing::MatchesRegex; +using ::testing::StartsWith; +... + + EXPECT_THAT(Foo(), StartsWith("Hello")); + EXPECT_THAT(Bar(), MatchesRegex("Line \\d+")); + ASSERT_THAT(Baz(), AllOf(Ge(5), Le(10))); +``` + +which (as you can probably guess) executes `Foo()`, `Bar()`, and +`Baz()`, and verifies that: + + * `Foo()` returns a string that starts with `"Hello"`. + * `Bar()` returns a string that matches regular expression `"Line \\d+"`. + * `Baz()` returns a number in the range [5, 10]. + +The nice thing about these macros is that _they read like +English_. They generate informative messages too. For example, if the +first `EXPECT_THAT()` above fails, the message will be something like: + +``` +Value of: Foo() + Actual: "Hi, world!" +Expected: starts with "Hello" +``` + +**Credit:** The idea of `(ASSERT|EXPECT)_THAT` was stolen from the +[Hamcrest](https://github.com/hamcrest/) project, which adds +`assertThat()` to JUnit. + +## Using Predicates as Matchers ## + +Google Mock provides a built-in set of matchers. In case you find them +lacking, you can use an arbitray unary predicate function or functor +as a matcher - as long as the predicate accepts a value of the type +you want. You do this by wrapping the predicate inside the `Truly()` +function, for example: + +``` +using ::testing::Truly; + +int IsEven(int n) { return (n % 2) == 0 ? 1 : 0; } +... + + // Bar() must be called with an even number. + EXPECT_CALL(foo, Bar(Truly(IsEven))); +``` + +Note that the predicate function / functor doesn't have to return +`bool`. It works as long as the return value can be used as the +condition in statement `if (condition) ...`. + +## Matching Arguments that Are Not Copyable ## + +When you do an `EXPECT_CALL(mock_obj, Foo(bar))`, Google Mock saves +away a copy of `bar`. When `Foo()` is called later, Google Mock +compares the argument to `Foo()` with the saved copy of `bar`. This +way, you don't need to worry about `bar` being modified or destroyed +after the `EXPECT_CALL()` is executed. The same is true when you use +matchers like `Eq(bar)`, `Le(bar)`, and so on. + +But what if `bar` cannot be copied (i.e. has no copy constructor)? You +could define your own matcher function and use it with `Truly()`, as +the previous couple of recipes have shown. Or, you may be able to get +away from it if you can guarantee that `bar` won't be changed after +the `EXPECT_CALL()` is executed. Just tell Google Mock that it should +save a reference to `bar`, instead of a copy of it. Here's how: + +``` +using ::testing::Eq; +using ::testing::ByRef; +using ::testing::Lt; +... + // Expects that Foo()'s argument == bar. + EXPECT_CALL(mock_obj, Foo(Eq(ByRef(bar)))); + + // Expects that Foo()'s argument < bar. + EXPECT_CALL(mock_obj, Foo(Lt(ByRef(bar)))); +``` + +Remember: if you do this, don't change `bar` after the +`EXPECT_CALL()`, or the result is undefined. + +## Validating a Member of an Object ## + +Often a mock function takes a reference to object as an argument. When +matching the argument, you may not want to compare the entire object +against a fixed object, as that may be over-specification. Instead, +you may need to validate a certain member variable or the result of a +certain getter method of the object. You can do this with `Field()` +and `Property()`. More specifically, + +``` +Field(&Foo::bar, m) +``` + +is a matcher that matches a `Foo` object whose `bar` member variable +satisfies matcher `m`. + +``` +Property(&Foo::baz, m) +``` + +is a matcher that matches a `Foo` object whose `baz()` method returns +a value that satisfies matcher `m`. + +For example: + +| Expression | Description | +|:-----------------------------|:-----------------------------------| +| `Field(&Foo::number, Ge(3))` | Matches `x` where `x.number >= 3`. | +| `Property(&Foo::name, StartsWith("John "))` | Matches `x` where `x.name()` starts with `"John "`. | + +Note that in `Property(&Foo::baz, ...)`, method `baz()` must take no +argument and be declared as `const`. + +BTW, `Field()` and `Property()` can also match plain pointers to +objects. For instance, + +``` +Field(&Foo::number, Ge(3)) +``` + +matches a plain pointer `p` where `p->number >= 3`. If `p` is `NULL`, +the match will always fail regardless of the inner matcher. + +What if you want to validate more than one members at the same time? +Remember that there is `AllOf()`. + +## Validating the Value Pointed to by a Pointer Argument ## + +C++ functions often take pointers as arguments. You can use matchers +like `IsNull()`, `NotNull()`, and other comparison matchers to match a +pointer, but what if you want to make sure the value _pointed to_ by +the pointer, instead of the pointer itself, has a certain property? +Well, you can use the `Pointee(m)` matcher. + +`Pointee(m)` matches a pointer iff `m` matches the value the pointer +points to. For example: + +``` +using ::testing::Ge; +using ::testing::Pointee; +... + EXPECT_CALL(foo, Bar(Pointee(Ge(3)))); +``` + +expects `foo.Bar()` to be called with a pointer that points to a value +greater than or equal to 3. + +One nice thing about `Pointee()` is that it treats a `NULL` pointer as +a match failure, so you can write `Pointee(m)` instead of + +``` + AllOf(NotNull(), Pointee(m)) +``` + +without worrying that a `NULL` pointer will crash your test. + +Also, did we tell you that `Pointee()` works with both raw pointers +**and** smart pointers (`linked_ptr`, `shared_ptr`, `scoped_ptr`, and +etc)? + +What if you have a pointer to pointer? You guessed it - you can use +nested `Pointee()` to probe deeper inside the value. For example, +`Pointee(Pointee(Lt(3)))` matches a pointer that points to a pointer +that points to a number less than 3 (what a mouthful...). + +## Testing a Certain Property of an Object ## + +Sometimes you want to specify that an object argument has a certain +property, but there is no existing matcher that does this. If you want +good error messages, you should define a matcher. If you want to do it +quick and dirty, you could get away with writing an ordinary function. + +Let's say you have a mock function that takes an object of type `Foo`, +which has an `int bar()` method and an `int baz()` method, and you +want to constrain that the argument's `bar()` value plus its `baz()` +value is a given number. Here's how you can define a matcher to do it: + +``` +using ::testing::MatcherInterface; +using ::testing::MatchResultListener; + +class BarPlusBazEqMatcher : public MatcherInterface { + public: + explicit BarPlusBazEqMatcher(int expected_sum) + : expected_sum_(expected_sum) {} + + virtual bool MatchAndExplain(const Foo& foo, + MatchResultListener* listener) const { + return (foo.bar() + foo.baz()) == expected_sum_; + } + + virtual void DescribeTo(::std::ostream* os) const { + *os << "bar() + baz() equals " << expected_sum_; + } + + virtual void DescribeNegationTo(::std::ostream* os) const { + *os << "bar() + baz() does not equal " << expected_sum_; + } + private: + const int expected_sum_; +}; + +inline Matcher BarPlusBazEq(int expected_sum) { + return MakeMatcher(new BarPlusBazEqMatcher(expected_sum)); +} + +... + + EXPECT_CALL(..., DoThis(BarPlusBazEq(5)))...; +``` + +## Matching Containers ## + +Sometimes an STL container (e.g. list, vector, map, ...) is passed to +a mock function and you may want to validate it. Since most STL +containers support the `==` operator, you can write +`Eq(expected_container)` or simply `expected_container` to match a +container exactly. + +Sometimes, though, you may want to be more flexible (for example, the +first element must be an exact match, but the second element can be +any positive number, and so on). Also, containers used in tests often +have a small number of elements, and having to define the expected +container out-of-line is a bit of a hassle. + +You can use the `ElementsAre()` or `UnorderedElementsAre()` matcher in +such cases: + +``` +using ::testing::_; +using ::testing::ElementsAre; +using ::testing::Gt; +... + + MOCK_METHOD1(Foo, void(const vector& numbers)); +... + + EXPECT_CALL(mock, Foo(ElementsAre(1, Gt(0), _, 5))); +``` + +The above matcher says that the container must have 4 elements, which +must be 1, greater than 0, anything, and 5 respectively. + +If you instead write: + +``` +using ::testing::_; +using ::testing::Gt; +using ::testing::UnorderedElementsAre; +... + + MOCK_METHOD1(Foo, void(const vector& numbers)); +... + + EXPECT_CALL(mock, Foo(UnorderedElementsAre(1, Gt(0), _, 5))); +``` + +It means that the container must have 4 elements, which under some +permutation must be 1, greater than 0, anything, and 5 respectively. + +`ElementsAre()` and `UnorderedElementsAre()` are overloaded to take 0 +to 10 arguments. If more are needed, you can place them in a C-style +array and use `ElementsAreArray()` or `UnorderedElementsAreArray()` +instead: + +``` +using ::testing::ElementsAreArray; +... + + // ElementsAreArray accepts an array of element values. + const int expected_vector1[] = { 1, 5, 2, 4, ... }; + EXPECT_CALL(mock, Foo(ElementsAreArray(expected_vector1))); + + // Or, an array of element matchers. + Matcher expected_vector2 = { 1, Gt(2), _, 3, ... }; + EXPECT_CALL(mock, Foo(ElementsAreArray(expected_vector2))); +``` + +In case the array needs to be dynamically created (and therefore the +array size cannot be inferred by the compiler), you can give +`ElementsAreArray()` an additional argument to specify the array size: + +``` +using ::testing::ElementsAreArray; +... + int* const expected_vector3 = new int[count]; + ... fill expected_vector3 with values ... + EXPECT_CALL(mock, Foo(ElementsAreArray(expected_vector3, count))); +``` + +**Tips:** + + * `ElementsAre*()` can be used to match _any_ container that implements the STL iterator pattern (i.e. it has a `const_iterator` type and supports `begin()/end()`), not just the ones defined in STL. It will even work with container types yet to be written - as long as they follows the above pattern. + * You can use nested `ElementsAre*()` to match nested (multi-dimensional) containers. + * If the container is passed by pointer instead of by reference, just write `Pointee(ElementsAre*(...))`. + * The order of elements _matters_ for `ElementsAre*()`. Therefore don't use it with containers whose element order is undefined (e.g. `hash_map`). + +## Sharing Matchers ## + +Under the hood, a Google Mock matcher object consists of a pointer to +a ref-counted implementation object. Copying matchers is allowed and +very efficient, as only the pointer is copied. When the last matcher +that references the implementation object dies, the implementation +object will be deleted. + +Therefore, if you have some complex matcher that you want to use again +and again, there is no need to build it every time. Just assign it to a +matcher variable and use that variable repeatedly! For example, + +``` + Matcher in_range = AllOf(Gt(5), Le(10)); + ... use in_range as a matcher in multiple EXPECT_CALLs ... +``` + +# Setting Expectations # + +## Knowing When to Expect ## + +`ON_CALL` is likely the single most under-utilized construct in Google Mock. + +There are basically two constructs for defining the behavior of a mock object: `ON_CALL` and `EXPECT_CALL`. The difference? `ON_CALL` defines what happens when a mock method is called, but _doesn't imply any expectation on the method being called._ `EXPECT_CALL` not only defines the behavior, but also sets an expectation that _the method will be called with the given arguments, for the given number of times_ (and _in the given order_ when you specify the order too). + +Since `EXPECT_CALL` does more, isn't it better than `ON_CALL`? Not really. Every `EXPECT_CALL` adds a constraint on the behavior of the code under test. Having more constraints than necessary is _baaad_ - even worse than not having enough constraints. + +This may be counter-intuitive. How could tests that verify more be worse than tests that verify less? Isn't verification the whole point of tests? + +The answer, lies in _what_ a test should verify. **A good test verifies the contract of the code.** If a test over-specifies, it doesn't leave enough freedom to the implementation. As a result, changing the implementation without breaking the contract (e.g. refactoring and optimization), which should be perfectly fine to do, can break such tests. Then you have to spend time fixing them, only to see them broken again the next time the implementation is changed. + +Keep in mind that one doesn't have to verify more than one property in one test. In fact, **it's a good style to verify only one thing in one test.** If you do that, a bug will likely break only one or two tests instead of dozens (which case would you rather debug?). If you are also in the habit of giving tests descriptive names that tell what they verify, you can often easily guess what's wrong just from the test log itself. + +So use `ON_CALL` by default, and only use `EXPECT_CALL` when you actually intend to verify that the call is made. For example, you may have a bunch of `ON_CALL`s in your test fixture to set the common mock behavior shared by all tests in the same group, and write (scarcely) different `EXPECT_CALL`s in different `TEST_F`s to verify different aspects of the code's behavior. Compared with the style where each `TEST` has many `EXPECT_CALL`s, this leads to tests that are more resilient to implementational changes (and thus less likely to require maintenance) and makes the intent of the tests more obvious (so they are easier to maintain when you do need to maintain them). + +If you are bothered by the "Uninteresting mock function call" message printed when a mock method without an `EXPECT_CALL` is called, you may use a `NiceMock` instead to suppress all such messages for the mock object, or suppress the message for specific methods by adding `EXPECT_CALL(...).Times(AnyNumber())`. DO NOT suppress it by blindly adding an `EXPECT_CALL(...)`, or you'll have a test that's a pain to maintain. + +## Ignoring Uninteresting Calls ## + +If you are not interested in how a mock method is called, just don't +say anything about it. In this case, if the method is ever called, +Google Mock will perform its default action to allow the test program +to continue. If you are not happy with the default action taken by +Google Mock, you can override it using `DefaultValue::Set()` +(described later in this document) or `ON_CALL()`. + +Please note that once you expressed interest in a particular mock +method (via `EXPECT_CALL()`), all invocations to it must match some +expectation. If this function is called but the arguments don't match +any `EXPECT_CALL()` statement, it will be an error. + +## Disallowing Unexpected Calls ## + +If a mock method shouldn't be called at all, explicitly say so: + +``` +using ::testing::_; +... + EXPECT_CALL(foo, Bar(_)) + .Times(0); +``` + +If some calls to the method are allowed, but the rest are not, just +list all the expected calls: + +``` +using ::testing::AnyNumber; +using ::testing::Gt; +... + EXPECT_CALL(foo, Bar(5)); + EXPECT_CALL(foo, Bar(Gt(10))) + .Times(AnyNumber()); +``` + +A call to `foo.Bar()` that doesn't match any of the `EXPECT_CALL()` +statements will be an error. + +## Understanding Uninteresting vs Unexpected Calls ## + +_Uninteresting_ calls and _unexpected_ calls are different concepts in Google Mock. _Very_ different. + +A call `x.Y(...)` is **uninteresting** if there's _not even a single_ `EXPECT_CALL(x, Y(...))` set. In other words, the test isn't interested in the `x.Y()` method at all, as evident in that the test doesn't care to say anything about it. + +A call `x.Y(...)` is **unexpected** if there are some `EXPECT_CALL(x, Y(...))s` set, but none of them matches the call. Put another way, the test is interested in the `x.Y()` method (therefore it _explicitly_ sets some `EXPECT_CALL` to verify how it's called); however, the verification fails as the test doesn't expect this particular call to happen. + +**An unexpected call is always an error,** as the code under test doesn't behave the way the test expects it to behave. + +**By default, an uninteresting call is not an error,** as it violates no constraint specified by the test. (Google Mock's philosophy is that saying nothing means there is no constraint.) However, it leads to a warning, as it _might_ indicate a problem (e.g. the test author might have forgotten to specify a constraint). + +In Google Mock, `NiceMock` and `StrictMock` can be used to make a mock class "nice" or "strict". How does this affect uninteresting calls and unexpected calls? + +A **nice mock** suppresses uninteresting call warnings. It is less chatty than the default mock, but otherwise is the same. If a test fails with a default mock, it will also fail using a nice mock instead. And vice versa. Don't expect making a mock nice to change the test's result. + +A **strict mock** turns uninteresting call warnings into errors. So making a mock strict may change the test's result. + +Let's look at an example: + +``` +TEST(...) { + NiceMock mock_registry; + EXPECT_CALL(mock_registry, GetDomainOwner("google.com")) + .WillRepeatedly(Return("Larry Page")); + + // Use mock_registry in code under test. + ... &mock_registry ... +} +``` + +The sole `EXPECT_CALL` here says that all calls to `GetDomainOwner()` must have `"google.com"` as the argument. If `GetDomainOwner("yahoo.com")` is called, it will be an unexpected call, and thus an error. Having a nice mock doesn't change the severity of an unexpected call. + +So how do we tell Google Mock that `GetDomainOwner()` can be called with some other arguments as well? The standard technique is to add a "catch all" `EXPECT_CALL`: + +``` + EXPECT_CALL(mock_registry, GetDomainOwner(_)) + .Times(AnyNumber()); // catches all other calls to this method. + EXPECT_CALL(mock_registry, GetDomainOwner("google.com")) + .WillRepeatedly(Return("Larry Page")); +``` + +Remember that `_` is the wildcard matcher that matches anything. With this, if `GetDomainOwner("google.com")` is called, it will do what the second `EXPECT_CALL` says; if it is called with a different argument, it will do what the first `EXPECT_CALL` says. + +Note that the order of the two `EXPECT_CALLs` is important, as a newer `EXPECT_CALL` takes precedence over an older one. + +For more on uninteresting calls, nice mocks, and strict mocks, read ["The Nice, the Strict, and the Naggy"](#the-nice-the-strict-and-the-naggy). + +## Expecting Ordered Calls ## + +Although an `EXPECT_CALL()` statement defined earlier takes precedence +when Google Mock tries to match a function call with an expectation, +by default calls don't have to happen in the order `EXPECT_CALL()` +statements are written. For example, if the arguments match the +matchers in the third `EXPECT_CALL()`, but not those in the first two, +then the third expectation will be used. + +If you would rather have all calls occur in the order of the +expectations, put the `EXPECT_CALL()` statements in a block where you +define a variable of type `InSequence`: + +``` + using ::testing::_; + using ::testing::InSequence; + + { + InSequence s; + + EXPECT_CALL(foo, DoThis(5)); + EXPECT_CALL(bar, DoThat(_)) + .Times(2); + EXPECT_CALL(foo, DoThis(6)); + } +``` + +In this example, we expect a call to `foo.DoThis(5)`, followed by two +calls to `bar.DoThat()` where the argument can be anything, which are +in turn followed by a call to `foo.DoThis(6)`. If a call occurred +out-of-order, Google Mock will report an error. + +## Expecting Partially Ordered Calls ## + +Sometimes requiring everything to occur in a predetermined order can +lead to brittle tests. For example, we may care about `A` occurring +before both `B` and `C`, but aren't interested in the relative order +of `B` and `C`. In this case, the test should reflect our real intent, +instead of being overly constraining. + +Google Mock allows you to impose an arbitrary DAG (directed acyclic +graph) on the calls. One way to express the DAG is to use the +[After](CheatSheet.md#the-after-clause) clause of `EXPECT_CALL`. + +Another way is via the `InSequence()` clause (not the same as the +`InSequence` class), which we borrowed from jMock 2. It's less +flexible than `After()`, but more convenient when you have long chains +of sequential calls, as it doesn't require you to come up with +different names for the expectations in the chains. Here's how it +works: + +If we view `EXPECT_CALL()` statements as nodes in a graph, and add an +edge from node A to node B wherever A must occur before B, we can get +a DAG. We use the term "sequence" to mean a directed path in this +DAG. Now, if we decompose the DAG into sequences, we just need to know +which sequences each `EXPECT_CALL()` belongs to in order to be able to +reconstruct the original DAG. + +So, to specify the partial order on the expectations we need to do two +things: first to define some `Sequence` objects, and then for each +`EXPECT_CALL()` say which `Sequence` objects it is part +of. Expectations in the same sequence must occur in the order they are +written. For example, + +``` + using ::testing::Sequence; + + Sequence s1, s2; + + EXPECT_CALL(foo, A()) + .InSequence(s1, s2); + EXPECT_CALL(bar, B()) + .InSequence(s1); + EXPECT_CALL(bar, C()) + .InSequence(s2); + EXPECT_CALL(foo, D()) + .InSequence(s2); +``` + +specifies the following DAG (where `s1` is `A -> B`, and `s2` is `A -> +C -> D`): + +``` + +---> B + | + A ---| + | + +---> C ---> D +``` + +This means that A must occur before B and C, and C must occur before +D. There's no restriction about the order other than these. + +## Controlling When an Expectation Retires ## + +When a mock method is called, Google Mock only consider expectations +that are still active. An expectation is active when created, and +becomes inactive (aka _retires_) when a call that has to occur later +has occurred. For example, in + +``` + using ::testing::_; + using ::testing::Sequence; + + Sequence s1, s2; + + EXPECT_CALL(log, Log(WARNING, _, "File too large.")) // #1 + .Times(AnyNumber()) + .InSequence(s1, s2); + EXPECT_CALL(log, Log(WARNING, _, "Data set is empty.")) // #2 + .InSequence(s1); + EXPECT_CALL(log, Log(WARNING, _, "User not found.")) // #3 + .InSequence(s2); +``` + +as soon as either #2 or #3 is matched, #1 will retire. If a warning +`"File too large."` is logged after this, it will be an error. + +Note that an expectation doesn't retire automatically when it's +saturated. For example, + +``` +using ::testing::_; +... + EXPECT_CALL(log, Log(WARNING, _, _)); // #1 + EXPECT_CALL(log, Log(WARNING, _, "File too large.")); // #2 +``` + +says that there will be exactly one warning with the message `"File +too large."`. If the second warning contains this message too, #2 will +match again and result in an upper-bound-violated error. + +If this is not what you want, you can ask an expectation to retire as +soon as it becomes saturated: + +``` +using ::testing::_; +... + EXPECT_CALL(log, Log(WARNING, _, _)); // #1 + EXPECT_CALL(log, Log(WARNING, _, "File too large.")) // #2 + .RetiresOnSaturation(); +``` + +Here #2 can be used only once, so if you have two warnings with the +message `"File too large."`, the first will match #2 and the second +will match #1 - there will be no error. + +# Using Actions # + +## Returning References from Mock Methods ## + +If a mock function's return type is a reference, you need to use +`ReturnRef()` instead of `Return()` to return a result: + +``` +using ::testing::ReturnRef; + +class MockFoo : public Foo { + public: + MOCK_METHOD0(GetBar, Bar&()); +}; +... + + MockFoo foo; + Bar bar; + EXPECT_CALL(foo, GetBar()) + .WillOnce(ReturnRef(bar)); +``` + +## Returning Live Values from Mock Methods ## + +The `Return(x)` action saves a copy of `x` when the action is +_created_, and always returns the same value whenever it's +executed. Sometimes you may want to instead return the _live_ value of +`x` (i.e. its value at the time when the action is _executed_.). + +If the mock function's return type is a reference, you can do it using +`ReturnRef(x)`, as shown in the previous recipe ("Returning References +from Mock Methods"). However, Google Mock doesn't let you use +`ReturnRef()` in a mock function whose return type is not a reference, +as doing that usually indicates a user error. So, what shall you do? + +You may be tempted to try `ByRef()`: + +``` +using testing::ByRef; +using testing::Return; + +class MockFoo : public Foo { + public: + MOCK_METHOD0(GetValue, int()); +}; +... + int x = 0; + MockFoo foo; + EXPECT_CALL(foo, GetValue()) + .WillRepeatedly(Return(ByRef(x))); + x = 42; + EXPECT_EQ(42, foo.GetValue()); +``` + +Unfortunately, it doesn't work here. The above code will fail with error: + +``` +Value of: foo.GetValue() + Actual: 0 +Expected: 42 +``` + +The reason is that `Return(value)` converts `value` to the actual +return type of the mock function at the time when the action is +_created_, not when it is _executed_. (This behavior was chosen for +the action to be safe when `value` is a proxy object that references +some temporary objects.) As a result, `ByRef(x)` is converted to an +`int` value (instead of a `const int&`) when the expectation is set, +and `Return(ByRef(x))` will always return 0. + +`ReturnPointee(pointer)` was provided to solve this problem +specifically. It returns the value pointed to by `pointer` at the time +the action is _executed_: + +``` +using testing::ReturnPointee; +... + int x = 0; + MockFoo foo; + EXPECT_CALL(foo, GetValue()) + .WillRepeatedly(ReturnPointee(&x)); // Note the & here. + x = 42; + EXPECT_EQ(42, foo.GetValue()); // This will succeed now. +``` + +## Combining Actions ## + +Want to do more than one thing when a function is called? That's +fine. `DoAll()` allow you to do sequence of actions every time. Only +the return value of the last action in the sequence will be used. + +``` +using ::testing::DoAll; + +class MockFoo : public Foo { + public: + MOCK_METHOD1(Bar, bool(int n)); +}; +... + + EXPECT_CALL(foo, Bar(_)) + .WillOnce(DoAll(action_1, + action_2, + ... + action_n)); +``` + +## Mocking Side Effects ## + +Sometimes a method exhibits its effect not via returning a value but +via side effects. For example, it may change some global state or +modify an output argument. To mock side effects, in general you can +define your own action by implementing `::testing::ActionInterface`. + +If all you need to do is to change an output argument, the built-in +`SetArgPointee()` action is convenient: + +``` +using ::testing::SetArgPointee; + +class MockMutator : public Mutator { + public: + MOCK_METHOD2(Mutate, void(bool mutate, int* value)); + ... +}; +... + + MockMutator mutator; + EXPECT_CALL(mutator, Mutate(true, _)) + .WillOnce(SetArgPointee<1>(5)); +``` + +In this example, when `mutator.Mutate()` is called, we will assign 5 +to the `int` variable pointed to by argument #1 +(0-based). + +`SetArgPointee()` conveniently makes an internal copy of the +value you pass to it, removing the need to keep the value in scope and +alive. The implication however is that the value must have a copy +constructor and assignment operator. + +If the mock method also needs to return a value as well, you can chain +`SetArgPointee()` with `Return()` using `DoAll()`: + +``` +using ::testing::_; +using ::testing::Return; +using ::testing::SetArgPointee; + +class MockMutator : public Mutator { + public: + ... + MOCK_METHOD1(MutateInt, bool(int* value)); +}; +... + + MockMutator mutator; + EXPECT_CALL(mutator, MutateInt(_)) + .WillOnce(DoAll(SetArgPointee<0>(5), + Return(true))); +``` + +If the output argument is an array, use the +`SetArrayArgument(first, last)` action instead. It copies the +elements in source range `[first, last)` to the array pointed to by +the `N`-th (0-based) argument: + +``` +using ::testing::NotNull; +using ::testing::SetArrayArgument; + +class MockArrayMutator : public ArrayMutator { + public: + MOCK_METHOD2(Mutate, void(int* values, int num_values)); + ... +}; +... + + MockArrayMutator mutator; + int values[5] = { 1, 2, 3, 4, 5 }; + EXPECT_CALL(mutator, Mutate(NotNull(), 5)) + .WillOnce(SetArrayArgument<0>(values, values + 5)); +``` + +This also works when the argument is an output iterator: + +``` +using ::testing::_; +using ::testing::SetArrayArgument; + +class MockRolodex : public Rolodex { + public: + MOCK_METHOD1(GetNames, void(std::back_insert_iterator >)); + ... +}; +... + + MockRolodex rolodex; + vector names; + names.push_back("George"); + names.push_back("John"); + names.push_back("Thomas"); + EXPECT_CALL(rolodex, GetNames(_)) + .WillOnce(SetArrayArgument<0>(names.begin(), names.end())); +``` + +## Changing a Mock Object's Behavior Based on the State ## + +If you expect a call to change the behavior of a mock object, you can use `::testing::InSequence` to specify different behaviors before and after the call: + +``` +using ::testing::InSequence; +using ::testing::Return; + +... + { + InSequence seq; + EXPECT_CALL(my_mock, IsDirty()) + .WillRepeatedly(Return(true)); + EXPECT_CALL(my_mock, Flush()); + EXPECT_CALL(my_mock, IsDirty()) + .WillRepeatedly(Return(false)); + } + my_mock.FlushIfDirty(); +``` + +This makes `my_mock.IsDirty()` return `true` before `my_mock.Flush()` is called and return `false` afterwards. + +If the behavior change is more complex, you can store the effects in a variable and make a mock method get its return value from that variable: + +``` +using ::testing::_; +using ::testing::SaveArg; +using ::testing::Return; + +ACTION_P(ReturnPointee, p) { return *p; } +... + int previous_value = 0; + EXPECT_CALL(my_mock, GetPrevValue()) + .WillRepeatedly(ReturnPointee(&previous_value)); + EXPECT_CALL(my_mock, UpdateValue(_)) + .WillRepeatedly(SaveArg<0>(&previous_value)); + my_mock.DoSomethingToUpdateValue(); +``` + +Here `my_mock.GetPrevValue()` will always return the argument of the last `UpdateValue()` call. + +## Setting the Default Value for a Return Type ## + +If a mock method's return type is a built-in C++ type or pointer, by +default it will return 0 when invoked. Also, in C++ 11 and above, a mock +method whose return type has a default constructor will return a default-constructed +value by default. You only need to specify an +action if this default value doesn't work for you. + +Sometimes, you may want to change this default value, or you may want +to specify a default value for types Google Mock doesn't know +about. You can do this using the `::testing::DefaultValue` class +template: + +``` +class MockFoo : public Foo { + public: + MOCK_METHOD0(CalculateBar, Bar()); +}; +... + + Bar default_bar; + // Sets the default return value for type Bar. + DefaultValue::Set(default_bar); + + MockFoo foo; + + // We don't need to specify an action here, as the default + // return value works for us. + EXPECT_CALL(foo, CalculateBar()); + + foo.CalculateBar(); // This should return default_bar. + + // Unsets the default return value. + DefaultValue::Clear(); +``` + +Please note that changing the default value for a type can make you +tests hard to understand. We recommend you to use this feature +judiciously. For example, you may want to make sure the `Set()` and +`Clear()` calls are right next to the code that uses your mock. + +## Setting the Default Actions for a Mock Method ## + +You've learned how to change the default value of a given +type. However, this may be too coarse for your purpose: perhaps you +have two mock methods with the same return type and you want them to +have different behaviors. The `ON_CALL()` macro allows you to +customize your mock's behavior at the method level: + +``` +using ::testing::_; +using ::testing::AnyNumber; +using ::testing::Gt; +using ::testing::Return; +... + ON_CALL(foo, Sign(_)) + .WillByDefault(Return(-1)); + ON_CALL(foo, Sign(0)) + .WillByDefault(Return(0)); + ON_CALL(foo, Sign(Gt(0))) + .WillByDefault(Return(1)); + + EXPECT_CALL(foo, Sign(_)) + .Times(AnyNumber()); + + foo.Sign(5); // This should return 1. + foo.Sign(-9); // This should return -1. + foo.Sign(0); // This should return 0. +``` + +As you may have guessed, when there are more than one `ON_CALL()` +statements, the news order take precedence over the older ones. In +other words, the **last** one that matches the function arguments will +be used. This matching order allows you to set up the common behavior +in a mock object's constructor or the test fixture's set-up phase and +specialize the mock's behavior later. + +## Using Functions/Methods/Functors as Actions ## + +If the built-in actions don't suit you, you can easily use an existing +function, method, or functor as an action: + +``` +using ::testing::_; +using ::testing::Invoke; + +class MockFoo : public Foo { + public: + MOCK_METHOD2(Sum, int(int x, int y)); + MOCK_METHOD1(ComplexJob, bool(int x)); +}; + +int CalculateSum(int x, int y) { return x + y; } + +class Helper { + public: + bool ComplexJob(int x); +}; +... + + MockFoo foo; + Helper helper; + EXPECT_CALL(foo, Sum(_, _)) + .WillOnce(Invoke(CalculateSum)); + EXPECT_CALL(foo, ComplexJob(_)) + .WillOnce(Invoke(&helper, &Helper::ComplexJob)); + + foo.Sum(5, 6); // Invokes CalculateSum(5, 6). + foo.ComplexJob(10); // Invokes helper.ComplexJob(10); +``` + +The only requirement is that the type of the function, etc must be +_compatible_ with the signature of the mock function, meaning that the +latter's arguments can be implicitly converted to the corresponding +arguments of the former, and the former's return type can be +implicitly converted to that of the latter. So, you can invoke +something whose type is _not_ exactly the same as the mock function, +as long as it's safe to do so - nice, huh? + +## Invoking a Function/Method/Functor Without Arguments ## + +`Invoke()` is very useful for doing actions that are more complex. It +passes the mock function's arguments to the function or functor being +invoked such that the callee has the full context of the call to work +with. If the invoked function is not interested in some or all of the +arguments, it can simply ignore them. + +Yet, a common pattern is that a test author wants to invoke a function +without the arguments of the mock function. `Invoke()` allows her to +do that using a wrapper function that throws away the arguments before +invoking an underlining nullary function. Needless to say, this can be +tedious and obscures the intent of the test. + +`InvokeWithoutArgs()` solves this problem. It's like `Invoke()` except +that it doesn't pass the mock function's arguments to the +callee. Here's an example: + +``` +using ::testing::_; +using ::testing::InvokeWithoutArgs; + +class MockFoo : public Foo { + public: + MOCK_METHOD1(ComplexJob, bool(int n)); +}; + +bool Job1() { ... } +... + + MockFoo foo; + EXPECT_CALL(foo, ComplexJob(_)) + .WillOnce(InvokeWithoutArgs(Job1)); + + foo.ComplexJob(10); // Invokes Job1(). +``` + +## Invoking an Argument of the Mock Function ## + +Sometimes a mock function will receive a function pointer or a functor +(in other words, a "callable") as an argument, e.g. + +``` +class MockFoo : public Foo { + public: + MOCK_METHOD2(DoThis, bool(int n, bool (*fp)(int))); +}; +``` + +and you may want to invoke this callable argument: + +``` +using ::testing::_; +... + MockFoo foo; + EXPECT_CALL(foo, DoThis(_, _)) + .WillOnce(...); + // Will execute (*fp)(5), where fp is the + // second argument DoThis() receives. +``` + +Arghh, you need to refer to a mock function argument but your version +of C++ has no lambdas, so you have to define your own action. :-( +Or do you really? + +Well, Google Mock has an action to solve _exactly_ this problem: + +``` + InvokeArgument(arg_1, arg_2, ..., arg_m) +``` + +will invoke the `N`-th (0-based) argument the mock function receives, +with `arg_1`, `arg_2`, ..., and `arg_m`. No matter if the argument is +a function pointer or a functor, Google Mock handles them both. + +With that, you could write: + +``` +using ::testing::_; +using ::testing::InvokeArgument; +... + EXPECT_CALL(foo, DoThis(_, _)) + .WillOnce(InvokeArgument<1>(5)); + // Will execute (*fp)(5), where fp is the + // second argument DoThis() receives. +``` + +What if the callable takes an argument by reference? No problem - just +wrap it inside `ByRef()`: + +``` +... + MOCK_METHOD1(Bar, bool(bool (*fp)(int, const Helper&))); +... +using ::testing::_; +using ::testing::ByRef; +using ::testing::InvokeArgument; +... + + MockFoo foo; + Helper helper; + ... + EXPECT_CALL(foo, Bar(_)) + .WillOnce(InvokeArgument<0>(5, ByRef(helper))); + // ByRef(helper) guarantees that a reference to helper, not a copy of it, + // will be passed to the callable. +``` + +What if the callable takes an argument by reference and we do **not** +wrap the argument in `ByRef()`? Then `InvokeArgument()` will _make a +copy_ of the argument, and pass a _reference to the copy_, instead of +a reference to the original value, to the callable. This is especially +handy when the argument is a temporary value: + +``` +... + MOCK_METHOD1(DoThat, bool(bool (*f)(const double& x, const string& s))); +... +using ::testing::_; +using ::testing::InvokeArgument; +... + + MockFoo foo; + ... + EXPECT_CALL(foo, DoThat(_)) + .WillOnce(InvokeArgument<0>(5.0, string("Hi"))); + // Will execute (*f)(5.0, string("Hi")), where f is the function pointer + // DoThat() receives. Note that the values 5.0 and string("Hi") are + // temporary and dead once the EXPECT_CALL() statement finishes. Yet + // it's fine to perform this action later, since a copy of the values + // are kept inside the InvokeArgument action. +``` + +## Ignoring an Action's Result ## + +Sometimes you have an action that returns _something_, but you need an +action that returns `void` (perhaps you want to use it in a mock +function that returns `void`, or perhaps it needs to be used in +`DoAll()` and it's not the last in the list). `IgnoreResult()` lets +you do that. For example: + +``` +using ::testing::_; +using ::testing::Invoke; +using ::testing::Return; + +int Process(const MyData& data); +string DoSomething(); + +class MockFoo : public Foo { + public: + MOCK_METHOD1(Abc, void(const MyData& data)); + MOCK_METHOD0(Xyz, bool()); +}; +... + + MockFoo foo; + EXPECT_CALL(foo, Abc(_)) + // .WillOnce(Invoke(Process)); + // The above line won't compile as Process() returns int but Abc() needs + // to return void. + .WillOnce(IgnoreResult(Invoke(Process))); + + EXPECT_CALL(foo, Xyz()) + .WillOnce(DoAll(IgnoreResult(Invoke(DoSomething)), + // Ignores the string DoSomething() returns. + Return(true))); +``` + +Note that you **cannot** use `IgnoreResult()` on an action that already +returns `void`. Doing so will lead to ugly compiler errors. + +## Selecting an Action's Arguments ## + +Say you have a mock function `Foo()` that takes seven arguments, and +you have a custom action that you want to invoke when `Foo()` is +called. Trouble is, the custom action only wants three arguments: + +``` +using ::testing::_; +using ::testing::Invoke; +... + MOCK_METHOD7(Foo, bool(bool visible, const string& name, int x, int y, + const map, double>& weight, + double min_weight, double max_wight)); +... + +bool IsVisibleInQuadrant1(bool visible, int x, int y) { + return visible && x >= 0 && y >= 0; +} +... + + EXPECT_CALL(mock, Foo(_, _, _, _, _, _, _)) + .WillOnce(Invoke(IsVisibleInQuadrant1)); // Uh, won't compile. :-( +``` + +To please the compiler God, you can to define an "adaptor" that has +the same signature as `Foo()` and calls the custom action with the +right arguments: + +``` +using ::testing::_; +using ::testing::Invoke; + +bool MyIsVisibleInQuadrant1(bool visible, const string& name, int x, int y, + const map, double>& weight, + double min_weight, double max_wight) { + return IsVisibleInQuadrant1(visible, x, y); +} +... + + EXPECT_CALL(mock, Foo(_, _, _, _, _, _, _)) + .WillOnce(Invoke(MyIsVisibleInQuadrant1)); // Now it works. +``` + +But isn't this awkward? + +Google Mock provides a generic _action adaptor_, so you can spend your +time minding more important business than writing your own +adaptors. Here's the syntax: + +``` + WithArgs(action) +``` + +creates an action that passes the arguments of the mock function at +the given indices (0-based) to the inner `action` and performs +it. Using `WithArgs`, our original example can be written as: + +``` +using ::testing::_; +using ::testing::Invoke; +using ::testing::WithArgs; +... + EXPECT_CALL(mock, Foo(_, _, _, _, _, _, _)) + .WillOnce(WithArgs<0, 2, 3>(Invoke(IsVisibleInQuadrant1))); + // No need to define your own adaptor. +``` + +For better readability, Google Mock also gives you: + + * `WithoutArgs(action)` when the inner `action` takes _no_ argument, and + * `WithArg(action)` (no `s` after `Arg`) when the inner `action` takes _one_ argument. + +As you may have realized, `InvokeWithoutArgs(...)` is just syntactic +sugar for `WithoutArgs(Invoke(...))`. + +Here are more tips: + + * The inner action used in `WithArgs` and friends does not have to be `Invoke()` -- it can be anything. + * You can repeat an argument in the argument list if necessary, e.g. `WithArgs<2, 3, 3, 5>(...)`. + * You can change the order of the arguments, e.g. `WithArgs<3, 2, 1>(...)`. + * The types of the selected arguments do _not_ have to match the signature of the inner action exactly. It works as long as they can be implicitly converted to the corresponding arguments of the inner action. For example, if the 4-th argument of the mock function is an `int` and `my_action` takes a `double`, `WithArg<4>(my_action)` will work. + +## Ignoring Arguments in Action Functions ## + +The selecting-an-action's-arguments recipe showed us one way to make a +mock function and an action with incompatible argument lists fit +together. The downside is that wrapping the action in +`WithArgs<...>()` can get tedious for people writing the tests. + +If you are defining a function, method, or functor to be used with +`Invoke*()`, and you are not interested in some of its arguments, an +alternative to `WithArgs` is to declare the uninteresting arguments as +`Unused`. This makes the definition less cluttered and less fragile in +case the types of the uninteresting arguments change. It could also +increase the chance the action function can be reused. For example, +given + +``` + MOCK_METHOD3(Foo, double(const string& label, double x, double y)); + MOCK_METHOD3(Bar, double(int index, double x, double y)); +``` + +instead of + +``` +using ::testing::_; +using ::testing::Invoke; + +double DistanceToOriginWithLabel(const string& label, double x, double y) { + return sqrt(x*x + y*y); +} + +double DistanceToOriginWithIndex(int index, double x, double y) { + return sqrt(x*x + y*y); +} +... + + EXEPCT_CALL(mock, Foo("abc", _, _)) + .WillOnce(Invoke(DistanceToOriginWithLabel)); + EXEPCT_CALL(mock, Bar(5, _, _)) + .WillOnce(Invoke(DistanceToOriginWithIndex)); +``` + +you could write + +``` +using ::testing::_; +using ::testing::Invoke; +using ::testing::Unused; + +double DistanceToOrigin(Unused, double x, double y) { + return sqrt(x*x + y*y); +} +... + + EXEPCT_CALL(mock, Foo("abc", _, _)) + .WillOnce(Invoke(DistanceToOrigin)); + EXEPCT_CALL(mock, Bar(5, _, _)) + .WillOnce(Invoke(DistanceToOrigin)); +``` + +## Sharing Actions ## + +Just like matchers, a Google Mock action object consists of a pointer +to a ref-counted implementation object. Therefore copying actions is +also allowed and very efficient. When the last action that references +the implementation object dies, the implementation object will be +deleted. + +If you have some complex action that you want to use again and again, +you may not have to build it from scratch every time. If the action +doesn't have an internal state (i.e. if it always does the same thing +no matter how many times it has been called), you can assign it to an +action variable and use that variable repeatedly. For example: + +``` + Action set_flag = DoAll(SetArgPointee<0>(5), + Return(true)); + ... use set_flag in .WillOnce() and .WillRepeatedly() ... +``` + +However, if the action has its own state, you may be surprised if you +share the action object. Suppose you have an action factory +`IncrementCounter(init)` which creates an action that increments and +returns a counter whose initial value is `init`, using two actions +created from the same expression and using a shared action will +exihibit different behaviors. Example: + +``` + EXPECT_CALL(foo, DoThis()) + .WillRepeatedly(IncrementCounter(0)); + EXPECT_CALL(foo, DoThat()) + .WillRepeatedly(IncrementCounter(0)); + foo.DoThis(); // Returns 1. + foo.DoThis(); // Returns 2. + foo.DoThat(); // Returns 1 - Blah() uses a different + // counter than Bar()'s. +``` + +versus + +``` + Action increment = IncrementCounter(0); + + EXPECT_CALL(foo, DoThis()) + .WillRepeatedly(increment); + EXPECT_CALL(foo, DoThat()) + .WillRepeatedly(increment); + foo.DoThis(); // Returns 1. + foo.DoThis(); // Returns 2. + foo.DoThat(); // Returns 3 - the counter is shared. +``` + +# Misc Recipes on Using Google Mock # + +## Mocking Methods That Use Move-Only Types ## + +C++11 introduced move-only types. A move-only-typed value can be moved from one object to another, but cannot be copied. `std::unique_ptr` is probably the most commonly used move-only type. + +Mocking a method that takes and/or returns move-only types presents some challenges, but nothing insurmountable. This recipe shows you how you can do it. + +Let’s say we are working on a fictional project that lets one post and share snippets called “buzzes”. Your code uses these types: + +``` +enum class AccessLevel { kInternal, kPublic }; + +class Buzz { + public: + explicit Buzz(AccessLevel access) { … } + ... +}; + +class Buzzer { + public: + virtual ~Buzzer() {} + virtual std::unique_ptr MakeBuzz(const std::string& text) = 0; + virtual bool ShareBuzz(std::unique_ptr buzz, Time timestamp) = 0; + ... +}; +``` + +A `Buzz` object represents a snippet being posted. A class that implements the `Buzzer` interface is capable of creating and sharing `Buzz`. Methods in `Buzzer` may return a `unique_ptr` or take a `unique_ptr`. Now we need to mock `Buzzer` in our tests. + +To mock a method that returns a move-only type, you just use the familiar `MOCK_METHOD` syntax as usual: + +``` +class MockBuzzer : public Buzzer { + public: + MOCK_METHOD1(MakeBuzz, std::unique_ptr(const std::string& text)); + … +}; +``` + +However, if you attempt to use the same `MOCK_METHOD` pattern to mock a method that takes a move-only parameter, you’ll get a compiler error currently: + +``` + // Does NOT compile! + MOCK_METHOD2(ShareBuzz, bool(std::unique_ptr buzz, Time timestamp)); +``` + +While it’s highly desirable to make this syntax just work, it’s not trivial and the work hasn’t been done yet. Fortunately, there is a trick you can apply today to get something that works nearly as well as this. + +The trick, is to delegate the `ShareBuzz()` method to a mock method (let’s call it `DoShareBuzz()`) that does not take move-only parameters: + +``` +class MockBuzzer : public Buzzer { + public: + MOCK_METHOD1(MakeBuzz, std::unique_ptr(const std::string& text)); + MOCK_METHOD2(DoShareBuzz, bool(Buzz* buzz, Time timestamp)); + bool ShareBuzz(std::unique_ptr buzz, Time timestamp) { + return DoShareBuzz(buzz.get(), timestamp); + } +}; +``` + +Note that there's no need to define or declare `DoShareBuzz()` in a base class. You only need to define it as a `MOCK_METHOD` in the mock class. + +Now that we have the mock class defined, we can use it in tests. In the following code examples, we assume that we have defined a `MockBuzzer` object named `mock_buzzer_`: + +``` + MockBuzzer mock_buzzer_; +``` + +First let’s see how we can set expectations on the `MakeBuzz()` method, which returns a `unique_ptr`. + +As usual, if you set an expectation without an action (i.e. the `.WillOnce()` or `.WillRepeated()` clause), when that expectation fires, the default action for that method will be taken. Since `unique_ptr<>` has a default constructor that returns a null `unique_ptr`, that’s what you’ll get if you don’t specify an action: + +``` + // Use the default action. + EXPECT_CALL(mock_buzzer_, MakeBuzz("hello")); + + // Triggers the previous EXPECT_CALL. + EXPECT_EQ(nullptr, mock_buzzer_.MakeBuzz("hello")); +``` + +If you are not happy with the default action, you can tweak it. Depending on what you need, you may either tweak the default action for a specific (mock object, mock method) combination using `ON_CALL()`, or you may tweak the default action for all mock methods that return a specific type. The usage of `ON_CALL()` is similar to `EXPECT_CALL()`, so we’ll skip it and just explain how to do the latter (tweaking the default action for a specific return type). You do this via the `DefaultValue<>::SetFactory()` and `DefaultValue<>::Clear()` API: + +``` + // Sets the default action for return type std::unique_ptr to + // creating a new Buzz every time. + DefaultValue>::SetFactory( + [] { return MakeUnique(AccessLevel::kInternal); }); + + // When this fires, the default action of MakeBuzz() will run, which + // will return a new Buzz object. + EXPECT_CALL(mock_buzzer_, MakeBuzz("hello")).Times(AnyNumber()); + + auto buzz1 = mock_buzzer_.MakeBuzz("hello"); + auto buzz2 = mock_buzzer_.MakeBuzz("hello"); + EXPECT_NE(nullptr, buzz1); + EXPECT_NE(nullptr, buzz2); + EXPECT_NE(buzz1, buzz2); + + // Resets the default action for return type std::unique_ptr, + // to avoid interfere with other tests. + DefaultValue>::Clear(); +``` + +What if you want the method to do something other than the default action? If you just need to return a pre-defined move-only value, you can use the `Return(ByMove(...))` action: + +``` + // When this fires, the unique_ptr<> specified by ByMove(...) will + // be returned. + EXPECT_CALL(mock_buzzer_, MakeBuzz("world")) + .WillOnce(Return(ByMove(MakeUnique(AccessLevel::kInternal)))); + + EXPECT_NE(nullptr, mock_buzzer_.MakeBuzz("world")); +``` + +Note that `ByMove()` is essential here - if you drop it, the code won’t compile. + +Quiz time! What do you think will happen if a `Return(ByMove(...))` action is performed more than once (e.g. you write `….WillRepeatedly(Return(ByMove(...)));`)? Come think of it, after the first time the action runs, the source value will be consumed (since it’s a move-only value), so the next time around, there’s no value to move from -- you’ll get a run-time error that `Return(ByMove(...))` can only be run once. + +If you need your mock method to do more than just moving a pre-defined value, remember that you can always use `Invoke()` to call a lambda or a callable object, which can do pretty much anything you want: + +``` + EXPECT_CALL(mock_buzzer_, MakeBuzz("x")) + .WillRepeatedly(Invoke([](const std::string& text) { + return std::make_unique(AccessLevel::kInternal); + })); + + EXPECT_NE(nullptr, mock_buzzer_.MakeBuzz("x")); + EXPECT_NE(nullptr, mock_buzzer_.MakeBuzz("x")); +``` + +Every time this `EXPECT_CALL` fires, a new `unique_ptr` will be created and returned. You cannot do this with `Return(ByMove(...))`. + +Now there’s one topic we haven’t covered: how do you set expectations on `ShareBuzz()`, which takes a move-only-typed parameter? The answer is you don’t. Instead, you set expectations on the `DoShareBuzz()` mock method (remember that we defined a `MOCK_METHOD` for `DoShareBuzz()`, not `ShareBuzz()`): + +``` + EXPECT_CALL(mock_buzzer_, DoShareBuzz(NotNull(), _)); + + // When one calls ShareBuzz() on the MockBuzzer like this, the call is + // forwarded to DoShareBuzz(), which is mocked. Therefore this statement + // will trigger the above EXPECT_CALL. + mock_buzzer_.ShareBuzz(MakeUnique(AccessLevel::kInternal), + ::base::Now()); +``` + +Some of you may have spotted one problem with this approach: the `DoShareBuzz()` mock method differs from the real `ShareBuzz()` method in that it cannot take ownership of the buzz parameter - `ShareBuzz()` will always delete buzz after `DoShareBuzz()` returns. What if you need to save the buzz object somewhere for later use when `ShareBuzz()` is called? Indeed, you'd be stuck. + +Another problem with the `DoShareBuzz()` we had is that it can surprise people reading or maintaining the test, as one would expect that `DoShareBuzz()` has (logically) the same contract as `ShareBuzz()`. + +Fortunately, these problems can be fixed with a bit more code. Let's try to get it right this time: + +``` +class MockBuzzer : public Buzzer { + public: + MockBuzzer() { + // Since DoShareBuzz(buzz, time) is supposed to take ownership of + // buzz, define a default behavior for DoShareBuzz(buzz, time) to + // delete buzz. + ON_CALL(*this, DoShareBuzz(_, _)) + .WillByDefault(Invoke([](Buzz* buzz, Time timestamp) { + delete buzz; + return true; + })); + } + + MOCK_METHOD1(MakeBuzz, std::unique_ptr(const std::string& text)); + + // Takes ownership of buzz. + MOCK_METHOD2(DoShareBuzz, bool(Buzz* buzz, Time timestamp)); + bool ShareBuzz(std::unique_ptr buzz, Time timestamp) { + return DoShareBuzz(buzz.release(), timestamp); + } +}; +``` + +Now, the mock `DoShareBuzz()` method is free to save the buzz argument for later use if this is what you want: + +``` + std::unique_ptr intercepted_buzz; + EXPECT_CALL(mock_buzzer_, DoShareBuzz(NotNull(), _)) + .WillOnce(Invoke([&intercepted_buzz](Buzz* buzz, Time timestamp) { + // Save buzz in intercepted_buzz for analysis later. + intercepted_buzz.reset(buzz); + return false; + })); + + mock_buzzer_.ShareBuzz(std::make_unique(AccessLevel::kInternal), + Now()); + EXPECT_NE(nullptr, intercepted_buzz); +``` + +Using the tricks covered in this recipe, you are now able to mock methods that take and/or return move-only types. Put your newly-acquired power to good use - when you design a new API, you can now feel comfortable using `unique_ptrs` as appropriate, without fearing that doing so will compromise your tests. + +## Making the Compilation Faster ## + +Believe it or not, the _vast majority_ of the time spent on compiling +a mock class is in generating its constructor and destructor, as they +perform non-trivial tasks (e.g. verification of the +expectations). What's more, mock methods with different signatures +have different types and thus their constructors/destructors need to +be generated by the compiler separately. As a result, if you mock many +different types of methods, compiling your mock class can get really +slow. + +If you are experiencing slow compilation, you can move the definition +of your mock class' constructor and destructor out of the class body +and into a `.cpp` file. This way, even if you `#include` your mock +class in N files, the compiler only needs to generate its constructor +and destructor once, resulting in a much faster compilation. + +Let's illustrate the idea using an example. Here's the definition of a +mock class before applying this recipe: + +``` +// File mock_foo.h. +... +class MockFoo : public Foo { + public: + // Since we don't declare the constructor or the destructor, + // the compiler will generate them in every translation unit + // where this mock class is used. + + MOCK_METHOD0(DoThis, int()); + MOCK_METHOD1(DoThat, bool(const char* str)); + ... more mock methods ... +}; +``` + +After the change, it would look like: + +``` +// File mock_foo.h. +... +class MockFoo : public Foo { + public: + // The constructor and destructor are declared, but not defined, here. + MockFoo(); + virtual ~MockFoo(); + + MOCK_METHOD0(DoThis, int()); + MOCK_METHOD1(DoThat, bool(const char* str)); + ... more mock methods ... +}; +``` +and +``` +// File mock_foo.cpp. +#include "path/to/mock_foo.h" + +// The definitions may appear trivial, but the functions actually do a +// lot of things through the constructors/destructors of the member +// variables used to implement the mock methods. +MockFoo::MockFoo() {} +MockFoo::~MockFoo() {} +``` + +## Forcing a Verification ## + +When it's being destroyed, your friendly mock object will automatically +verify that all expectations on it have been satisfied, and will +generate [Google Test](../../googletest/) failures +if not. This is convenient as it leaves you with one less thing to +worry about. That is, unless you are not sure if your mock object will +be destroyed. + +How could it be that your mock object won't eventually be destroyed? +Well, it might be created on the heap and owned by the code you are +testing. Suppose there's a bug in that code and it doesn't delete the +mock object properly - you could end up with a passing test when +there's actually a bug. + +Using a heap checker is a good idea and can alleviate the concern, but +its implementation may not be 100% reliable. So, sometimes you do want +to _force_ Google Mock to verify a mock object before it is +(hopefully) destructed. You can do this with +`Mock::VerifyAndClearExpectations(&mock_object)`: + +``` +TEST(MyServerTest, ProcessesRequest) { + using ::testing::Mock; + + MockFoo* const foo = new MockFoo; + EXPECT_CALL(*foo, ...)...; + // ... other expectations ... + + // server now owns foo. + MyServer server(foo); + server.ProcessRequest(...); + + // In case that server's destructor will forget to delete foo, + // this will verify the expectations anyway. + Mock::VerifyAndClearExpectations(foo); +} // server is destroyed when it goes out of scope here. +``` + +**Tip:** The `Mock::VerifyAndClearExpectations()` function returns a +`bool` to indicate whether the verification was successful (`true` for +yes), so you can wrap that function call inside a `ASSERT_TRUE()` if +there is no point going further when the verification has failed. + +## Using Check Points ## + +Sometimes you may want to "reset" a mock object at various check +points in your test: at each check point, you verify that all existing +expectations on the mock object have been satisfied, and then you set +some new expectations on it as if it's newly created. This allows you +to work with a mock object in "phases" whose sizes are each +manageable. + +One such scenario is that in your test's `SetUp()` function, you may +want to put the object you are testing into a certain state, with the +help from a mock object. Once in the desired state, you want to clear +all expectations on the mock, such that in the `TEST_F` body you can +set fresh expectations on it. + +As you may have figured out, the `Mock::VerifyAndClearExpectations()` +function we saw in the previous recipe can help you here. Or, if you +are using `ON_CALL()` to set default actions on the mock object and +want to clear the default actions as well, use +`Mock::VerifyAndClear(&mock_object)` instead. This function does what +`Mock::VerifyAndClearExpectations(&mock_object)` does and returns the +same `bool`, **plus** it clears the `ON_CALL()` statements on +`mock_object` too. + +Another trick you can use to achieve the same effect is to put the +expectations in sequences and insert calls to a dummy "check-point" +function at specific places. Then you can verify that the mock +function calls do happen at the right time. For example, if you are +exercising code: + +``` +Foo(1); +Foo(2); +Foo(3); +``` + +and want to verify that `Foo(1)` and `Foo(3)` both invoke +`mock.Bar("a")`, but `Foo(2)` doesn't invoke anything. You can write: + +``` +using ::testing::MockFunction; + +TEST(FooTest, InvokesBarCorrectly) { + MyMock mock; + // Class MockFunction has exactly one mock method. It is named + // Call() and has type F. + MockFunction check; + { + InSequence s; + + EXPECT_CALL(mock, Bar("a")); + EXPECT_CALL(check, Call("1")); + EXPECT_CALL(check, Call("2")); + EXPECT_CALL(mock, Bar("a")); + } + Foo(1); + check.Call("1"); + Foo(2); + check.Call("2"); + Foo(3); +} +``` + +The expectation spec says that the first `Bar("a")` must happen before +check point "1", the second `Bar("a")` must happen after check point "2", +and nothing should happen between the two check points. The explicit +check points make it easy to tell which `Bar("a")` is called by which +call to `Foo()`. + +## Mocking Destructors ## + +Sometimes you want to make sure a mock object is destructed at the +right time, e.g. after `bar->A()` is called but before `bar->B()` is +called. We already know that you can specify constraints on the order +of mock function calls, so all we need to do is to mock the destructor +of the mock function. + +This sounds simple, except for one problem: a destructor is a special +function with special syntax and special semantics, and the +`MOCK_METHOD0` macro doesn't work for it: + +``` + MOCK_METHOD0(~MockFoo, void()); // Won't compile! +``` + +The good news is that you can use a simple pattern to achieve the same +effect. First, add a mock function `Die()` to your mock class and call +it in the destructor, like this: + +``` +class MockFoo : public Foo { + ... + // Add the following two lines to the mock class. + MOCK_METHOD0(Die, void()); + virtual ~MockFoo() { Die(); } +}; +``` + +(If the name `Die()` clashes with an existing symbol, choose another +name.) Now, we have translated the problem of testing when a `MockFoo` +object dies to testing when its `Die()` method is called: + +``` + MockFoo* foo = new MockFoo; + MockBar* bar = new MockBar; + ... + { + InSequence s; + + // Expects *foo to die after bar->A() and before bar->B(). + EXPECT_CALL(*bar, A()); + EXPECT_CALL(*foo, Die()); + EXPECT_CALL(*bar, B()); + } +``` + +And that's that. + +## Using Google Mock and Threads ## + +**IMPORTANT NOTE:** What we describe in this recipe is **ONLY** true on +platforms where Google Mock is thread-safe. Currently these are only +platforms that support the pthreads library (this includes Linux and Mac). +To make it thread-safe on other platforms we only need to implement +some synchronization operations in `"gtest/internal/gtest-port.h"`. + +In a **unit** test, it's best if you could isolate and test a piece of +code in a single-threaded context. That avoids race conditions and +dead locks, and makes debugging your test much easier. + +Yet many programs are multi-threaded, and sometimes to test something +we need to pound on it from more than one thread. Google Mock works +for this purpose too. + +Remember the steps for using a mock: + + 1. Create a mock object `foo`. + 1. Set its default actions and expectations using `ON_CALL()` and `EXPECT_CALL()`. + 1. The code under test calls methods of `foo`. + 1. Optionally, verify and reset the mock. + 1. Destroy the mock yourself, or let the code under test destroy it. The destructor will automatically verify it. + +If you follow the following simple rules, your mocks and threads can +live happily together: + + * Execute your _test code_ (as opposed to the code being tested) in _one_ thread. This makes your test easy to follow. + * Obviously, you can do step #1 without locking. + * When doing step #2 and #5, make sure no other thread is accessing `foo`. Obvious too, huh? + * #3 and #4 can be done either in one thread or in multiple threads - anyway you want. Google Mock takes care of the locking, so you don't have to do any - unless required by your test logic. + +If you violate the rules (for example, if you set expectations on a +mock while another thread is calling its methods), you get undefined +behavior. That's not fun, so don't do it. + +Google Mock guarantees that the action for a mock function is done in +the same thread that called the mock function. For example, in + +``` + EXPECT_CALL(mock, Foo(1)) + .WillOnce(action1); + EXPECT_CALL(mock, Foo(2)) + .WillOnce(action2); +``` + +if `Foo(1)` is called in thread 1 and `Foo(2)` is called in thread 2, +Google Mock will execute `action1` in thread 1 and `action2` in thread +2. + +Google Mock does _not_ impose a sequence on actions performed in +different threads (doing so may create deadlocks as the actions may +need to cooperate). This means that the execution of `action1` and +`action2` in the above example _may_ interleave. If this is a problem, +you should add proper synchronization logic to `action1` and `action2` +to make the test thread-safe. + + +Also, remember that `DefaultValue` is a global resource that +potentially affects _all_ living mock objects in your +program. Naturally, you won't want to mess with it from multiple +threads or when there still are mocks in action. + +## Controlling How Much Information Google Mock Prints ## + +When Google Mock sees something that has the potential of being an +error (e.g. a mock function with no expectation is called, a.k.a. an +uninteresting call, which is allowed but perhaps you forgot to +explicitly ban the call), it prints some warning messages, including +the arguments of the function and the return value. Hopefully this +will remind you to take a look and see if there is indeed a problem. + +Sometimes you are confident that your tests are correct and may not +appreciate such friendly messages. Some other times, you are debugging +your tests or learning about the behavior of the code you are testing, +and wish you could observe every mock call that happens (including +argument values and the return value). Clearly, one size doesn't fit +all. + +You can control how much Google Mock tells you using the +`--gmock_verbose=LEVEL` command-line flag, where `LEVEL` is a string +with three possible values: + + * `info`: Google Mock will print all informational messages, warnings, and errors (most verbose). At this setting, Google Mock will also log any calls to the `ON_CALL/EXPECT_CALL` macros. + * `warning`: Google Mock will print both warnings and errors (less verbose). This is the default. + * `error`: Google Mock will print errors only (least verbose). + +Alternatively, you can adjust the value of that flag from within your +tests like so: + +``` + ::testing::FLAGS_gmock_verbose = "error"; +``` + +Now, judiciously use the right flag to enable Google Mock serve you better! + +## Gaining Super Vision into Mock Calls ## + +You have a test using Google Mock. It fails: Google Mock tells you +that some expectations aren't satisfied. However, you aren't sure why: +Is there a typo somewhere in the matchers? Did you mess up the order +of the `EXPECT_CALL`s? Or is the code under test doing something +wrong? How can you find out the cause? + +Won't it be nice if you have X-ray vision and can actually see the +trace of all `EXPECT_CALL`s and mock method calls as they are made? +For each call, would you like to see its actual argument values and +which `EXPECT_CALL` Google Mock thinks it matches? + +You can unlock this power by running your test with the +`--gmock_verbose=info` flag. For example, given the test program: + +``` +using testing::_; +using testing::HasSubstr; +using testing::Return; + +class MockFoo { + public: + MOCK_METHOD2(F, void(const string& x, const string& y)); +}; + +TEST(Foo, Bar) { + MockFoo mock; + EXPECT_CALL(mock, F(_, _)).WillRepeatedly(Return()); + EXPECT_CALL(mock, F("a", "b")); + EXPECT_CALL(mock, F("c", HasSubstr("d"))); + + mock.F("a", "good"); + mock.F("a", "b"); +} +``` + +if you run it with `--gmock_verbose=info`, you will see this output: + +``` +[ RUN ] Foo.Bar + +foo_test.cc:14: EXPECT_CALL(mock, F(_, _)) invoked +foo_test.cc:15: EXPECT_CALL(mock, F("a", "b")) invoked +foo_test.cc:16: EXPECT_CALL(mock, F("c", HasSubstr("d"))) invoked +foo_test.cc:14: Mock function call matches EXPECT_CALL(mock, F(_, _))... + Function call: F(@0x7fff7c8dad40"a", @0x7fff7c8dad10"good") +foo_test.cc:15: Mock function call matches EXPECT_CALL(mock, F("a", "b"))... + Function call: F(@0x7fff7c8dada0"a", @0x7fff7c8dad70"b") +foo_test.cc:16: Failure +Actual function call count doesn't match EXPECT_CALL(mock, F("c", HasSubstr("d")))... + Expected: to be called once + Actual: never called - unsatisfied and active +[ FAILED ] Foo.Bar +``` + +Suppose the bug is that the `"c"` in the third `EXPECT_CALL` is a typo +and should actually be `"a"`. With the above message, you should see +that the actual `F("a", "good")` call is matched by the first +`EXPECT_CALL`, not the third as you thought. From that it should be +obvious that the third `EXPECT_CALL` is written wrong. Case solved. + +## Running Tests in Emacs ## + +If you build and run your tests in Emacs, the source file locations of +Google Mock and [Google Test](../../googletest/) +errors will be highlighted. Just press `` on one of them and +you'll be taken to the offending line. Or, you can just type `C-x `` +to jump to the next error. + +To make it even easier, you can add the following lines to your +`~/.emacs` file: + +``` +(global-set-key "\M-m" 'compile) ; m is for make +(global-set-key [M-down] 'next-error) +(global-set-key [M-up] '(lambda () (interactive) (next-error -1))) +``` + +Then you can type `M-m` to start a build, or `M-up`/`M-down` to move +back and forth between errors. + +## Fusing Google Mock Source Files ## + +Google Mock's implementation consists of dozens of files (excluding +its own tests). Sometimes you may want them to be packaged up in +fewer files instead, such that you can easily copy them to a new +machine and start hacking there. For this we provide an experimental +Python script `fuse_gmock_files.py` in the `scripts/` directory +(starting with release 1.2.0). Assuming you have Python 2.4 or above +installed on your machine, just go to that directory and run +``` +python fuse_gmock_files.py OUTPUT_DIR +``` + +and you should see an `OUTPUT_DIR` directory being created with files +`gtest/gtest.h`, `gmock/gmock.h`, and `gmock-gtest-all.cc` in it. +These three files contain everything you need to use Google Mock (and +Google Test). Just copy them to anywhere you want and you are ready +to write tests and use mocks. You can use the +[scrpts/test/Makefile](../scripts/test/Makefile) file as an example on how to compile your tests +against them. + +# Extending Google Mock # + +## Writing New Matchers Quickly ## + +The `MATCHER*` family of macros can be used to define custom matchers +easily. The syntax: + +``` +MATCHER(name, description_string_expression) { statements; } +``` + +will define a matcher with the given name that executes the +statements, which must return a `bool` to indicate if the match +succeeds. Inside the statements, you can refer to the value being +matched by `arg`, and refer to its type by `arg_type`. + +The description string is a `string`-typed expression that documents +what the matcher does, and is used to generate the failure message +when the match fails. It can (and should) reference the special +`bool` variable `negation`, and should evaluate to the description of +the matcher when `negation` is `false`, or that of the matcher's +negation when `negation` is `true`. + +For convenience, we allow the description string to be empty (`""`), +in which case Google Mock will use the sequence of words in the +matcher name as the description. + +For example: +``` +MATCHER(IsDivisibleBy7, "") { return (arg % 7) == 0; } +``` +allows you to write +``` + // Expects mock_foo.Bar(n) to be called where n is divisible by 7. + EXPECT_CALL(mock_foo, Bar(IsDivisibleBy7())); +``` +or, +``` +using ::testing::Not; +... + EXPECT_THAT(some_expression, IsDivisibleBy7()); + EXPECT_THAT(some_other_expression, Not(IsDivisibleBy7())); +``` +If the above assertions fail, they will print something like: +``` + Value of: some_expression + Expected: is divisible by 7 + Actual: 27 +... + Value of: some_other_expression + Expected: not (is divisible by 7) + Actual: 21 +``` +where the descriptions `"is divisible by 7"` and `"not (is divisible +by 7)"` are automatically calculated from the matcher name +`IsDivisibleBy7`. + +As you may have noticed, the auto-generated descriptions (especially +those for the negation) may not be so great. You can always override +them with a string expression of your own: +``` +MATCHER(IsDivisibleBy7, std::string(negation ? "isn't" : "is") + + " divisible by 7") { + return (arg % 7) == 0; +} +``` + +Optionally, you can stream additional information to a hidden argument +named `result_listener` to explain the match result. For example, a +better definition of `IsDivisibleBy7` is: +``` +MATCHER(IsDivisibleBy7, "") { + if ((arg % 7) == 0) + return true; + + *result_listener << "the remainder is " << (arg % 7); + return false; +} +``` + +With this definition, the above assertion will give a better message: +``` + Value of: some_expression + Expected: is divisible by 7 + Actual: 27 (the remainder is 6) +``` + +You should let `MatchAndExplain()` print _any additional information_ +that can help a user understand the match result. Note that it should +explain why the match succeeds in case of a success (unless it's +obvious) - this is useful when the matcher is used inside +`Not()`. There is no need to print the argument value itself, as +Google Mock already prints it for you. + +**Notes:** + + 1. The type of the value being matched (`arg_type`) is determined by the context in which you use the matcher and is supplied to you by the compiler, so you don't need to worry about declaring it (nor can you). This allows the matcher to be polymorphic. For example, `IsDivisibleBy7()` can be used to match any type where the value of `(arg % 7) == 0` can be implicitly converted to a `bool`. In the `Bar(IsDivisibleBy7())` example above, if method `Bar()` takes an `int`, `arg_type` will be `int`; if it takes an `unsigned long`, `arg_type` will be `unsigned long`; and so on. + 1. Google Mock doesn't guarantee when or how many times a matcher will be invoked. Therefore the matcher logic must be _purely functional_ (i.e. it cannot have any side effect, and the result must not depend on anything other than the value being matched and the matcher parameters). This requirement must be satisfied no matter how you define the matcher (e.g. using one of the methods described in the following recipes). In particular, a matcher can never call a mock function, as that will affect the state of the mock object and Google Mock. + +## Writing New Parameterized Matchers Quickly ## + +Sometimes you'll want to define a matcher that has parameters. For that you +can use the macro: +``` +MATCHER_P(name, param_name, description_string) { statements; } +``` +where the description string can be either `""` or a string expression +that references `negation` and `param_name`. + +For example: +``` +MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; } +``` +will allow you to write: +``` + EXPECT_THAT(Blah("a"), HasAbsoluteValue(n)); +``` +which may lead to this message (assuming `n` is 10): +``` + Value of: Blah("a") + Expected: has absolute value 10 + Actual: -9 +``` + +Note that both the matcher description and its parameter are +printed, making the message human-friendly. + +In the matcher definition body, you can write `foo_type` to +reference the type of a parameter named `foo`. For example, in the +body of `MATCHER_P(HasAbsoluteValue, value)` above, you can write +`value_type` to refer to the type of `value`. + +Google Mock also provides `MATCHER_P2`, `MATCHER_P3`, ..., up to +`MATCHER_P10` to support multi-parameter matchers: +``` +MATCHER_Pk(name, param_1, ..., param_k, description_string) { statements; } +``` + +Please note that the custom description string is for a particular +**instance** of the matcher, where the parameters have been bound to +actual values. Therefore usually you'll want the parameter values to +be part of the description. Google Mock lets you do that by +referencing the matcher parameters in the description string +expression. + +For example, +``` + using ::testing::PrintToString; + MATCHER_P2(InClosedRange, low, hi, + std::string(negation ? "isn't" : "is") + " in range [" + + PrintToString(low) + ", " + PrintToString(hi) + "]") { + return low <= arg && arg <= hi; + } + ... + EXPECT_THAT(3, InClosedRange(4, 6)); +``` +would generate a failure that contains the message: +``` + Expected: is in range [4, 6] +``` + +If you specify `""` as the description, the failure message will +contain the sequence of words in the matcher name followed by the +parameter values printed as a tuple. For example, +``` + MATCHER_P2(InClosedRange, low, hi, "") { ... } + ... + EXPECT_THAT(3, InClosedRange(4, 6)); +``` +would generate a failure that contains the text: +``` + Expected: in closed range (4, 6) +``` + +For the purpose of typing, you can view +``` +MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... } +``` +as shorthand for +``` +template +FooMatcherPk +Foo(p1_type p1, ..., pk_type pk) { ... } +``` + +When you write `Foo(v1, ..., vk)`, the compiler infers the types of +the parameters `v1`, ..., and `vk` for you. If you are not happy with +the result of the type inference, you can specify the types by +explicitly instantiating the template, as in `Foo(5, false)`. +As said earlier, you don't get to (or need to) specify +`arg_type` as that's determined by the context in which the matcher +is used. + +You can assign the result of expression `Foo(p1, ..., pk)` to a +variable of type `FooMatcherPk`. This can be +useful when composing matchers. Matchers that don't have a parameter +or have only one parameter have special types: you can assign `Foo()` +to a `FooMatcher`-typed variable, and assign `Foo(p)` to a +`FooMatcherP`-typed variable. + +While you can instantiate a matcher template with reference types, +passing the parameters by pointer usually makes your code more +readable. If, however, you still want to pass a parameter by +reference, be aware that in the failure message generated by the +matcher you will see the value of the referenced object but not its +address. + +You can overload matchers with different numbers of parameters: +``` +MATCHER_P(Blah, a, description_string_1) { ... } +MATCHER_P2(Blah, a, b, description_string_2) { ... } +``` + +While it's tempting to always use the `MATCHER*` macros when defining +a new matcher, you should also consider implementing +`MatcherInterface` or using `MakePolymorphicMatcher()` instead (see +the recipes that follow), especially if you need to use the matcher a +lot. While these approaches require more work, they give you more +control on the types of the value being matched and the matcher +parameters, which in general leads to better compiler error messages +that pay off in the long run. They also allow overloading matchers +based on parameter types (as opposed to just based on the number of +parameters). + +## Writing New Monomorphic Matchers ## + +A matcher of argument type `T` implements +`::testing::MatcherInterface` and does two things: it tests whether a +value of type `T` matches the matcher, and can describe what kind of +values it matches. The latter ability is used for generating readable +error messages when expectations are violated. + +The interface looks like this: + +``` +class MatchResultListener { + public: + ... + // Streams x to the underlying ostream; does nothing if the ostream + // is NULL. + template + MatchResultListener& operator<<(const T& x); + + // Returns the underlying ostream. + ::std::ostream* stream(); +}; + +template +class MatcherInterface { + public: + virtual ~MatcherInterface(); + + // Returns true iff the matcher matches x; also explains the match + // result to 'listener'. + virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0; + + // Describes this matcher to an ostream. + virtual void DescribeTo(::std::ostream* os) const = 0; + + // Describes the negation of this matcher to an ostream. + virtual void DescribeNegationTo(::std::ostream* os) const; +}; +``` + +If you need a custom matcher but `Truly()` is not a good option (for +example, you may not be happy with the way `Truly(predicate)` +describes itself, or you may want your matcher to be polymorphic as +`Eq(value)` is), you can define a matcher to do whatever you want in +two steps: first implement the matcher interface, and then define a +factory function to create a matcher instance. The second step is not +strictly needed but it makes the syntax of using the matcher nicer. + +For example, you can define a matcher to test whether an `int` is +divisible by 7 and then use it like this: +``` +using ::testing::MakeMatcher; +using ::testing::Matcher; +using ::testing::MatcherInterface; +using ::testing::MatchResultListener; + +class DivisibleBy7Matcher : public MatcherInterface { + public: + virtual bool MatchAndExplain(int n, MatchResultListener* listener) const { + return (n % 7) == 0; + } + + virtual void DescribeTo(::std::ostream* os) const { + *os << "is divisible by 7"; + } + + virtual void DescribeNegationTo(::std::ostream* os) const { + *os << "is not divisible by 7"; + } +}; + +inline Matcher DivisibleBy7() { + return MakeMatcher(new DivisibleBy7Matcher); +} +... + + EXPECT_CALL(foo, Bar(DivisibleBy7())); +``` + +You may improve the matcher message by streaming additional +information to the `listener` argument in `MatchAndExplain()`: + +``` +class DivisibleBy7Matcher : public MatcherInterface { + public: + virtual bool MatchAndExplain(int n, + MatchResultListener* listener) const { + const int remainder = n % 7; + if (remainder != 0) { + *listener << "the remainder is " << remainder; + } + return remainder == 0; + } + ... +}; +``` + +Then, `EXPECT_THAT(x, DivisibleBy7());` may general a message like this: +``` +Value of: x +Expected: is divisible by 7 + Actual: 23 (the remainder is 2) +``` + +## Writing New Polymorphic Matchers ## + +You've learned how to write your own matchers in the previous +recipe. Just one problem: a matcher created using `MakeMatcher()` only +works for one particular type of arguments. If you want a +_polymorphic_ matcher that works with arguments of several types (for +instance, `Eq(x)` can be used to match a `value` as long as `value` == +`x` compiles -- `value` and `x` don't have to share the same type), +you can learn the trick from `"gmock/gmock-matchers.h"` but it's a bit +involved. + +Fortunately, most of the time you can define a polymorphic matcher +easily with the help of `MakePolymorphicMatcher()`. Here's how you can +define `NotNull()` as an example: + +``` +using ::testing::MakePolymorphicMatcher; +using ::testing::MatchResultListener; +using ::testing::NotNull; +using ::testing::PolymorphicMatcher; + +class NotNullMatcher { + public: + // To implement a polymorphic matcher, first define a COPYABLE class + // that has three members MatchAndExplain(), DescribeTo(), and + // DescribeNegationTo(), like the following. + + // In this example, we want to use NotNull() with any pointer, so + // MatchAndExplain() accepts a pointer of any type as its first argument. + // In general, you can define MatchAndExplain() as an ordinary method or + // a method template, or even overload it. + template + bool MatchAndExplain(T* p, + MatchResultListener* /* listener */) const { + return p != NULL; + } + + // Describes the property of a value matching this matcher. + void DescribeTo(::std::ostream* os) const { *os << "is not NULL"; } + + // Describes the property of a value NOT matching this matcher. + void DescribeNegationTo(::std::ostream* os) const { *os << "is NULL"; } +}; + +// To construct a polymorphic matcher, pass an instance of the class +// to MakePolymorphicMatcher(). Note the return type. +inline PolymorphicMatcher NotNull() { + return MakePolymorphicMatcher(NotNullMatcher()); +} +... + + EXPECT_CALL(foo, Bar(NotNull())); // The argument must be a non-NULL pointer. +``` + +**Note:** Your polymorphic matcher class does **not** need to inherit from +`MatcherInterface` or any other class, and its methods do **not** need +to be virtual. + +Like in a monomorphic matcher, you may explain the match result by +streaming additional information to the `listener` argument in +`MatchAndExplain()`. + +## Writing New Cardinalities ## + +A cardinality is used in `Times()` to tell Google Mock how many times +you expect a call to occur. It doesn't have to be exact. For example, +you can say `AtLeast(5)` or `Between(2, 4)`. + +If the built-in set of cardinalities doesn't suit you, you are free to +define your own by implementing the following interface (in namespace +`testing`): + +``` +class CardinalityInterface { + public: + virtual ~CardinalityInterface(); + + // Returns true iff call_count calls will satisfy this cardinality. + virtual bool IsSatisfiedByCallCount(int call_count) const = 0; + + // Returns true iff call_count calls will saturate this cardinality. + virtual bool IsSaturatedByCallCount(int call_count) const = 0; + + // Describes self to an ostream. + virtual void DescribeTo(::std::ostream* os) const = 0; +}; +``` + +For example, to specify that a call must occur even number of times, +you can write + +``` +using ::testing::Cardinality; +using ::testing::CardinalityInterface; +using ::testing::MakeCardinality; + +class EvenNumberCardinality : public CardinalityInterface { + public: + virtual bool IsSatisfiedByCallCount(int call_count) const { + return (call_count % 2) == 0; + } + + virtual bool IsSaturatedByCallCount(int call_count) const { + return false; + } + + virtual void DescribeTo(::std::ostream* os) const { + *os << "called even number of times"; + } +}; + +Cardinality EvenNumber() { + return MakeCardinality(new EvenNumberCardinality); +} +... + + EXPECT_CALL(foo, Bar(3)) + .Times(EvenNumber()); +``` + +## Writing New Actions Quickly ## + +If the built-in actions don't work for you, and you find it +inconvenient to use `Invoke()`, you can use a macro from the `ACTION*` +family to quickly define a new action that can be used in your code as +if it's a built-in action. + +By writing +``` +ACTION(name) { statements; } +``` +in a namespace scope (i.e. not inside a class or function), you will +define an action with the given name that executes the statements. +The value returned by `statements` will be used as the return value of +the action. Inside the statements, you can refer to the K-th +(0-based) argument of the mock function as `argK`. For example: +``` +ACTION(IncrementArg1) { return ++(*arg1); } +``` +allows you to write +``` +... WillOnce(IncrementArg1()); +``` + +Note that you don't need to specify the types of the mock function +arguments. Rest assured that your code is type-safe though: +you'll get a compiler error if `*arg1` doesn't support the `++` +operator, or if the type of `++(*arg1)` isn't compatible with the mock +function's return type. + +Another example: +``` +ACTION(Foo) { + (*arg2)(5); + Blah(); + *arg1 = 0; + return arg0; +} +``` +defines an action `Foo()` that invokes argument #2 (a function pointer) +with 5, calls function `Blah()`, sets the value pointed to by argument +#1 to 0, and returns argument #0. + +For more convenience and flexibility, you can also use the following +pre-defined symbols in the body of `ACTION`: + +| `argK_type` | The type of the K-th (0-based) argument of the mock function | +|:------------|:-------------------------------------------------------------| +| `args` | All arguments of the mock function as a tuple | +| `args_type` | The type of all arguments of the mock function as a tuple | +| `return_type` | The return type of the mock function | +| `function_type` | The type of the mock function | + +For example, when using an `ACTION` as a stub action for mock function: +``` +int DoSomething(bool flag, int* ptr); +``` +we have: + +| **Pre-defined Symbol** | **Is Bound To** | +|:-----------------------|:----------------| +| `arg0` | the value of `flag` | +| `arg0_type` | the type `bool` | +| `arg1` | the value of `ptr` | +| `arg1_type` | the type `int*` | +| `args` | the tuple `(flag, ptr)` | +| `args_type` | the type `::testing::tuple` | +| `return_type` | the type `int` | +| `function_type` | the type `int(bool, int*)` | + +## Writing New Parameterized Actions Quickly ## + +Sometimes you'll want to parameterize an action you define. For that +we have another macro +``` +ACTION_P(name, param) { statements; } +``` + +For example, +``` +ACTION_P(Add, n) { return arg0 + n; } +``` +will allow you to write +``` +// Returns argument #0 + 5. +... WillOnce(Add(5)); +``` + +For convenience, we use the term _arguments_ for the values used to +invoke the mock function, and the term _parameters_ for the values +used to instantiate an action. + +Note that you don't need to provide the type of the parameter either. +Suppose the parameter is named `param`, you can also use the +Google-Mock-defined symbol `param_type` to refer to the type of the +parameter as inferred by the compiler. For example, in the body of +`ACTION_P(Add, n)` above, you can write `n_type` for the type of `n`. + +Google Mock also provides `ACTION_P2`, `ACTION_P3`, and etc to support +multi-parameter actions. For example, +``` +ACTION_P2(ReturnDistanceTo, x, y) { + double dx = arg0 - x; + double dy = arg1 - y; + return sqrt(dx*dx + dy*dy); +} +``` +lets you write +``` +... WillOnce(ReturnDistanceTo(5.0, 26.5)); +``` + +You can view `ACTION` as a degenerated parameterized action where the +number of parameters is 0. + +You can also easily define actions overloaded on the number of parameters: +``` +ACTION_P(Plus, a) { ... } +ACTION_P2(Plus, a, b) { ... } +``` + +## Restricting the Type of an Argument or Parameter in an ACTION ## + +For maximum brevity and reusability, the `ACTION*` macros don't ask +you to provide the types of the mock function arguments and the action +parameters. Instead, we let the compiler infer the types for us. + +Sometimes, however, we may want to be more explicit about the types. +There are several tricks to do that. For example: +``` +ACTION(Foo) { + // Makes sure arg0 can be converted to int. + int n = arg0; + ... use n instead of arg0 here ... +} + +ACTION_P(Bar, param) { + // Makes sure the type of arg1 is const char*. + ::testing::StaticAssertTypeEq(); + + // Makes sure param can be converted to bool. + bool flag = param; +} +``` +where `StaticAssertTypeEq` is a compile-time assertion in Google Test +that verifies two types are the same. + +## Writing New Action Templates Quickly ## + +Sometimes you want to give an action explicit template parameters that +cannot be inferred from its value parameters. `ACTION_TEMPLATE()` +supports that and can be viewed as an extension to `ACTION()` and +`ACTION_P*()`. + +The syntax: +``` +ACTION_TEMPLATE(ActionName, + HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m), + AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; } +``` + +defines an action template that takes _m_ explicit template parameters +and _n_ value parameters, where _m_ is between 1 and 10, and _n_ is +between 0 and 10. `name_i` is the name of the i-th template +parameter, and `kind_i` specifies whether it's a `typename`, an +integral constant, or a template. `p_i` is the name of the i-th value +parameter. + +Example: +``` +// DuplicateArg(output) converts the k-th argument of the mock +// function to type T and copies it to *output. +ACTION_TEMPLATE(DuplicateArg, + // Note the comma between int and k: + HAS_2_TEMPLATE_PARAMS(int, k, typename, T), + AND_1_VALUE_PARAMS(output)) { + *output = T(::testing::get(args)); +} +``` + +To create an instance of an action template, write: +``` + ActionName(v1, ..., v_n) +``` +where the `t`s are the template arguments and the +`v`s are the value arguments. The value argument +types are inferred by the compiler. For example: +``` +using ::testing::_; +... + int n; + EXPECT_CALL(mock, Foo(_, _)) + .WillOnce(DuplicateArg<1, unsigned char>(&n)); +``` + +If you want to explicitly specify the value argument types, you can +provide additional template arguments: +``` + ActionName(v1, ..., v_n) +``` +where `u_i` is the desired type of `v_i`. + +`ACTION_TEMPLATE` and `ACTION`/`ACTION_P*` can be overloaded on the +number of value parameters, but not on the number of template +parameters. Without the restriction, the meaning of the following is +unclear: + +``` + OverloadedAction(x); +``` + +Are we using a single-template-parameter action where `bool` refers to +the type of `x`, or a two-template-parameter action where the compiler +is asked to infer the type of `x`? + +## Using the ACTION Object's Type ## + +If you are writing a function that returns an `ACTION` object, you'll +need to know its type. The type depends on the macro used to define +the action and the parameter types. The rule is relatively simple: + +| **Given Definition** | **Expression** | **Has Type** | +|:---------------------|:---------------|:-------------| +| `ACTION(Foo)` | `Foo()` | `FooAction` | +| `ACTION_TEMPLATE(Foo, HAS_m_TEMPLATE_PARAMS(...), AND_0_VALUE_PARAMS())` | `Foo()` | `FooAction` | +| `ACTION_P(Bar, param)` | `Bar(int_value)` | `BarActionP` | +| `ACTION_TEMPLATE(Bar, HAS_m_TEMPLATE_PARAMS(...), AND_1_VALUE_PARAMS(p1))` | `Bar(int_value)` | `FooActionP` | +| `ACTION_P2(Baz, p1, p2)` | `Baz(bool_value, int_value)` | `BazActionP2` | +| `ACTION_TEMPLATE(Baz, HAS_m_TEMPLATE_PARAMS(...), AND_2_VALUE_PARAMS(p1, p2))`| `Baz(bool_value, int_value)` | `FooActionP2` | +| ... | ... | ... | + +Note that we have to pick different suffixes (`Action`, `ActionP`, +`ActionP2`, and etc) for actions with different numbers of value +parameters, or the action definitions cannot be overloaded on the +number of them. + +## Writing New Monomorphic Actions ## + +While the `ACTION*` macros are very convenient, sometimes they are +inappropriate. For example, despite the tricks shown in the previous +recipes, they don't let you directly specify the types of the mock +function arguments and the action parameters, which in general leads +to unoptimized compiler error messages that can baffle unfamiliar +users. They also don't allow overloading actions based on parameter +types without jumping through some hoops. + +An alternative to the `ACTION*` macros is to implement +`::testing::ActionInterface`, where `F` is the type of the mock +function in which the action will be used. For example: + +``` +template class ActionInterface { + public: + virtual ~ActionInterface(); + + // Performs the action. Result is the return type of function type + // F, and ArgumentTuple is the tuple of arguments of F. + // + // For example, if F is int(bool, const string&), then Result would + // be int, and ArgumentTuple would be ::testing::tuple. + virtual Result Perform(const ArgumentTuple& args) = 0; +}; + +using ::testing::_; +using ::testing::Action; +using ::testing::ActionInterface; +using ::testing::MakeAction; + +typedef int IncrementMethod(int*); + +class IncrementArgumentAction : public ActionInterface { + public: + virtual int Perform(const ::testing::tuple& args) { + int* p = ::testing::get<0>(args); // Grabs the first argument. + return *p++; + } +}; + +Action IncrementArgument() { + return MakeAction(new IncrementArgumentAction); +} +... + + EXPECT_CALL(foo, Baz(_)) + .WillOnce(IncrementArgument()); + + int n = 5; + foo.Baz(&n); // Should return 5 and change n to 6. +``` + +## Writing New Polymorphic Actions ## + +The previous recipe showed you how to define your own action. This is +all good, except that you need to know the type of the function in +which the action will be used. Sometimes that can be a problem. For +example, if you want to use the action in functions with _different_ +types (e.g. like `Return()` and `SetArgPointee()`). + +If an action can be used in several types of mock functions, we say +it's _polymorphic_. The `MakePolymorphicAction()` function template +makes it easy to define such an action: + +``` +namespace testing { + +template +PolymorphicAction MakePolymorphicAction(const Impl& impl); + +} // namespace testing +``` + +As an example, let's define an action that returns the second argument +in the mock function's argument list. The first step is to define an +implementation class: + +``` +class ReturnSecondArgumentAction { + public: + template + Result Perform(const ArgumentTuple& args) const { + // To get the i-th (0-based) argument, use ::testing::get(args). + return ::testing::get<1>(args); + } +}; +``` + +This implementation class does _not_ need to inherit from any +particular class. What matters is that it must have a `Perform()` +method template. This method template takes the mock function's +arguments as a tuple in a **single** argument, and returns the result of +the action. It can be either `const` or not, but must be invokable +with exactly one template argument, which is the result type. In other +words, you must be able to call `Perform(args)` where `R` is the +mock function's return type and `args` is its arguments in a tuple. + +Next, we use `MakePolymorphicAction()` to turn an instance of the +implementation class into the polymorphic action we need. It will be +convenient to have a wrapper for this: + +``` +using ::testing::MakePolymorphicAction; +using ::testing::PolymorphicAction; + +PolymorphicAction ReturnSecondArgument() { + return MakePolymorphicAction(ReturnSecondArgumentAction()); +} +``` + +Now, you can use this polymorphic action the same way you use the +built-in ones: + +``` +using ::testing::_; + +class MockFoo : public Foo { + public: + MOCK_METHOD2(DoThis, int(bool flag, int n)); + MOCK_METHOD3(DoThat, string(int x, const char* str1, const char* str2)); +}; +... + + MockFoo foo; + EXPECT_CALL(foo, DoThis(_, _)) + .WillOnce(ReturnSecondArgument()); + EXPECT_CALL(foo, DoThat(_, _, _)) + .WillOnce(ReturnSecondArgument()); + ... + foo.DoThis(true, 5); // Will return 5. + foo.DoThat(1, "Hi", "Bye"); // Will return "Hi". +``` + +## Teaching Google Mock How to Print Your Values ## + +When an uninteresting or unexpected call occurs, Google Mock prints the +argument values and the stack trace to help you debug. Assertion +macros like `EXPECT_THAT` and `EXPECT_EQ` also print the values in +question when the assertion fails. Google Mock and Google Test do this using +Google Test's user-extensible value printer. + +This printer knows how to print built-in C++ types, native arrays, STL +containers, and any type that supports the `<<` operator. For other +types, it prints the raw bytes in the value and hopes that you the +user can figure it out. +[Google Test's advanced guide](../../googletest/docs/AdvancedGuide.md#teaching-google-test-how-to-print-your-values) +explains how to extend the printer to do a better job at +printing your particular type than to dump the bytes. diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/DesignDoc.md b/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/DesignDoc.md new file mode 100644 index 00000000000..3f515c3b6dd --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/DesignDoc.md @@ -0,0 +1,280 @@ +This page discusses the design of new Google Mock features. + + + +# Macros for Defining Actions # + +## Problem ## + +Due to the lack of closures in C++, it currently requires some +non-trivial effort to define a custom action in Google Mock. For +example, suppose you want to "increment the value pointed to by the +second argument of the mock function and return it", you could write: + +``` +int IncrementArg1(Unused, int* p, Unused) { + return ++(*p); +} + +... WillOnce(Invoke(IncrementArg1)); +``` + +There are several things unsatisfactory about this approach: + + * Even though the action only cares about the second argument of the mock function, its definition needs to list other arguments as dummies. This is tedious. + * The defined action is usable only in mock functions that takes exactly 3 arguments - an unnecessary restriction. + * To use the action, one has to say `Invoke(IncrementArg1)`, which isn't as nice as `IncrementArg1()`. + +The latter two problems can be overcome using `MakePolymorphicAction()`, +but it requires much more boilerplate code: + +``` +class IncrementArg1Action { + public: + template + Result Perform(const ArgumentTuple& args) const { + return ++(*tr1::get<1>(args)); + } +}; + +PolymorphicAction IncrementArg1() { + return MakePolymorphicAction(IncrementArg1Action()); +} + +... WillOnce(IncrementArg1()); +``` + +Our goal is to allow defining custom actions with the least amount of +boiler-plate C++ requires. + +## Solution ## + +We propose to introduce a new macro: +``` +ACTION(name) { statements; } +``` + +Using this in a namespace scope will define an action with the given +name that executes the statements. Inside the statements, you can +refer to the K-th (0-based) argument of the mock function as `argK`. +For example: +``` +ACTION(IncrementArg1) { return ++(*arg1); } +``` +allows you to write +``` +... WillOnce(IncrementArg1()); +``` + +Note that you don't need to specify the types of the mock function +arguments, as brevity is a top design goal here. Rest assured that +your code is still type-safe though: you'll get a compiler error if +`*arg1` doesn't support the `++` operator, or if the type of +`++(*arg1)` isn't compatible with the mock function's return type. + +Another example: +``` +ACTION(Foo) { + (*arg2)(5); + Blah(); + *arg1 = 0; + return arg0; +} +``` +defines an action `Foo()` that invokes argument #2 (a function pointer) +with 5, calls function `Blah()`, sets the value pointed to by argument +#1 to 0, and returns argument #0. + +For more convenience and flexibility, you can also use the following +pre-defined symbols in the body of `ACTION`: + +| `argK_type` | The type of the K-th (0-based) argument of the mock function | +|:------------|:-------------------------------------------------------------| +| `args` | All arguments of the mock function as a tuple | +| `args_type` | The type of all arguments of the mock function as a tuple | +| `return_type` | The return type of the mock function | +| `function_type` | The type of the mock function | + +For example, when using an `ACTION` as a stub action for mock function: +``` +int DoSomething(bool flag, int* ptr); +``` +we have: +| **Pre-defined Symbol** | **Is Bound To** | +|:-----------------------|:----------------| +| `arg0` | the value of `flag` | +| `arg0_type` | the type `bool` | +| `arg1` | the value of `ptr` | +| `arg1_type` | the type `int*` | +| `args` | the tuple `(flag, ptr)` | +| `args_type` | the type `std::tr1::tuple` | +| `return_type` | the type `int` | +| `function_type` | the type `int(bool, int*)` | + +## Parameterized actions ## + +Sometimes you'll want to parameterize the action. For that we propose +another macro +``` +ACTION_P(name, param) { statements; } +``` + +For example, +``` +ACTION_P(Add, n) { return arg0 + n; } +``` +will allow you to write +``` +// Returns argument #0 + 5. +... WillOnce(Add(5)); +``` + +For convenience, we use the term _arguments_ for the values used to +invoke the mock function, and the term _parameters_ for the values +used to instantiate an action. + +Note that you don't need to provide the type of the parameter either. +Suppose the parameter is named `param`, you can also use the +Google-Mock-defined symbol `param_type` to refer to the type of the +parameter as inferred by the compiler. + +We will also provide `ACTION_P2`, `ACTION_P3`, and etc to support +multi-parameter actions. For example, +``` +ACTION_P2(ReturnDistanceTo, x, y) { + double dx = arg0 - x; + double dy = arg1 - y; + return sqrt(dx*dx + dy*dy); +} +``` +lets you write +``` +... WillOnce(ReturnDistanceTo(5.0, 26.5)); +``` + +You can view `ACTION` as a degenerated parameterized action where the +number of parameters is 0. + +## Advanced Usages ## + +### Overloading Actions ### + +You can easily define actions overloaded on the number of parameters: +``` +ACTION_P(Plus, a) { ... } +ACTION_P2(Plus, a, b) { ... } +``` + +### Restricting the Type of an Argument or Parameter ### + +For maximum brevity and reusability, the `ACTION*` macros don't let +you specify the types of the mock function arguments and the action +parameters. Instead, we let the compiler infer the types for us. + +Sometimes, however, we may want to be more explicit about the types. +There are several tricks to do that. For example: +``` +ACTION(Foo) { + // Makes sure arg0 can be converted to int. + int n = arg0; + ... use n instead of arg0 here ... +} + +ACTION_P(Bar, param) { + // Makes sure the type of arg1 is const char*. + ::testing::StaticAssertTypeEq(); + + // Makes sure param can be converted to bool. + bool flag = param; +} +``` +where `StaticAssertTypeEq` is a compile-time assertion we plan to add to +Google Test (the name is chosen to match `static_assert` in C++0x). + +### Using the ACTION Object's Type ### + +If you are writing a function that returns an `ACTION` object, you'll +need to know its type. The type depends on the macro used to define +the action and the parameter types. The rule is relatively simple: +| **Given Definition** | **Expression** | **Has Type** | +|:---------------------|:---------------|:-------------| +| `ACTION(Foo)` | `Foo()` | `FooAction` | +| `ACTION_P(Bar, param)` | `Bar(int_value)` | `BarActionP` | +| `ACTION_P2(Baz, p1, p2)` | `Baz(bool_value, int_value)` | `BazActionP2` | +| ... | ... | ... | + +Note that we have to pick different suffixes (`Action`, `ActionP`, +`ActionP2`, and etc) for actions with different numbers of parameters, +or the action definitions cannot be overloaded on the number of +parameters. + +## When to Use ## + +While the new macros are very convenient, please also consider other +means of implementing actions (e.g. via `ActionInterface` or +`MakePolymorphicAction()`), especially if you need to use the defined +action a lot. While the other approaches require more work, they give +you more control on the types of the mock function arguments and the +action parameters, which in general leads to better compiler error +messages that pay off in the long run. They also allow overloading +actions based on parameter types, as opposed to just the number of +parameters. + +## Related Work ## + +As you may have realized, the `ACTION*` macros resemble closures (also +known as lambda expressions or anonymous functions). Indeed, both of +them seek to lower the syntactic overhead for defining a function. + +C++0x will support lambdas, but they are not part of C++ right now. +Some non-standard libraries (most notably BLL or Boost Lambda Library) +try to alleviate this problem. However, they are not a good choice +for defining actions as: + + * They are non-standard and not widely installed. Google Mock only depends on standard libraries and `tr1::tuple`, which is part of the new C++ standard and comes with gcc 4+. We want to keep it that way. + * They are not trivial to learn. + * They will become obsolete when C++0x's lambda feature is widely supported. We don't want to make our users use a dying library. + * Since they are based on operators, they are rather ad hoc: you cannot use statements, and you cannot pass the lambda arguments to a function, for example. + * They have subtle semantics that easily confuses new users. For example, in expression `_1++ + foo++`, `foo` will be incremented only once where the expression is evaluated, while `_1` will be incremented every time the unnamed function is invoked. This is far from intuitive. + +`ACTION*` avoid all these problems. + +## Future Improvements ## + +There may be a need for composing `ACTION*` definitions (i.e. invoking +another `ACTION` inside the definition of one `ACTION*`). We are not +sure we want it yet, as one can get a similar effect by putting +`ACTION` definitions in function templates and composing the function +templates. We'll revisit this based on user feedback. + +The reason we don't allow `ACTION*()` inside a function body is that +the current C++ standard doesn't allow function-local types to be used +to instantiate templates. The upcoming C++0x standard will lift this +restriction. Once this feature is widely supported by compilers, we +can revisit the implementation and add support for using `ACTION*()` +inside a function. + +C++0x will also support lambda expressions. When they become +available, we may want to support using lambdas as actions. + +# Macros for Defining Matchers # + +Once the macros for defining actions are implemented, we plan to do +the same for matchers: + +``` +MATCHER(name) { statements; } +``` + +where you can refer to the value being matched as `arg`. For example, +given: + +``` +MATCHER(IsPositive) { return arg > 0; } +``` + +you can use `IsPositive()` as a matcher that matches a value iff it is +greater than 0. + +We will also add `MATCHER_P`, `MATCHER_P2`, and etc for parameterized +matchers. \ No newline at end of file diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/Documentation.md b/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/Documentation.md new file mode 100644 index 00000000000..16083e7047a --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/Documentation.md @@ -0,0 +1,15 @@ +This page lists all documentation markdown files for Google Mock **(the +current git version)** +-- **if you use a former version of Google Mock, please read the +documentation for that specific version instead (e.g. by checking out +the respective git branch/tag).** + + * [ForDummies](ForDummies.md) -- start here if you are new to Google Mock. + * [CheatSheet](CheatSheet.md) -- a quick reference. + * [CookBook](CookBook.md) -- recipes for doing various tasks using Google Mock. + * [FrequentlyAskedQuestions](FrequentlyAskedQuestions.md) -- check here before asking a question on the mailing list. + +To contribute code to Google Mock, read: + + * [CONTRIBUTING](../CONTRIBUTING.md) -- read this _before_ writing your first patch. + * [Pump Manual](../../googletest/docs/PumpManual.md) -- how we generate some of Google Mock's source files. diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/ForDummies.md b/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/ForDummies.md new file mode 100644 index 00000000000..769105698c5 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/ForDummies.md @@ -0,0 +1,447 @@ + + +(**Note:** If you get compiler errors that you don't understand, be sure to consult [Google Mock Doctor](FrequentlyAskedQuestions.md#how-am-i-supposed-to-make-sense-of-these-horrible-template-errors).) + +# What Is Google C++ Mocking Framework? # +When you write a prototype or test, often it's not feasible or wise to rely on real objects entirely. A **mock object** implements the same interface as a real object (so it can be used as one), but lets you specify at run time how it will be used and what it should do (which methods will be called? in which order? how many times? with what arguments? what will they return? etc). + +**Note:** It is easy to confuse the term _fake objects_ with mock objects. Fakes and mocks actually mean very different things in the Test-Driven Development (TDD) community: + + * **Fake** objects have working implementations, but usually take some shortcut (perhaps to make the operations less expensive), which makes them not suitable for production. An in-memory file system would be an example of a fake. + * **Mocks** are objects pre-programmed with _expectations_, which form a specification of the calls they are expected to receive. + +If all this seems too abstract for you, don't worry - the most important thing to remember is that a mock allows you to check the _interaction_ between itself and code that uses it. The difference between fakes and mocks will become much clearer once you start to use mocks. + +**Google C++ Mocking Framework** (or **Google Mock** for short) is a library (sometimes we also call it a "framework" to make it sound cool) for creating mock classes and using them. It does to C++ what [jMock](http://www.jmock.org/) and [EasyMock](http://www.easymock.org/) do to Java. + +Using Google Mock involves three basic steps: + + 1. Use some simple macros to describe the interface you want to mock, and they will expand to the implementation of your mock class; + 1. Create some mock objects and specify its expectations and behavior using an intuitive syntax; + 1. Exercise code that uses the mock objects. Google Mock will catch any violation of the expectations as soon as it arises. + +# Why Google Mock? # +While mock objects help you remove unnecessary dependencies in tests and make them fast and reliable, using mocks manually in C++ is _hard_: + + * Someone has to implement the mocks. The job is usually tedious and error-prone. No wonder people go great distances to avoid it. + * The quality of those manually written mocks is a bit, uh, unpredictable. You may see some really polished ones, but you may also see some that were hacked up in a hurry and have all sorts of ad-hoc restrictions. + * The knowledge you gained from using one mock doesn't transfer to the next. + +In contrast, Java and Python programmers have some fine mock frameworks, which automate the creation of mocks. As a result, mocking is a proven effective technique and widely adopted practice in those communities. Having the right tool absolutely makes the difference. + +Google Mock was built to help C++ programmers. It was inspired by [jMock](http://www.jmock.org/) and [EasyMock](http://www.easymock.org/), but designed with C++'s specifics in mind. It is your friend if any of the following problems is bothering you: + + * You are stuck with a sub-optimal design and wish you had done more prototyping before it was too late, but prototyping in C++ is by no means "rapid". + * Your tests are slow as they depend on too many libraries or use expensive resources (e.g. a database). + * Your tests are brittle as some resources they use are unreliable (e.g. the network). + * You want to test how your code handles a failure (e.g. a file checksum error), but it's not easy to cause one. + * You need to make sure that your module interacts with other modules in the right way, but it's hard to observe the interaction; therefore you resort to observing the side effects at the end of the action, which is awkward at best. + * You want to "mock out" your dependencies, except that they don't have mock implementations yet; and, frankly, you aren't thrilled by some of those hand-written mocks. + +We encourage you to use Google Mock as: + + * a _design_ tool, for it lets you experiment with your interface design early and often. More iterations lead to better designs! + * a _testing_ tool to cut your tests' outbound dependencies and probe the interaction between your module and its collaborators. + +# Getting Started # +Using Google Mock is easy! Inside your C++ source file, just `#include` `"gtest/gtest.h"` and `"gmock/gmock.h"`, and you are ready to go. + +# A Case for Mock Turtles # +Let's look at an example. Suppose you are developing a graphics program that relies on a LOGO-like API for drawing. How would you test that it does the right thing? Well, you can run it and compare the screen with a golden screen snapshot, but let's admit it: tests like this are expensive to run and fragile (What if you just upgraded to a shiny new graphics card that has better anti-aliasing? Suddenly you have to update all your golden images.). It would be too painful if all your tests are like this. Fortunately, you learned about Dependency Injection and know the right thing to do: instead of having your application talk to the drawing API directly, wrap the API in an interface (say, `Turtle`) and code to that interface: + +``` +class Turtle { + ... + virtual ~Turtle() {} + virtual void PenUp() = 0; + virtual void PenDown() = 0; + virtual void Forward(int distance) = 0; + virtual void Turn(int degrees) = 0; + virtual void GoTo(int x, int y) = 0; + virtual int GetX() const = 0; + virtual int GetY() const = 0; +}; +``` + +(Note that the destructor of `Turtle` **must** be virtual, as is the case for **all** classes you intend to inherit from - otherwise the destructor of the derived class will not be called when you delete an object through a base pointer, and you'll get corrupted program states like memory leaks.) + +You can control whether the turtle's movement will leave a trace using `PenUp()` and `PenDown()`, and control its movement using `Forward()`, `Turn()`, and `GoTo()`. Finally, `GetX()` and `GetY()` tell you the current position of the turtle. + +Your program will normally use a real implementation of this interface. In tests, you can use a mock implementation instead. This allows you to easily check what drawing primitives your program is calling, with what arguments, and in which order. Tests written this way are much more robust (they won't break because your new machine does anti-aliasing differently), easier to read and maintain (the intent of a test is expressed in the code, not in some binary images), and run _much, much faster_. + +# Writing the Mock Class # +If you are lucky, the mocks you need to use have already been implemented by some nice people. If, however, you find yourself in the position to write a mock class, relax - Google Mock turns this task into a fun game! (Well, almost.) + +## How to Define It ## +Using the `Turtle` interface as example, here are the simple steps you need to follow: + + 1. Derive a class `MockTurtle` from `Turtle`. + 1. Take a _virtual_ function of `Turtle` (while it's possible to [mock non-virtual methods using templates](CookBook.md#mocking-nonvirtual-methods), it's much more involved). Count how many arguments it has. + 1. In the `public:` section of the child class, write `MOCK_METHODn();` (or `MOCK_CONST_METHODn();` if you are mocking a `const` method), where `n` is the number of the arguments; if you counted wrong, shame on you, and a compiler error will tell you so. + 1. Now comes the fun part: you take the function signature, cut-and-paste the _function name_ as the _first_ argument to the macro, and leave what's left as the _second_ argument (in case you're curious, this is the _type of the function_). + 1. Repeat until all virtual functions you want to mock are done. + +After the process, you should have something like: + +``` +#include "gmock/gmock.h" // Brings in Google Mock. +class MockTurtle : public Turtle { + public: + ... + MOCK_METHOD0(PenUp, void()); + MOCK_METHOD0(PenDown, void()); + MOCK_METHOD1(Forward, void(int distance)); + MOCK_METHOD1(Turn, void(int degrees)); + MOCK_METHOD2(GoTo, void(int x, int y)); + MOCK_CONST_METHOD0(GetX, int()); + MOCK_CONST_METHOD0(GetY, int()); +}; +``` + +You don't need to define these mock methods somewhere else - the `MOCK_METHOD*` macros will generate the definitions for you. It's that simple! Once you get the hang of it, you can pump out mock classes faster than your source-control system can handle your check-ins. + +**Tip:** If even this is too much work for you, you'll find the +`gmock_gen.py` tool in Google Mock's `scripts/generator/` directory (courtesy of the [cppclean](http://code.google.com/p/cppclean/) project) useful. This command-line +tool requires that you have Python 2.4 installed. You give it a C++ file and the name of an abstract class defined in it, +and it will print the definition of the mock class for you. Due to the +complexity of the C++ language, this script may not always work, but +it can be quite handy when it does. For more details, read the [user documentation](../scripts/generator/README). + +## Where to Put It ## +When you define a mock class, you need to decide where to put its definition. Some people put it in a `*_test.cc`. This is fine when the interface being mocked (say, `Foo`) is owned by the same person or team. Otherwise, when the owner of `Foo` changes it, your test could break. (You can't really expect `Foo`'s maintainer to fix every test that uses `Foo`, can you?) + +So, the rule of thumb is: if you need to mock `Foo` and it's owned by others, define the mock class in `Foo`'s package (better, in a `testing` sub-package such that you can clearly separate production code and testing utilities), and put it in a `mock_foo.h`. Then everyone can reference `mock_foo.h` from their tests. If `Foo` ever changes, there is only one copy of `MockFoo` to change, and only tests that depend on the changed methods need to be fixed. + +Another way to do it: you can introduce a thin layer `FooAdaptor` on top of `Foo` and code to this new interface. Since you own `FooAdaptor`, you can absorb changes in `Foo` much more easily. While this is more work initially, carefully choosing the adaptor interface can make your code easier to write and more readable (a net win in the long run), as you can choose `FooAdaptor` to fit your specific domain much better than `Foo` does. + +# Using Mocks in Tests # +Once you have a mock class, using it is easy. The typical work flow is: + + 1. Import the Google Mock names from the `testing` namespace such that you can use them unqualified (You only have to do it once per file. Remember that namespaces are a good idea and good for your health.). + 1. Create some mock objects. + 1. Specify your expectations on them (How many times will a method be called? With what arguments? What should it do? etc.). + 1. Exercise some code that uses the mocks; optionally, check the result using Google Test assertions. If a mock method is called more than expected or with wrong arguments, you'll get an error immediately. + 1. When a mock is destructed, Google Mock will automatically check whether all expectations on it have been satisfied. + +Here's an example: + +``` +#include "path/to/mock-turtle.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" +using ::testing::AtLeast; // #1 + +TEST(PainterTest, CanDrawSomething) { + MockTurtle turtle; // #2 + EXPECT_CALL(turtle, PenDown()) // #3 + .Times(AtLeast(1)); + + Painter painter(&turtle); // #4 + + EXPECT_TRUE(painter.DrawCircle(0, 0, 10)); +} // #5 + +int main(int argc, char** argv) { + // The following line must be executed to initialize Google Mock + // (and Google Test) before running the tests. + ::testing::InitGoogleMock(&argc, argv); + return RUN_ALL_TESTS(); +} +``` + +As you might have guessed, this test checks that `PenDown()` is called at least once. If the `painter` object didn't call this method, your test will fail with a message like this: + +``` +path/to/my_test.cc:119: Failure +Actual function call count doesn't match this expectation: +Actually: never called; +Expected: called at least once. +``` + +**Tip 1:** If you run the test from an Emacs buffer, you can hit `` on the line number displayed in the error message to jump right to the failed expectation. + +**Tip 2:** If your mock objects are never deleted, the final verification won't happen. Therefore it's a good idea to use a heap leak checker in your tests when you allocate mocks on the heap. + +**Important note:** Google Mock requires expectations to be set **before** the mock functions are called, otherwise the behavior is **undefined**. In particular, you mustn't interleave `EXPECT_CALL()`s and calls to the mock functions. + +This means `EXPECT_CALL()` should be read as expecting that a call will occur _in the future_, not that a call has occurred. Why does Google Mock work like that? Well, specifying the expectation beforehand allows Google Mock to report a violation as soon as it arises, when the context (stack trace, etc) is still available. This makes debugging much easier. + +Admittedly, this test is contrived and doesn't do much. You can easily achieve the same effect without using Google Mock. However, as we shall reveal soon, Google Mock allows you to do _much more_ with the mocks. + +## Using Google Mock with Any Testing Framework ## +If you want to use something other than Google Test (e.g. [CppUnit](http://sourceforge.net/projects/cppunit/) or +[CxxTest](http://cxxtest.tigris.org/)) as your testing framework, just change the `main()` function in the previous section to: +``` +int main(int argc, char** argv) { + // The following line causes Google Mock to throw an exception on failure, + // which will be interpreted by your testing framework as a test failure. + ::testing::GTEST_FLAG(throw_on_failure) = true; + ::testing::InitGoogleMock(&argc, argv); + ... whatever your testing framework requires ... +} +``` + +This approach has a catch: it makes Google Mock throw an exception +from a mock object's destructor sometimes. With some compilers, this +sometimes causes the test program to crash. You'll still be able to +notice that the test has failed, but it's not a graceful failure. + +A better solution is to use Google Test's +[event listener API](../../googletest/docs/AdvancedGuide.md#extending-google-test-by-handling-test-events) +to report a test failure to your testing framework properly. You'll need to +implement the `OnTestPartResult()` method of the event listener interface, but it +should be straightforward. + +If this turns out to be too much work, we suggest that you stick with +Google Test, which works with Google Mock seamlessly (in fact, it is +technically part of Google Mock.). If there is a reason that you +cannot use Google Test, please let us know. + +# Setting Expectations # +The key to using a mock object successfully is to set the _right expectations_ on it. If you set the expectations too strict, your test will fail as the result of unrelated changes. If you set them too loose, bugs can slip through. You want to do it just right such that your test can catch exactly the kind of bugs you intend it to catch. Google Mock provides the necessary means for you to do it "just right." + +## General Syntax ## +In Google Mock we use the `EXPECT_CALL()` macro to set an expectation on a mock method. The general syntax is: + +``` +EXPECT_CALL(mock_object, method(matchers)) + .Times(cardinality) + .WillOnce(action) + .WillRepeatedly(action); +``` + +The macro has two arguments: first the mock object, and then the method and its arguments. Note that the two are separated by a comma (`,`), not a period (`.`). (Why using a comma? The answer is that it was necessary for technical reasons.) + +The macro can be followed by some optional _clauses_ that provide more information about the expectation. We'll discuss how each clause works in the coming sections. + +This syntax is designed to make an expectation read like English. For example, you can probably guess that + +``` +using ::testing::Return; +... +EXPECT_CALL(turtle, GetX()) + .Times(5) + .WillOnce(Return(100)) + .WillOnce(Return(150)) + .WillRepeatedly(Return(200)); +``` + +says that the `turtle` object's `GetX()` method will be called five times, it will return 100 the first time, 150 the second time, and then 200 every time. Some people like to call this style of syntax a Domain-Specific Language (DSL). + +**Note:** Why do we use a macro to do this? It serves two purposes: first it makes expectations easily identifiable (either by `grep` or by a human reader), and second it allows Google Mock to include the source file location of a failed expectation in messages, making debugging easier. + +## Matchers: What Arguments Do We Expect? ## +When a mock function takes arguments, we must specify what arguments we are expecting; for example: + +``` +// Expects the turtle to move forward by 100 units. +EXPECT_CALL(turtle, Forward(100)); +``` + +Sometimes you may not want to be too specific (Remember that talk about tests being too rigid? Over specification leads to brittle tests and obscures the intent of tests. Therefore we encourage you to specify only what's necessary - no more, no less.). If you care to check that `Forward()` will be called but aren't interested in its actual argument, write `_` as the argument, which means "anything goes": + +``` +using ::testing::_; +... +// Expects the turtle to move forward. +EXPECT_CALL(turtle, Forward(_)); +``` + +`_` is an instance of what we call **matchers**. A matcher is like a predicate and can test whether an argument is what we'd expect. You can use a matcher inside `EXPECT_CALL()` wherever a function argument is expected. + +A list of built-in matchers can be found in the [CheatSheet](CheatSheet.md). For example, here's the `Ge` (greater than or equal) matcher: + +``` +using ::testing::Ge; +... +EXPECT_CALL(turtle, Forward(Ge(100))); +``` + +This checks that the turtle will be told to go forward by at least 100 units. + +## Cardinalities: How Many Times Will It Be Called? ## +The first clause we can specify following an `EXPECT_CALL()` is `Times()`. We call its argument a **cardinality** as it tells _how many times_ the call should occur. It allows us to repeat an expectation many times without actually writing it as many times. More importantly, a cardinality can be "fuzzy", just like a matcher can be. This allows a user to express the intent of a test exactly. + +An interesting special case is when we say `Times(0)`. You may have guessed - it means that the function shouldn't be called with the given arguments at all, and Google Mock will report a Google Test failure whenever the function is (wrongfully) called. + +We've seen `AtLeast(n)` as an example of fuzzy cardinalities earlier. For the list of built-in cardinalities you can use, see the [CheatSheet](CheatSheet.md). + +The `Times()` clause can be omitted. **If you omit `Times()`, Google Mock will infer the cardinality for you.** The rules are easy to remember: + + * If **neither** `WillOnce()` **nor** `WillRepeatedly()` is in the `EXPECT_CALL()`, the inferred cardinality is `Times(1)`. + * If there are `n WillOnce()`'s but **no** `WillRepeatedly()`, where `n` >= 1, the cardinality is `Times(n)`. + * If there are `n WillOnce()`'s and **one** `WillRepeatedly()`, where `n` >= 0, the cardinality is `Times(AtLeast(n))`. + +**Quick quiz:** what do you think will happen if a function is expected to be called twice but actually called four times? + +## Actions: What Should It Do? ## +Remember that a mock object doesn't really have a working implementation? We as users have to tell it what to do when a method is invoked. This is easy in Google Mock. + +First, if the return type of a mock function is a built-in type or a pointer, the function has a **default action** (a `void` function will just return, a `bool` function will return `false`, and other functions will return 0). In addition, in C++ 11 and above, a mock function whose return type is default-constructible (i.e. has a default constructor) has a default action of returning a default-constructed value. If you don't say anything, this behavior will be used. + +Second, if a mock function doesn't have a default action, or the default action doesn't suit you, you can specify the action to be taken each time the expectation matches using a series of `WillOnce()` clauses followed by an optional `WillRepeatedly()`. For example, + +``` +using ::testing::Return; +... +EXPECT_CALL(turtle, GetX()) + .WillOnce(Return(100)) + .WillOnce(Return(200)) + .WillOnce(Return(300)); +``` + +This says that `turtle.GetX()` will be called _exactly three times_ (Google Mock inferred this from how many `WillOnce()` clauses we've written, since we didn't explicitly write `Times()`), and will return 100, 200, and 300 respectively. + +``` +using ::testing::Return; +... +EXPECT_CALL(turtle, GetY()) + .WillOnce(Return(100)) + .WillOnce(Return(200)) + .WillRepeatedly(Return(300)); +``` + +says that `turtle.GetY()` will be called _at least twice_ (Google Mock knows this as we've written two `WillOnce()` clauses and a `WillRepeatedly()` while having no explicit `Times()`), will return 100 the first time, 200 the second time, and 300 from the third time on. + +Of course, if you explicitly write a `Times()`, Google Mock will not try to infer the cardinality itself. What if the number you specified is larger than there are `WillOnce()` clauses? Well, after all `WillOnce()`s are used up, Google Mock will do the _default_ action for the function every time (unless, of course, you have a `WillRepeatedly()`.). + +What can we do inside `WillOnce()` besides `Return()`? You can return a reference using `ReturnRef(variable)`, or invoke a pre-defined function, among [others](CheatSheet.md#actions). + +**Important note:** The `EXPECT_CALL()` statement evaluates the action clause only once, even though the action may be performed many times. Therefore you must be careful about side effects. The following may not do what you want: + +``` +int n = 100; +EXPECT_CALL(turtle, GetX()) +.Times(4) +.WillRepeatedly(Return(n++)); +``` + +Instead of returning 100, 101, 102, ..., consecutively, this mock function will always return 100 as `n++` is only evaluated once. Similarly, `Return(new Foo)` will create a new `Foo` object when the `EXPECT_CALL()` is executed, and will return the same pointer every time. If you want the side effect to happen every time, you need to define a custom action, which we'll teach in the [CookBook](CookBook.md). + +Time for another quiz! What do you think the following means? + +``` +using ::testing::Return; +... +EXPECT_CALL(turtle, GetY()) +.Times(4) +.WillOnce(Return(100)); +``` + +Obviously `turtle.GetY()` is expected to be called four times. But if you think it will return 100 every time, think twice! Remember that one `WillOnce()` clause will be consumed each time the function is invoked and the default action will be taken afterwards. So the right answer is that `turtle.GetY()` will return 100 the first time, but **return 0 from the second time on**, as returning 0 is the default action for `int` functions. + +## Using Multiple Expectations ## +So far we've only shown examples where you have a single expectation. More realistically, you're going to specify expectations on multiple mock methods, which may be from multiple mock objects. + +By default, when a mock method is invoked, Google Mock will search the expectations in the **reverse order** they are defined, and stop when an active expectation that matches the arguments is found (you can think of it as "newer rules override older ones."). If the matching expectation cannot take any more calls, you will get an upper-bound-violated failure. Here's an example: + +``` +using ::testing::_; +... +EXPECT_CALL(turtle, Forward(_)); // #1 +EXPECT_CALL(turtle, Forward(10)) // #2 + .Times(2); +``` + +If `Forward(10)` is called three times in a row, the third time it will be an error, as the last matching expectation (#2) has been saturated. If, however, the third `Forward(10)` call is replaced by `Forward(20)`, then it would be OK, as now #1 will be the matching expectation. + +**Side note:** Why does Google Mock search for a match in the _reverse_ order of the expectations? The reason is that this allows a user to set up the default expectations in a mock object's constructor or the test fixture's set-up phase and then customize the mock by writing more specific expectations in the test body. So, if you have two expectations on the same method, you want to put the one with more specific matchers **after** the other, or the more specific rule would be shadowed by the more general one that comes after it. + +## Ordered vs Unordered Calls ## +By default, an expectation can match a call even though an earlier expectation hasn't been satisfied. In other words, the calls don't have to occur in the order the expectations are specified. + +Sometimes, you may want all the expected calls to occur in a strict order. To say this in Google Mock is easy: + +``` +using ::testing::InSequence; +... +TEST(FooTest, DrawsLineSegment) { + ... + { + InSequence dummy; + + EXPECT_CALL(turtle, PenDown()); + EXPECT_CALL(turtle, Forward(100)); + EXPECT_CALL(turtle, PenUp()); + } + Foo(); +} +``` + +By creating an object of type `InSequence`, all expectations in its scope are put into a _sequence_ and have to occur _sequentially_. Since we are just relying on the constructor and destructor of this object to do the actual work, its name is really irrelevant. + +In this example, we test that `Foo()` calls the three expected functions in the order as written. If a call is made out-of-order, it will be an error. + +(What if you care about the relative order of some of the calls, but not all of them? Can you specify an arbitrary partial order? The answer is ... yes! If you are impatient, the details can be found in the [CookBook](CookBook.md#expecting-partially-ordered-calls).) + +## All Expectations Are Sticky (Unless Said Otherwise) ## +Now let's do a quick quiz to see how well you can use this mock stuff already. How would you test that the turtle is asked to go to the origin _exactly twice_ (you want to ignore any other instructions it receives)? + +After you've come up with your answer, take a look at ours and compare notes (solve it yourself first - don't cheat!): + +``` +using ::testing::_; +... +EXPECT_CALL(turtle, GoTo(_, _)) // #1 + .Times(AnyNumber()); +EXPECT_CALL(turtle, GoTo(0, 0)) // #2 + .Times(2); +``` + +Suppose `turtle.GoTo(0, 0)` is called three times. In the third time, Google Mock will see that the arguments match expectation #2 (remember that we always pick the last matching expectation). Now, since we said that there should be only two such calls, Google Mock will report an error immediately. This is basically what we've told you in the "Using Multiple Expectations" section above. + +This example shows that **expectations in Google Mock are "sticky" by default**, in the sense that they remain active even after we have reached their invocation upper bounds. This is an important rule to remember, as it affects the meaning of the spec, and is **different** to how it's done in many other mocking frameworks (Why'd we do that? Because we think our rule makes the common cases easier to express and understand.). + +Simple? Let's see if you've really understood it: what does the following code say? + +``` +using ::testing::Return; +... +for (int i = n; i > 0; i--) { + EXPECT_CALL(turtle, GetX()) + .WillOnce(Return(10*i)); +} +``` + +If you think it says that `turtle.GetX()` will be called `n` times and will return 10, 20, 30, ..., consecutively, think twice! The problem is that, as we said, expectations are sticky. So, the second time `turtle.GetX()` is called, the last (latest) `EXPECT_CALL()` statement will match, and will immediately lead to an "upper bound exceeded" error - this piece of code is not very useful! + +One correct way of saying that `turtle.GetX()` will return 10, 20, 30, ..., is to explicitly say that the expectations are _not_ sticky. In other words, they should _retire_ as soon as they are saturated: + +``` +using ::testing::Return; +... +for (int i = n; i > 0; i--) { + EXPECT_CALL(turtle, GetX()) + .WillOnce(Return(10*i)) + .RetiresOnSaturation(); +} +``` + +And, there's a better way to do it: in this case, we expect the calls to occur in a specific order, and we line up the actions to match the order. Since the order is important here, we should make it explicit using a sequence: + +``` +using ::testing::InSequence; +using ::testing::Return; +... +{ + InSequence s; + + for (int i = 1; i <= n; i++) { + EXPECT_CALL(turtle, GetX()) + .WillOnce(Return(10*i)) + .RetiresOnSaturation(); + } +} +``` + +By the way, the other situation where an expectation may _not_ be sticky is when it's in a sequence - as soon as another expectation that comes after it in the sequence has been used, it automatically retires (and will never be used to match any call). + +## Uninteresting Calls ## +A mock object may have many methods, and not all of them are that interesting. For example, in some tests we may not care about how many times `GetX()` and `GetY()` get called. + +In Google Mock, if you are not interested in a method, just don't say anything about it. If a call to this method occurs, you'll see a warning in the test output, but it won't be a failure. + +# What Now? # +Congratulations! You've learned enough about Google Mock to start using it. Now, you might want to join the [googlemock](http://groups.google.com/group/googlemock) discussion group and actually write some tests using Google Mock - it will be fun. Hey, it may even be addictive - you've been warned. + +Then, if you feel like increasing your mock quotient, you should move on to the [CookBook](CookBook.md). You can learn many advanced features of Google Mock there -- and advance your level of enjoyment and testing bliss. diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/FrequentlyAskedQuestions.md b/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/FrequentlyAskedQuestions.md new file mode 100644 index 00000000000..ccaa3d7a87f --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/FrequentlyAskedQuestions.md @@ -0,0 +1,628 @@ + + +Please send your questions to the +[googlemock](http://groups.google.com/group/googlemock) discussion +group. If you need help with compiler errors, make sure you have +tried [Google Mock Doctor](#How_am_I_supposed_to_make_sense_of_these_horrible_template_error.md) first. + +## When I call a method on my mock object, the method for the real object is invoked instead. What's the problem? ## + +In order for a method to be mocked, it must be _virtual_, unless you use the [high-perf dependency injection technique](CookBook.md#mocking-nonvirtual-methods). + +## I wrote some matchers. After I upgraded to a new version of Google Mock, they no longer compile. What's going on? ## + +After version 1.4.0 of Google Mock was released, we had an idea on how +to make it easier to write matchers that can generate informative +messages efficiently. We experimented with this idea and liked what +we saw. Therefore we decided to implement it. + +Unfortunately, this means that if you have defined your own matchers +by implementing `MatcherInterface` or using `MakePolymorphicMatcher()`, +your definitions will no longer compile. Matchers defined using the +`MATCHER*` family of macros are not affected. + +Sorry for the hassle if your matchers are affected. We believe it's +in everyone's long-term interest to make this change sooner than +later. Fortunately, it's usually not hard to migrate an existing +matcher to the new API. Here's what you need to do: + +If you wrote your matcher like this: +``` +// Old matcher definition that doesn't work with the latest +// Google Mock. +using ::testing::MatcherInterface; +... +class MyWonderfulMatcher : public MatcherInterface { + public: + ... + virtual bool Matches(MyType value) const { + // Returns true if value matches. + return value.GetFoo() > 5; + } + ... +}; +``` + +you'll need to change it to: +``` +// New matcher definition that works with the latest Google Mock. +using ::testing::MatcherInterface; +using ::testing::MatchResultListener; +... +class MyWonderfulMatcher : public MatcherInterface { + public: + ... + virtual bool MatchAndExplain(MyType value, + MatchResultListener* listener) const { + // Returns true if value matches. + return value.GetFoo() > 5; + } + ... +}; +``` +(i.e. rename `Matches()` to `MatchAndExplain()` and give it a second +argument of type `MatchResultListener*`.) + +If you were also using `ExplainMatchResultTo()` to improve the matcher +message: +``` +// Old matcher definition that doesn't work with the lastest +// Google Mock. +using ::testing::MatcherInterface; +... +class MyWonderfulMatcher : public MatcherInterface { + public: + ... + virtual bool Matches(MyType value) const { + // Returns true if value matches. + return value.GetFoo() > 5; + } + + virtual void ExplainMatchResultTo(MyType value, + ::std::ostream* os) const { + // Prints some helpful information to os to help + // a user understand why value matches (or doesn't match). + *os << "the Foo property is " << value.GetFoo(); + } + ... +}; +``` + +you should move the logic of `ExplainMatchResultTo()` into +`MatchAndExplain()`, using the `MatchResultListener` argument where +the `::std::ostream` was used: +``` +// New matcher definition that works with the latest Google Mock. +using ::testing::MatcherInterface; +using ::testing::MatchResultListener; +... +class MyWonderfulMatcher : public MatcherInterface { + public: + ... + virtual bool MatchAndExplain(MyType value, + MatchResultListener* listener) const { + // Returns true if value matches. + *listener << "the Foo property is " << value.GetFoo(); + return value.GetFoo() > 5; + } + ... +}; +``` + +If your matcher is defined using `MakePolymorphicMatcher()`: +``` +// Old matcher definition that doesn't work with the latest +// Google Mock. +using ::testing::MakePolymorphicMatcher; +... +class MyGreatMatcher { + public: + ... + bool Matches(MyType value) const { + // Returns true if value matches. + return value.GetBar() < 42; + } + ... +}; +... MakePolymorphicMatcher(MyGreatMatcher()) ... +``` + +you should rename the `Matches()` method to `MatchAndExplain()` and +add a `MatchResultListener*` argument (the same as what you need to do +for matchers defined by implementing `MatcherInterface`): +``` +// New matcher definition that works with the latest Google Mock. +using ::testing::MakePolymorphicMatcher; +using ::testing::MatchResultListener; +... +class MyGreatMatcher { + public: + ... + bool MatchAndExplain(MyType value, + MatchResultListener* listener) const { + // Returns true if value matches. + return value.GetBar() < 42; + } + ... +}; +... MakePolymorphicMatcher(MyGreatMatcher()) ... +``` + +If your polymorphic matcher uses `ExplainMatchResultTo()` for better +failure messages: +``` +// Old matcher definition that doesn't work with the latest +// Google Mock. +using ::testing::MakePolymorphicMatcher; +... +class MyGreatMatcher { + public: + ... + bool Matches(MyType value) const { + // Returns true if value matches. + return value.GetBar() < 42; + } + ... +}; +void ExplainMatchResultTo(const MyGreatMatcher& matcher, + MyType value, + ::std::ostream* os) { + // Prints some helpful information to os to help + // a user understand why value matches (or doesn't match). + *os << "the Bar property is " << value.GetBar(); +} +... MakePolymorphicMatcher(MyGreatMatcher()) ... +``` + +you'll need to move the logic inside `ExplainMatchResultTo()` to +`MatchAndExplain()`: +``` +// New matcher definition that works with the latest Google Mock. +using ::testing::MakePolymorphicMatcher; +using ::testing::MatchResultListener; +... +class MyGreatMatcher { + public: + ... + bool MatchAndExplain(MyType value, + MatchResultListener* listener) const { + // Returns true if value matches. + *listener << "the Bar property is " << value.GetBar(); + return value.GetBar() < 42; + } + ... +}; +... MakePolymorphicMatcher(MyGreatMatcher()) ... +``` + +For more information, you can read these +[two](CookBook.md#writing-new-monomorphic-matchers) +[recipes](CookBook.md#writing-new-polymorphic-matchers) +from the cookbook. As always, you +are welcome to post questions on `googlemock@googlegroups.com` if you +need any help. + +## When using Google Mock, do I have to use Google Test as the testing framework? I have my favorite testing framework and don't want to switch. ## + +Google Mock works out of the box with Google Test. However, it's easy +to configure it to work with any testing framework of your choice. +[Here](ForDummies.md#using-google-mock-with-any-testing-framework) is how. + +## How am I supposed to make sense of these horrible template errors? ## + +If you are confused by the compiler errors gcc threw at you, +try consulting the _Google Mock Doctor_ tool first. What it does is to +scan stdin for gcc error messages, and spit out diagnoses on the +problems (we call them diseases) your code has. + +To "install", run command: +``` +alias gmd='/scripts/gmock_doctor.py' +``` + +To use it, do: +``` + 2>&1 | gmd +``` + +For example: +``` +make my_test 2>&1 | gmd +``` + +Or you can run `gmd` and copy-n-paste gcc's error messages to it. + +## Can I mock a variadic function? ## + +You cannot mock a variadic function (i.e. a function taking ellipsis +(`...`) arguments) directly in Google Mock. + +The problem is that in general, there is _no way_ for a mock object to +know how many arguments are passed to the variadic method, and what +the arguments' types are. Only the _author of the base class_ knows +the protocol, and we cannot look into their head. + +Therefore, to mock such a function, the _user_ must teach the mock +object how to figure out the number of arguments and their types. One +way to do it is to provide overloaded versions of the function. + +Ellipsis arguments are inherited from C and not really a C++ feature. +They are unsafe to use and don't work with arguments that have +constructors or destructors. Therefore we recommend to avoid them in +C++ as much as possible. + +## MSVC gives me warning C4301 or C4373 when I define a mock method with a const parameter. Why? ## + +If you compile this using Microsoft Visual C++ 2005 SP1: +``` +class Foo { + ... + virtual void Bar(const int i) = 0; +}; + +class MockFoo : public Foo { + ... + MOCK_METHOD1(Bar, void(const int i)); +}; +``` +You may get the following warning: +``` +warning C4301: 'MockFoo::Bar': overriding virtual function only differs from 'Foo::Bar' by const/volatile qualifier +``` + +This is a MSVC bug. The same code compiles fine with gcc ,for +example. If you use Visual C++ 2008 SP1, you would get the warning: +``` +warning C4373: 'MockFoo::Bar': virtual function overrides 'Foo::Bar', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers +``` + +In C++, if you _declare_ a function with a `const` parameter, the +`const` modifier is _ignored_. Therefore, the `Foo` base class above +is equivalent to: +``` +class Foo { + ... + virtual void Bar(int i) = 0; // int or const int? Makes no difference. +}; +``` + +In fact, you can _declare_ Bar() with an `int` parameter, and _define_ +it with a `const int` parameter. The compiler will still match them +up. + +Since making a parameter `const` is meaningless in the method +_declaration_, we recommend to remove it in both `Foo` and `MockFoo`. +That should workaround the VC bug. + +Note that we are talking about the _top-level_ `const` modifier here. +If the function parameter is passed by pointer or reference, declaring +the _pointee_ or _referee_ as `const` is still meaningful. For +example, the following two declarations are _not_ equivalent: +``` +void Bar(int* p); // Neither p nor *p is const. +void Bar(const int* p); // p is not const, but *p is. +``` + +## I have a huge mock class, and Microsoft Visual C++ runs out of memory when compiling it. What can I do? ## + +We've noticed that when the `/clr` compiler flag is used, Visual C++ +uses 5~6 times as much memory when compiling a mock class. We suggest +to avoid `/clr` when compiling native C++ mocks. + +## I can't figure out why Google Mock thinks my expectations are not satisfied. What should I do? ## + +You might want to run your test with +`--gmock_verbose=info`. This flag lets Google Mock print a trace +of every mock function call it receives. By studying the trace, +you'll gain insights on why the expectations you set are not met. + +## How can I assert that a function is NEVER called? ## + +``` +EXPECT_CALL(foo, Bar(_)) + .Times(0); +``` + +## I have a failed test where Google Mock tells me TWICE that a particular expectation is not satisfied. Isn't this redundant? ## + +When Google Mock detects a failure, it prints relevant information +(the mock function arguments, the state of relevant expectations, and +etc) to help the user debug. If another failure is detected, Google +Mock will do the same, including printing the state of relevant +expectations. + +Sometimes an expectation's state didn't change between two failures, +and you'll see the same description of the state twice. They are +however _not_ redundant, as they refer to _different points in time_. +The fact they are the same _is_ interesting information. + +## I get a heap check failure when using a mock object, but using a real object is fine. What can be wrong? ## + +Does the class (hopefully a pure interface) you are mocking have a +virtual destructor? + +Whenever you derive from a base class, make sure its destructor is +virtual. Otherwise Bad Things will happen. Consider the following +code: + +``` +class Base { + public: + // Not virtual, but should be. + ~Base() { ... } + ... +}; + +class Derived : public Base { + public: + ... + private: + std::string value_; +}; + +... + Base* p = new Derived; + ... + delete p; // Surprise! ~Base() will be called, but ~Derived() will not + // - value_ is leaked. +``` + +By changing `~Base()` to virtual, `~Derived()` will be correctly +called when `delete p` is executed, and the heap checker +will be happy. + +## The "newer expectations override older ones" rule makes writing expectations awkward. Why does Google Mock do that? ## + +When people complain about this, often they are referring to code like: + +``` +// foo.Bar() should be called twice, return 1 the first time, and return +// 2 the second time. However, I have to write the expectations in the +// reverse order. This sucks big time!!! +EXPECT_CALL(foo, Bar()) + .WillOnce(Return(2)) + .RetiresOnSaturation(); +EXPECT_CALL(foo, Bar()) + .WillOnce(Return(1)) + .RetiresOnSaturation(); +``` + +The problem is that they didn't pick the **best** way to express the test's +intent. + +By default, expectations don't have to be matched in _any_ particular +order. If you want them to match in a certain order, you need to be +explicit. This is Google Mock's (and jMock's) fundamental philosophy: it's +easy to accidentally over-specify your tests, and we want to make it +harder to do so. + +There are two better ways to write the test spec. You could either +put the expectations in sequence: + +``` +// foo.Bar() should be called twice, return 1 the first time, and return +// 2 the second time. Using a sequence, we can write the expectations +// in their natural order. +{ + InSequence s; + EXPECT_CALL(foo, Bar()) + .WillOnce(Return(1)) + .RetiresOnSaturation(); + EXPECT_CALL(foo, Bar()) + .WillOnce(Return(2)) + .RetiresOnSaturation(); +} +``` + +or you can put the sequence of actions in the same expectation: + +``` +// foo.Bar() should be called twice, return 1 the first time, and return +// 2 the second time. +EXPECT_CALL(foo, Bar()) + .WillOnce(Return(1)) + .WillOnce(Return(2)) + .RetiresOnSaturation(); +``` + +Back to the original questions: why does Google Mock search the +expectations (and `ON_CALL`s) from back to front? Because this +allows a user to set up a mock's behavior for the common case early +(e.g. in the mock's constructor or the test fixture's set-up phase) +and customize it with more specific rules later. If Google Mock +searches from front to back, this very useful pattern won't be +possible. + +## Google Mock prints a warning when a function without EXPECT\_CALL is called, even if I have set its behavior using ON\_CALL. Would it be reasonable not to show the warning in this case? ## + +When choosing between being neat and being safe, we lean toward the +latter. So the answer is that we think it's better to show the +warning. + +Often people write `ON_CALL`s in the mock object's +constructor or `SetUp()`, as the default behavior rarely changes from +test to test. Then in the test body they set the expectations, which +are often different for each test. Having an `ON_CALL` in the set-up +part of a test doesn't mean that the calls are expected. If there's +no `EXPECT_CALL` and the method is called, it's possibly an error. If +we quietly let the call go through without notifying the user, bugs +may creep in unnoticed. + +If, however, you are sure that the calls are OK, you can write + +``` +EXPECT_CALL(foo, Bar(_)) + .WillRepeatedly(...); +``` + +instead of + +``` +ON_CALL(foo, Bar(_)) + .WillByDefault(...); +``` + +This tells Google Mock that you do expect the calls and no warning should be +printed. + +Also, you can control the verbosity using the `--gmock_verbose` flag. +If you find the output too noisy when debugging, just choose a less +verbose level. + +## How can I delete the mock function's argument in an action? ## + +If you find yourself needing to perform some action that's not +supported by Google Mock directly, remember that you can define your own +actions using +[MakeAction()](CookBook.md#writing-new-actions) or +[MakePolymorphicAction()](CookBook.md#writing_new_polymorphic_actions), +or you can write a stub function and invoke it using +[Invoke()](CookBook.md#using-functions_methods_functors). + +## MOCK\_METHODn()'s second argument looks funny. Why don't you use the MOCK\_METHODn(Method, return\_type, arg\_1, ..., arg\_n) syntax? ## + +What?! I think it's beautiful. :-) + +While which syntax looks more natural is a subjective matter to some +extent, Google Mock's syntax was chosen for several practical advantages it +has. + +Try to mock a function that takes a map as an argument: +``` +virtual int GetSize(const map& m); +``` + +Using the proposed syntax, it would be: +``` +MOCK_METHOD1(GetSize, int, const map& m); +``` + +Guess what? You'll get a compiler error as the compiler thinks that +`const map& m` are **two**, not one, arguments. To work +around this you can use `typedef` to give the map type a name, but +that gets in the way of your work. Google Mock's syntax avoids this +problem as the function's argument types are protected inside a pair +of parentheses: +``` +// This compiles fine. +MOCK_METHOD1(GetSize, int(const map& m)); +``` + +You still need a `typedef` if the return type contains an unprotected +comma, but that's much rarer. + +Other advantages include: + 1. `MOCK_METHOD1(Foo, int, bool)` can leave a reader wonder whether the method returns `int` or `bool`, while there won't be such confusion using Google Mock's syntax. + 1. The way Google Mock describes a function type is nothing new, although many people may not be familiar with it. The same syntax was used in C, and the `function` library in `tr1` uses this syntax extensively. Since `tr1` will become a part of the new version of STL, we feel very comfortable to be consistent with it. + 1. The function type syntax is also used in other parts of Google Mock's API (e.g. the action interface) in order to make the implementation tractable. A user needs to learn it anyway in order to utilize Google Mock's more advanced features. We'd as well stick to the same syntax in `MOCK_METHOD*`! + +## My code calls a static/global function. Can I mock it? ## + +You can, but you need to make some changes. + +In general, if you find yourself needing to mock a static function, +it's a sign that your modules are too tightly coupled (and less +flexible, less reusable, less testable, etc). You are probably better +off defining a small interface and call the function through that +interface, which then can be easily mocked. It's a bit of work +initially, but usually pays for itself quickly. + +This Google Testing Blog +[post](http://googletesting.blogspot.com/2008/06/defeat-static-cling.html) +says it excellently. Check it out. + +## My mock object needs to do complex stuff. It's a lot of pain to specify the actions. Google Mock sucks! ## + +I know it's not a question, but you get an answer for free any way. :-) + +With Google Mock, you can create mocks in C++ easily. And people might be +tempted to use them everywhere. Sometimes they work great, and +sometimes you may find them, well, a pain to use. So, what's wrong in +the latter case? + +When you write a test without using mocks, you exercise the code and +assert that it returns the correct value or that the system is in an +expected state. This is sometimes called "state-based testing". + +Mocks are great for what some call "interaction-based" testing: +instead of checking the system state at the very end, mock objects +verify that they are invoked the right way and report an error as soon +as it arises, giving you a handle on the precise context in which the +error was triggered. This is often more effective and economical to +do than state-based testing. + +If you are doing state-based testing and using a test double just to +simulate the real object, you are probably better off using a fake. +Using a mock in this case causes pain, as it's not a strong point for +mocks to perform complex actions. If you experience this and think +that mocks suck, you are just not using the right tool for your +problem. Or, you might be trying to solve the wrong problem. :-) + +## I got a warning "Uninteresting function call encountered - default action taken.." Should I panic? ## + +By all means, NO! It's just an FYI. + +What it means is that you have a mock function, you haven't set any +expectations on it (by Google Mock's rule this means that you are not +interested in calls to this function and therefore it can be called +any number of times), and it is called. That's OK - you didn't say +it's not OK to call the function! + +What if you actually meant to disallow this function to be called, but +forgot to write `EXPECT_CALL(foo, Bar()).Times(0)`? While +one can argue that it's the user's fault, Google Mock tries to be nice and +prints you a note. + +So, when you see the message and believe that there shouldn't be any +uninteresting calls, you should investigate what's going on. To make +your life easier, Google Mock prints the function name and arguments +when an uninteresting call is encountered. + +## I want to define a custom action. Should I use Invoke() or implement the action interface? ## + +Either way is fine - you want to choose the one that's more convenient +for your circumstance. + +Usually, if your action is for a particular function type, defining it +using `Invoke()` should be easier; if your action can be used in +functions of different types (e.g. if you are defining +`Return(value)`), `MakePolymorphicAction()` is +easiest. Sometimes you want precise control on what types of +functions the action can be used in, and implementing +`ActionInterface` is the way to go here. See the implementation of +`Return()` in `include/gmock/gmock-actions.h` for an example. + +## I'm using the set-argument-pointee action, and the compiler complains about "conflicting return type specified". What does it mean? ## + +You got this error as Google Mock has no idea what value it should return +when the mock method is called. `SetArgPointee()` says what the +side effect is, but doesn't say what the return value should be. You +need `DoAll()` to chain a `SetArgPointee()` with a `Return()`. + +See this [recipe](CookBook.md#mocking_side_effects) for more details and an example. + + +## My question is not in your FAQ! ## + +If you cannot find the answer to your question in this FAQ, there are +some other resources you can use: + + 1. read other [documentation](Documentation.md), + 1. search the mailing list [archive](http://groups.google.com/group/googlemock/topics), + 1. ask it on [googlemock@googlegroups.com](mailto:googlemock@googlegroups.com) and someone will answer it (to prevent spam, we require you to join the [discussion group](http://groups.google.com/group/googlemock) before you can post.). + +Please note that creating an issue in the +[issue tracker](https://github.com/google/googletest/issues) is _not_ +a good way to get your answer, as it is monitored infrequently by a +very small number of people. + +When asking a question, it's helpful to provide as much of the +following information as possible (people cannot help you if there's +not enough information in your question): + + * the version (or the revision number if you check out from SVN directly) of Google Mock you use (Google Mock is under active development, so it's possible that your problem has been solved in a later version), + * your operating system, + * the name and version of your compiler, + * the complete command line flags you give to your compiler, + * the complete compiler error messages (if the question is about compilation), + * the _actual_ code (ideally, a minimal but complete program) that has the problem you encounter. diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/KnownIssues.md b/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/KnownIssues.md new file mode 100644 index 00000000000..adadf5144b1 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/docs/KnownIssues.md @@ -0,0 +1,19 @@ +As any non-trivial software system, Google Mock has some known limitations and problems. We are working on improving it, and welcome your help! The follow is a list of issues we know about. + + + +## README contains outdated information on Google Mock's compatibility with other testing frameworks ## + +The `README` file in release 1.1.0 still says that Google Mock only works with Google Test. Actually, you can configure Google Mock to work with any testing framework you choose. + +## Tests failing on machines using Power PC CPUs (e.g. some Macs) ## + +`gmock_output_test` and `gmock-printers_test` are known to fail with Power PC CPUs. This is due to portability issues with these tests, and is not an indication of problems in Google Mock itself. You can safely ignore them. + +## Failed to resolve libgtest.so.0 in tests when built against installed Google Test ## + +This only applies if you manually built and installed Google Test, and then built a Google Mock against it (either explicitly, or because gtest-config was in your path post-install). In this situation, Libtool has a known issue with certain systems' ldconfig setup: + +http://article.gmane.org/gmane.comp.sysutils.automake.general/9025 + +This requires a manual run of "sudo ldconfig" after the "sudo make install" for Google Test before any binaries which link against it can be executed. This isn't a bug in our install, but we should at least have documented it or hacked a work-around into our install. We should have one of these solutions in our next release. \ No newline at end of file diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-actions.h b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-actions.h new file mode 100644 index 00000000000..90fd2ea69d2 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-actions.h @@ -0,0 +1,1206 @@ +// Copyright 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: wan@google.com (Zhanyong Wan) + +// Google Mock - a framework for writing C++ mock classes. +// +// This file implements some commonly used actions. + +#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ +#define GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ + +#ifndef _WIN32_WCE +# include +#endif + +#include +#include + +#include "gmock/internal/gmock-internal-utils.h" +#include "gmock/internal/gmock-port.h" + +#if GTEST_LANG_CXX11 // Defined by gtest-port.h via gmock-port.h. +#include +#include +#endif // GTEST_LANG_CXX11 + +namespace testing { + +// To implement an action Foo, define: +// 1. a class FooAction that implements the ActionInterface interface, and +// 2. a factory function that creates an Action object from a +// const FooAction*. +// +// The two-level delegation design follows that of Matcher, providing +// consistency for extension developers. It also eases ownership +// management as Action objects can now be copied like plain values. + +namespace internal { + +template +class ActionAdaptor; + +// BuiltInDefaultValueGetter::Get() returns a +// default-constructed T value. BuiltInDefaultValueGetter::Get() crashes with an error. +// +// This primary template is used when kDefaultConstructible is true. +template +struct BuiltInDefaultValueGetter { + static T Get() { return T(); } +}; +template +struct BuiltInDefaultValueGetter { + static T Get() { + Assert(false, __FILE__, __LINE__, + "Default action undefined for the function return type."); + return internal::Invalid(); + // The above statement will never be reached, but is required in + // order for this function to compile. + } +}; + +// BuiltInDefaultValue::Get() returns the "built-in" default value +// for type T, which is NULL when T is a raw pointer type, 0 when T is +// a numeric type, false when T is bool, or "" when T is string or +// std::string. In addition, in C++11 and above, it turns a +// default-constructed T value if T is default constructible. For any +// other type T, the built-in default T value is undefined, and the +// function will abort the process. +template +class BuiltInDefaultValue { + public: +#if GTEST_LANG_CXX11 + // This function returns true iff type T has a built-in default value. + static bool Exists() { + return ::std::is_default_constructible::value; + } + + static T Get() { + return BuiltInDefaultValueGetter< + T, ::std::is_default_constructible::value>::Get(); + } + +#else // GTEST_LANG_CXX11 + // This function returns true iff type T has a built-in default value. + static bool Exists() { + return false; + } + + static T Get() { + return BuiltInDefaultValueGetter::Get(); + } + +#endif // GTEST_LANG_CXX11 +}; + +// This partial specialization says that we use the same built-in +// default value for T and const T. +template +class BuiltInDefaultValue { + public: + static bool Exists() { return BuiltInDefaultValue::Exists(); } + static T Get() { return BuiltInDefaultValue::Get(); } +}; + +// This partial specialization defines the default values for pointer +// types. +template +class BuiltInDefaultValue { + public: + static bool Exists() { return true; } + static T* Get() { return NULL; } +}; + +// The following specializations define the default values for +// specific types we care about. +#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(type, value) \ + template <> \ + class BuiltInDefaultValue { \ + public: \ + static bool Exists() { return true; } \ + static type Get() { return value; } \ + } + +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(void, ); // NOLINT +#if GTEST_HAS_GLOBAL_STRING +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::string, ""); +#endif // GTEST_HAS_GLOBAL_STRING +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::std::string, ""); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(bool, false); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned char, '\0'); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed char, '\0'); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(char, '\0'); + +// There's no need for a default action for signed wchar_t, as that +// type is the same as wchar_t for gcc, and invalid for MSVC. +// +// There's also no need for a default action for unsigned wchar_t, as +// that type is the same as unsigned int for gcc, and invalid for +// MSVC. +#if GMOCK_WCHAR_T_IS_NATIVE_ +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(wchar_t, 0U); // NOLINT +#endif + +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned short, 0U); // NOLINT +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed short, 0); // NOLINT +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned int, 0U); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed int, 0); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long, 0UL); // NOLINT +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long, 0L); // NOLINT +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(UInt64, 0); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(Int64, 0); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(float, 0); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(double, 0); + +#undef GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ + +} // namespace internal + +// When an unexpected function call is encountered, Google Mock will +// let it return a default value if the user has specified one for its +// return type, or if the return type has a built-in default value; +// otherwise Google Mock won't know what value to return and will have +// to abort the process. +// +// The DefaultValue class allows a user to specify the +// default value for a type T that is both copyable and publicly +// destructible (i.e. anything that can be used as a function return +// type). The usage is: +// +// // Sets the default value for type T to be foo. +// DefaultValue::Set(foo); +template +class DefaultValue { + public: + // Sets the default value for type T; requires T to be + // copy-constructable and have a public destructor. + static void Set(T x) { + delete producer_; + producer_ = new FixedValueProducer(x); + } + + // Provides a factory function to be called to generate the default value. + // This method can be used even if T is only move-constructible, but it is not + // limited to that case. + typedef T (*FactoryFunction)(); + static void SetFactory(FactoryFunction factory) { + delete producer_; + producer_ = new FactoryValueProducer(factory); + } + + // Unsets the default value for type T. + static void Clear() { + delete producer_; + producer_ = NULL; + } + + // Returns true iff the user has set the default value for type T. + static bool IsSet() { return producer_ != NULL; } + + // Returns true if T has a default return value set by the user or there + // exists a built-in default value. + static bool Exists() { + return IsSet() || internal::BuiltInDefaultValue::Exists(); + } + + // Returns the default value for type T if the user has set one; + // otherwise returns the built-in default value. Requires that Exists() + // is true, which ensures that the return value is well-defined. + static T Get() { + return producer_ == NULL ? + internal::BuiltInDefaultValue::Get() : producer_->Produce(); + } + + private: + class ValueProducer { + public: + virtual ~ValueProducer() {} + virtual T Produce() = 0; + }; + + class FixedValueProducer : public ValueProducer { + public: + explicit FixedValueProducer(T value) : value_(value) {} + virtual T Produce() { return value_; } + + private: + const T value_; + GTEST_DISALLOW_COPY_AND_ASSIGN_(FixedValueProducer); + }; + + class FactoryValueProducer : public ValueProducer { + public: + explicit FactoryValueProducer(FactoryFunction factory) + : factory_(factory) {} + virtual T Produce() { return factory_(); } + + private: + const FactoryFunction factory_; + GTEST_DISALLOW_COPY_AND_ASSIGN_(FactoryValueProducer); + }; + + static ValueProducer* producer_; +}; + +// This partial specialization allows a user to set default values for +// reference types. +template +class DefaultValue { + public: + // Sets the default value for type T&. + static void Set(T& x) { // NOLINT + address_ = &x; + } + + // Unsets the default value for type T&. + static void Clear() { + address_ = NULL; + } + + // Returns true iff the user has set the default value for type T&. + static bool IsSet() { return address_ != NULL; } + + // Returns true if T has a default return value set by the user or there + // exists a built-in default value. + static bool Exists() { + return IsSet() || internal::BuiltInDefaultValue::Exists(); + } + + // Returns the default value for type T& if the user has set one; + // otherwise returns the built-in default value if there is one; + // otherwise aborts the process. + static T& Get() { + return address_ == NULL ? + internal::BuiltInDefaultValue::Get() : *address_; + } + + private: + static T* address_; +}; + +// This specialization allows DefaultValue::Get() to +// compile. +template <> +class DefaultValue { + public: + static bool Exists() { return true; } + static void Get() {} +}; + +// Points to the user-set default value for type T. +template +typename DefaultValue::ValueProducer* DefaultValue::producer_ = NULL; + +// Points to the user-set default value for type T&. +template +T* DefaultValue::address_ = NULL; + +// Implement this interface to define an action for function type F. +template +class ActionInterface { + public: + typedef typename internal::Function::Result Result; + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + ActionInterface() {} + virtual ~ActionInterface() {} + + // Performs the action. This method is not const, as in general an + // action can have side effects and be stateful. For example, a + // get-the-next-element-from-the-collection action will need to + // remember the current element. + virtual Result Perform(const ArgumentTuple& args) = 0; + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionInterface); +}; + +// An Action is a copyable and IMMUTABLE (except by assignment) +// object that represents an action to be taken when a mock function +// of type F is called. The implementation of Action is just a +// linked_ptr to const ActionInterface, so copying is fairly cheap. +// Don't inherit from Action! +// +// You can view an object implementing ActionInterface as a +// concrete action (including its current state), and an Action +// object as a handle to it. +template +class Action { + public: + typedef typename internal::Function::Result Result; + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + // Constructs a null Action. Needed for storing Action objects in + // STL containers. + Action() : impl_(NULL) {} + + // Constructs an Action from its implementation. A NULL impl is + // used to represent the "do-default" action. + explicit Action(ActionInterface* impl) : impl_(impl) {} + + // Copy constructor. + Action(const Action& action) : impl_(action.impl_) {} + + // This constructor allows us to turn an Action object into an + // Action, as long as F's arguments can be implicitly converted + // to Func's and Func's return type can be implicitly converted to + // F's. + template + explicit Action(const Action& action); + + // Returns true iff this is the DoDefault() action. + bool IsDoDefault() const { return impl_.get() == NULL; } + + // Performs the action. Note that this method is const even though + // the corresponding method in ActionInterface is not. The reason + // is that a const Action means that it cannot be re-bound to + // another concrete action, not that the concrete action it binds to + // cannot change state. (Think of the difference between a const + // pointer and a pointer to const.) + Result Perform(const ArgumentTuple& args) const { + internal::Assert( + !IsDoDefault(), __FILE__, __LINE__, + "You are using DoDefault() inside a composite action like " + "DoAll() or WithArgs(). This is not supported for technical " + "reasons. Please instead spell out the default action, or " + "assign the default action to an Action variable and use " + "the variable in various places."); + return impl_->Perform(args); + } + + private: + template + friend class internal::ActionAdaptor; + + internal::linked_ptr > impl_; +}; + +// The PolymorphicAction class template makes it easy to implement a +// polymorphic action (i.e. an action that can be used in mock +// functions of than one type, e.g. Return()). +// +// To define a polymorphic action, a user first provides a COPYABLE +// implementation class that has a Perform() method template: +// +// class FooAction { +// public: +// template +// Result Perform(const ArgumentTuple& args) const { +// // Processes the arguments and returns a result, using +// // tr1::get(args) to get the N-th (0-based) argument in the tuple. +// } +// ... +// }; +// +// Then the user creates the polymorphic action using +// MakePolymorphicAction(object) where object has type FooAction. See +// the definition of Return(void) and SetArgumentPointee(value) for +// complete examples. +template +class PolymorphicAction { + public: + explicit PolymorphicAction(const Impl& impl) : impl_(impl) {} + + template + operator Action() const { + return Action(new MonomorphicImpl(impl_)); + } + + private: + template + class MonomorphicImpl : public ActionInterface { + public: + typedef typename internal::Function::Result Result; + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {} + + virtual Result Perform(const ArgumentTuple& args) { + return impl_.template Perform(args); + } + + private: + Impl impl_; + + GTEST_DISALLOW_ASSIGN_(MonomorphicImpl); + }; + + Impl impl_; + + GTEST_DISALLOW_ASSIGN_(PolymorphicAction); +}; + +// Creates an Action from its implementation and returns it. The +// created Action object owns the implementation. +template +Action MakeAction(ActionInterface* impl) { + return Action(impl); +} + +// Creates a polymorphic action from its implementation. This is +// easier to use than the PolymorphicAction constructor as it +// doesn't require you to explicitly write the template argument, e.g. +// +// MakePolymorphicAction(foo); +// vs +// PolymorphicAction(foo); +template +inline PolymorphicAction MakePolymorphicAction(const Impl& impl) { + return PolymorphicAction(impl); +} + +namespace internal { + +// Allows an Action object to pose as an Action, as long as F2 +// and F1 are compatible. +template +class ActionAdaptor : public ActionInterface { + public: + typedef typename internal::Function::Result Result; + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + explicit ActionAdaptor(const Action& from) : impl_(from.impl_) {} + + virtual Result Perform(const ArgumentTuple& args) { + return impl_->Perform(args); + } + + private: + const internal::linked_ptr > impl_; + + GTEST_DISALLOW_ASSIGN_(ActionAdaptor); +}; + +// Helper struct to specialize ReturnAction to execute a move instead of a copy +// on return. Useful for move-only types, but could be used on any type. +template +struct ByMoveWrapper { + explicit ByMoveWrapper(T value) : payload(internal::move(value)) {} + T payload; +}; + +// Implements the polymorphic Return(x) action, which can be used in +// any function that returns the type of x, regardless of the argument +// types. +// +// Note: The value passed into Return must be converted into +// Function::Result when this action is cast to Action rather than +// when that action is performed. This is important in scenarios like +// +// MOCK_METHOD1(Method, T(U)); +// ... +// { +// Foo foo; +// X x(&foo); +// EXPECT_CALL(mock, Method(_)).WillOnce(Return(x)); +// } +// +// In the example above the variable x holds reference to foo which leaves +// scope and gets destroyed. If copying X just copies a reference to foo, +// that copy will be left with a hanging reference. If conversion to T +// makes a copy of foo, the above code is safe. To support that scenario, we +// need to make sure that the type conversion happens inside the EXPECT_CALL +// statement, and conversion of the result of Return to Action is a +// good place for that. +// +template +class ReturnAction { + public: + // Constructs a ReturnAction object from the value to be returned. + // 'value' is passed by value instead of by const reference in order + // to allow Return("string literal") to compile. + explicit ReturnAction(R value) : value_(new R(internal::move(value))) {} + + // This template type conversion operator allows Return(x) to be + // used in ANY function that returns x's type. + template + operator Action() const { + // Assert statement belongs here because this is the best place to verify + // conditions on F. It produces the clearest error messages + // in most compilers. + // Impl really belongs in this scope as a local class but can't + // because MSVC produces duplicate symbols in different translation units + // in this case. Until MS fixes that bug we put Impl into the class scope + // and put the typedef both here (for use in assert statement) and + // in the Impl class. But both definitions must be the same. + typedef typename Function::Result Result; + GTEST_COMPILE_ASSERT_( + !is_reference::value, + use_ReturnRef_instead_of_Return_to_return_a_reference); + return Action(new Impl(value_)); + } + + private: + // Implements the Return(x) action for a particular function type F. + template + class Impl : public ActionInterface { + public: + typedef typename Function::Result Result; + typedef typename Function::ArgumentTuple ArgumentTuple; + + // The implicit cast is necessary when Result has more than one + // single-argument constructor (e.g. Result is std::vector) and R + // has a type conversion operator template. In that case, value_(value) + // won't compile as the compiler doesn't known which constructor of + // Result to call. ImplicitCast_ forces the compiler to convert R to + // Result without considering explicit constructors, thus resolving the + // ambiguity. value_ is then initialized using its copy constructor. + explicit Impl(const linked_ptr& value) + : value_before_cast_(*value), + value_(ImplicitCast_(value_before_cast_)) {} + + virtual Result Perform(const ArgumentTuple&) { return value_; } + + private: + GTEST_COMPILE_ASSERT_(!is_reference::value, + Result_cannot_be_a_reference_type); + // We save the value before casting just in case it is being cast to a + // wrapper type. + R value_before_cast_; + Result value_; + + GTEST_DISALLOW_COPY_AND_ASSIGN_(Impl); + }; + + // Partially specialize for ByMoveWrapper. This version of ReturnAction will + // move its contents instead. + template + class Impl, F> : public ActionInterface { + public: + typedef typename Function::Result Result; + typedef typename Function::ArgumentTuple ArgumentTuple; + + explicit Impl(const linked_ptr& wrapper) + : performed_(false), wrapper_(wrapper) {} + + virtual Result Perform(const ArgumentTuple&) { + GTEST_CHECK_(!performed_) + << "A ByMove() action should only be performed once."; + performed_ = true; + return internal::move(wrapper_->payload); + } + + private: + bool performed_; + const linked_ptr wrapper_; + + GTEST_DISALLOW_ASSIGN_(Impl); + }; + + const linked_ptr value_; + + GTEST_DISALLOW_ASSIGN_(ReturnAction); +}; + +// Implements the ReturnNull() action. +class ReturnNullAction { + public: + // Allows ReturnNull() to be used in any pointer-returning function. In C++11 + // this is enforced by returning nullptr, and in non-C++11 by asserting a + // pointer type on compile time. + template + static Result Perform(const ArgumentTuple&) { +#if GTEST_LANG_CXX11 + return nullptr; +#else + GTEST_COMPILE_ASSERT_(internal::is_pointer::value, + ReturnNull_can_be_used_to_return_a_pointer_only); + return NULL; +#endif // GTEST_LANG_CXX11 + } +}; + +// Implements the Return() action. +class ReturnVoidAction { + public: + // Allows Return() to be used in any void-returning function. + template + static void Perform(const ArgumentTuple&) { + CompileAssertTypesEqual(); + } +}; + +// Implements the polymorphic ReturnRef(x) action, which can be used +// in any function that returns a reference to the type of x, +// regardless of the argument types. +template +class ReturnRefAction { + public: + // Constructs a ReturnRefAction object from the reference to be returned. + explicit ReturnRefAction(T& ref) : ref_(ref) {} // NOLINT + + // This template type conversion operator allows ReturnRef(x) to be + // used in ANY function that returns a reference to x's type. + template + operator Action() const { + typedef typename Function::Result Result; + // Asserts that the function return type is a reference. This + // catches the user error of using ReturnRef(x) when Return(x) + // should be used, and generates some helpful error message. + GTEST_COMPILE_ASSERT_(internal::is_reference::value, + use_Return_instead_of_ReturnRef_to_return_a_value); + return Action(new Impl(ref_)); + } + + private: + // Implements the ReturnRef(x) action for a particular function type F. + template + class Impl : public ActionInterface { + public: + typedef typename Function::Result Result; + typedef typename Function::ArgumentTuple ArgumentTuple; + + explicit Impl(T& ref) : ref_(ref) {} // NOLINT + + virtual Result Perform(const ArgumentTuple&) { + return ref_; + } + + private: + T& ref_; + + GTEST_DISALLOW_ASSIGN_(Impl); + }; + + T& ref_; + + GTEST_DISALLOW_ASSIGN_(ReturnRefAction); +}; + +// Implements the polymorphic ReturnRefOfCopy(x) action, which can be +// used in any function that returns a reference to the type of x, +// regardless of the argument types. +template +class ReturnRefOfCopyAction { + public: + // Constructs a ReturnRefOfCopyAction object from the reference to + // be returned. + explicit ReturnRefOfCopyAction(const T& value) : value_(value) {} // NOLINT + + // This template type conversion operator allows ReturnRefOfCopy(x) to be + // used in ANY function that returns a reference to x's type. + template + operator Action() const { + typedef typename Function::Result Result; + // Asserts that the function return type is a reference. This + // catches the user error of using ReturnRefOfCopy(x) when Return(x) + // should be used, and generates some helpful error message. + GTEST_COMPILE_ASSERT_( + internal::is_reference::value, + use_Return_instead_of_ReturnRefOfCopy_to_return_a_value); + return Action(new Impl(value_)); + } + + private: + // Implements the ReturnRefOfCopy(x) action for a particular function type F. + template + class Impl : public ActionInterface { + public: + typedef typename Function::Result Result; + typedef typename Function::ArgumentTuple ArgumentTuple; + + explicit Impl(const T& value) : value_(value) {} // NOLINT + + virtual Result Perform(const ArgumentTuple&) { + return value_; + } + + private: + T value_; + + GTEST_DISALLOW_ASSIGN_(Impl); + }; + + const T value_; + + GTEST_DISALLOW_ASSIGN_(ReturnRefOfCopyAction); +}; + +// Implements the polymorphic DoDefault() action. +class DoDefaultAction { + public: + // This template type conversion operator allows DoDefault() to be + // used in any function. + template + operator Action() const { return Action(NULL); } +}; + +// Implements the Assign action to set a given pointer referent to a +// particular value. +template +class AssignAction { + public: + AssignAction(T1* ptr, T2 value) : ptr_(ptr), value_(value) {} + + template + void Perform(const ArgumentTuple& /* args */) const { + *ptr_ = value_; + } + + private: + T1* const ptr_; + const T2 value_; + + GTEST_DISALLOW_ASSIGN_(AssignAction); +}; + +#if !GTEST_OS_WINDOWS_MOBILE + +// Implements the SetErrnoAndReturn action to simulate return from +// various system calls and libc functions. +template +class SetErrnoAndReturnAction { + public: + SetErrnoAndReturnAction(int errno_value, T result) + : errno_(errno_value), + result_(result) {} + template + Result Perform(const ArgumentTuple& /* args */) const { + errno = errno_; + return result_; + } + + private: + const int errno_; + const T result_; + + GTEST_DISALLOW_ASSIGN_(SetErrnoAndReturnAction); +}; + +#endif // !GTEST_OS_WINDOWS_MOBILE + +// Implements the SetArgumentPointee(x) action for any function +// whose N-th argument (0-based) is a pointer to x's type. The +// template parameter kIsProto is true iff type A is ProtocolMessage, +// proto2::Message, or a sub-class of those. +template +class SetArgumentPointeeAction { + public: + // Constructs an action that sets the variable pointed to by the + // N-th function argument to 'value'. + explicit SetArgumentPointeeAction(const A& value) : value_(value) {} + + template + void Perform(const ArgumentTuple& args) const { + CompileAssertTypesEqual(); + *::testing::get(args) = value_; + } + + private: + const A value_; + + GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction); +}; + +template +class SetArgumentPointeeAction { + public: + // Constructs an action that sets the variable pointed to by the + // N-th function argument to 'proto'. Both ProtocolMessage and + // proto2::Message have the CopyFrom() method, so the same + // implementation works for both. + explicit SetArgumentPointeeAction(const Proto& proto) : proto_(new Proto) { + proto_->CopyFrom(proto); + } + + template + void Perform(const ArgumentTuple& args) const { + CompileAssertTypesEqual(); + ::testing::get(args)->CopyFrom(*proto_); + } + + private: + const internal::linked_ptr proto_; + + GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction); +}; + +// Implements the InvokeWithoutArgs(f) action. The template argument +// FunctionImpl is the implementation type of f, which can be either a +// function pointer or a functor. InvokeWithoutArgs(f) can be used as an +// Action as long as f's type is compatible with F (i.e. f can be +// assigned to a tr1::function). +template +class InvokeWithoutArgsAction { + public: + // The c'tor makes a copy of function_impl (either a function + // pointer or a functor). + explicit InvokeWithoutArgsAction(FunctionImpl function_impl) + : function_impl_(function_impl) {} + + // Allows InvokeWithoutArgs(f) to be used as any action whose type is + // compatible with f. + template + Result Perform(const ArgumentTuple&) { return function_impl_(); } + + private: + FunctionImpl function_impl_; + + GTEST_DISALLOW_ASSIGN_(InvokeWithoutArgsAction); +}; + +// Implements the InvokeWithoutArgs(object_ptr, &Class::Method) action. +template +class InvokeMethodWithoutArgsAction { + public: + InvokeMethodWithoutArgsAction(Class* obj_ptr, MethodPtr method_ptr) + : obj_ptr_(obj_ptr), method_ptr_(method_ptr) {} + + template + Result Perform(const ArgumentTuple&) const { + return (obj_ptr_->*method_ptr_)(); + } + + private: + Class* const obj_ptr_; + const MethodPtr method_ptr_; + + GTEST_DISALLOW_ASSIGN_(InvokeMethodWithoutArgsAction); +}; + +// Implements the IgnoreResult(action) action. +template +class IgnoreResultAction { + public: + explicit IgnoreResultAction(const A& action) : action_(action) {} + + template + operator Action() const { + // Assert statement belongs here because this is the best place to verify + // conditions on F. It produces the clearest error messages + // in most compilers. + // Impl really belongs in this scope as a local class but can't + // because MSVC produces duplicate symbols in different translation units + // in this case. Until MS fixes that bug we put Impl into the class scope + // and put the typedef both here (for use in assert statement) and + // in the Impl class. But both definitions must be the same. + typedef typename internal::Function::Result Result; + + // Asserts at compile time that F returns void. + CompileAssertTypesEqual(); + + return Action(new Impl(action_)); + } + + private: + template + class Impl : public ActionInterface { + public: + typedef typename internal::Function::Result Result; + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + explicit Impl(const A& action) : action_(action) {} + + virtual void Perform(const ArgumentTuple& args) { + // Performs the action and ignores its result. + action_.Perform(args); + } + + private: + // Type OriginalFunction is the same as F except that its return + // type is IgnoredValue. + typedef typename internal::Function::MakeResultIgnoredValue + OriginalFunction; + + const Action action_; + + GTEST_DISALLOW_ASSIGN_(Impl); + }; + + const A action_; + + GTEST_DISALLOW_ASSIGN_(IgnoreResultAction); +}; + +// A ReferenceWrapper object represents a reference to type T, +// which can be either const or not. It can be explicitly converted +// from, and implicitly converted to, a T&. Unlike a reference, +// ReferenceWrapper can be copied and can survive template type +// inference. This is used to support by-reference arguments in the +// InvokeArgument(...) action. The idea was from "reference +// wrappers" in tr1, which we don't have in our source tree yet. +template +class ReferenceWrapper { + public: + // Constructs a ReferenceWrapper object from a T&. + explicit ReferenceWrapper(T& l_value) : pointer_(&l_value) {} // NOLINT + + // Allows a ReferenceWrapper object to be implicitly converted to + // a T&. + operator T&() const { return *pointer_; } + private: + T* pointer_; +}; + +// Allows the expression ByRef(x) to be printed as a reference to x. +template +void PrintTo(const ReferenceWrapper& ref, ::std::ostream* os) { + T& value = ref; + UniversalPrinter::Print(value, os); +} + +// Does two actions sequentially. Used for implementing the DoAll(a1, +// a2, ...) action. +template +class DoBothAction { + public: + DoBothAction(Action1 action1, Action2 action2) + : action1_(action1), action2_(action2) {} + + // This template type conversion operator allows DoAll(a1, ..., a_n) + // to be used in ANY function of compatible type. + template + operator Action() const { + return Action(new Impl(action1_, action2_)); + } + + private: + // Implements the DoAll(...) action for a particular function type F. + template + class Impl : public ActionInterface { + public: + typedef typename Function::Result Result; + typedef typename Function::ArgumentTuple ArgumentTuple; + typedef typename Function::MakeResultVoid VoidResult; + + Impl(const Action& action1, const Action& action2) + : action1_(action1), action2_(action2) {} + + virtual Result Perform(const ArgumentTuple& args) { + action1_.Perform(args); + return action2_.Perform(args); + } + + private: + const Action action1_; + const Action action2_; + + GTEST_DISALLOW_ASSIGN_(Impl); + }; + + Action1 action1_; + Action2 action2_; + + GTEST_DISALLOW_ASSIGN_(DoBothAction); +}; + +} // namespace internal + +// An Unused object can be implicitly constructed from ANY value. +// This is handy when defining actions that ignore some or all of the +// mock function arguments. For example, given +// +// MOCK_METHOD3(Foo, double(const string& label, double x, double y)); +// MOCK_METHOD3(Bar, double(int index, double x, double y)); +// +// instead of +// +// double DistanceToOriginWithLabel(const string& label, double x, double y) { +// return sqrt(x*x + y*y); +// } +// double DistanceToOriginWithIndex(int index, double x, double y) { +// return sqrt(x*x + y*y); +// } +// ... +// EXPECT_CALL(mock, Foo("abc", _, _)) +// .WillOnce(Invoke(DistanceToOriginWithLabel)); +// EXPECT_CALL(mock, Bar(5, _, _)) +// .WillOnce(Invoke(DistanceToOriginWithIndex)); +// +// you could write +// +// // We can declare any uninteresting argument as Unused. +// double DistanceToOrigin(Unused, double x, double y) { +// return sqrt(x*x + y*y); +// } +// ... +// EXPECT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin)); +// EXPECT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin)); +typedef internal::IgnoredValue Unused; + +// This constructor allows us to turn an Action object into an +// Action, as long as To's arguments can be implicitly converted +// to From's and From's return type cann be implicitly converted to +// To's. +template +template +Action::Action(const Action& from) + : impl_(new internal::ActionAdaptor(from)) {} + +// Creates an action that returns 'value'. 'value' is passed by value +// instead of const reference - otherwise Return("string literal") +// will trigger a compiler error about using array as initializer. +template +internal::ReturnAction Return(R value) { + return internal::ReturnAction(internal::move(value)); +} + +// Creates an action that returns NULL. +inline PolymorphicAction ReturnNull() { + return MakePolymorphicAction(internal::ReturnNullAction()); +} + +// Creates an action that returns from a void function. +inline PolymorphicAction Return() { + return MakePolymorphicAction(internal::ReturnVoidAction()); +} + +// Creates an action that returns the reference to a variable. +template +inline internal::ReturnRefAction ReturnRef(R& x) { // NOLINT + return internal::ReturnRefAction(x); +} + +// Creates an action that returns the reference to a copy of the +// argument. The copy is created when the action is constructed and +// lives as long as the action. +template +inline internal::ReturnRefOfCopyAction ReturnRefOfCopy(const R& x) { + return internal::ReturnRefOfCopyAction(x); +} + +// Modifies the parent action (a Return() action) to perform a move of the +// argument instead of a copy. +// Return(ByMove()) actions can only be executed once and will assert this +// invariant. +template +internal::ByMoveWrapper ByMove(R x) { + return internal::ByMoveWrapper(internal::move(x)); +} + +// Creates an action that does the default action for the give mock function. +inline internal::DoDefaultAction DoDefault() { + return internal::DoDefaultAction(); +} + +// Creates an action that sets the variable pointed by the N-th +// (0-based) function argument to 'value'. +template +PolymorphicAction< + internal::SetArgumentPointeeAction< + N, T, internal::IsAProtocolMessage::value> > +SetArgPointee(const T& x) { + return MakePolymorphicAction(internal::SetArgumentPointeeAction< + N, T, internal::IsAProtocolMessage::value>(x)); +} + +#if !((GTEST_GCC_VER_ && GTEST_GCC_VER_ < 40000) || GTEST_OS_SYMBIAN) +// This overload allows SetArgPointee() to accept a string literal. +// GCC prior to the version 4.0 and Symbian C++ compiler cannot distinguish +// this overload from the templated version and emit a compile error. +template +PolymorphicAction< + internal::SetArgumentPointeeAction > +SetArgPointee(const char* p) { + return MakePolymorphicAction(internal::SetArgumentPointeeAction< + N, const char*, false>(p)); +} + +template +PolymorphicAction< + internal::SetArgumentPointeeAction > +SetArgPointee(const wchar_t* p) { + return MakePolymorphicAction(internal::SetArgumentPointeeAction< + N, const wchar_t*, false>(p)); +} +#endif + +// The following version is DEPRECATED. +template +PolymorphicAction< + internal::SetArgumentPointeeAction< + N, T, internal::IsAProtocolMessage::value> > +SetArgumentPointee(const T& x) { + return MakePolymorphicAction(internal::SetArgumentPointeeAction< + N, T, internal::IsAProtocolMessage::value>(x)); +} + +// Creates an action that sets a pointer referent to a given value. +template +PolymorphicAction > Assign(T1* ptr, T2 val) { + return MakePolymorphicAction(internal::AssignAction(ptr, val)); +} + +#if !GTEST_OS_WINDOWS_MOBILE + +// Creates an action that sets errno and returns the appropriate error. +template +PolymorphicAction > +SetErrnoAndReturn(int errval, T result) { + return MakePolymorphicAction( + internal::SetErrnoAndReturnAction(errval, result)); +} + +#endif // !GTEST_OS_WINDOWS_MOBILE + +// Various overloads for InvokeWithoutArgs(). + +// Creates an action that invokes 'function_impl' with no argument. +template +PolymorphicAction > +InvokeWithoutArgs(FunctionImpl function_impl) { + return MakePolymorphicAction( + internal::InvokeWithoutArgsAction(function_impl)); +} + +// Creates an action that invokes the given method on the given object +// with no argument. +template +PolymorphicAction > +InvokeWithoutArgs(Class* obj_ptr, MethodPtr method_ptr) { + return MakePolymorphicAction( + internal::InvokeMethodWithoutArgsAction( + obj_ptr, method_ptr)); +} + +// Creates an action that performs an_action and throws away its +// result. In other words, it changes the return type of an_action to +// void. an_action MUST NOT return void, or the code won't compile. +template +inline internal::IgnoreResultAction IgnoreResult(const A& an_action) { + return internal::IgnoreResultAction(an_action); +} + +// Creates a reference wrapper for the given L-value. If necessary, +// you can explicitly specify the type of the reference. For example, +// suppose 'derived' is an object of type Derived, ByRef(derived) +// would wrap a Derived&. If you want to wrap a const Base& instead, +// where Base is a base class of Derived, just write: +// +// ByRef(derived) +template +inline internal::ReferenceWrapper ByRef(T& l_value) { // NOLINT + return internal::ReferenceWrapper(l_value); +} + +} // namespace testing + +#endif // GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-cardinalities.h b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-cardinalities.h new file mode 100644 index 00000000000..fc315f92ab5 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-cardinalities.h @@ -0,0 +1,147 @@ +// Copyright 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: wan@google.com (Zhanyong Wan) + +// Google Mock - a framework for writing C++ mock classes. +// +// This file implements some commonly used cardinalities. More +// cardinalities can be defined by the user implementing the +// CardinalityInterface interface if necessary. + +#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ +#define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ + +#include +#include // NOLINT +#include "gmock/internal/gmock-port.h" +#include "gtest/gtest.h" + +namespace testing { + +// To implement a cardinality Foo, define: +// 1. a class FooCardinality that implements the +// CardinalityInterface interface, and +// 2. a factory function that creates a Cardinality object from a +// const FooCardinality*. +// +// The two-level delegation design follows that of Matcher, providing +// consistency for extension developers. It also eases ownership +// management as Cardinality objects can now be copied like plain values. + +// The implementation of a cardinality. +class CardinalityInterface { + public: + virtual ~CardinalityInterface() {} + + // Conservative estimate on the lower/upper bound of the number of + // calls allowed. + virtual int ConservativeLowerBound() const { return 0; } + virtual int ConservativeUpperBound() const { return INT_MAX; } + + // Returns true iff call_count calls will satisfy this cardinality. + virtual bool IsSatisfiedByCallCount(int call_count) const = 0; + + // Returns true iff call_count calls will saturate this cardinality. + virtual bool IsSaturatedByCallCount(int call_count) const = 0; + + // Describes self to an ostream. + virtual void DescribeTo(::std::ostream* os) const = 0; +}; + +// A Cardinality is a copyable and IMMUTABLE (except by assignment) +// object that specifies how many times a mock function is expected to +// be called. The implementation of Cardinality is just a linked_ptr +// to const CardinalityInterface, so copying is fairly cheap. +// Don't inherit from Cardinality! +class GTEST_API_ Cardinality { + public: + // Constructs a null cardinality. Needed for storing Cardinality + // objects in STL containers. + Cardinality() {} + + // Constructs a Cardinality from its implementation. + explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {} + + // Conservative estimate on the lower/upper bound of the number of + // calls allowed. + int ConservativeLowerBound() const { return impl_->ConservativeLowerBound(); } + int ConservativeUpperBound() const { return impl_->ConservativeUpperBound(); } + + // Returns true iff call_count calls will satisfy this cardinality. + bool IsSatisfiedByCallCount(int call_count) const { + return impl_->IsSatisfiedByCallCount(call_count); + } + + // Returns true iff call_count calls will saturate this cardinality. + bool IsSaturatedByCallCount(int call_count) const { + return impl_->IsSaturatedByCallCount(call_count); + } + + // Returns true iff call_count calls will over-saturate this + // cardinality, i.e. exceed the maximum number of allowed calls. + bool IsOverSaturatedByCallCount(int call_count) const { + return impl_->IsSaturatedByCallCount(call_count) && + !impl_->IsSatisfiedByCallCount(call_count); + } + + // Describes self to an ostream + void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); } + + // Describes the given actual call count to an ostream. + static void DescribeActualCallCountTo(int actual_call_count, + ::std::ostream* os); + + private: + internal::linked_ptr impl_; +}; + +// Creates a cardinality that allows at least n calls. +GTEST_API_ Cardinality AtLeast(int n); + +// Creates a cardinality that allows at most n calls. +GTEST_API_ Cardinality AtMost(int n); + +// Creates a cardinality that allows any number of calls. +GTEST_API_ Cardinality AnyNumber(); + +// Creates a cardinality that allows between min and max calls. +GTEST_API_ Cardinality Between(int min, int max); + +// Creates a cardinality that allows exactly n calls. +GTEST_API_ Cardinality Exactly(int n); + +// Creates a cardinality from its implementation. +inline Cardinality MakeCardinality(const CardinalityInterface* c) { + return Cardinality(c); +} + +} // namespace testing + +#endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-actions.h b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-actions.h new file mode 100644 index 00000000000..be4ebe4f062 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-actions.h @@ -0,0 +1,2377 @@ +// This file was GENERATED by a script. DO NOT EDIT BY HAND!!! + +// Copyright 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: wan@google.com (Zhanyong Wan) + +// Google Mock - a framework for writing C++ mock classes. +// +// This file implements some commonly used variadic actions. + +#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ +#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ + +#include "gmock/gmock-actions.h" +#include "gmock/internal/gmock-port.h" + +namespace testing { +namespace internal { + +// InvokeHelper knows how to unpack an N-tuple and invoke an N-ary +// function or method with the unpacked values, where F is a function +// type that takes N arguments. +template +class InvokeHelper; + +template +class InvokeHelper > { + public: + template + static R Invoke(Function function, const ::testing::tuple<>&) { + return function(); + } + + template + static R InvokeMethod(Class* obj_ptr, + MethodPtr method_ptr, + const ::testing::tuple<>&) { + return (obj_ptr->*method_ptr)(); + } +}; + +template +class InvokeHelper > { + public: + template + static R Invoke(Function function, const ::testing::tuple& args) { + return function(get<0>(args)); + } + + template + static R InvokeMethod(Class* obj_ptr, + MethodPtr method_ptr, + const ::testing::tuple& args) { + return (obj_ptr->*method_ptr)(get<0>(args)); + } +}; + +template +class InvokeHelper > { + public: + template + static R Invoke(Function function, const ::testing::tuple& args) { + return function(get<0>(args), get<1>(args)); + } + + template + static R InvokeMethod(Class* obj_ptr, + MethodPtr method_ptr, + const ::testing::tuple& args) { + return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args)); + } +}; + +template +class InvokeHelper > { + public: + template + static R Invoke(Function function, const ::testing::tuple& args) { + return function(get<0>(args), get<1>(args), get<2>(args)); + } + + template + static R InvokeMethod(Class* obj_ptr, + MethodPtr method_ptr, + const ::testing::tuple& args) { + return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), + get<2>(args)); + } +}; + +template +class InvokeHelper > { + public: + template + static R Invoke(Function function, const ::testing::tuple& args) { + return function(get<0>(args), get<1>(args), get<2>(args), + get<3>(args)); + } + + template + static R InvokeMethod(Class* obj_ptr, + MethodPtr method_ptr, + const ::testing::tuple& args) { + return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), + get<2>(args), get<3>(args)); + } +}; + +template +class InvokeHelper > { + public: + template + static R Invoke(Function function, const ::testing::tuple& args) { + return function(get<0>(args), get<1>(args), get<2>(args), + get<3>(args), get<4>(args)); + } + + template + static R InvokeMethod(Class* obj_ptr, + MethodPtr method_ptr, + const ::testing::tuple& args) { + return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), + get<2>(args), get<3>(args), get<4>(args)); + } +}; + +template +class InvokeHelper > { + public: + template + static R Invoke(Function function, const ::testing::tuple& args) { + return function(get<0>(args), get<1>(args), get<2>(args), + get<3>(args), get<4>(args), get<5>(args)); + } + + template + static R InvokeMethod(Class* obj_ptr, + MethodPtr method_ptr, + const ::testing::tuple& args) { + return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), + get<2>(args), get<3>(args), get<4>(args), get<5>(args)); + } +}; + +template +class InvokeHelper > { + public: + template + static R Invoke(Function function, const ::testing::tuple& args) { + return function(get<0>(args), get<1>(args), get<2>(args), + get<3>(args), get<4>(args), get<5>(args), get<6>(args)); + } + + template + static R InvokeMethod(Class* obj_ptr, + MethodPtr method_ptr, + const ::testing::tuple& args) { + return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), + get<2>(args), get<3>(args), get<4>(args), get<5>(args), + get<6>(args)); + } +}; + +template +class InvokeHelper > { + public: + template + static R Invoke(Function function, const ::testing::tuple& args) { + return function(get<0>(args), get<1>(args), get<2>(args), + get<3>(args), get<4>(args), get<5>(args), get<6>(args), + get<7>(args)); + } + + template + static R InvokeMethod(Class* obj_ptr, + MethodPtr method_ptr, + const ::testing::tuple& args) { + return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), + get<2>(args), get<3>(args), get<4>(args), get<5>(args), + get<6>(args), get<7>(args)); + } +}; + +template +class InvokeHelper > { + public: + template + static R Invoke(Function function, const ::testing::tuple& args) { + return function(get<0>(args), get<1>(args), get<2>(args), + get<3>(args), get<4>(args), get<5>(args), get<6>(args), + get<7>(args), get<8>(args)); + } + + template + static R InvokeMethod(Class* obj_ptr, + MethodPtr method_ptr, + const ::testing::tuple& args) { + return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), + get<2>(args), get<3>(args), get<4>(args), get<5>(args), + get<6>(args), get<7>(args), get<8>(args)); + } +}; + +template +class InvokeHelper > { + public: + template + static R Invoke(Function function, const ::testing::tuple& args) { + return function(get<0>(args), get<1>(args), get<2>(args), + get<3>(args), get<4>(args), get<5>(args), get<6>(args), + get<7>(args), get<8>(args), get<9>(args)); + } + + template + static R InvokeMethod(Class* obj_ptr, + MethodPtr method_ptr, + const ::testing::tuple& args) { + return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), + get<2>(args), get<3>(args), get<4>(args), get<5>(args), + get<6>(args), get<7>(args), get<8>(args), get<9>(args)); + } +}; + +// An INTERNAL macro for extracting the type of a tuple field. It's +// subject to change without notice - DO NOT USE IN USER CODE! +#define GMOCK_FIELD_(Tuple, N) \ + typename ::testing::tuple_element::type + +// SelectArgs::type is the +// type of an n-ary function whose i-th (1-based) argument type is the +// k{i}-th (0-based) field of ArgumentTuple, which must be a tuple +// type, and whose return type is Result. For example, +// SelectArgs, 0, 3>::type +// is int(bool, long). +// +// SelectArgs::Select(args) +// returns the selected fields (k1, k2, ..., k_n) of args as a tuple. +// For example, +// SelectArgs, 2, 0>::Select( +// ::testing::make_tuple(true, 'a', 2.5)) +// returns tuple (2.5, true). +// +// The numbers in list k1, k2, ..., k_n must be >= 0, where n can be +// in the range [0, 10]. Duplicates are allowed and they don't have +// to be in an ascending or descending order. + +template +class SelectArgs { + public: + typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), + GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), + GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), + GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7), + GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9), + GMOCK_FIELD_(ArgumentTuple, k10)); + typedef typename Function::ArgumentTuple SelectedArgs; + static SelectedArgs Select(const ArgumentTuple& args) { + return SelectedArgs(get(args), get(args), get(args), + get(args), get(args), get(args), get(args), + get(args), get(args), get(args)); + } +}; + +template +class SelectArgs { + public: + typedef Result type(); + typedef typename Function::ArgumentTuple SelectedArgs; + static SelectedArgs Select(const ArgumentTuple& /* args */) { + return SelectedArgs(); + } +}; + +template +class SelectArgs { + public: + typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1)); + typedef typename Function::ArgumentTuple SelectedArgs; + static SelectedArgs Select(const ArgumentTuple& args) { + return SelectedArgs(get(args)); + } +}; + +template +class SelectArgs { + public: + typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), + GMOCK_FIELD_(ArgumentTuple, k2)); + typedef typename Function::ArgumentTuple SelectedArgs; + static SelectedArgs Select(const ArgumentTuple& args) { + return SelectedArgs(get(args), get(args)); + } +}; + +template +class SelectArgs { + public: + typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), + GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3)); + typedef typename Function::ArgumentTuple SelectedArgs; + static SelectedArgs Select(const ArgumentTuple& args) { + return SelectedArgs(get(args), get(args), get(args)); + } +}; + +template +class SelectArgs { + public: + typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), + GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), + GMOCK_FIELD_(ArgumentTuple, k4)); + typedef typename Function::ArgumentTuple SelectedArgs; + static SelectedArgs Select(const ArgumentTuple& args) { + return SelectedArgs(get(args), get(args), get(args), + get(args)); + } +}; + +template +class SelectArgs { + public: + typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), + GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), + GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5)); + typedef typename Function::ArgumentTuple SelectedArgs; + static SelectedArgs Select(const ArgumentTuple& args) { + return SelectedArgs(get(args), get(args), get(args), + get(args), get(args)); + } +}; + +template +class SelectArgs { + public: + typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), + GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), + GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), + GMOCK_FIELD_(ArgumentTuple, k6)); + typedef typename Function::ArgumentTuple SelectedArgs; + static SelectedArgs Select(const ArgumentTuple& args) { + return SelectedArgs(get(args), get(args), get(args), + get(args), get(args), get(args)); + } +}; + +template +class SelectArgs { + public: + typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), + GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), + GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), + GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7)); + typedef typename Function::ArgumentTuple SelectedArgs; + static SelectedArgs Select(const ArgumentTuple& args) { + return SelectedArgs(get(args), get(args), get(args), + get(args), get(args), get(args), get(args)); + } +}; + +template +class SelectArgs { + public: + typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), + GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), + GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), + GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7), + GMOCK_FIELD_(ArgumentTuple, k8)); + typedef typename Function::ArgumentTuple SelectedArgs; + static SelectedArgs Select(const ArgumentTuple& args) { + return SelectedArgs(get(args), get(args), get(args), + get(args), get(args), get(args), get(args), + get(args)); + } +}; + +template +class SelectArgs { + public: + typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), + GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), + GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), + GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7), + GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9)); + typedef typename Function::ArgumentTuple SelectedArgs; + static SelectedArgs Select(const ArgumentTuple& args) { + return SelectedArgs(get(args), get(args), get(args), + get(args), get(args), get(args), get(args), + get(args), get(args)); + } +}; + +#undef GMOCK_FIELD_ + +// Implements the WithArgs action. +template +class WithArgsAction { + public: + explicit WithArgsAction(const InnerAction& action) : action_(action) {} + + template + operator Action() const { return MakeAction(new Impl(action_)); } + + private: + template + class Impl : public ActionInterface { + public: + typedef typename Function::Result Result; + typedef typename Function::ArgumentTuple ArgumentTuple; + + explicit Impl(const InnerAction& action) : action_(action) {} + + virtual Result Perform(const ArgumentTuple& args) { + return action_.Perform(SelectArgs::Select(args)); + } + + private: + typedef typename SelectArgs::type InnerFunctionType; + + Action action_; + }; + + const InnerAction action_; + + GTEST_DISALLOW_ASSIGN_(WithArgsAction); +}; + +// A macro from the ACTION* family (defined later in this file) +// defines an action that can be used in a mock function. Typically, +// these actions only care about a subset of the arguments of the mock +// function. For example, if such an action only uses the second +// argument, it can be used in any mock function that takes >= 2 +// arguments where the type of the second argument is compatible. +// +// Therefore, the action implementation must be prepared to take more +// arguments than it needs. The ExcessiveArg type is used to +// represent those excessive arguments. In order to keep the compiler +// error messages tractable, we define it in the testing namespace +// instead of testing::internal. However, this is an INTERNAL TYPE +// and subject to change without notice, so a user MUST NOT USE THIS +// TYPE DIRECTLY. +struct ExcessiveArg {}; + +// A helper class needed for implementing the ACTION* macros. +template +class ActionHelper { + public: + static Result Perform(Impl* impl, const ::testing::tuple<>& args) { + return impl->template gmock_PerformImpl<>(args, ExcessiveArg(), + ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), + ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), + ExcessiveArg()); + } + + template + static Result Perform(Impl* impl, const ::testing::tuple& args) { + return impl->template gmock_PerformImpl(args, get<0>(args), + ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), + ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), + ExcessiveArg()); + } + + template + static Result Perform(Impl* impl, const ::testing::tuple& args) { + return impl->template gmock_PerformImpl(args, get<0>(args), + get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), + ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), + ExcessiveArg()); + } + + template + static Result Perform(Impl* impl, const ::testing::tuple& args) { + return impl->template gmock_PerformImpl(args, get<0>(args), + get<1>(args), get<2>(args), ExcessiveArg(), ExcessiveArg(), + ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), + ExcessiveArg()); + } + + template + static Result Perform(Impl* impl, const ::testing::tuple& args) { + return impl->template gmock_PerformImpl(args, get<0>(args), + get<1>(args), get<2>(args), get<3>(args), ExcessiveArg(), + ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), + ExcessiveArg()); + } + + template + static Result Perform(Impl* impl, const ::testing::tuple& args) { + return impl->template gmock_PerformImpl(args, + get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), + ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), + ExcessiveArg()); + } + + template + static Result Perform(Impl* impl, const ::testing::tuple& args) { + return impl->template gmock_PerformImpl(args, + get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), + get<5>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), + ExcessiveArg()); + } + + template + static Result Perform(Impl* impl, const ::testing::tuple& args) { + return impl->template gmock_PerformImpl(args, + get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), + get<5>(args), get<6>(args), ExcessiveArg(), ExcessiveArg(), + ExcessiveArg()); + } + + template + static Result Perform(Impl* impl, const ::testing::tuple& args) { + return impl->template gmock_PerformImpl(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), + get<4>(args), get<5>(args), get<6>(args), get<7>(args), ExcessiveArg(), + ExcessiveArg()); + } + + template + static Result Perform(Impl* impl, const ::testing::tuple& args) { + return impl->template gmock_PerformImpl(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), + get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args), + ExcessiveArg()); + } + + template + static Result Perform(Impl* impl, const ::testing::tuple& args) { + return impl->template gmock_PerformImpl(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), + get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args), + get<9>(args)); + } +}; + +} // namespace internal + +// Various overloads for Invoke(). + +// WithArgs(an_action) creates an action that passes +// the selected arguments of the mock function to an_action and +// performs it. It serves as an adaptor between actions with +// different argument lists. C++ doesn't support default arguments for +// function templates, so we have to overload it. +template +inline internal::WithArgsAction +WithArgs(const InnerAction& action) { + return internal::WithArgsAction(action); +} + +template +inline internal::WithArgsAction +WithArgs(const InnerAction& action) { + return internal::WithArgsAction(action); +} + +template +inline internal::WithArgsAction +WithArgs(const InnerAction& action) { + return internal::WithArgsAction(action); +} + +template +inline internal::WithArgsAction +WithArgs(const InnerAction& action) { + return internal::WithArgsAction(action); +} + +template +inline internal::WithArgsAction +WithArgs(const InnerAction& action) { + return internal::WithArgsAction(action); +} + +template +inline internal::WithArgsAction +WithArgs(const InnerAction& action) { + return internal::WithArgsAction(action); +} + +template +inline internal::WithArgsAction +WithArgs(const InnerAction& action) { + return internal::WithArgsAction(action); +} + +template +inline internal::WithArgsAction +WithArgs(const InnerAction& action) { + return internal::WithArgsAction(action); +} + +template +inline internal::WithArgsAction +WithArgs(const InnerAction& action) { + return internal::WithArgsAction(action); +} + +template +inline internal::WithArgsAction +WithArgs(const InnerAction& action) { + return internal::WithArgsAction(action); +} + +// Creates an action that does actions a1, a2, ..., sequentially in +// each invocation. +template +inline internal::DoBothAction +DoAll(Action1 a1, Action2 a2) { + return internal::DoBothAction(a1, a2); +} + +template +inline internal::DoBothAction > +DoAll(Action1 a1, Action2 a2, Action3 a3) { + return DoAll(a1, DoAll(a2, a3)); +} + +template +inline internal::DoBothAction > > +DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4) { + return DoAll(a1, DoAll(a2, a3, a4)); +} + +template +inline internal::DoBothAction > > > +DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5) { + return DoAll(a1, DoAll(a2, a3, a4, a5)); +} + +template +inline internal::DoBothAction > > > > +DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6) { + return DoAll(a1, DoAll(a2, a3, a4, a5, a6)); +} + +template +inline internal::DoBothAction > > > > > +DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, + Action7 a7) { + return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7)); +} + +template +inline internal::DoBothAction > > > > > > +DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, + Action7 a7, Action8 a8) { + return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8)); +} + +template +inline internal::DoBothAction > > > > > > > +DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, + Action7 a7, Action8 a8, Action9 a9) { + return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9)); +} + +template +inline internal::DoBothAction > > > > > > > > +DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, + Action7 a7, Action8 a8, Action9 a9, Action10 a10) { + return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9, a10)); +} + +} // namespace testing + +// The ACTION* family of macros can be used in a namespace scope to +// define custom actions easily. The syntax: +// +// ACTION(name) { statements; } +// +// will define an action with the given name that executes the +// statements. The value returned by the statements will be used as +// the return value of the action. Inside the statements, you can +// refer to the K-th (0-based) argument of the mock function by +// 'argK', and refer to its type by 'argK_type'. For example: +// +// ACTION(IncrementArg1) { +// arg1_type temp = arg1; +// return ++(*temp); +// } +// +// allows you to write +// +// ...WillOnce(IncrementArg1()); +// +// You can also refer to the entire argument tuple and its type by +// 'args' and 'args_type', and refer to the mock function type and its +// return type by 'function_type' and 'return_type'. +// +// Note that you don't need to specify the types of the mock function +// arguments. However rest assured that your code is still type-safe: +// you'll get a compiler error if *arg1 doesn't support the ++ +// operator, or if the type of ++(*arg1) isn't compatible with the +// mock function's return type, for example. +// +// Sometimes you'll want to parameterize the action. For that you can use +// another macro: +// +// ACTION_P(name, param_name) { statements; } +// +// For example: +// +// ACTION_P(Add, n) { return arg0 + n; } +// +// will allow you to write: +// +// ...WillOnce(Add(5)); +// +// Note that you don't need to provide the type of the parameter +// either. If you need to reference the type of a parameter named +// 'foo', you can write 'foo_type'. For example, in the body of +// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type +// of 'n'. +// +// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support +// multi-parameter actions. +// +// For the purpose of typing, you can view +// +// ACTION_Pk(Foo, p1, ..., pk) { ... } +// +// as shorthand for +// +// template +// FooActionPk Foo(p1_type p1, ..., pk_type pk) { ... } +// +// In particular, you can provide the template type arguments +// explicitly when invoking Foo(), as in Foo(5, false); +// although usually you can rely on the compiler to infer the types +// for you automatically. You can assign the result of expression +// Foo(p1, ..., pk) to a variable of type FooActionPk. This can be useful when composing actions. +// +// You can also overload actions with different numbers of parameters: +// +// ACTION_P(Plus, a) { ... } +// ACTION_P2(Plus, a, b) { ... } +// +// While it's tempting to always use the ACTION* macros when defining +// a new action, you should also consider implementing ActionInterface +// or using MakePolymorphicAction() instead, especially if you need to +// use the action a lot. While these approaches require more work, +// they give you more control on the types of the mock function +// arguments and the action parameters, which in general leads to +// better compiler error messages that pay off in the long run. They +// also allow overloading actions based on parameter types (as opposed +// to just based on the number of parameters). +// +// CAVEAT: +// +// ACTION*() can only be used in a namespace scope. The reason is +// that C++ doesn't yet allow function-local types to be used to +// instantiate templates. The up-coming C++0x standard will fix this. +// Once that's done, we'll consider supporting using ACTION*() inside +// a function. +// +// MORE INFORMATION: +// +// To learn more about using these macros, please search for 'ACTION' +// on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md + +// An internal macro needed for implementing ACTION*(). +#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ + const args_type& args GTEST_ATTRIBUTE_UNUSED_, \ + arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_, \ + arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_, \ + arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_, \ + arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_, \ + arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_, \ + arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_, \ + arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_, \ + arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_, \ + arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_, \ + arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_ + +// Sometimes you want to give an action explicit template parameters +// that cannot be inferred from its value parameters. ACTION() and +// ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that +// and can be viewed as an extension to ACTION() and ACTION_P*(). +// +// The syntax: +// +// ACTION_TEMPLATE(ActionName, +// HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m), +// AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; } +// +// defines an action template that takes m explicit template +// parameters and n value parameters. name_i is the name of the i-th +// template parameter, and kind_i specifies whether it's a typename, +// an integral constant, or a template. p_i is the name of the i-th +// value parameter. +// +// Example: +// +// // DuplicateArg(output) converts the k-th argument of the mock +// // function to type T and copies it to *output. +// ACTION_TEMPLATE(DuplicateArg, +// HAS_2_TEMPLATE_PARAMS(int, k, typename, T), +// AND_1_VALUE_PARAMS(output)) { +// *output = T(::testing::get(args)); +// } +// ... +// int n; +// EXPECT_CALL(mock, Foo(_, _)) +// .WillOnce(DuplicateArg<1, unsigned char>(&n)); +// +// To create an instance of an action template, write: +// +// ActionName(v1, ..., v_n) +// +// where the ts are the template arguments and the vs are the value +// arguments. The value argument types are inferred by the compiler. +// If you want to explicitly specify the value argument types, you can +// provide additional template arguments: +// +// ActionName(v1, ..., v_n) +// +// where u_i is the desired type of v_i. +// +// ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the +// number of value parameters, but not on the number of template +// parameters. Without the restriction, the meaning of the following +// is unclear: +// +// OverloadedAction(x); +// +// Are we using a single-template-parameter action where 'bool' refers +// to the type of x, or are we using a two-template-parameter action +// where the compiler is asked to infer the type of x? +// +// Implementation notes: +// +// GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and +// GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for +// implementing ACTION_TEMPLATE. The main trick we use is to create +// new macro invocations when expanding a macro. For example, we have +// +// #define ACTION_TEMPLATE(name, template_params, value_params) +// ... GMOCK_INTERNAL_DECL_##template_params ... +// +// which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...) +// to expand to +// +// ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ... +// +// Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the +// preprocessor will continue to expand it to +// +// ... typename T ... +// +// This technique conforms to the C++ standard and is portable. It +// allows us to implement action templates using O(N) code, where N is +// the maximum number of template/value parameters supported. Without +// using it, we'd have to devote O(N^2) amount of code to implement all +// combinations of m and n. + +// Declares the template parameters. +#define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0 +#define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ + name1) kind0 name0, kind1 name1 +#define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ + kind2, name2) kind0 name0, kind1 name1, kind2 name2 +#define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ + kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \ + kind3 name3 +#define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ + kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \ + kind2 name2, kind3 name3, kind4 name4 +#define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ + kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \ + kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5 +#define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ + kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ + name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \ + kind5 name5, kind6 name6 +#define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ + kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ + kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \ + kind4 name4, kind5 name5, kind6 name6, kind7 name7 +#define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ + kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ + kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \ + kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \ + kind8 name8 +#define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ + name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ + name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \ + kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \ + kind6 name6, kind7 name7, kind8 name8, kind9 name9 + +// Lists the template parameters. +#define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0 +#define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ + name1) name0, name1 +#define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ + kind2, name2) name0, name1, name2 +#define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ + kind2, name2, kind3, name3) name0, name1, name2, name3 +#define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ + kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \ + name4 +#define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ + kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \ + name2, name3, name4, name5 +#define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ + kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ + name6) name0, name1, name2, name3, name4, name5, name6 +#define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ + kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ + kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7 +#define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ + kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ + kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \ + name6, name7, name8 +#define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ + name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ + name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \ + name3, name4, name5, name6, name7, name8, name9 + +// Declares the types of value parameters. +#define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS() +#define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type +#define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \ + typename p0##_type, typename p1##_type +#define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \ + typename p0##_type, typename p1##_type, typename p2##_type +#define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ + typename p0##_type, typename p1##_type, typename p2##_type, \ + typename p3##_type +#define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ + typename p0##_type, typename p1##_type, typename p2##_type, \ + typename p3##_type, typename p4##_type +#define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \ + typename p0##_type, typename p1##_type, typename p2##_type, \ + typename p3##_type, typename p4##_type, typename p5##_type +#define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ + p6) , typename p0##_type, typename p1##_type, typename p2##_type, \ + typename p3##_type, typename p4##_type, typename p5##_type, \ + typename p6##_type +#define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ + p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \ + typename p3##_type, typename p4##_type, typename p5##_type, \ + typename p6##_type, typename p7##_type +#define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ + p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \ + typename p3##_type, typename p4##_type, typename p5##_type, \ + typename p6##_type, typename p7##_type, typename p8##_type +#define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ + p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \ + typename p2##_type, typename p3##_type, typename p4##_type, \ + typename p5##_type, typename p6##_type, typename p7##_type, \ + typename p8##_type, typename p9##_type + +// Initializes the value parameters. +#define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\ + () +#define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\ + (p0##_type gmock_p0) : p0(gmock_p0) +#define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\ + (p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), p1(gmock_p1) +#define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\ + (p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) +#define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\ + (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3) +#define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\ + (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), \ + p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) +#define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\ + (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, \ + p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) +#define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\ + (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) +#define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\ + (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), \ + p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ + p7(gmock_p7) +#define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ + p7, p8)\ + (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6, p7##_type gmock_p7, \ + p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ + p8(gmock_p8) +#define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ + p7, p8, p9)\ + (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ + p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ + p8(gmock_p8), p9(gmock_p9) + +// Declares the fields for storing the value parameters. +#define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS() +#define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0; +#define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \ + p1##_type p1; +#define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \ + p1##_type p1; p2##_type p2; +#define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \ + p1##_type p1; p2##_type p2; p3##_type p3; +#define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ + p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; +#define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ + p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ + p5##_type p5; +#define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ + p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ + p5##_type p5; p6##_type p6; +#define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ + p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ + p5##_type p5; p6##_type p6; p7##_type p7; +#define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ + p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ + p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; +#define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ + p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ + p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \ + p9##_type p9; + +// Lists the value parameters. +#define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS() +#define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0 +#define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1 +#define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2 +#define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3 +#define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \ + p2, p3, p4 +#define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \ + p1, p2, p3, p4, p5 +#define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ + p6) p0, p1, p2, p3, p4, p5, p6 +#define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ + p7) p0, p1, p2, p3, p4, p5, p6, p7 +#define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ + p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8 +#define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ + p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 + +// Lists the value parameter types. +#define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS() +#define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type +#define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \ + p1##_type +#define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \ + p1##_type, p2##_type +#define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ + p0##_type, p1##_type, p2##_type, p3##_type +#define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ + p0##_type, p1##_type, p2##_type, p3##_type, p4##_type +#define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \ + p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type +#define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ + p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \ + p6##_type +#define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ + p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ + p5##_type, p6##_type, p7##_type +#define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ + p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ + p5##_type, p6##_type, p7##_type, p8##_type +#define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ + p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ + p5##_type, p6##_type, p7##_type, p8##_type, p9##_type + +// Declares the value parameters. +#define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS() +#define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0 +#define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \ + p1##_type p1 +#define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \ + p1##_type p1, p2##_type p2 +#define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \ + p1##_type p1, p2##_type p2, p3##_type p3 +#define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ + p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4 +#define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ + p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ + p5##_type p5 +#define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ + p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ + p5##_type p5, p6##_type p6 +#define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ + p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ + p5##_type p5, p6##_type p6, p7##_type p7 +#define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ + p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ + p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8 +#define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ + p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ + p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ + p9##_type p9 + +// The suffix of the class template implementing the action template. +#define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS() +#define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P +#define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2 +#define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3 +#define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4 +#define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5 +#define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6 +#define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7 +#define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ + p7) P8 +#define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ + p7, p8) P9 +#define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ + p7, p8, p9) P10 + +// The name of the class template implementing the action template. +#define GMOCK_ACTION_CLASS_(name, value_params)\ + GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params) + +#define ACTION_TEMPLATE(name, template_params, value_params)\ + template \ + class GMOCK_ACTION_CLASS_(name, value_params) {\ + public:\ + explicit GMOCK_ACTION_CLASS_(name, value_params)\ + GMOCK_INTERNAL_INIT_##value_params {}\ + template \ + class gmock_Impl : public ::testing::ActionInterface {\ + public:\ + typedef F function_type;\ + typedef typename ::testing::internal::Function::Result return_type;\ + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\ + virtual return_type Perform(const args_type& args) {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ + template \ + return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ + arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ + arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ + arg9_type arg9) const;\ + GMOCK_INTERNAL_DEFN_##value_params\ + private:\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template operator ::testing::Action() const {\ + return ::testing::Action(\ + new gmock_Impl(GMOCK_INTERNAL_LIST_##value_params));\ + }\ + GMOCK_INTERNAL_DEFN_##value_params\ + private:\ + GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\ + };\ + template \ + inline GMOCK_ACTION_CLASS_(name, value_params)<\ + GMOCK_INTERNAL_LIST_##template_params\ + GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\ + GMOCK_INTERNAL_DECL_##value_params) {\ + return GMOCK_ACTION_CLASS_(name, value_params)<\ + GMOCK_INTERNAL_LIST_##template_params\ + GMOCK_INTERNAL_LIST_TYPE_##value_params>(\ + GMOCK_INTERNAL_LIST_##value_params);\ + }\ + template \ + template \ + template \ + typename ::testing::internal::Function::Result\ + GMOCK_ACTION_CLASS_(name, value_params)<\ + GMOCK_INTERNAL_LIST_##template_params\ + GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl::\ + gmock_PerformImpl(\ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +#define ACTION(name)\ + class name##Action {\ + public:\ + name##Action() {}\ + template \ + class gmock_Impl : public ::testing::ActionInterface {\ + public:\ + typedef F function_type;\ + typedef typename ::testing::internal::Function::Result return_type;\ + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + gmock_Impl() {}\ + virtual return_type Perform(const args_type& args) {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ + template \ + return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ + arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ + arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ + arg9_type arg9) const;\ + private:\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template operator ::testing::Action() const {\ + return ::testing::Action(new gmock_Impl());\ + }\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##Action);\ + };\ + inline name##Action name() {\ + return name##Action();\ + }\ + template \ + template \ + typename ::testing::internal::Function::Result\ + name##Action::gmock_Impl::gmock_PerformImpl(\ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +#define ACTION_P(name, p0)\ + template \ + class name##ActionP {\ + public:\ + explicit name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\ + template \ + class gmock_Impl : public ::testing::ActionInterface {\ + public:\ + typedef F function_type;\ + typedef typename ::testing::internal::Function::Result return_type;\ + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + explicit gmock_Impl(p0##_type gmock_p0) : p0(gmock_p0) {}\ + virtual return_type Perform(const args_type& args) {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ + template \ + return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ + arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ + arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ + arg9_type arg9) const;\ + p0##_type p0;\ + private:\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template operator ::testing::Action() const {\ + return ::testing::Action(new gmock_Impl(p0));\ + }\ + p0##_type p0;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##ActionP);\ + };\ + template \ + inline name##ActionP name(p0##_type p0) {\ + return name##ActionP(p0);\ + }\ + template \ + template \ + template \ + typename ::testing::internal::Function::Result\ + name##ActionP::gmock_Impl::gmock_PerformImpl(\ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +#define ACTION_P2(name, p0, p1)\ + template \ + class name##ActionP2 {\ + public:\ + name##ActionP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ + p1(gmock_p1) {}\ + template \ + class gmock_Impl : public ::testing::ActionInterface {\ + public:\ + typedef F function_type;\ + typedef typename ::testing::internal::Function::Result return_type;\ + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ + p1(gmock_p1) {}\ + virtual return_type Perform(const args_type& args) {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ + template \ + return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ + arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ + arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ + arg9_type arg9) const;\ + p0##_type p0;\ + p1##_type p1;\ + private:\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template operator ::testing::Action() const {\ + return ::testing::Action(new gmock_Impl(p0, p1));\ + }\ + p0##_type p0;\ + p1##_type p1;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##ActionP2);\ + };\ + template \ + inline name##ActionP2 name(p0##_type p0, \ + p1##_type p1) {\ + return name##ActionP2(p0, p1);\ + }\ + template \ + template \ + template \ + typename ::testing::internal::Function::Result\ + name##ActionP2::gmock_Impl::gmock_PerformImpl(\ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +#define ACTION_P3(name, p0, p1, p2)\ + template \ + class name##ActionP3 {\ + public:\ + name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ + template \ + class gmock_Impl : public ::testing::ActionInterface {\ + public:\ + typedef F function_type;\ + typedef typename ::testing::internal::Function::Result return_type;\ + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ + virtual return_type Perform(const args_type& args) {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ + template \ + return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ + arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ + arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ + arg9_type arg9) const;\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + private:\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template operator ::testing::Action() const {\ + return ::testing::Action(new gmock_Impl(p0, p1, p2));\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##ActionP3);\ + };\ + template \ + inline name##ActionP3 name(p0##_type p0, \ + p1##_type p1, p2##_type p2) {\ + return name##ActionP3(p0, p1, p2);\ + }\ + template \ + template \ + template \ + typename ::testing::internal::Function::Result\ + name##ActionP3::gmock_Impl::gmock_PerformImpl(\ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +#define ACTION_P4(name, p0, p1, p2, p3)\ + template \ + class name##ActionP4 {\ + public:\ + name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \ + p2(gmock_p2), p3(gmock_p3) {}\ + template \ + class gmock_Impl : public ::testing::ActionInterface {\ + public:\ + typedef F function_type;\ + typedef typename ::testing::internal::Function::Result return_type;\ + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3) {}\ + virtual return_type Perform(const args_type& args) {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ + template \ + return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ + arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ + arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ + arg9_type arg9) const;\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + private:\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template operator ::testing::Action() const {\ + return ::testing::Action(new gmock_Impl(p0, p1, p2, p3));\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##ActionP4);\ + };\ + template \ + inline name##ActionP4 name(p0##_type p0, p1##_type p1, p2##_type p2, \ + p3##_type p3) {\ + return name##ActionP4(p0, p1, \ + p2, p3);\ + }\ + template \ + template \ + template \ + typename ::testing::internal::Function::Result\ + name##ActionP4::gmock_Impl::gmock_PerformImpl(\ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +#define ACTION_P5(name, p0, p1, p2, p3, p4)\ + template \ + class name##ActionP5 {\ + public:\ + name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2, p3##_type gmock_p3, \ + p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4) {}\ + template \ + class gmock_Impl : public ::testing::ActionInterface {\ + public:\ + typedef F function_type;\ + typedef typename ::testing::internal::Function::Result return_type;\ + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), \ + p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) {}\ + virtual return_type Perform(const args_type& args) {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ + template \ + return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ + arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ + arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ + arg9_type arg9) const;\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + private:\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template operator ::testing::Action() const {\ + return ::testing::Action(new gmock_Impl(p0, p1, p2, p3, p4));\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##ActionP5);\ + };\ + template \ + inline name##ActionP5 name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ + p4##_type p4) {\ + return name##ActionP5(p0, p1, p2, p3, p4);\ + }\ + template \ + template \ + template \ + typename ::testing::internal::Function::Result\ + name##ActionP5::gmock_Impl::gmock_PerformImpl(\ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +#define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\ + template \ + class name##ActionP6 {\ + public:\ + name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ + p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ + template \ + class gmock_Impl : public ::testing::ActionInterface {\ + public:\ + typedef F function_type;\ + typedef typename ::testing::internal::Function::Result return_type;\ + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, \ + p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ + virtual return_type Perform(const args_type& args) {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ + template \ + return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ + arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ + arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ + arg9_type arg9) const;\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + private:\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template operator ::testing::Action() const {\ + return ::testing::Action(new gmock_Impl(p0, p1, p2, p3, p4, p5));\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##ActionP6);\ + };\ + template \ + inline name##ActionP6 name(p0##_type p0, p1##_type p1, p2##_type p2, \ + p3##_type p3, p4##_type p4, p5##_type p5) {\ + return name##ActionP6(p0, p1, p2, p3, p4, p5);\ + }\ + template \ + template \ + template \ + typename ::testing::internal::Function::Result\ + name##ActionP6::gmock_Impl::gmock_PerformImpl(\ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +#define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\ + template \ + class name##ActionP7 {\ + public:\ + name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ + p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \ + p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \ + p6(gmock_p6) {}\ + template \ + class gmock_Impl : public ::testing::ActionInterface {\ + public:\ + typedef F function_type;\ + typedef typename ::testing::internal::Function::Result return_type;\ + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\ + virtual return_type Perform(const args_type& args) {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ + template \ + return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ + arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ + arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ + arg9_type arg9) const;\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + private:\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template operator ::testing::Action() const {\ + return ::testing::Action(new gmock_Impl(p0, p1, p2, p3, p4, p5, \ + p6));\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##ActionP7);\ + };\ + template \ + inline name##ActionP7 name(p0##_type p0, p1##_type p1, \ + p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ + p6##_type p6) {\ + return name##ActionP7(p0, p1, p2, p3, p4, p5, p6);\ + }\ + template \ + template \ + template \ + typename ::testing::internal::Function::Result\ + name##ActionP7::gmock_Impl::gmock_PerformImpl(\ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +#define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\ + template \ + class name##ActionP8 {\ + public:\ + name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ + p5##_type gmock_p5, p6##_type gmock_p6, \ + p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ + p7(gmock_p7) {}\ + template \ + class gmock_Impl : public ::testing::ActionInterface {\ + public:\ + typedef F function_type;\ + typedef typename ::testing::internal::Function::Result return_type;\ + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), \ + p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), \ + p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\ + virtual return_type Perform(const args_type& args) {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ + template \ + return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ + arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ + arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ + arg9_type arg9) const;\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + p7##_type p7;\ + private:\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template operator ::testing::Action() const {\ + return ::testing::Action(new gmock_Impl(p0, p1, p2, p3, p4, p5, \ + p6, p7));\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + p7##_type p7;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##ActionP8);\ + };\ + template \ + inline name##ActionP8 name(p0##_type p0, \ + p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ + p6##_type p6, p7##_type p7) {\ + return name##ActionP8(p0, p1, p2, p3, p4, p5, \ + p6, p7);\ + }\ + template \ + template \ + template \ + typename ::testing::internal::Function::Result\ + name##ActionP8::gmock_Impl::gmock_PerformImpl(\ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +#define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\ + template \ + class name##ActionP9 {\ + public:\ + name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ + p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ + p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ + p8(gmock_p8) {}\ + template \ + class gmock_Impl : public ::testing::ActionInterface {\ + public:\ + typedef F function_type;\ + typedef typename ::testing::internal::Function::Result return_type;\ + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6, p7##_type gmock_p7, \ + p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ + p7(gmock_p7), p8(gmock_p8) {}\ + virtual return_type Perform(const args_type& args) {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ + template \ + return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ + arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ + arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ + arg9_type arg9) const;\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + p7##_type p7;\ + p8##_type p8;\ + private:\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template operator ::testing::Action() const {\ + return ::testing::Action(new gmock_Impl(p0, p1, p2, p3, p4, p5, \ + p6, p7, p8));\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + p7##_type p7;\ + p8##_type p8;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##ActionP9);\ + };\ + template \ + inline name##ActionP9 name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ + p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \ + p8##_type p8) {\ + return name##ActionP9(p0, p1, p2, \ + p3, p4, p5, p6, p7, p8);\ + }\ + template \ + template \ + template \ + typename ::testing::internal::Function::Result\ + name##ActionP9::gmock_Impl::gmock_PerformImpl(\ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +#define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\ + template \ + class name##ActionP10 {\ + public:\ + name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ + p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ + p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \ + p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ + p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ + template \ + class gmock_Impl : public ::testing::ActionInterface {\ + public:\ + typedef F function_type;\ + typedef typename ::testing::internal::Function::Result return_type;\ + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ + p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ + p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ + virtual return_type Perform(const args_type& args) {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ + template \ + return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ + arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ + arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ + arg9_type arg9) const;\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + p7##_type p7;\ + p8##_type p8;\ + p9##_type p9;\ + private:\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template operator ::testing::Action() const {\ + return ::testing::Action(new gmock_Impl(p0, p1, p2, p3, p4, p5, \ + p6, p7, p8, p9));\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + p7##_type p7;\ + p8##_type p8;\ + p9##_type p9;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##ActionP10);\ + };\ + template \ + inline name##ActionP10 name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ + p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ + p9##_type p9) {\ + return name##ActionP10(p0, \ + p1, p2, p3, p4, p5, p6, p7, p8, p9);\ + }\ + template \ + template \ + template \ + typename ::testing::internal::Function::Result\ + name##ActionP10::gmock_Impl::gmock_PerformImpl(\ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +namespace testing { + + +// The ACTION*() macros trigger warning C4100 (unreferenced formal +// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in +// the macro definition, as the warnings are generated when the macro +// is expanded and macro expansion cannot contain #pragma. Therefore +// we suppress them here. +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable:4100) +#endif + +// Various overloads for InvokeArgument(). +// +// The InvokeArgument(a1, a2, ..., a_k) action invokes the N-th +// (0-based) argument, which must be a k-ary callable, of the mock +// function, with arguments a1, a2, ..., a_k. +// +// Notes: +// +// 1. The arguments are passed by value by default. If you need to +// pass an argument by reference, wrap it inside ByRef(). For +// example, +// +// InvokeArgument<1>(5, string("Hello"), ByRef(foo)) +// +// passes 5 and string("Hello") by value, and passes foo by +// reference. +// +// 2. If the callable takes an argument by reference but ByRef() is +// not used, it will receive the reference to a copy of the value, +// instead of the original value. For example, when the 0-th +// argument of the mock function takes a const string&, the action +// +// InvokeArgument<0>(string("Hello")) +// +// makes a copy of the temporary string("Hello") object and passes a +// reference of the copy, instead of the original temporary object, +// to the callable. This makes it easy for a user to define an +// InvokeArgument action from temporary values and have it performed +// later. + +namespace internal { +namespace invoke_argument { + +// Appears in InvokeArgumentAdl's argument list to help avoid +// accidental calls to user functions of the same name. +struct AdlTag {}; + +// InvokeArgumentAdl - a helper for InvokeArgument. +// The basic overloads are provided here for generic functors. +// Overloads for other custom-callables are provided in the +// internal/custom/callback-actions.h header. + +template +R InvokeArgumentAdl(AdlTag, F f) { + return f(); +} +template +R InvokeArgumentAdl(AdlTag, F f, A1 a1) { + return f(a1); +} +template +R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2) { + return f(a1, a2); +} +template +R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3) { + return f(a1, a2, a3); +} +template +R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4) { + return f(a1, a2, a3, a4); +} +template +R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { + return f(a1, a2, a3, a4, a5); +} +template +R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { + return f(a1, a2, a3, a4, a5, a6); +} +template +R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, + A7 a7) { + return f(a1, a2, a3, a4, a5, a6, a7); +} +template +R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, + A7 a7, A8 a8) { + return f(a1, a2, a3, a4, a5, a6, a7, a8); +} +template +R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, + A7 a7, A8 a8, A9 a9) { + return f(a1, a2, a3, a4, a5, a6, a7, a8, a9); +} +template +R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, + A7 a7, A8 a8, A9 a9, A10 a10) { + return f(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); +} +} // namespace invoke_argument +} // namespace internal + +ACTION_TEMPLATE(InvokeArgument, + HAS_1_TEMPLATE_PARAMS(int, k), + AND_0_VALUE_PARAMS()) { + using internal::invoke_argument::InvokeArgumentAdl; + return InvokeArgumentAdl( + internal::invoke_argument::AdlTag(), + ::testing::get(args)); +} + +ACTION_TEMPLATE(InvokeArgument, + HAS_1_TEMPLATE_PARAMS(int, k), + AND_1_VALUE_PARAMS(p0)) { + using internal::invoke_argument::InvokeArgumentAdl; + return InvokeArgumentAdl( + internal::invoke_argument::AdlTag(), + ::testing::get(args), p0); +} + +ACTION_TEMPLATE(InvokeArgument, + HAS_1_TEMPLATE_PARAMS(int, k), + AND_2_VALUE_PARAMS(p0, p1)) { + using internal::invoke_argument::InvokeArgumentAdl; + return InvokeArgumentAdl( + internal::invoke_argument::AdlTag(), + ::testing::get(args), p0, p1); +} + +ACTION_TEMPLATE(InvokeArgument, + HAS_1_TEMPLATE_PARAMS(int, k), + AND_3_VALUE_PARAMS(p0, p1, p2)) { + using internal::invoke_argument::InvokeArgumentAdl; + return InvokeArgumentAdl( + internal::invoke_argument::AdlTag(), + ::testing::get(args), p0, p1, p2); +} + +ACTION_TEMPLATE(InvokeArgument, + HAS_1_TEMPLATE_PARAMS(int, k), + AND_4_VALUE_PARAMS(p0, p1, p2, p3)) { + using internal::invoke_argument::InvokeArgumentAdl; + return InvokeArgumentAdl( + internal::invoke_argument::AdlTag(), + ::testing::get(args), p0, p1, p2, p3); +} + +ACTION_TEMPLATE(InvokeArgument, + HAS_1_TEMPLATE_PARAMS(int, k), + AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) { + using internal::invoke_argument::InvokeArgumentAdl; + return InvokeArgumentAdl( + internal::invoke_argument::AdlTag(), + ::testing::get(args), p0, p1, p2, p3, p4); +} + +ACTION_TEMPLATE(InvokeArgument, + HAS_1_TEMPLATE_PARAMS(int, k), + AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) { + using internal::invoke_argument::InvokeArgumentAdl; + return InvokeArgumentAdl( + internal::invoke_argument::AdlTag(), + ::testing::get(args), p0, p1, p2, p3, p4, p5); +} + +ACTION_TEMPLATE(InvokeArgument, + HAS_1_TEMPLATE_PARAMS(int, k), + AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) { + using internal::invoke_argument::InvokeArgumentAdl; + return InvokeArgumentAdl( + internal::invoke_argument::AdlTag(), + ::testing::get(args), p0, p1, p2, p3, p4, p5, p6); +} + +ACTION_TEMPLATE(InvokeArgument, + HAS_1_TEMPLATE_PARAMS(int, k), + AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) { + using internal::invoke_argument::InvokeArgumentAdl; + return InvokeArgumentAdl( + internal::invoke_argument::AdlTag(), + ::testing::get(args), p0, p1, p2, p3, p4, p5, p6, p7); +} + +ACTION_TEMPLATE(InvokeArgument, + HAS_1_TEMPLATE_PARAMS(int, k), + AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) { + using internal::invoke_argument::InvokeArgumentAdl; + return InvokeArgumentAdl( + internal::invoke_argument::AdlTag(), + ::testing::get(args), p0, p1, p2, p3, p4, p5, p6, p7, p8); +} + +ACTION_TEMPLATE(InvokeArgument, + HAS_1_TEMPLATE_PARAMS(int, k), + AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) { + using internal::invoke_argument::InvokeArgumentAdl; + return InvokeArgumentAdl( + internal::invoke_argument::AdlTag(), + ::testing::get(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); +} + +// Various overloads for ReturnNew(). +// +// The ReturnNew(a1, a2, ..., a_k) action returns a pointer to a new +// instance of type T, constructed on the heap with constructor arguments +// a1, a2, ..., and a_k. The caller assumes ownership of the returned value. +ACTION_TEMPLATE(ReturnNew, + HAS_1_TEMPLATE_PARAMS(typename, T), + AND_0_VALUE_PARAMS()) { + return new T(); +} + +ACTION_TEMPLATE(ReturnNew, + HAS_1_TEMPLATE_PARAMS(typename, T), + AND_1_VALUE_PARAMS(p0)) { + return new T(p0); +} + +ACTION_TEMPLATE(ReturnNew, + HAS_1_TEMPLATE_PARAMS(typename, T), + AND_2_VALUE_PARAMS(p0, p1)) { + return new T(p0, p1); +} + +ACTION_TEMPLATE(ReturnNew, + HAS_1_TEMPLATE_PARAMS(typename, T), + AND_3_VALUE_PARAMS(p0, p1, p2)) { + return new T(p0, p1, p2); +} + +ACTION_TEMPLATE(ReturnNew, + HAS_1_TEMPLATE_PARAMS(typename, T), + AND_4_VALUE_PARAMS(p0, p1, p2, p3)) { + return new T(p0, p1, p2, p3); +} + +ACTION_TEMPLATE(ReturnNew, + HAS_1_TEMPLATE_PARAMS(typename, T), + AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) { + return new T(p0, p1, p2, p3, p4); +} + +ACTION_TEMPLATE(ReturnNew, + HAS_1_TEMPLATE_PARAMS(typename, T), + AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) { + return new T(p0, p1, p2, p3, p4, p5); +} + +ACTION_TEMPLATE(ReturnNew, + HAS_1_TEMPLATE_PARAMS(typename, T), + AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) { + return new T(p0, p1, p2, p3, p4, p5, p6); +} + +ACTION_TEMPLATE(ReturnNew, + HAS_1_TEMPLATE_PARAMS(typename, T), + AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) { + return new T(p0, p1, p2, p3, p4, p5, p6, p7); +} + +ACTION_TEMPLATE(ReturnNew, + HAS_1_TEMPLATE_PARAMS(typename, T), + AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) { + return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8); +} + +ACTION_TEMPLATE(ReturnNew, + HAS_1_TEMPLATE_PARAMS(typename, T), + AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) { + return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); +} + +#ifdef _MSC_VER +# pragma warning(pop) +#endif + +} // namespace testing + +// Include any custom actions added by the local installation. +// We must include this header at the end to make sure it can use the +// declarations from this file. +#include "gmock/internal/custom/gmock-generated-actions.h" + +#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump new file mode 100644 index 00000000000..712f65d62d9 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump @@ -0,0 +1,794 @@ +$$ -*- mode: c++; -*- +$$ This is a Pump source file. Please use Pump to convert it to +$$ gmock-generated-actions.h. +$$ +$var n = 10 $$ The maximum arity we support. +$$}} This meta comment fixes auto-indentation in editors. +// Copyright 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: wan@google.com (Zhanyong Wan) + +// Google Mock - a framework for writing C++ mock classes. +// +// This file implements some commonly used variadic actions. + +#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ +#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ + +#include "gmock/gmock-actions.h" +#include "gmock/internal/gmock-port.h" + +namespace testing { +namespace internal { + +// InvokeHelper knows how to unpack an N-tuple and invoke an N-ary +// function or method with the unpacked values, where F is a function +// type that takes N arguments. +template +class InvokeHelper; + + +$range i 0..n +$for i [[ +$range j 1..i +$var types = [[$for j [[, typename A$j]]]] +$var as = [[$for j, [[A$j]]]] +$var args = [[$if i==0 [[]] $else [[ args]]]] +$var gets = [[$for j, [[get<$(j - 1)>(args)]]]] +template +class InvokeHelper > { + public: + template + static R Invoke(Function function, const ::testing::tuple<$as>&$args) { + return function($gets); + } + + template + static R InvokeMethod(Class* obj_ptr, + MethodPtr method_ptr, + const ::testing::tuple<$as>&$args) { + return (obj_ptr->*method_ptr)($gets); + } +}; + + +]] +// An INTERNAL macro for extracting the type of a tuple field. It's +// subject to change without notice - DO NOT USE IN USER CODE! +#define GMOCK_FIELD_(Tuple, N) \ + typename ::testing::tuple_element::type + +$range i 1..n + +// SelectArgs::type is the +// type of an n-ary function whose i-th (1-based) argument type is the +// k{i}-th (0-based) field of ArgumentTuple, which must be a tuple +// type, and whose return type is Result. For example, +// SelectArgs, 0, 3>::type +// is int(bool, long). +// +// SelectArgs::Select(args) +// returns the selected fields (k1, k2, ..., k_n) of args as a tuple. +// For example, +// SelectArgs, 2, 0>::Select( +// ::testing::make_tuple(true, 'a', 2.5)) +// returns tuple (2.5, true). +// +// The numbers in list k1, k2, ..., k_n must be >= 0, where n can be +// in the range [0, $n]. Duplicates are allowed and they don't have +// to be in an ascending or descending order. + +template +class SelectArgs { + public: + typedef Result type($for i, [[GMOCK_FIELD_(ArgumentTuple, k$i)]]); + typedef typename Function::ArgumentTuple SelectedArgs; + static SelectedArgs Select(const ArgumentTuple& args) { + return SelectedArgs($for i, [[get(args)]]); + } +}; + + +$for i [[ +$range j 1..n +$range j1 1..i-1 +template +class SelectArgs { + public: + typedef Result type($for j1, [[GMOCK_FIELD_(ArgumentTuple, k$j1)]]); + typedef typename Function::ArgumentTuple SelectedArgs; + static SelectedArgs Select(const ArgumentTuple& [[]] +$if i == 1 [[/* args */]] $else [[args]]) { + return SelectedArgs($for j1, [[get(args)]]); + } +}; + + +]] +#undef GMOCK_FIELD_ + +$var ks = [[$for i, [[k$i]]]] + +// Implements the WithArgs action. +template +class WithArgsAction { + public: + explicit WithArgsAction(const InnerAction& action) : action_(action) {} + + template + operator Action() const { return MakeAction(new Impl(action_)); } + + private: + template + class Impl : public ActionInterface { + public: + typedef typename Function::Result Result; + typedef typename Function::ArgumentTuple ArgumentTuple; + + explicit Impl(const InnerAction& action) : action_(action) {} + + virtual Result Perform(const ArgumentTuple& args) { + return action_.Perform(SelectArgs::Select(args)); + } + + private: + typedef typename SelectArgs::type InnerFunctionType; + + Action action_; + }; + + const InnerAction action_; + + GTEST_DISALLOW_ASSIGN_(WithArgsAction); +}; + +// A macro from the ACTION* family (defined later in this file) +// defines an action that can be used in a mock function. Typically, +// these actions only care about a subset of the arguments of the mock +// function. For example, if such an action only uses the second +// argument, it can be used in any mock function that takes >= 2 +// arguments where the type of the second argument is compatible. +// +// Therefore, the action implementation must be prepared to take more +// arguments than it needs. The ExcessiveArg type is used to +// represent those excessive arguments. In order to keep the compiler +// error messages tractable, we define it in the testing namespace +// instead of testing::internal. However, this is an INTERNAL TYPE +// and subject to change without notice, so a user MUST NOT USE THIS +// TYPE DIRECTLY. +struct ExcessiveArg {}; + +// A helper class needed for implementing the ACTION* macros. +template +class ActionHelper { + public: +$range i 0..n +$for i + +[[ +$var template = [[$if i==0 [[]] $else [[ +$range j 0..i-1 + template <$for j, [[typename A$j]]> +]]]] +$range j 0..i-1 +$var As = [[$for j, [[A$j]]]] +$var as = [[$for j, [[get<$j>(args)]]]] +$range k 1..n-i +$var eas = [[$for k, [[ExcessiveArg()]]]] +$var arg_list = [[$if (i==0) | (i==n) [[$as$eas]] $else [[$as, $eas]]]] +$template + static Result Perform(Impl* impl, const ::testing::tuple<$As>& args) { + return impl->template gmock_PerformImpl<$As>(args, $arg_list); + } + +]] +}; + +} // namespace internal + +// Various overloads for Invoke(). + +// WithArgs(an_action) creates an action that passes +// the selected arguments of the mock function to an_action and +// performs it. It serves as an adaptor between actions with +// different argument lists. C++ doesn't support default arguments for +// function templates, so we have to overload it. + +$range i 1..n +$for i [[ +$range j 1..i +template <$for j [[int k$j, ]]typename InnerAction> +inline internal::WithArgsAction +WithArgs(const InnerAction& action) { + return internal::WithArgsAction(action); +} + + +]] +// Creates an action that does actions a1, a2, ..., sequentially in +// each invocation. +$range i 2..n +$for i [[ +$range j 2..i +$var types = [[$for j, [[typename Action$j]]]] +$var Aas = [[$for j [[, Action$j a$j]]]] + +template +$range k 1..i-1 + +inline $for k [[internal::DoBothAction]] + +DoAll(Action1 a1$Aas) { +$if i==2 [[ + + return internal::DoBothAction(a1, a2); +]] $else [[ +$range j2 2..i + + return DoAll(a1, DoAll($for j2, [[a$j2]])); +]] + +} + +]] + +} // namespace testing + +// The ACTION* family of macros can be used in a namespace scope to +// define custom actions easily. The syntax: +// +// ACTION(name) { statements; } +// +// will define an action with the given name that executes the +// statements. The value returned by the statements will be used as +// the return value of the action. Inside the statements, you can +// refer to the K-th (0-based) argument of the mock function by +// 'argK', and refer to its type by 'argK_type'. For example: +// +// ACTION(IncrementArg1) { +// arg1_type temp = arg1; +// return ++(*temp); +// } +// +// allows you to write +// +// ...WillOnce(IncrementArg1()); +// +// You can also refer to the entire argument tuple and its type by +// 'args' and 'args_type', and refer to the mock function type and its +// return type by 'function_type' and 'return_type'. +// +// Note that you don't need to specify the types of the mock function +// arguments. However rest assured that your code is still type-safe: +// you'll get a compiler error if *arg1 doesn't support the ++ +// operator, or if the type of ++(*arg1) isn't compatible with the +// mock function's return type, for example. +// +// Sometimes you'll want to parameterize the action. For that you can use +// another macro: +// +// ACTION_P(name, param_name) { statements; } +// +// For example: +// +// ACTION_P(Add, n) { return arg0 + n; } +// +// will allow you to write: +// +// ...WillOnce(Add(5)); +// +// Note that you don't need to provide the type of the parameter +// either. If you need to reference the type of a parameter named +// 'foo', you can write 'foo_type'. For example, in the body of +// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type +// of 'n'. +// +// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P$n to support +// multi-parameter actions. +// +// For the purpose of typing, you can view +// +// ACTION_Pk(Foo, p1, ..., pk) { ... } +// +// as shorthand for +// +// template +// FooActionPk Foo(p1_type p1, ..., pk_type pk) { ... } +// +// In particular, you can provide the template type arguments +// explicitly when invoking Foo(), as in Foo(5, false); +// although usually you can rely on the compiler to infer the types +// for you automatically. You can assign the result of expression +// Foo(p1, ..., pk) to a variable of type FooActionPk. This can be useful when composing actions. +// +// You can also overload actions with different numbers of parameters: +// +// ACTION_P(Plus, a) { ... } +// ACTION_P2(Plus, a, b) { ... } +// +// While it's tempting to always use the ACTION* macros when defining +// a new action, you should also consider implementing ActionInterface +// or using MakePolymorphicAction() instead, especially if you need to +// use the action a lot. While these approaches require more work, +// they give you more control on the types of the mock function +// arguments and the action parameters, which in general leads to +// better compiler error messages that pay off in the long run. They +// also allow overloading actions based on parameter types (as opposed +// to just based on the number of parameters). +// +// CAVEAT: +// +// ACTION*() can only be used in a namespace scope. The reason is +// that C++ doesn't yet allow function-local types to be used to +// instantiate templates. The up-coming C++0x standard will fix this. +// Once that's done, we'll consider supporting using ACTION*() inside +// a function. +// +// MORE INFORMATION: +// +// To learn more about using these macros, please search for 'ACTION' +// on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md + +$range i 0..n +$range k 0..n-1 + +// An internal macro needed for implementing ACTION*(). +#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ + const args_type& args GTEST_ATTRIBUTE_UNUSED_ +$for k [[, \ + arg$k[[]]_type arg$k GTEST_ATTRIBUTE_UNUSED_]] + + +// Sometimes you want to give an action explicit template parameters +// that cannot be inferred from its value parameters. ACTION() and +// ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that +// and can be viewed as an extension to ACTION() and ACTION_P*(). +// +// The syntax: +// +// ACTION_TEMPLATE(ActionName, +// HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m), +// AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; } +// +// defines an action template that takes m explicit template +// parameters and n value parameters. name_i is the name of the i-th +// template parameter, and kind_i specifies whether it's a typename, +// an integral constant, or a template. p_i is the name of the i-th +// value parameter. +// +// Example: +// +// // DuplicateArg(output) converts the k-th argument of the mock +// // function to type T and copies it to *output. +// ACTION_TEMPLATE(DuplicateArg, +// HAS_2_TEMPLATE_PARAMS(int, k, typename, T), +// AND_1_VALUE_PARAMS(output)) { +// *output = T(::testing::get(args)); +// } +// ... +// int n; +// EXPECT_CALL(mock, Foo(_, _)) +// .WillOnce(DuplicateArg<1, unsigned char>(&n)); +// +// To create an instance of an action template, write: +// +// ActionName(v1, ..., v_n) +// +// where the ts are the template arguments and the vs are the value +// arguments. The value argument types are inferred by the compiler. +// If you want to explicitly specify the value argument types, you can +// provide additional template arguments: +// +// ActionName(v1, ..., v_n) +// +// where u_i is the desired type of v_i. +// +// ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the +// number of value parameters, but not on the number of template +// parameters. Without the restriction, the meaning of the following +// is unclear: +// +// OverloadedAction(x); +// +// Are we using a single-template-parameter action where 'bool' refers +// to the type of x, or are we using a two-template-parameter action +// where the compiler is asked to infer the type of x? +// +// Implementation notes: +// +// GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and +// GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for +// implementing ACTION_TEMPLATE. The main trick we use is to create +// new macro invocations when expanding a macro. For example, we have +// +// #define ACTION_TEMPLATE(name, template_params, value_params) +// ... GMOCK_INTERNAL_DECL_##template_params ... +// +// which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...) +// to expand to +// +// ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ... +// +// Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the +// preprocessor will continue to expand it to +// +// ... typename T ... +// +// This technique conforms to the C++ standard and is portable. It +// allows us to implement action templates using O(N) code, where N is +// the maximum number of template/value parameters supported. Without +// using it, we'd have to devote O(N^2) amount of code to implement all +// combinations of m and n. + +// Declares the template parameters. + +$range j 1..n +$for j [[ +$range m 0..j-1 +#define GMOCK_INTERNAL_DECL_HAS_$j[[]] +_TEMPLATE_PARAMS($for m, [[kind$m, name$m]]) $for m, [[kind$m name$m]] + + +]] + +// Lists the template parameters. + +$for j [[ +$range m 0..j-1 +#define GMOCK_INTERNAL_LIST_HAS_$j[[]] +_TEMPLATE_PARAMS($for m, [[kind$m, name$m]]) $for m, [[name$m]] + + +]] + +// Declares the types of value parameters. + +$for i [[ +$range j 0..i-1 +#define GMOCK_INTERNAL_DECL_TYPE_AND_$i[[]] +_VALUE_PARAMS($for j, [[p$j]]) $for j [[, typename p$j##_type]] + + +]] + +// Initializes the value parameters. + +$for i [[ +$range j 0..i-1 +#define GMOCK_INTERNAL_INIT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])\ + ($for j, [[p$j##_type gmock_p$j]])$if i>0 [[ : ]]$for j, [[p$j(gmock_p$j)]] + + +]] + +// Declares the fields for storing the value parameters. + +$for i [[ +$range j 0..i-1 +#define GMOCK_INTERNAL_DEFN_AND_$i[[]] +_VALUE_PARAMS($for j, [[p$j]]) $for j [[p$j##_type p$j; ]] + + +]] + +// Lists the value parameters. + +$for i [[ +$range j 0..i-1 +#define GMOCK_INTERNAL_LIST_AND_$i[[]] +_VALUE_PARAMS($for j, [[p$j]]) $for j, [[p$j]] + + +]] + +// Lists the value parameter types. + +$for i [[ +$range j 0..i-1 +#define GMOCK_INTERNAL_LIST_TYPE_AND_$i[[]] +_VALUE_PARAMS($for j, [[p$j]]) $for j [[, p$j##_type]] + + +]] + +// Declares the value parameters. + +$for i [[ +$range j 0..i-1 +#define GMOCK_INTERNAL_DECL_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]]) [[]] +$for j, [[p$j##_type p$j]] + + +]] + +// The suffix of the class template implementing the action template. +$for i [[ + + +$range j 0..i-1 +#define GMOCK_INTERNAL_COUNT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]]) [[]] +$if i==1 [[P]] $elif i>=2 [[P$i]] +]] + + +// The name of the class template implementing the action template. +#define GMOCK_ACTION_CLASS_(name, value_params)\ + GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params) + +$range k 0..n-1 + +#define ACTION_TEMPLATE(name, template_params, value_params)\ + template \ + class GMOCK_ACTION_CLASS_(name, value_params) {\ + public:\ + explicit GMOCK_ACTION_CLASS_(name, value_params)\ + GMOCK_INTERNAL_INIT_##value_params {}\ + template \ + class gmock_Impl : public ::testing::ActionInterface {\ + public:\ + typedef F function_type;\ + typedef typename ::testing::internal::Function::Result return_type;\ + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\ + virtual return_type Perform(const args_type& args) {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ + template <$for k, [[typename arg$k[[]]_type]]>\ + return_type gmock_PerformImpl(const args_type& args[[]] +$for k [[, arg$k[[]]_type arg$k]]) const;\ + GMOCK_INTERNAL_DEFN_##value_params\ + private:\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template operator ::testing::Action() const {\ + return ::testing::Action(\ + new gmock_Impl(GMOCK_INTERNAL_LIST_##value_params));\ + }\ + GMOCK_INTERNAL_DEFN_##value_params\ + private:\ + GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\ + };\ + template \ + inline GMOCK_ACTION_CLASS_(name, value_params)<\ + GMOCK_INTERNAL_LIST_##template_params\ + GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\ + GMOCK_INTERNAL_DECL_##value_params) {\ + return GMOCK_ACTION_CLASS_(name, value_params)<\ + GMOCK_INTERNAL_LIST_##template_params\ + GMOCK_INTERNAL_LIST_TYPE_##value_params>(\ + GMOCK_INTERNAL_LIST_##value_params);\ + }\ + template \ + template \ + template \ + typename ::testing::internal::Function::Result\ + GMOCK_ACTION_CLASS_(name, value_params)<\ + GMOCK_INTERNAL_LIST_##template_params\ + GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl::\ + gmock_PerformImpl(\ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +$for i + +[[ +$var template = [[$if i==0 [[]] $else [[ +$range j 0..i-1 + + template <$for j, [[typename p$j##_type]]>\ +]]]] +$var class_name = [[name##Action[[$if i==0 [[]] $elif i==1 [[P]] + $else [[P$i]]]]]] +$range j 0..i-1 +$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] +$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]] +$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] +$var param_field_decls = [[$for j +[[ + + p$j##_type p$j;\ +]]]] +$var param_field_decls2 = [[$for j +[[ + + p$j##_type p$j;\ +]]]] +$var params = [[$for j, [[p$j]]]] +$var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]] +$var typename_arg_types = [[$for k, [[typename arg$k[[]]_type]]]] +$var arg_types_and_names = [[$for k, [[arg$k[[]]_type arg$k]]]] +$var macro_name = [[$if i==0 [[ACTION]] $elif i==1 [[ACTION_P]] + $else [[ACTION_P$i]]]] + +#define $macro_name(name$for j [[, p$j]])\$template + class $class_name {\ + public:\ + [[$if i==1 [[explicit ]]]]$class_name($ctor_param_list)$inits {}\ + template \ + class gmock_Impl : public ::testing::ActionInterface {\ + public:\ + typedef F function_type;\ + typedef typename ::testing::internal::Function::Result return_type;\ + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + [[$if i==1 [[explicit ]]]]gmock_Impl($ctor_param_list)$inits {}\ + virtual return_type Perform(const args_type& args) {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ + template <$typename_arg_types>\ + return_type gmock_PerformImpl(const args_type& args, [[]] +$arg_types_and_names) const;\$param_field_decls + private:\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template operator ::testing::Action() const {\ + return ::testing::Action(new gmock_Impl($params));\ + }\$param_field_decls2 + private:\ + GTEST_DISALLOW_ASSIGN_($class_name);\ + };\$template + inline $class_name$param_types name($param_types_and_names) {\ + return $class_name$param_types($params);\ + }\$template + template \ + template <$typename_arg_types>\ + typename ::testing::internal::Function::Result\ + $class_name$param_types::gmock_Impl::gmock_PerformImpl(\ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const +]] +$$ } // This meta comment fixes auto-indentation in Emacs. It won't +$$ // show up in the generated code. + + +namespace testing { + + +// The ACTION*() macros trigger warning C4100 (unreferenced formal +// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in +// the macro definition, as the warnings are generated when the macro +// is expanded and macro expansion cannot contain #pragma. Therefore +// we suppress them here. +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable:4100) +#endif + +// Various overloads for InvokeArgument(). +// +// The InvokeArgument(a1, a2, ..., a_k) action invokes the N-th +// (0-based) argument, which must be a k-ary callable, of the mock +// function, with arguments a1, a2, ..., a_k. +// +// Notes: +// +// 1. The arguments are passed by value by default. If you need to +// pass an argument by reference, wrap it inside ByRef(). For +// example, +// +// InvokeArgument<1>(5, string("Hello"), ByRef(foo)) +// +// passes 5 and string("Hello") by value, and passes foo by +// reference. +// +// 2. If the callable takes an argument by reference but ByRef() is +// not used, it will receive the reference to a copy of the value, +// instead of the original value. For example, when the 0-th +// argument of the mock function takes a const string&, the action +// +// InvokeArgument<0>(string("Hello")) +// +// makes a copy of the temporary string("Hello") object and passes a +// reference of the copy, instead of the original temporary object, +// to the callable. This makes it easy for a user to define an +// InvokeArgument action from temporary values and have it performed +// later. + +namespace internal { +namespace invoke_argument { + +// Appears in InvokeArgumentAdl's argument list to help avoid +// accidental calls to user functions of the same name. +struct AdlTag {}; + +// InvokeArgumentAdl - a helper for InvokeArgument. +// The basic overloads are provided here for generic functors. +// Overloads for other custom-callables are provided in the +// internal/custom/callback-actions.h header. + +$range i 0..n +$for i +[[ +$range j 1..i + +template +R InvokeArgumentAdl(AdlTag, F f[[$for j [[, A$j a$j]]]]) { + return f([[$for j, [[a$j]]]]); +} +]] + +} // namespace invoke_argument +} // namespace internal + +$range i 0..n +$for i [[ +$range j 0..i-1 + +ACTION_TEMPLATE(InvokeArgument, + HAS_1_TEMPLATE_PARAMS(int, k), + AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])) { + using internal::invoke_argument::InvokeArgumentAdl; + return InvokeArgumentAdl( + internal::invoke_argument::AdlTag(), + ::testing::get(args)$for j [[, p$j]]); +} + +]] + +// Various overloads for ReturnNew(). +// +// The ReturnNew(a1, a2, ..., a_k) action returns a pointer to a new +// instance of type T, constructed on the heap with constructor arguments +// a1, a2, ..., and a_k. The caller assumes ownership of the returned value. +$range i 0..n +$for i [[ +$range j 0..i-1 +$var ps = [[$for j, [[p$j]]]] + +ACTION_TEMPLATE(ReturnNew, + HAS_1_TEMPLATE_PARAMS(typename, T), + AND_$i[[]]_VALUE_PARAMS($ps)) { + return new T($ps); +} + +]] + +#ifdef _MSC_VER +# pragma warning(pop) +#endif + +} // namespace testing + +// Include any custom callback actions added by the local installation. +// We must include this header at the end to make sure it can use the +// declarations from this file. +#include "gmock/internal/custom/gmock-generated-actions.h" + +#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h new file mode 100644 index 00000000000..550cfd250e3 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h @@ -0,0 +1,1160 @@ +// This file was GENERATED by command: +// pump.py gmock-generated-function-mockers.h.pump +// DO NOT EDIT BY HAND!!! + +// Copyright 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: wan@google.com (Zhanyong Wan) + +// Google Mock - a framework for writing C++ mock classes. +// +// This file implements function mockers of various arities. + +#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ +#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ + +#include "gmock/gmock-spec-builders.h" +#include "gmock/internal/gmock-internal-utils.h" + +#if GTEST_HAS_STD_FUNCTION_ +# include +#endif + +namespace testing { +namespace internal { + +template +class FunctionMockerBase; + +// Note: class FunctionMocker really belongs to the ::testing +// namespace. However if we define it in ::testing, MSVC will +// complain when classes in ::testing::internal declare it as a +// friend class template. To workaround this compiler bug, we define +// FunctionMocker in ::testing::internal and import it into ::testing. +template +class FunctionMocker; + +template +class FunctionMocker : public + internal::FunctionMockerBase { + public: + typedef R F(); + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + MockSpec With() { + return MockSpec(this, ::testing::make_tuple()); + } + + R Invoke() { + // Even though gcc and MSVC don't enforce it, 'this->' is required + // by the C++ standard [14.6.4] here, as the base class type is + // dependent on the template argument (and thus shouldn't be + // looked into when resolving InvokeWith). + return this->InvokeWith(ArgumentTuple()); + } +}; + +template +class FunctionMocker : public + internal::FunctionMockerBase { + public: + typedef R F(A1); + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + MockSpec With(const Matcher& m1) { + return MockSpec(this, ::testing::make_tuple(m1)); + } + + R Invoke(A1 a1) { + // Even though gcc and MSVC don't enforce it, 'this->' is required + // by the C++ standard [14.6.4] here, as the base class type is + // dependent on the template argument (and thus shouldn't be + // looked into when resolving InvokeWith). + return this->InvokeWith(ArgumentTuple(internal::forward(a1))); + } +}; + +template +class FunctionMocker : public + internal::FunctionMockerBase { + public: + typedef R F(A1, A2); + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + MockSpec With(const Matcher& m1, const Matcher& m2) { + return MockSpec(this, ::testing::make_tuple(m1, m2)); + } + + R Invoke(A1 a1, A2 a2) { + // Even though gcc and MSVC don't enforce it, 'this->' is required + // by the C++ standard [14.6.4] here, as the base class type is + // dependent on the template argument (and thus shouldn't be + // looked into when resolving InvokeWith). + return this->InvokeWith(ArgumentTuple(internal::forward(a1), + internal::forward(a2))); + } +}; + +template +class FunctionMocker : public + internal::FunctionMockerBase { + public: + typedef R F(A1, A2, A3); + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + MockSpec With(const Matcher& m1, const Matcher& m2, + const Matcher& m3) { + return MockSpec(this, ::testing::make_tuple(m1, m2, m3)); + } + + R Invoke(A1 a1, A2 a2, A3 a3) { + // Even though gcc and MSVC don't enforce it, 'this->' is required + // by the C++ standard [14.6.4] here, as the base class type is + // dependent on the template argument (and thus shouldn't be + // looked into when resolving InvokeWith). + return this->InvokeWith(ArgumentTuple(internal::forward(a1), + internal::forward(a2), internal::forward(a3))); + } +}; + +template +class FunctionMocker : public + internal::FunctionMockerBase { + public: + typedef R F(A1, A2, A3, A4); + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + MockSpec With(const Matcher& m1, const Matcher& m2, + const Matcher& m3, const Matcher& m4) { + return MockSpec(this, ::testing::make_tuple(m1, m2, m3, m4)); + } + + R Invoke(A1 a1, A2 a2, A3 a3, A4 a4) { + // Even though gcc and MSVC don't enforce it, 'this->' is required + // by the C++ standard [14.6.4] here, as the base class type is + // dependent on the template argument (and thus shouldn't be + // looked into when resolving InvokeWith). + return this->InvokeWith(ArgumentTuple(internal::forward(a1), + internal::forward(a2), internal::forward(a3), + internal::forward(a4))); + } +}; + +template +class FunctionMocker : public + internal::FunctionMockerBase { + public: + typedef R F(A1, A2, A3, A4, A5); + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + MockSpec With(const Matcher& m1, const Matcher& m2, + const Matcher& m3, const Matcher& m4, const Matcher& m5) { + return MockSpec(this, ::testing::make_tuple(m1, m2, m3, m4, m5)); + } + + R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { + // Even though gcc and MSVC don't enforce it, 'this->' is required + // by the C++ standard [14.6.4] here, as the base class type is + // dependent on the template argument (and thus shouldn't be + // looked into when resolving InvokeWith). + return this->InvokeWith(ArgumentTuple(internal::forward(a1), + internal::forward(a2), internal::forward(a3), + internal::forward(a4), internal::forward(a5))); + } +}; + +template +class FunctionMocker : public + internal::FunctionMockerBase { + public: + typedef R F(A1, A2, A3, A4, A5, A6); + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + MockSpec With(const Matcher& m1, const Matcher& m2, + const Matcher& m3, const Matcher& m4, const Matcher& m5, + const Matcher& m6) { + return MockSpec(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6)); + } + + R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { + // Even though gcc and MSVC don't enforce it, 'this->' is required + // by the C++ standard [14.6.4] here, as the base class type is + // dependent on the template argument (and thus shouldn't be + // looked into when resolving InvokeWith). + return this->InvokeWith(ArgumentTuple(internal::forward(a1), + internal::forward(a2), internal::forward(a3), + internal::forward(a4), internal::forward(a5), + internal::forward(a6))); + } +}; + +template +class FunctionMocker : public + internal::FunctionMockerBase { + public: + typedef R F(A1, A2, A3, A4, A5, A6, A7); + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + MockSpec With(const Matcher& m1, const Matcher& m2, + const Matcher& m3, const Matcher& m4, const Matcher& m5, + const Matcher& m6, const Matcher& m7) { + return MockSpec(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7)); + } + + R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { + // Even though gcc and MSVC don't enforce it, 'this->' is required + // by the C++ standard [14.6.4] here, as the base class type is + // dependent on the template argument (and thus shouldn't be + // looked into when resolving InvokeWith). + return this->InvokeWith(ArgumentTuple(internal::forward(a1), + internal::forward(a2), internal::forward(a3), + internal::forward(a4), internal::forward(a5), + internal::forward(a6), internal::forward(a7))); + } +}; + +template +class FunctionMocker : public + internal::FunctionMockerBase { + public: + typedef R F(A1, A2, A3, A4, A5, A6, A7, A8); + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + MockSpec With(const Matcher& m1, const Matcher& m2, + const Matcher& m3, const Matcher& m4, const Matcher& m5, + const Matcher& m6, const Matcher& m7, const Matcher& m8) { + return MockSpec(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7, + m8)); + } + + R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { + // Even though gcc and MSVC don't enforce it, 'this->' is required + // by the C++ standard [14.6.4] here, as the base class type is + // dependent on the template argument (and thus shouldn't be + // looked into when resolving InvokeWith). + return this->InvokeWith(ArgumentTuple(internal::forward(a1), + internal::forward(a2), internal::forward(a3), + internal::forward(a4), internal::forward(a5), + internal::forward(a6), internal::forward(a7), + internal::forward(a8))); + } +}; + +template +class FunctionMocker : public + internal::FunctionMockerBase { + public: + typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9); + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + MockSpec With(const Matcher& m1, const Matcher& m2, + const Matcher& m3, const Matcher& m4, const Matcher& m5, + const Matcher& m6, const Matcher& m7, const Matcher& m8, + const Matcher& m9) { + return MockSpec(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7, + m8, m9)); + } + + R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { + // Even though gcc and MSVC don't enforce it, 'this->' is required + // by the C++ standard [14.6.4] here, as the base class type is + // dependent on the template argument (and thus shouldn't be + // looked into when resolving InvokeWith). + return this->InvokeWith(ArgumentTuple(internal::forward(a1), + internal::forward(a2), internal::forward(a3), + internal::forward(a4), internal::forward(a5), + internal::forward(a6), internal::forward(a7), + internal::forward(a8), internal::forward(a9))); + } +}; + +template +class FunctionMocker : public + internal::FunctionMockerBase { + public: + typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + MockSpec With(const Matcher& m1, const Matcher& m2, + const Matcher& m3, const Matcher& m4, const Matcher& m5, + const Matcher& m6, const Matcher& m7, const Matcher& m8, + const Matcher& m9, const Matcher& m10) { + return MockSpec(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7, + m8, m9, m10)); + } + + R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, + A10 a10) { + // Even though gcc and MSVC don't enforce it, 'this->' is required + // by the C++ standard [14.6.4] here, as the base class type is + // dependent on the template argument (and thus shouldn't be + // looked into when resolving InvokeWith). + return this->InvokeWith(ArgumentTuple(internal::forward(a1), + internal::forward(a2), internal::forward(a3), + internal::forward(a4), internal::forward(a5), + internal::forward(a6), internal::forward(a7), + internal::forward(a8), internal::forward(a9), + internal::forward(a10))); + } +}; + +} // namespace internal + +// The style guide prohibits "using" statements in a namespace scope +// inside a header file. However, the FunctionMocker class template +// is meant to be defined in the ::testing namespace. The following +// line is just a trick for working around a bug in MSVC 8.0, which +// cannot handle it if we define FunctionMocker in ::testing. +using internal::FunctionMocker; + +// GMOCK_RESULT_(tn, F) expands to the result type of function type F. +// We define this as a variadic macro in case F contains unprotected +// commas (the same reason that we use variadic macros in other places +// in this file). +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_RESULT_(tn, ...) \ + tn ::testing::internal::Function<__VA_ARGS__>::Result + +// The type of argument N of the given function type. +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_ARG_(tn, N, ...) \ + tn ::testing::internal::Function<__VA_ARGS__>::Argument##N + +// The matcher type for argument N of the given function type. +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_MATCHER_(tn, N, ...) \ + const ::testing::Matcher& + +// The variable for mocking the given method. +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_MOCKER_(arity, constness, Method) \ + GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__) + +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \ + GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ + ) constness { \ + GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ + tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ + == 0), \ + this_method_does_not_take_0_arguments); \ + GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \ + return GMOCK_MOCKER_(0, constness, Method).Invoke(); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method() constness { \ + GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(0, constness, Method).With(); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness, \ + Method) + +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \ + GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ + GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) constness { \ + GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ + tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ + == 1), \ + this_method_does_not_take_1_argument); \ + GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \ + return GMOCK_MOCKER_(1, constness, \ + Method).Invoke(::testing::internal::forward(gmock_a1)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) constness { \ + GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \ + Method) + +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_METHOD2_(tn, constness, ct, Method, ...) \ + GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ + GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ + __VA_ARGS__) gmock_a2) constness { \ + GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ + tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ + == 2), \ + this_method_does_not_take_2_arguments); \ + GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \ + return GMOCK_MOCKER_(2, constness, \ + Method).Invoke(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2) constness { \ + GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \ + Method) + +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_METHOD3_(tn, constness, ct, Method, ...) \ + GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ + GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ + __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, \ + __VA_ARGS__) gmock_a3) constness { \ + GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ + tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ + == 3), \ + this_method_does_not_take_3_arguments); \ + GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \ + return GMOCK_MOCKER_(3, constness, \ + Method).Invoke(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3) constness { \ + GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \ + Method) + +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_METHOD4_(tn, constness, ct, Method, ...) \ + GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ + GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ + __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4) constness { \ + GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ + tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ + == 4), \ + this_method_does_not_take_4_arguments); \ + GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \ + return GMOCK_MOCKER_(4, constness, \ + Method).Invoke(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3), \ + ::testing::internal::forward(gmock_a4)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4) constness { \ + GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3, gmock_a4); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \ + Method) + +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_METHOD5_(tn, constness, ct, Method, ...) \ + GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ + GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ + __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \ + __VA_ARGS__) gmock_a5) constness { \ + GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ + tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ + == 5), \ + this_method_does_not_take_5_arguments); \ + GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \ + return GMOCK_MOCKER_(5, constness, \ + Method).Invoke(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3), \ + ::testing::internal::forward(gmock_a4), \ + ::testing::internal::forward(gmock_a5)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ + GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5) constness { \ + GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3, gmock_a4, gmock_a5); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \ + Method) + +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_METHOD6_(tn, constness, ct, Method, ...) \ + GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ + GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ + __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \ + __VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, \ + __VA_ARGS__) gmock_a6) constness { \ + GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ + tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ + == 6), \ + this_method_does_not_take_6_arguments); \ + GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \ + return GMOCK_MOCKER_(6, constness, \ + Method).Invoke(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3), \ + ::testing::internal::forward(gmock_a4), \ + ::testing::internal::forward(gmock_a5), \ + ::testing::internal::forward(gmock_a6)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ + GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ + GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6) constness { \ + GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(6, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3, gmock_a4, gmock_a5, gmock_a6); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \ + Method) + +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_METHOD7_(tn, constness, ct, Method, ...) \ + GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ + GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ + __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \ + __VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ + GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7) constness { \ + GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ + tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ + == 7), \ + this_method_does_not_take_7_arguments); \ + GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \ + return GMOCK_MOCKER_(7, constness, \ + Method).Invoke(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3), \ + ::testing::internal::forward(gmock_a4), \ + ::testing::internal::forward(gmock_a5), \ + ::testing::internal::forward(gmock_a6), \ + ::testing::internal::forward(gmock_a7)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ + GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ + GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ + GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7) constness { \ + GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(7, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \ + Method) + +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_METHOD8_(tn, constness, ct, Method, ...) \ + GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ + GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ + __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \ + __VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ + GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, GMOCK_ARG_(tn, 8, \ + __VA_ARGS__) gmock_a8) constness { \ + GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ + tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ + == 8), \ + this_method_does_not_take_8_arguments); \ + GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \ + return GMOCK_MOCKER_(8, constness, \ + Method).Invoke(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3), \ + ::testing::internal::forward(gmock_a4), \ + ::testing::internal::forward(gmock_a5), \ + ::testing::internal::forward(gmock_a6), \ + ::testing::internal::forward(gmock_a7), \ + ::testing::internal::forward(gmock_a8)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ + GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ + GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ + GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ + GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8) constness { \ + GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(8, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness, \ + Method) + +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_METHOD9_(tn, constness, ct, Method, ...) \ + GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ + GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ + __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \ + __VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ + GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, GMOCK_ARG_(tn, 8, \ + __VA_ARGS__) gmock_a8, GMOCK_ARG_(tn, 9, \ + __VA_ARGS__) gmock_a9) constness { \ + GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ + tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ + == 9), \ + this_method_does_not_take_9_arguments); \ + GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \ + return GMOCK_MOCKER_(9, constness, \ + Method).Invoke(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3), \ + ::testing::internal::forward(gmock_a4), \ + ::testing::internal::forward(gmock_a5), \ + ::testing::internal::forward(gmock_a6), \ + ::testing::internal::forward(gmock_a7), \ + ::testing::internal::forward(gmock_a8), \ + ::testing::internal::forward(gmock_a9)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ + GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ + GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ + GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ + GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \ + GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9) constness { \ + GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(9, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \ + gmock_a9); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness, \ + Method) + +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_METHOD10_(tn, constness, ct, Method, ...) \ + GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ + GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ + __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \ + __VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ + GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, GMOCK_ARG_(tn, 8, \ + __VA_ARGS__) gmock_a8, GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9, \ + GMOCK_ARG_(tn, 10, __VA_ARGS__) gmock_a10) constness { \ + GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ + tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ + == 10), \ + this_method_does_not_take_10_arguments); \ + GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \ + return GMOCK_MOCKER_(10, constness, \ + Method).Invoke(::testing::internal::forward(gmock_a1), \ + ::testing::internal::forward(gmock_a2), \ + ::testing::internal::forward(gmock_a3), \ + ::testing::internal::forward(gmock_a4), \ + ::testing::internal::forward(gmock_a5), \ + ::testing::internal::forward(gmock_a6), \ + ::testing::internal::forward(gmock_a7), \ + ::testing::internal::forward(gmock_a8), \ + ::testing::internal::forward(gmock_a9), \ + ::testing::internal::forward(gmock_a10)); \ + } \ + ::testing::MockSpec<__VA_ARGS__> \ + gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ + GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ + GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ + GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ + GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ + GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ + GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ + GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \ + GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9, \ + GMOCK_MATCHER_(tn, 10, \ + __VA_ARGS__) gmock_a10) constness { \ + GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_(10, constness, Method).With(gmock_a1, gmock_a2, \ + gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \ + gmock_a10); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constness, \ + Method) + +#define MOCK_METHOD0(m, ...) GMOCK_METHOD0_(, , , m, __VA_ARGS__) +#define MOCK_METHOD1(m, ...) GMOCK_METHOD1_(, , , m, __VA_ARGS__) +#define MOCK_METHOD2(m, ...) GMOCK_METHOD2_(, , , m, __VA_ARGS__) +#define MOCK_METHOD3(m, ...) GMOCK_METHOD3_(, , , m, __VA_ARGS__) +#define MOCK_METHOD4(m, ...) GMOCK_METHOD4_(, , , m, __VA_ARGS__) +#define MOCK_METHOD5(m, ...) GMOCK_METHOD5_(, , , m, __VA_ARGS__) +#define MOCK_METHOD6(m, ...) GMOCK_METHOD6_(, , , m, __VA_ARGS__) +#define MOCK_METHOD7(m, ...) GMOCK_METHOD7_(, , , m, __VA_ARGS__) +#define MOCK_METHOD8(m, ...) GMOCK_METHOD8_(, , , m, __VA_ARGS__) +#define MOCK_METHOD9(m, ...) GMOCK_METHOD9_(, , , m, __VA_ARGS__) +#define MOCK_METHOD10(m, ...) GMOCK_METHOD10_(, , , m, __VA_ARGS__) + +#define MOCK_CONST_METHOD0(m, ...) GMOCK_METHOD0_(, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD1(m, ...) GMOCK_METHOD1_(, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD2(m, ...) GMOCK_METHOD2_(, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD3(m, ...) GMOCK_METHOD3_(, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD4(m, ...) GMOCK_METHOD4_(, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD5(m, ...) GMOCK_METHOD5_(, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD6(m, ...) GMOCK_METHOD6_(, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD7(m, ...) GMOCK_METHOD7_(, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD8(m, ...) GMOCK_METHOD8_(, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD9(m, ...) GMOCK_METHOD9_(, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD10(m, ...) GMOCK_METHOD10_(, const, , m, __VA_ARGS__) + +#define MOCK_METHOD0_T(m, ...) GMOCK_METHOD0_(typename, , , m, __VA_ARGS__) +#define MOCK_METHOD1_T(m, ...) GMOCK_METHOD1_(typename, , , m, __VA_ARGS__) +#define MOCK_METHOD2_T(m, ...) GMOCK_METHOD2_(typename, , , m, __VA_ARGS__) +#define MOCK_METHOD3_T(m, ...) GMOCK_METHOD3_(typename, , , m, __VA_ARGS__) +#define MOCK_METHOD4_T(m, ...) GMOCK_METHOD4_(typename, , , m, __VA_ARGS__) +#define MOCK_METHOD5_T(m, ...) GMOCK_METHOD5_(typename, , , m, __VA_ARGS__) +#define MOCK_METHOD6_T(m, ...) GMOCK_METHOD6_(typename, , , m, __VA_ARGS__) +#define MOCK_METHOD7_T(m, ...) GMOCK_METHOD7_(typename, , , m, __VA_ARGS__) +#define MOCK_METHOD8_T(m, ...) GMOCK_METHOD8_(typename, , , m, __VA_ARGS__) +#define MOCK_METHOD9_T(m, ...) GMOCK_METHOD9_(typename, , , m, __VA_ARGS__) +#define MOCK_METHOD10_T(m, ...) GMOCK_METHOD10_(typename, , , m, __VA_ARGS__) + +#define MOCK_CONST_METHOD0_T(m, ...) \ + GMOCK_METHOD0_(typename, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD1_T(m, ...) \ + GMOCK_METHOD1_(typename, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD2_T(m, ...) \ + GMOCK_METHOD2_(typename, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD3_T(m, ...) \ + GMOCK_METHOD3_(typename, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD4_T(m, ...) \ + GMOCK_METHOD4_(typename, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD5_T(m, ...) \ + GMOCK_METHOD5_(typename, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD6_T(m, ...) \ + GMOCK_METHOD6_(typename, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD7_T(m, ...) \ + GMOCK_METHOD7_(typename, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD8_T(m, ...) \ + GMOCK_METHOD8_(typename, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD9_T(m, ...) \ + GMOCK_METHOD9_(typename, const, , m, __VA_ARGS__) +#define MOCK_CONST_METHOD10_T(m, ...) \ + GMOCK_METHOD10_(typename, const, , m, __VA_ARGS__) + +#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD0_(, , ct, m, __VA_ARGS__) +#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD1_(, , ct, m, __VA_ARGS__) +#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD2_(, , ct, m, __VA_ARGS__) +#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD3_(, , ct, m, __VA_ARGS__) +#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD4_(, , ct, m, __VA_ARGS__) +#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD5_(, , ct, m, __VA_ARGS__) +#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD6_(, , ct, m, __VA_ARGS__) +#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD7_(, , ct, m, __VA_ARGS__) +#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD8_(, , ct, m, __VA_ARGS__) +#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD9_(, , ct, m, __VA_ARGS__) +#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD10_(, , ct, m, __VA_ARGS__) + +#define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD0_(, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD1_(, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD2_(, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD3_(, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD4_(, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD5_(, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD6_(, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD7_(, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD8_(, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD9_(, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD10_(, const, ct, m, __VA_ARGS__) + +#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD0_(typename, , ct, m, __VA_ARGS__) +#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD1_(typename, , ct, m, __VA_ARGS__) +#define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD2_(typename, , ct, m, __VA_ARGS__) +#define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD3_(typename, , ct, m, __VA_ARGS__) +#define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD4_(typename, , ct, m, __VA_ARGS__) +#define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD5_(typename, , ct, m, __VA_ARGS__) +#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD6_(typename, , ct, m, __VA_ARGS__) +#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD7_(typename, , ct, m, __VA_ARGS__) +#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD8_(typename, , ct, m, __VA_ARGS__) +#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD9_(typename, , ct, m, __VA_ARGS__) +#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD10_(typename, , ct, m, __VA_ARGS__) + +#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD0_(typename, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD1_(typename, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD2_(typename, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD3_(typename, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD4_(typename, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD5_(typename, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD6_(typename, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD7_(typename, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD8_(typename, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD9_(typename, const, ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD10_(typename, const, ct, m, __VA_ARGS__) + +// A MockFunction class has one mock method whose type is F. It is +// useful when you just want your test code to emit some messages and +// have Google Mock verify the right messages are sent (and perhaps at +// the right times). For example, if you are exercising code: +// +// Foo(1); +// Foo(2); +// Foo(3); +// +// and want to verify that Foo(1) and Foo(3) both invoke +// mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write: +// +// TEST(FooTest, InvokesBarCorrectly) { +// MyMock mock; +// MockFunction check; +// { +// InSequence s; +// +// EXPECT_CALL(mock, Bar("a")); +// EXPECT_CALL(check, Call("1")); +// EXPECT_CALL(check, Call("2")); +// EXPECT_CALL(mock, Bar("a")); +// } +// Foo(1); +// check.Call("1"); +// Foo(2); +// check.Call("2"); +// Foo(3); +// } +// +// The expectation spec says that the first Bar("a") must happen +// before check point "1", the second Bar("a") must happen after check +// point "2", and nothing should happen between the two check +// points. The explicit check points make it easy to tell which +// Bar("a") is called by which call to Foo(). +// +// MockFunction can also be used to exercise code that accepts +// std::function callbacks. To do so, use AsStdFunction() method +// to create std::function proxy forwarding to original object's Call. +// Example: +// +// TEST(FooTest, RunsCallbackWithBarArgument) { +// MockFunction callback; +// EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1)); +// Foo(callback.AsStdFunction()); +// } +template +class MockFunction; + +template +class MockFunction { + public: + MockFunction() {} + + MOCK_METHOD0_T(Call, R()); + +#if GTEST_HAS_STD_FUNCTION_ + ::std::function AsStdFunction() { + return [this]() -> R { + return this->Call(); + }; + } +#endif // GTEST_HAS_STD_FUNCTION_ + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); +}; + +template +class MockFunction { + public: + MockFunction() {} + + MOCK_METHOD1_T(Call, R(A0)); + +#if GTEST_HAS_STD_FUNCTION_ + ::std::function AsStdFunction() { + return [this](A0 a0) -> R { + return this->Call(::std::move(a0)); + }; + } +#endif // GTEST_HAS_STD_FUNCTION_ + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); +}; + +template +class MockFunction { + public: + MockFunction() {} + + MOCK_METHOD2_T(Call, R(A0, A1)); + +#if GTEST_HAS_STD_FUNCTION_ + ::std::function AsStdFunction() { + return [this](A0 a0, A1 a1) -> R { + return this->Call(::std::move(a0), ::std::move(a1)); + }; + } +#endif // GTEST_HAS_STD_FUNCTION_ + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); +}; + +template +class MockFunction { + public: + MockFunction() {} + + MOCK_METHOD3_T(Call, R(A0, A1, A2)); + +#if GTEST_HAS_STD_FUNCTION_ + ::std::function AsStdFunction() { + return [this](A0 a0, A1 a1, A2 a2) -> R { + return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2)); + }; + } +#endif // GTEST_HAS_STD_FUNCTION_ + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); +}; + +template +class MockFunction { + public: + MockFunction() {} + + MOCK_METHOD4_T(Call, R(A0, A1, A2, A3)); + +#if GTEST_HAS_STD_FUNCTION_ + ::std::function AsStdFunction() { + return [this](A0 a0, A1 a1, A2 a2, A3 a3) -> R { + return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2), + ::std::move(a3)); + }; + } +#endif // GTEST_HAS_STD_FUNCTION_ + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); +}; + +template +class MockFunction { + public: + MockFunction() {} + + MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4)); + +#if GTEST_HAS_STD_FUNCTION_ + ::std::function AsStdFunction() { + return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) -> R { + return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2), + ::std::move(a3), ::std::move(a4)); + }; + } +#endif // GTEST_HAS_STD_FUNCTION_ + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); +}; + +template +class MockFunction { + public: + MockFunction() {} + + MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5)); + +#if GTEST_HAS_STD_FUNCTION_ + ::std::function AsStdFunction() { + return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -> R { + return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2), + ::std::move(a3), ::std::move(a4), ::std::move(a5)); + }; + } +#endif // GTEST_HAS_STD_FUNCTION_ + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); +}; + +template +class MockFunction { + public: + MockFunction() {} + + MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6)); + +#if GTEST_HAS_STD_FUNCTION_ + ::std::function AsStdFunction() { + return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -> R { + return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2), + ::std::move(a3), ::std::move(a4), ::std::move(a5), ::std::move(a6)); + }; + } +#endif // GTEST_HAS_STD_FUNCTION_ + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); +}; + +template +class MockFunction { + public: + MockFunction() {} + + MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7)); + +#if GTEST_HAS_STD_FUNCTION_ + ::std::function AsStdFunction() { + return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -> R { + return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2), + ::std::move(a3), ::std::move(a4), ::std::move(a5), ::std::move(a6), + ::std::move(a7)); + }; + } +#endif // GTEST_HAS_STD_FUNCTION_ + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); +}; + +template +class MockFunction { + public: + MockFunction() {} + + MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8)); + +#if GTEST_HAS_STD_FUNCTION_ + ::std::function AsStdFunction() { + return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, + A8 a8) -> R { + return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2), + ::std::move(a3), ::std::move(a4), ::std::move(a5), ::std::move(a6), + ::std::move(a7), ::std::move(a8)); + }; + } +#endif // GTEST_HAS_STD_FUNCTION_ + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); +}; + +template +class MockFunction { + public: + MockFunction() {} + + MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)); + +#if GTEST_HAS_STD_FUNCTION_ + ::std::function AsStdFunction() { + return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, + A8 a8, A9 a9) -> R { + return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2), + ::std::move(a3), ::std::move(a4), ::std::move(a5), ::std::move(a6), + ::std::move(a7), ::std::move(a8), ::std::move(a9)); + }; + } +#endif // GTEST_HAS_STD_FUNCTION_ + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); +}; + +} // namespace testing + +#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump new file mode 100644 index 00000000000..55dc6c5b49f --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump @@ -0,0 +1,291 @@ +$$ -*- mode: c++; -*- +$$ This is a Pump source file. Please use Pump to convert +$$ it to gmock-generated-function-mockers.h. +$$ +$var n = 10 $$ The maximum arity we support. +// Copyright 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: wan@google.com (Zhanyong Wan) + +// Google Mock - a framework for writing C++ mock classes. +// +// This file implements function mockers of various arities. + +#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ +#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ + +#include "gmock/gmock-spec-builders.h" +#include "gmock/internal/gmock-internal-utils.h" + +#if GTEST_HAS_STD_FUNCTION_ +# include +#endif + +namespace testing { +namespace internal { + +template +class FunctionMockerBase; + +// Note: class FunctionMocker really belongs to the ::testing +// namespace. However if we define it in ::testing, MSVC will +// complain when classes in ::testing::internal declare it as a +// friend class template. To workaround this compiler bug, we define +// FunctionMocker in ::testing::internal and import it into ::testing. +template +class FunctionMocker; + + +$range i 0..n +$for i [[ +$range j 1..i +$var typename_As = [[$for j [[, typename A$j]]]] +$var As = [[$for j, [[A$j]]]] +$var as = [[$for j, [[a$j]]]] +$var Aas = [[$for j, [[A$j a$j]]]] +$var ms = [[$for j, [[m$j]]]] +$var matchers = [[$for j, [[const Matcher& m$j]]]] +template +class FunctionMocker : public + internal::FunctionMockerBase { + public: + typedef R F($As); + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + MockSpec& With($matchers) { + +$if i >= 1 [[ + this->current_spec().SetMatchers(::testing::make_tuple($ms)); + +]] + return this->current_spec(); + } + + R Invoke($Aas) { + // Even though gcc and MSVC don't enforce it, 'this->' is required + // by the C++ standard [14.6.4] here, as the base class type is + // dependent on the template argument (and thus shouldn't be + // looked into when resolving InvokeWith). + return this->InvokeWith(ArgumentTuple($as)); + } +}; + + +]] +} // namespace internal + +// The style guide prohibits "using" statements in a namespace scope +// inside a header file. However, the FunctionMocker class template +// is meant to be defined in the ::testing namespace. The following +// line is just a trick for working around a bug in MSVC 8.0, which +// cannot handle it if we define FunctionMocker in ::testing. +using internal::FunctionMocker; + +// GMOCK_RESULT_(tn, F) expands to the result type of function type F. +// We define this as a variadic macro in case F contains unprotected +// commas (the same reason that we use variadic macros in other places +// in this file). +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_RESULT_(tn, ...) \ + tn ::testing::internal::Function<__VA_ARGS__>::Result + +// The type of argument N of the given function type. +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_ARG_(tn, N, ...) \ + tn ::testing::internal::Function<__VA_ARGS__>::Argument##N + +// The matcher type for argument N of the given function type. +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_MATCHER_(tn, N, ...) \ + const ::testing::Matcher& + +// The variable for mocking the given method. +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_MOCKER_(arity, constness, Method) \ + GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__) + + +$for i [[ +$range j 1..i +$var arg_as = [[$for j, \ + [[GMOCK_ARG_(tn, $j, __VA_ARGS__) gmock_a$j]]]] +$var as = [[$for j, [[gmock_a$j]]]] +$var matcher_as = [[$for j, \ + [[GMOCK_MATCHER_(tn, $j, __VA_ARGS__) gmock_a$j]]]] +// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! +#define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, ...) \ + GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ + $arg_as) constness { \ + GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ + tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value == $i), \ + this_method_does_not_take_$i[[]]_argument[[$if i != 1 [[s]]]]); \ + GMOCK_MOCKER_($i, constness, Method).SetOwnerAndName(this, #Method); \ + return GMOCK_MOCKER_($i, constness, Method).Invoke($as); \ + } \ + ::testing::MockSpec<__VA_ARGS__>& \ + gmock_##Method($matcher_as) constness { \ + GMOCK_MOCKER_($i, constness, Method).RegisterOwner(this); \ + return GMOCK_MOCKER_($i, constness, Method).With($as); \ + } \ + mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_($i, constness, Method) + + +]] +$for i [[ +#define MOCK_METHOD$i(m, ...) GMOCK_METHOD$i[[]]_(, , , m, __VA_ARGS__) + +]] + + +$for i [[ +#define MOCK_CONST_METHOD$i(m, ...) GMOCK_METHOD$i[[]]_(, const, , m, __VA_ARGS__) + +]] + + +$for i [[ +#define MOCK_METHOD$i[[]]_T(m, ...) GMOCK_METHOD$i[[]]_(typename, , , m, __VA_ARGS__) + +]] + + +$for i [[ +#define MOCK_CONST_METHOD$i[[]]_T(m, ...) \ + GMOCK_METHOD$i[[]]_(typename, const, , m, __VA_ARGS__) + +]] + + +$for i [[ +#define MOCK_METHOD$i[[]]_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD$i[[]]_(, , ct, m, __VA_ARGS__) + +]] + + +$for i [[ +#define MOCK_CONST_METHOD$i[[]]_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD$i[[]]_(, const, ct, m, __VA_ARGS__) + +]] + + +$for i [[ +#define MOCK_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD$i[[]]_(typename, , ct, m, __VA_ARGS__) + +]] + + +$for i [[ +#define MOCK_CONST_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_METHOD$i[[]]_(typename, const, ct, m, __VA_ARGS__) + +]] + +// A MockFunction class has one mock method whose type is F. It is +// useful when you just want your test code to emit some messages and +// have Google Mock verify the right messages are sent (and perhaps at +// the right times). For example, if you are exercising code: +// +// Foo(1); +// Foo(2); +// Foo(3); +// +// and want to verify that Foo(1) and Foo(3) both invoke +// mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write: +// +// TEST(FooTest, InvokesBarCorrectly) { +// MyMock mock; +// MockFunction check; +// { +// InSequence s; +// +// EXPECT_CALL(mock, Bar("a")); +// EXPECT_CALL(check, Call("1")); +// EXPECT_CALL(check, Call("2")); +// EXPECT_CALL(mock, Bar("a")); +// } +// Foo(1); +// check.Call("1"); +// Foo(2); +// check.Call("2"); +// Foo(3); +// } +// +// The expectation spec says that the first Bar("a") must happen +// before check point "1", the second Bar("a") must happen after check +// point "2", and nothing should happen between the two check +// points. The explicit check points make it easy to tell which +// Bar("a") is called by which call to Foo(). +// +// MockFunction can also be used to exercise code that accepts +// std::function callbacks. To do so, use AsStdFunction() method +// to create std::function proxy forwarding to original object's Call. +// Example: +// +// TEST(FooTest, RunsCallbackWithBarArgument) { +// MockFunction callback; +// EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1)); +// Foo(callback.AsStdFunction()); +// } +template +class MockFunction; + + +$for i [[ +$range j 0..i-1 +$var ArgTypes = [[$for j, [[A$j]]]] +$var ArgNames = [[$for j, [[a$j]]]] +$var ArgDecls = [[$for j, [[A$j a$j]]]] +template +class MockFunction { + public: + MockFunction() {} + + MOCK_METHOD$i[[]]_T(Call, R($ArgTypes)); + +#if GTEST_HAS_STD_FUNCTION_ + std::function AsStdFunction() { + return [this]($ArgDecls) -> R { + return this->Call($ArgNames); + }; + } +#endif // GTEST_HAS_STD_FUNCTION_ + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); +}; + + +]] +} // namespace testing + +#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-matchers.h b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-matchers.h new file mode 100644 index 00000000000..1655bcd36c1 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-matchers.h @@ -0,0 +1,2191 @@ +// This file was GENERATED by command: +// pump.py gmock-generated-matchers.h.pump +// DO NOT EDIT BY HAND!!! + +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Google Mock - a framework for writing C++ mock classes. +// +// This file implements some commonly used variadic matchers. + +#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ +#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ + +#include +#include +#include +#include +#include "gmock/gmock-matchers.h" + +namespace testing { +namespace internal { + +// The type of the i-th (0-based) field of Tuple. +#define GMOCK_FIELD_TYPE_(Tuple, i) \ + typename ::testing::tuple_element::type + +// TupleFields is for selecting fields from a +// tuple of type Tuple. It has two members: +// +// type: a tuple type whose i-th field is the ki-th field of Tuple. +// GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple. +// +// For example, in class TupleFields, 2, 0>, we have: +// +// type is tuple, and +// GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true). + +template +class TupleFields; + +// This generic version is used when there are 10 selectors. +template +class TupleFields { + public: + typedef ::testing::tuple type; + static type GetSelectedFields(const Tuple& t) { + return type(get(t), get(t), get(t), get(t), get(t), + get(t), get(t), get(t), get(t), get(t)); + } +}; + +// The following specialization is used for 0 ~ 9 selectors. + +template +class TupleFields { + public: + typedef ::testing::tuple<> type; + static type GetSelectedFields(const Tuple& /* t */) { + return type(); + } +}; + +template +class TupleFields { + public: + typedef ::testing::tuple type; + static type GetSelectedFields(const Tuple& t) { + return type(get(t)); + } +}; + +template +class TupleFields { + public: + typedef ::testing::tuple type; + static type GetSelectedFields(const Tuple& t) { + return type(get(t), get(t)); + } +}; + +template +class TupleFields { + public: + typedef ::testing::tuple type; + static type GetSelectedFields(const Tuple& t) { + return type(get(t), get(t), get(t)); + } +}; + +template +class TupleFields { + public: + typedef ::testing::tuple type; + static type GetSelectedFields(const Tuple& t) { + return type(get(t), get(t), get(t), get(t)); + } +}; + +template +class TupleFields { + public: + typedef ::testing::tuple type; + static type GetSelectedFields(const Tuple& t) { + return type(get(t), get(t), get(t), get(t), get(t)); + } +}; + +template +class TupleFields { + public: + typedef ::testing::tuple type; + static type GetSelectedFields(const Tuple& t) { + return type(get(t), get(t), get(t), get(t), get(t), + get(t)); + } +}; + +template +class TupleFields { + public: + typedef ::testing::tuple type; + static type GetSelectedFields(const Tuple& t) { + return type(get(t), get(t), get(t), get(t), get(t), + get(t), get(t)); + } +}; + +template +class TupleFields { + public: + typedef ::testing::tuple type; + static type GetSelectedFields(const Tuple& t) { + return type(get(t), get(t), get(t), get(t), get(t), + get(t), get(t), get(t)); + } +}; + +template +class TupleFields { + public: + typedef ::testing::tuple type; + static type GetSelectedFields(const Tuple& t) { + return type(get(t), get(t), get(t), get(t), get(t), + get(t), get(t), get(t), get(t)); + } +}; + +#undef GMOCK_FIELD_TYPE_ + +// Implements the Args() matcher. +template +class ArgsMatcherImpl : public MatcherInterface { + public: + // ArgsTuple may have top-level const or reference modifiers. + typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple; + typedef typename internal::TupleFields::type SelectedArgs; + typedef Matcher MonomorphicInnerMatcher; + + template + explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher) + : inner_matcher_(SafeMatcherCast(inner_matcher)) {} + + virtual bool MatchAndExplain(ArgsTuple args, + MatchResultListener* listener) const { + const SelectedArgs& selected_args = GetSelectedArgs(args); + if (!listener->IsInterested()) + return inner_matcher_.Matches(selected_args); + + PrintIndices(listener->stream()); + *listener << "are " << PrintToString(selected_args); + + StringMatchResultListener inner_listener; + const bool match = inner_matcher_.MatchAndExplain(selected_args, + &inner_listener); + PrintIfNotEmpty(inner_listener.str(), listener->stream()); + return match; + } + + virtual void DescribeTo(::std::ostream* os) const { + *os << "are a tuple "; + PrintIndices(os); + inner_matcher_.DescribeTo(os); + } + + virtual void DescribeNegationTo(::std::ostream* os) const { + *os << "are a tuple "; + PrintIndices(os); + inner_matcher_.DescribeNegationTo(os); + } + + private: + static SelectedArgs GetSelectedArgs(ArgsTuple args) { + return TupleFields::GetSelectedFields(args); + } + + // Prints the indices of the selected fields. + static void PrintIndices(::std::ostream* os) { + *os << "whose fields ("; + const int indices[10] = { k0, k1, k2, k3, k4, k5, k6, k7, k8, k9 }; + for (int i = 0; i < 10; i++) { + if (indices[i] < 0) + break; + + if (i >= 1) + *os << ", "; + + *os << "#" << indices[i]; + } + *os << ") "; + } + + const MonomorphicInnerMatcher inner_matcher_; + + GTEST_DISALLOW_ASSIGN_(ArgsMatcherImpl); +}; + +template +class ArgsMatcher { + public: + explicit ArgsMatcher(const InnerMatcher& inner_matcher) + : inner_matcher_(inner_matcher) {} + + template + operator Matcher() const { + return MakeMatcher(new ArgsMatcherImpl(inner_matcher_)); + } + + private: + const InnerMatcher inner_matcher_; + + GTEST_DISALLOW_ASSIGN_(ArgsMatcher); +}; + +// A set of metafunctions for computing the result type of AllOf. +// AllOf(m1, ..., mN) returns +// AllOfResultN::type. + +// Although AllOf isn't defined for one argument, AllOfResult1 is defined +// to simplify the implementation. +template +struct AllOfResult1 { + typedef M1 type; +}; + +template +struct AllOfResult2 { + typedef BothOfMatcher< + typename AllOfResult1::type, + typename AllOfResult1::type + > type; +}; + +template +struct AllOfResult3 { + typedef BothOfMatcher< + typename AllOfResult1::type, + typename AllOfResult2::type + > type; +}; + +template +struct AllOfResult4 { + typedef BothOfMatcher< + typename AllOfResult2::type, + typename AllOfResult2::type + > type; +}; + +template +struct AllOfResult5 { + typedef BothOfMatcher< + typename AllOfResult2::type, + typename AllOfResult3::type + > type; +}; + +template +struct AllOfResult6 { + typedef BothOfMatcher< + typename AllOfResult3::type, + typename AllOfResult3::type + > type; +}; + +template +struct AllOfResult7 { + typedef BothOfMatcher< + typename AllOfResult3::type, + typename AllOfResult4::type + > type; +}; + +template +struct AllOfResult8 { + typedef BothOfMatcher< + typename AllOfResult4::type, + typename AllOfResult4::type + > type; +}; + +template +struct AllOfResult9 { + typedef BothOfMatcher< + typename AllOfResult4::type, + typename AllOfResult5::type + > type; +}; + +template +struct AllOfResult10 { + typedef BothOfMatcher< + typename AllOfResult5::type, + typename AllOfResult5::type + > type; +}; + +// A set of metafunctions for computing the result type of AnyOf. +// AnyOf(m1, ..., mN) returns +// AnyOfResultN::type. + +// Although AnyOf isn't defined for one argument, AnyOfResult1 is defined +// to simplify the implementation. +template +struct AnyOfResult1 { + typedef M1 type; +}; + +template +struct AnyOfResult2 { + typedef EitherOfMatcher< + typename AnyOfResult1::type, + typename AnyOfResult1::type + > type; +}; + +template +struct AnyOfResult3 { + typedef EitherOfMatcher< + typename AnyOfResult1::type, + typename AnyOfResult2::type + > type; +}; + +template +struct AnyOfResult4 { + typedef EitherOfMatcher< + typename AnyOfResult2::type, + typename AnyOfResult2::type + > type; +}; + +template +struct AnyOfResult5 { + typedef EitherOfMatcher< + typename AnyOfResult2::type, + typename AnyOfResult3::type + > type; +}; + +template +struct AnyOfResult6 { + typedef EitherOfMatcher< + typename AnyOfResult3::type, + typename AnyOfResult3::type + > type; +}; + +template +struct AnyOfResult7 { + typedef EitherOfMatcher< + typename AnyOfResult3::type, + typename AnyOfResult4::type + > type; +}; + +template +struct AnyOfResult8 { + typedef EitherOfMatcher< + typename AnyOfResult4::type, + typename AnyOfResult4::type + > type; +}; + +template +struct AnyOfResult9 { + typedef EitherOfMatcher< + typename AnyOfResult4::type, + typename AnyOfResult5::type + > type; +}; + +template +struct AnyOfResult10 { + typedef EitherOfMatcher< + typename AnyOfResult5::type, + typename AnyOfResult5::type + > type; +}; + +} // namespace internal + +// Args(a_matcher) matches a tuple if the selected +// fields of it matches a_matcher. C++ doesn't support default +// arguments for function templates, so we have to overload it. +template +inline internal::ArgsMatcher +Args(const InnerMatcher& matcher) { + return internal::ArgsMatcher(matcher); +} + +template +inline internal::ArgsMatcher +Args(const InnerMatcher& matcher) { + return internal::ArgsMatcher(matcher); +} + +template +inline internal::ArgsMatcher +Args(const InnerMatcher& matcher) { + return internal::ArgsMatcher(matcher); +} + +template +inline internal::ArgsMatcher +Args(const InnerMatcher& matcher) { + return internal::ArgsMatcher(matcher); +} + +template +inline internal::ArgsMatcher +Args(const InnerMatcher& matcher) { + return internal::ArgsMatcher(matcher); +} + +template +inline internal::ArgsMatcher +Args(const InnerMatcher& matcher) { + return internal::ArgsMatcher(matcher); +} + +template +inline internal::ArgsMatcher +Args(const InnerMatcher& matcher) { + return internal::ArgsMatcher(matcher); +} + +template +inline internal::ArgsMatcher +Args(const InnerMatcher& matcher) { + return internal::ArgsMatcher(matcher); +} + +template +inline internal::ArgsMatcher +Args(const InnerMatcher& matcher) { + return internal::ArgsMatcher(matcher); +} + +template +inline internal::ArgsMatcher +Args(const InnerMatcher& matcher) { + return internal::ArgsMatcher(matcher); +} + +template +inline internal::ArgsMatcher +Args(const InnerMatcher& matcher) { + return internal::ArgsMatcher(matcher); +} + +// ElementsAre(e_1, e_2, ... e_n) matches an STL-style container with +// n elements, where the i-th element in the container must +// match the i-th argument in the list. Each argument of +// ElementsAre() can be either a value or a matcher. We support up to +// 10 arguments. +// +// The use of DecayArray in the implementation allows ElementsAre() +// to accept string literals, whose type is const char[N], but we +// want to treat them as const char*. +// +// NOTE: Since ElementsAre() cares about the order of the elements, it +// must not be used with containers whose elements's order is +// undefined (e.g. hash_map). + +inline internal::ElementsAreMatcher< + ::testing::tuple<> > +ElementsAre() { + typedef ::testing::tuple<> Args; + return internal::ElementsAreMatcher(Args()); +} + +template +inline internal::ElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type> > +ElementsAre(const T1& e1) { + typedef ::testing::tuple< + typename internal::DecayArray::type> Args; + return internal::ElementsAreMatcher(Args(e1)); +} + +template +inline internal::ElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +ElementsAre(const T1& e1, const T2& e2) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::ElementsAreMatcher(Args(e1, e2)); +} + +template +inline internal::ElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +ElementsAre(const T1& e1, const T2& e2, const T3& e3) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::ElementsAreMatcher(Args(e1, e2, e3)); +} + +template +inline internal::ElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::ElementsAreMatcher(Args(e1, e2, e3, e4)); +} + +template +inline internal::ElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, + const T5& e5) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::ElementsAreMatcher(Args(e1, e2, e3, e4, e5)); +} + +template +inline internal::ElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, + const T5& e5, const T6& e6) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::ElementsAreMatcher(Args(e1, e2, e3, e4, e5, e6)); +} + +template +inline internal::ElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, + const T5& e5, const T6& e6, const T7& e7) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::ElementsAreMatcher(Args(e1, e2, e3, e4, e5, e6, e7)); +} + +template +inline internal::ElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, + const T5& e5, const T6& e6, const T7& e7, const T8& e8) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::ElementsAreMatcher(Args(e1, e2, e3, e4, e5, e6, e7, + e8)); +} + +template +inline internal::ElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, + const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::ElementsAreMatcher(Args(e1, e2, e3, e4, e5, e6, e7, + e8, e9)); +} + +template +inline internal::ElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, + const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9, + const T10& e10) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::ElementsAreMatcher(Args(e1, e2, e3, e4, e5, e6, e7, + e8, e9, e10)); +} + +// UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension +// that matches n elements in any order. We support up to n=10 arguments. + +inline internal::UnorderedElementsAreMatcher< + ::testing::tuple<> > +UnorderedElementsAre() { + typedef ::testing::tuple<> Args; + return internal::UnorderedElementsAreMatcher(Args()); +} + +template +inline internal::UnorderedElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type> > +UnorderedElementsAre(const T1& e1) { + typedef ::testing::tuple< + typename internal::DecayArray::type> Args; + return internal::UnorderedElementsAreMatcher(Args(e1)); +} + +template +inline internal::UnorderedElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +UnorderedElementsAre(const T1& e1, const T2& e2) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::UnorderedElementsAreMatcher(Args(e1, e2)); +} + +template +inline internal::UnorderedElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3)); +} + +template +inline internal::UnorderedElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3, e4)); +} + +template +inline internal::UnorderedElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, + const T5& e5) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3, e4, e5)); +} + +template +inline internal::UnorderedElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, + const T5& e5, const T6& e6) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3, e4, e5, + e6)); +} + +template +inline internal::UnorderedElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, + const T5& e5, const T6& e6, const T7& e7) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3, e4, e5, + e6, e7)); +} + +template +inline internal::UnorderedElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, + const T5& e5, const T6& e6, const T7& e7, const T8& e8) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3, e4, e5, + e6, e7, e8)); +} + +template +inline internal::UnorderedElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, + const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3, e4, e5, + e6, e7, e8, e9)); +} + +template +inline internal::UnorderedElementsAreMatcher< + ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> > +UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, + const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9, + const T10& e10) { + typedef ::testing::tuple< + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type, + typename internal::DecayArray::type> Args; + return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3, e4, e5, + e6, e7, e8, e9, e10)); +} + +// AllOf(m1, m2, ..., mk) matches any value that matches all of the given +// sub-matchers. AllOf is called fully qualified to prevent ADL from firing. + +template +inline typename internal::AllOfResult2::type +AllOf(M1 m1, M2 m2) { + return typename internal::AllOfResult2::type( + m1, + m2); +} + +template +inline typename internal::AllOfResult3::type +AllOf(M1 m1, M2 m2, M3 m3) { + return typename internal::AllOfResult3::type( + m1, + ::testing::AllOf(m2, m3)); +} + +template +inline typename internal::AllOfResult4::type +AllOf(M1 m1, M2 m2, M3 m3, M4 m4) { + return typename internal::AllOfResult4::type( + ::testing::AllOf(m1, m2), + ::testing::AllOf(m3, m4)); +} + +template +inline typename internal::AllOfResult5::type +AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) { + return typename internal::AllOfResult5::type( + ::testing::AllOf(m1, m2), + ::testing::AllOf(m3, m4, m5)); +} + +template +inline typename internal::AllOfResult6::type +AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) { + return typename internal::AllOfResult6::type( + ::testing::AllOf(m1, m2, m3), + ::testing::AllOf(m4, m5, m6)); +} + +template +inline typename internal::AllOfResult7::type +AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) { + return typename internal::AllOfResult7::type( + ::testing::AllOf(m1, m2, m3), + ::testing::AllOf(m4, m5, m6, m7)); +} + +template +inline typename internal::AllOfResult8::type +AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) { + return typename internal::AllOfResult8::type( + ::testing::AllOf(m1, m2, m3, m4), + ::testing::AllOf(m5, m6, m7, m8)); +} + +template +inline typename internal::AllOfResult9::type +AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) { + return typename internal::AllOfResult9::type( + ::testing::AllOf(m1, m2, m3, m4), + ::testing::AllOf(m5, m6, m7, m8, m9)); +} + +template +inline typename internal::AllOfResult10::type +AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { + return typename internal::AllOfResult10::type( + ::testing::AllOf(m1, m2, m3, m4, m5), + ::testing::AllOf(m6, m7, m8, m9, m10)); +} + +// AnyOf(m1, m2, ..., mk) matches any value that matches any of the given +// sub-matchers. AnyOf is called fully qualified to prevent ADL from firing. + +template +inline typename internal::AnyOfResult2::type +AnyOf(M1 m1, M2 m2) { + return typename internal::AnyOfResult2::type( + m1, + m2); +} + +template +inline typename internal::AnyOfResult3::type +AnyOf(M1 m1, M2 m2, M3 m3) { + return typename internal::AnyOfResult3::type( + m1, + ::testing::AnyOf(m2, m3)); +} + +template +inline typename internal::AnyOfResult4::type +AnyOf(M1 m1, M2 m2, M3 m3, M4 m4) { + return typename internal::AnyOfResult4::type( + ::testing::AnyOf(m1, m2), + ::testing::AnyOf(m3, m4)); +} + +template +inline typename internal::AnyOfResult5::type +AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) { + return typename internal::AnyOfResult5::type( + ::testing::AnyOf(m1, m2), + ::testing::AnyOf(m3, m4, m5)); +} + +template +inline typename internal::AnyOfResult6::type +AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) { + return typename internal::AnyOfResult6::type( + ::testing::AnyOf(m1, m2, m3), + ::testing::AnyOf(m4, m5, m6)); +} + +template +inline typename internal::AnyOfResult7::type +AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) { + return typename internal::AnyOfResult7::type( + ::testing::AnyOf(m1, m2, m3), + ::testing::AnyOf(m4, m5, m6, m7)); +} + +template +inline typename internal::AnyOfResult8::type +AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) { + return typename internal::AnyOfResult8::type( + ::testing::AnyOf(m1, m2, m3, m4), + ::testing::AnyOf(m5, m6, m7, m8)); +} + +template +inline typename internal::AnyOfResult9::type +AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) { + return typename internal::AnyOfResult9::type( + ::testing::AnyOf(m1, m2, m3, m4), + ::testing::AnyOf(m5, m6, m7, m8, m9)); +} + +template +inline typename internal::AnyOfResult10::type +AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { + return typename internal::AnyOfResult10::type( + ::testing::AnyOf(m1, m2, m3, m4, m5), + ::testing::AnyOf(m6, m7, m8, m9, m10)); +} + +} // namespace testing + + +// The MATCHER* family of macros can be used in a namespace scope to +// define custom matchers easily. +// +// Basic Usage +// =========== +// +// The syntax +// +// MATCHER(name, description_string) { statements; } +// +// defines a matcher with the given name that executes the statements, +// which must return a bool to indicate if the match succeeds. Inside +// the statements, you can refer to the value being matched by 'arg', +// and refer to its type by 'arg_type'. +// +// The description string documents what the matcher does, and is used +// to generate the failure message when the match fails. Since a +// MATCHER() is usually defined in a header file shared by multiple +// C++ source files, we require the description to be a C-string +// literal to avoid possible side effects. It can be empty, in which +// case we'll use the sequence of words in the matcher name as the +// description. +// +// For example: +// +// MATCHER(IsEven, "") { return (arg % 2) == 0; } +// +// allows you to write +// +// // Expects mock_foo.Bar(n) to be called where n is even. +// EXPECT_CALL(mock_foo, Bar(IsEven())); +// +// or, +// +// // Verifies that the value of some_expression is even. +// EXPECT_THAT(some_expression, IsEven()); +// +// If the above assertion fails, it will print something like: +// +// Value of: some_expression +// Expected: is even +// Actual: 7 +// +// where the description "is even" is automatically calculated from the +// matcher name IsEven. +// +// Argument Type +// ============= +// +// Note that the type of the value being matched (arg_type) is +// determined by the context in which you use the matcher and is +// supplied to you by the compiler, so you don't need to worry about +// declaring it (nor can you). This allows the matcher to be +// polymorphic. For example, IsEven() can be used to match any type +// where the value of "(arg % 2) == 0" can be implicitly converted to +// a bool. In the "Bar(IsEven())" example above, if method Bar() +// takes an int, 'arg_type' will be int; if it takes an unsigned long, +// 'arg_type' will be unsigned long; and so on. +// +// Parameterizing Matchers +// ======================= +// +// Sometimes you'll want to parameterize the matcher. For that you +// can use another macro: +// +// MATCHER_P(name, param_name, description_string) { statements; } +// +// For example: +// +// MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; } +// +// will allow you to write: +// +// EXPECT_THAT(Blah("a"), HasAbsoluteValue(n)); +// +// which may lead to this message (assuming n is 10): +// +// Value of: Blah("a") +// Expected: has absolute value 10 +// Actual: -9 +// +// Note that both the matcher description and its parameter are +// printed, making the message human-friendly. +// +// In the matcher definition body, you can write 'foo_type' to +// reference the type of a parameter named 'foo'. For example, in the +// body of MATCHER_P(HasAbsoluteValue, value) above, you can write +// 'value_type' to refer to the type of 'value'. +// +// We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P10 to +// support multi-parameter matchers. +// +// Describing Parameterized Matchers +// ================================= +// +// The last argument to MATCHER*() is a string-typed expression. The +// expression can reference all of the matcher's parameters and a +// special bool-typed variable named 'negation'. When 'negation' is +// false, the expression should evaluate to the matcher's description; +// otherwise it should evaluate to the description of the negation of +// the matcher. For example, +// +// using testing::PrintToString; +// +// MATCHER_P2(InClosedRange, low, hi, +// string(negation ? "is not" : "is") + " in range [" + +// PrintToString(low) + ", " + PrintToString(hi) + "]") { +// return low <= arg && arg <= hi; +// } +// ... +// EXPECT_THAT(3, InClosedRange(4, 6)); +// EXPECT_THAT(3, Not(InClosedRange(2, 4))); +// +// would generate two failures that contain the text: +// +// Expected: is in range [4, 6] +// ... +// Expected: is not in range [2, 4] +// +// If you specify "" as the description, the failure message will +// contain the sequence of words in the matcher name followed by the +// parameter values printed as a tuple. For example, +// +// MATCHER_P2(InClosedRange, low, hi, "") { ... } +// ... +// EXPECT_THAT(3, InClosedRange(4, 6)); +// EXPECT_THAT(3, Not(InClosedRange(2, 4))); +// +// would generate two failures that contain the text: +// +// Expected: in closed range (4, 6) +// ... +// Expected: not (in closed range (2, 4)) +// +// Types of Matcher Parameters +// =========================== +// +// For the purpose of typing, you can view +// +// MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... } +// +// as shorthand for +// +// template +// FooMatcherPk +// Foo(p1_type p1, ..., pk_type pk) { ... } +// +// When you write Foo(v1, ..., vk), the compiler infers the types of +// the parameters v1, ..., and vk for you. If you are not happy with +// the result of the type inference, you can specify the types by +// explicitly instantiating the template, as in Foo(5, +// false). As said earlier, you don't get to (or need to) specify +// 'arg_type' as that's determined by the context in which the matcher +// is used. You can assign the result of expression Foo(p1, ..., pk) +// to a variable of type FooMatcherPk. This +// can be useful when composing matchers. +// +// While you can instantiate a matcher template with reference types, +// passing the parameters by pointer usually makes your code more +// readable. If, however, you still want to pass a parameter by +// reference, be aware that in the failure message generated by the +// matcher you will see the value of the referenced object but not its +// address. +// +// Explaining Match Results +// ======================== +// +// Sometimes the matcher description alone isn't enough to explain why +// the match has failed or succeeded. For example, when expecting a +// long string, it can be very helpful to also print the diff between +// the expected string and the actual one. To achieve that, you can +// optionally stream additional information to a special variable +// named result_listener, whose type is a pointer to class +// MatchResultListener: +// +// MATCHER_P(EqualsLongString, str, "") { +// if (arg == str) return true; +// +// *result_listener << "the difference: " +/// << DiffStrings(str, arg); +// return false; +// } +// +// Overloading Matchers +// ==================== +// +// You can overload matchers with different numbers of parameters: +// +// MATCHER_P(Blah, a, description_string1) { ... } +// MATCHER_P2(Blah, a, b, description_string2) { ... } +// +// Caveats +// ======= +// +// When defining a new matcher, you should also consider implementing +// MatcherInterface or using MakePolymorphicMatcher(). These +// approaches require more work than the MATCHER* macros, but also +// give you more control on the types of the value being matched and +// the matcher parameters, which may leads to better compiler error +// messages when the matcher is used wrong. They also allow +// overloading matchers based on parameter types (as opposed to just +// based on the number of parameters). +// +// MATCHER*() can only be used in a namespace scope. The reason is +// that C++ doesn't yet allow function-local types to be used to +// instantiate templates. The up-coming C++0x standard will fix this. +// Once that's done, we'll consider supporting using MATCHER*() inside +// a function. +// +// More Information +// ================ +// +// To learn more about using these macros, please search for 'MATCHER' +// on https://github.com/google/googletest/blob/master/googlemock/docs/ +// CookBook.md + +#define MATCHER(name, description)\ + class name##Matcher {\ + public:\ + template \ + class gmock_Impl : public ::testing::MatcherInterface {\ + public:\ + gmock_Impl()\ + {}\ + virtual bool MatchAndExplain(\ + arg_type arg, ::testing::MatchResultListener* result_listener) const;\ + virtual void DescribeTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ + }\ + private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty()) {\ + return gmock_description;\ + }\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name, \ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::testing::tuple<>()));\ + }\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template \ + operator ::testing::Matcher() const {\ + return ::testing::Matcher(\ + new gmock_Impl());\ + }\ + name##Matcher() {\ + }\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##Matcher);\ + };\ + inline name##Matcher name() {\ + return name##Matcher();\ + }\ + template \ + bool name##Matcher::gmock_Impl::MatchAndExplain(\ + arg_type arg, \ + ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ + const + +#define MATCHER_P(name, p0, description)\ + template \ + class name##MatcherP {\ + public:\ + template \ + class gmock_Impl : public ::testing::MatcherInterface {\ + public:\ + explicit gmock_Impl(p0##_type gmock_p0)\ + : p0(gmock_p0) {}\ + virtual bool MatchAndExplain(\ + arg_type arg, ::testing::MatchResultListener* result_listener) const;\ + virtual void DescribeTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type p0;\ + private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty()) {\ + return gmock_description;\ + }\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name, \ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::testing::tuple(p0)));\ + }\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template \ + operator ::testing::Matcher() const {\ + return ::testing::Matcher(\ + new gmock_Impl(p0));\ + }\ + explicit name##MatcherP(p0##_type gmock_p0) : p0(gmock_p0) {\ + }\ + p0##_type p0;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##MatcherP);\ + };\ + template \ + inline name##MatcherP name(p0##_type p0) {\ + return name##MatcherP(p0);\ + }\ + template \ + template \ + bool name##MatcherP::gmock_Impl::MatchAndExplain(\ + arg_type arg, \ + ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ + const + +#define MATCHER_P2(name, p0, p1, description)\ + template \ + class name##MatcherP2 {\ + public:\ + template \ + class gmock_Impl : public ::testing::MatcherInterface {\ + public:\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\ + : p0(gmock_p0), p1(gmock_p1) {}\ + virtual bool MatchAndExplain(\ + arg_type arg, ::testing::MatchResultListener* result_listener) const;\ + virtual void DescribeTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type p0;\ + p1##_type p1;\ + private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty()) {\ + return gmock_description;\ + }\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name, \ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::testing::tuple(p0, p1)));\ + }\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template \ + operator ::testing::Matcher() const {\ + return ::testing::Matcher(\ + new gmock_Impl(p0, p1));\ + }\ + name##MatcherP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ + p1(gmock_p1) {\ + }\ + p0##_type p0;\ + p1##_type p1;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##MatcherP2);\ + };\ + template \ + inline name##MatcherP2 name(p0##_type p0, \ + p1##_type p1) {\ + return name##MatcherP2(p0, p1);\ + }\ + template \ + template \ + bool name##MatcherP2::gmock_Impl::MatchAndExplain(\ + arg_type arg, \ + ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ + const + +#define MATCHER_P3(name, p0, p1, p2, description)\ + template \ + class name##MatcherP3 {\ + public:\ + template \ + class gmock_Impl : public ::testing::MatcherInterface {\ + public:\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\ + : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ + virtual bool MatchAndExplain(\ + arg_type arg, ::testing::MatchResultListener* result_listener) const;\ + virtual void DescribeTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty()) {\ + return gmock_description;\ + }\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name, \ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::testing::tuple(p0, p1, \ + p2)));\ + }\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template \ + operator ::testing::Matcher() const {\ + return ::testing::Matcher(\ + new gmock_Impl(p0, p1, p2));\ + }\ + name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##MatcherP3);\ + };\ + template \ + inline name##MatcherP3 name(p0##_type p0, \ + p1##_type p1, p2##_type p2) {\ + return name##MatcherP3(p0, p1, p2);\ + }\ + template \ + template \ + bool name##MatcherP3::gmock_Impl::MatchAndExplain(\ + arg_type arg, \ + ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ + const + +#define MATCHER_P4(name, p0, p1, p2, p3, description)\ + template \ + class name##MatcherP4 {\ + public:\ + template \ + class gmock_Impl : public ::testing::MatcherInterface {\ + public:\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3)\ + : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3) {}\ + virtual bool MatchAndExplain(\ + arg_type arg, ::testing::MatchResultListener* result_listener) const;\ + virtual void DescribeTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty()) {\ + return gmock_description;\ + }\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name, \ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::testing::tuple(p0, p1, p2, p3)));\ + }\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template \ + operator ::testing::Matcher() const {\ + return ::testing::Matcher(\ + new gmock_Impl(p0, p1, p2, p3));\ + }\ + name##MatcherP4(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \ + p2(gmock_p2), p3(gmock_p3) {\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##MatcherP4);\ + };\ + template \ + inline name##MatcherP4 name(p0##_type p0, p1##_type p1, p2##_type p2, \ + p3##_type p3) {\ + return name##MatcherP4(p0, \ + p1, p2, p3);\ + }\ + template \ + template \ + bool name##MatcherP4::gmock_Impl::MatchAndExplain(\ + arg_type arg, \ + ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ + const + +#define MATCHER_P5(name, p0, p1, p2, p3, p4, description)\ + template \ + class name##MatcherP5 {\ + public:\ + template \ + class gmock_Impl : public ::testing::MatcherInterface {\ + public:\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4)\ + : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ + p4(gmock_p4) {}\ + virtual bool MatchAndExplain(\ + arg_type arg, ::testing::MatchResultListener* result_listener) const;\ + virtual void DescribeTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty()) {\ + return gmock_description;\ + }\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name, \ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::testing::tuple(p0, p1, p2, p3, p4)));\ + }\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template \ + operator ::testing::Matcher() const {\ + return ::testing::Matcher(\ + new gmock_Impl(p0, p1, p2, p3, p4));\ + }\ + name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2, p3##_type gmock_p3, \ + p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4) {\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##MatcherP5);\ + };\ + template \ + inline name##MatcherP5 name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ + p4##_type p4) {\ + return name##MatcherP5(p0, p1, p2, p3, p4);\ + }\ + template \ + template \ + bool name##MatcherP5::gmock_Impl::MatchAndExplain(\ + arg_type arg, \ + ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ + const + +#define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description)\ + template \ + class name##MatcherP6 {\ + public:\ + template \ + class gmock_Impl : public ::testing::MatcherInterface {\ + public:\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5)\ + : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ + p4(gmock_p4), p5(gmock_p5) {}\ + virtual bool MatchAndExplain(\ + arg_type arg, ::testing::MatchResultListener* result_listener) const;\ + virtual void DescribeTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty()) {\ + return gmock_description;\ + }\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name, \ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::testing::tuple(p0, p1, p2, p3, p4, p5)));\ + }\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template \ + operator ::testing::Matcher() const {\ + return ::testing::Matcher(\ + new gmock_Impl(p0, p1, p2, p3, p4, p5));\ + }\ + name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ + p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##MatcherP6);\ + };\ + template \ + inline name##MatcherP6 name(p0##_type p0, p1##_type p1, p2##_type p2, \ + p3##_type p3, p4##_type p4, p5##_type p5) {\ + return name##MatcherP6(p0, p1, p2, p3, p4, p5);\ + }\ + template \ + template \ + bool name##MatcherP6::gmock_Impl::MatchAndExplain(\ + arg_type arg, \ + ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ + const + +#define MATCHER_P7(name, p0, p1, p2, p3, p4, p5, p6, description)\ + template \ + class name##MatcherP7 {\ + public:\ + template \ + class gmock_Impl : public ::testing::MatcherInterface {\ + public:\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6)\ + : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ + p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\ + virtual bool MatchAndExplain(\ + arg_type arg, ::testing::MatchResultListener* result_listener) const;\ + virtual void DescribeTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty()) {\ + return gmock_description;\ + }\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name, \ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::testing::tuple(p0, p1, p2, p3, p4, p5, \ + p6)));\ + }\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template \ + operator ::testing::Matcher() const {\ + return ::testing::Matcher(\ + new gmock_Impl(p0, p1, p2, p3, p4, p5, p6));\ + }\ + name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ + p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \ + p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \ + p6(gmock_p6) {\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##MatcherP7);\ + };\ + template \ + inline name##MatcherP7 name(p0##_type p0, p1##_type p1, \ + p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ + p6##_type p6) {\ + return name##MatcherP7(p0, p1, p2, p3, p4, p5, p6);\ + }\ + template \ + template \ + bool name##MatcherP7::gmock_Impl::MatchAndExplain(\ + arg_type arg, \ + ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ + const + +#define MATCHER_P8(name, p0, p1, p2, p3, p4, p5, p6, p7, description)\ + template \ + class name##MatcherP8 {\ + public:\ + template \ + class gmock_Impl : public ::testing::MatcherInterface {\ + public:\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6, p7##_type gmock_p7)\ + : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ + p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\ + virtual bool MatchAndExplain(\ + arg_type arg, ::testing::MatchResultListener* result_listener) const;\ + virtual void DescribeTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + p7##_type p7;\ + private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty()) {\ + return gmock_description;\ + }\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name, \ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::testing::tuple(p0, p1, p2, \ + p3, p4, p5, p6, p7)));\ + }\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template \ + operator ::testing::Matcher() const {\ + return ::testing::Matcher(\ + new gmock_Impl(p0, p1, p2, p3, p4, p5, p6, p7));\ + }\ + name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ + p5##_type gmock_p5, p6##_type gmock_p6, \ + p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ + p7(gmock_p7) {\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + p7##_type p7;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##MatcherP8);\ + };\ + template \ + inline name##MatcherP8 name(p0##_type p0, \ + p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ + p6##_type p6, p7##_type p7) {\ + return name##MatcherP8(p0, p1, p2, p3, p4, p5, \ + p6, p7);\ + }\ + template \ + template \ + bool name##MatcherP8::gmock_Impl::MatchAndExplain(\ + arg_type arg, \ + ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ + const + +#define MATCHER_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, description)\ + template \ + class name##MatcherP9 {\ + public:\ + template \ + class gmock_Impl : public ::testing::MatcherInterface {\ + public:\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8)\ + : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ + p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ + p8(gmock_p8) {}\ + virtual bool MatchAndExplain(\ + arg_type arg, ::testing::MatchResultListener* result_listener) const;\ + virtual void DescribeTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + p7##_type p7;\ + p8##_type p8;\ + private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty()) {\ + return gmock_description;\ + }\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name, \ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::testing::tuple(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\ + }\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template \ + operator ::testing::Matcher() const {\ + return ::testing::Matcher(\ + new gmock_Impl(p0, p1, p2, p3, p4, p5, p6, p7, p8));\ + }\ + name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ + p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ + p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ + p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ + p8(gmock_p8) {\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + p7##_type p7;\ + p8##_type p8;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##MatcherP9);\ + };\ + template \ + inline name##MatcherP9 name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ + p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \ + p8##_type p8) {\ + return name##MatcherP9(p0, p1, p2, \ + p3, p4, p5, p6, p7, p8);\ + }\ + template \ + template \ + bool name##MatcherP9::gmock_Impl::MatchAndExplain(\ + arg_type arg, \ + ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ + const + +#define MATCHER_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, description)\ + template \ + class name##MatcherP10 {\ + public:\ + template \ + class gmock_Impl : public ::testing::MatcherInterface {\ + public:\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ + p9##_type gmock_p9)\ + : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ + p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ + p8(gmock_p8), p9(gmock_p9) {}\ + virtual bool MatchAndExplain(\ + arg_type arg, ::testing::MatchResultListener* result_listener) const;\ + virtual void DescribeTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + p7##_type p7;\ + p8##_type p8;\ + p9##_type p9;\ + private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty()) {\ + return gmock_description;\ + }\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name, \ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::testing::tuple(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\ + }\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template \ + operator ::testing::Matcher() const {\ + return ::testing::Matcher(\ + new gmock_Impl(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9));\ + }\ + name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \ + p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ + p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ + p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \ + p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ + p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {\ + }\ + p0##_type p0;\ + p1##_type p1;\ + p2##_type p2;\ + p3##_type p3;\ + p4##_type p4;\ + p5##_type p5;\ + p6##_type p6;\ + p7##_type p7;\ + p8##_type p8;\ + p9##_type p9;\ + private:\ + GTEST_DISALLOW_ASSIGN_(name##MatcherP10);\ + };\ + template \ + inline name##MatcherP10 name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ + p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ + p9##_type p9) {\ + return name##MatcherP10(p0, \ + p1, p2, p3, p4, p5, p6, p7, p8, p9);\ + }\ + template \ + template \ + bool name##MatcherP10::gmock_Impl::MatchAndExplain(\ + arg_type arg, \ + ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ + const + +#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump new file mode 100644 index 00000000000..25d2da997cd --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -0,0 +1,673 @@ +$$ -*- mode: c++; -*- +$$ This is a Pump source file. Please use Pump to convert it to +$$ gmock-generated-actions.h. +$$ +$var n = 10 $$ The maximum arity we support. +$$ }} This line fixes auto-indentation of the following code in Emacs. +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Google Mock - a framework for writing C++ mock classes. +// +// This file implements some commonly used variadic matchers. + +#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ +#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ + +#include +#include +#include +#include +#include "gmock/gmock-matchers.h" + +namespace testing { +namespace internal { + +$range i 0..n-1 + +// The type of the i-th (0-based) field of Tuple. +#define GMOCK_FIELD_TYPE_(Tuple, i) \ + typename ::testing::tuple_element::type + +// TupleFields is for selecting fields from a +// tuple of type Tuple. It has two members: +// +// type: a tuple type whose i-th field is the ki-th field of Tuple. +// GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple. +// +// For example, in class TupleFields, 2, 0>, we have: +// +// type is tuple, and +// GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true). + +template +class TupleFields; + +// This generic version is used when there are $n selectors. +template +class TupleFields { + public: + typedef ::testing::tuple<$for i, [[GMOCK_FIELD_TYPE_(Tuple, k$i)]]> type; + static type GetSelectedFields(const Tuple& t) { + return type($for i, [[get(t)]]); + } +}; + +// The following specialization is used for 0 ~ $(n-1) selectors. + +$for i [[ +$$ }}} +$range j 0..i-1 +$range k 0..n-1 + +template +class TupleFields { + public: + typedef ::testing::tuple<$for j, [[GMOCK_FIELD_TYPE_(Tuple, k$j)]]> type; + static type GetSelectedFields(const Tuple& $if i==0 [[/* t */]] $else [[t]]) { + return type($for j, [[get(t)]]); + } +}; + +]] + +#undef GMOCK_FIELD_TYPE_ + +// Implements the Args() matcher. + +$var ks = [[$for i, [[k$i]]]] +template +class ArgsMatcherImpl : public MatcherInterface { + public: + // ArgsTuple may have top-level const or reference modifiers. + typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple; + typedef typename internal::TupleFields::type SelectedArgs; + typedef Matcher MonomorphicInnerMatcher; + + template + explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher) + : inner_matcher_(SafeMatcherCast(inner_matcher)) {} + + virtual bool MatchAndExplain(ArgsTuple args, + MatchResultListener* listener) const { + const SelectedArgs& selected_args = GetSelectedArgs(args); + if (!listener->IsInterested()) + return inner_matcher_.Matches(selected_args); + + PrintIndices(listener->stream()); + *listener << "are " << PrintToString(selected_args); + + StringMatchResultListener inner_listener; + const bool match = inner_matcher_.MatchAndExplain(selected_args, + &inner_listener); + PrintIfNotEmpty(inner_listener.str(), listener->stream()); + return match; + } + + virtual void DescribeTo(::std::ostream* os) const { + *os << "are a tuple "; + PrintIndices(os); + inner_matcher_.DescribeTo(os); + } + + virtual void DescribeNegationTo(::std::ostream* os) const { + *os << "are a tuple "; + PrintIndices(os); + inner_matcher_.DescribeNegationTo(os); + } + + private: + static SelectedArgs GetSelectedArgs(ArgsTuple args) { + return TupleFields::GetSelectedFields(args); + } + + // Prints the indices of the selected fields. + static void PrintIndices(::std::ostream* os) { + *os << "whose fields ("; + const int indices[$n] = { $ks }; + for (int i = 0; i < $n; i++) { + if (indices[i] < 0) + break; + + if (i >= 1) + *os << ", "; + + *os << "#" << indices[i]; + } + *os << ") "; + } + + const MonomorphicInnerMatcher inner_matcher_; + + GTEST_DISALLOW_ASSIGN_(ArgsMatcherImpl); +}; + +template +class ArgsMatcher { + public: + explicit ArgsMatcher(const InnerMatcher& inner_matcher) + : inner_matcher_(inner_matcher) {} + + template + operator Matcher() const { + return MakeMatcher(new ArgsMatcherImpl(inner_matcher_)); + } + + private: + const InnerMatcher inner_matcher_; + + GTEST_DISALLOW_ASSIGN_(ArgsMatcher); +}; + +// A set of metafunctions for computing the result type of AllOf. +// AllOf(m1, ..., mN) returns +// AllOfResultN::type. + +// Although AllOf isn't defined for one argument, AllOfResult1 is defined +// to simplify the implementation. +template +struct AllOfResult1 { + typedef M1 type; +}; + +$range i 1..n + +$range i 2..n +$for i [[ +$range j 2..i +$var m = i/2 +$range k 1..m +$range t m+1..i + +template +struct AllOfResult$i { + typedef BothOfMatcher< + typename AllOfResult$m<$for k, [[M$k]]>::type, + typename AllOfResult$(i-m)<$for t, [[M$t]]>::type + > type; +}; + +]] + +// A set of metafunctions for computing the result type of AnyOf. +// AnyOf(m1, ..., mN) returns +// AnyOfResultN::type. + +// Although AnyOf isn't defined for one argument, AnyOfResult1 is defined +// to simplify the implementation. +template +struct AnyOfResult1 { + typedef M1 type; +}; + +$range i 1..n + +$range i 2..n +$for i [[ +$range j 2..i +$var m = i/2 +$range k 1..m +$range t m+1..i + +template +struct AnyOfResult$i { + typedef EitherOfMatcher< + typename AnyOfResult$m<$for k, [[M$k]]>::type, + typename AnyOfResult$(i-m)<$for t, [[M$t]]>::type + > type; +}; + +]] + +} // namespace internal + +// Args(a_matcher) matches a tuple if the selected +// fields of it matches a_matcher. C++ doesn't support default +// arguments for function templates, so we have to overload it. + +$range i 0..n +$for i [[ +$range j 1..i +template <$for j [[int k$j, ]]typename InnerMatcher> +inline internal::ArgsMatcher +Args(const InnerMatcher& matcher) { + return internal::ArgsMatcher(matcher); +} + + +]] +// ElementsAre(e_1, e_2, ... e_n) matches an STL-style container with +// n elements, where the i-th element in the container must +// match the i-th argument in the list. Each argument of +// ElementsAre() can be either a value or a matcher. We support up to +// $n arguments. +// +// The use of DecayArray in the implementation allows ElementsAre() +// to accept string literals, whose type is const char[N], but we +// want to treat them as const char*. +// +// NOTE: Since ElementsAre() cares about the order of the elements, it +// must not be used with containers whose elements's order is +// undefined (e.g. hash_map). + +$range i 0..n +$for i [[ + +$range j 1..i + +$if i>0 [[ + +template <$for j, [[typename T$j]]> +]] + +inline internal::ElementsAreMatcher< + ::testing::tuple< +$for j, [[ + + typename internal::DecayArray::type]]> > +ElementsAre($for j, [[const T$j& e$j]]) { + typedef ::testing::tuple< +$for j, [[ + + typename internal::DecayArray::type]]> Args; + return internal::ElementsAreMatcher(Args($for j, [[e$j]])); +} + +]] + +// UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension +// that matches n elements in any order. We support up to n=$n arguments. + +$range i 0..n +$for i [[ + +$range j 1..i + +$if i>0 [[ + +template <$for j, [[typename T$j]]> +]] + +inline internal::UnorderedElementsAreMatcher< + ::testing::tuple< +$for j, [[ + + typename internal::DecayArray::type]]> > +UnorderedElementsAre($for j, [[const T$j& e$j]]) { + typedef ::testing::tuple< +$for j, [[ + + typename internal::DecayArray::type]]> Args; + return internal::UnorderedElementsAreMatcher(Args($for j, [[e$j]])); +} + +]] + +// AllOf(m1, m2, ..., mk) matches any value that matches all of the given +// sub-matchers. AllOf is called fully qualified to prevent ADL from firing. + +$range i 2..n +$for i [[ +$range j 1..i +$var m = i/2 +$range k 1..m +$range t m+1..i + +template <$for j, [[typename M$j]]> +inline typename internal::AllOfResult$i<$for j, [[M$j]]>::type +AllOf($for j, [[M$j m$j]]) { + return typename internal::AllOfResult$i<$for j, [[M$j]]>::type( + $if m == 1 [[m1]] $else [[::testing::AllOf($for k, [[m$k]])]], + $if m+1 == i [[m$i]] $else [[::testing::AllOf($for t, [[m$t]])]]); +} + +]] + +// AnyOf(m1, m2, ..., mk) matches any value that matches any of the given +// sub-matchers. AnyOf is called fully qualified to prevent ADL from firing. + +$range i 2..n +$for i [[ +$range j 1..i +$var m = i/2 +$range k 1..m +$range t m+1..i + +template <$for j, [[typename M$j]]> +inline typename internal::AnyOfResult$i<$for j, [[M$j]]>::type +AnyOf($for j, [[M$j m$j]]) { + return typename internal::AnyOfResult$i<$for j, [[M$j]]>::type( + $if m == 1 [[m1]] $else [[::testing::AnyOf($for k, [[m$k]])]], + $if m+1 == i [[m$i]] $else [[::testing::AnyOf($for t, [[m$t]])]]); +} + +]] + +} // namespace testing +$$ } // This Pump meta comment fixes auto-indentation in Emacs. It will not +$$ // show up in the generated code. + + +// The MATCHER* family of macros can be used in a namespace scope to +// define custom matchers easily. +// +// Basic Usage +// =========== +// +// The syntax +// +// MATCHER(name, description_string) { statements; } +// +// defines a matcher with the given name that executes the statements, +// which must return a bool to indicate if the match succeeds. Inside +// the statements, you can refer to the value being matched by 'arg', +// and refer to its type by 'arg_type'. +// +// The description string documents what the matcher does, and is used +// to generate the failure message when the match fails. Since a +// MATCHER() is usually defined in a header file shared by multiple +// C++ source files, we require the description to be a C-string +// literal to avoid possible side effects. It can be empty, in which +// case we'll use the sequence of words in the matcher name as the +// description. +// +// For example: +// +// MATCHER(IsEven, "") { return (arg % 2) == 0; } +// +// allows you to write +// +// // Expects mock_foo.Bar(n) to be called where n is even. +// EXPECT_CALL(mock_foo, Bar(IsEven())); +// +// or, +// +// // Verifies that the value of some_expression is even. +// EXPECT_THAT(some_expression, IsEven()); +// +// If the above assertion fails, it will print something like: +// +// Value of: some_expression +// Expected: is even +// Actual: 7 +// +// where the description "is even" is automatically calculated from the +// matcher name IsEven. +// +// Argument Type +// ============= +// +// Note that the type of the value being matched (arg_type) is +// determined by the context in which you use the matcher and is +// supplied to you by the compiler, so you don't need to worry about +// declaring it (nor can you). This allows the matcher to be +// polymorphic. For example, IsEven() can be used to match any type +// where the value of "(arg % 2) == 0" can be implicitly converted to +// a bool. In the "Bar(IsEven())" example above, if method Bar() +// takes an int, 'arg_type' will be int; if it takes an unsigned long, +// 'arg_type' will be unsigned long; and so on. +// +// Parameterizing Matchers +// ======================= +// +// Sometimes you'll want to parameterize the matcher. For that you +// can use another macro: +// +// MATCHER_P(name, param_name, description_string) { statements; } +// +// For example: +// +// MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; } +// +// will allow you to write: +// +// EXPECT_THAT(Blah("a"), HasAbsoluteValue(n)); +// +// which may lead to this message (assuming n is 10): +// +// Value of: Blah("a") +// Expected: has absolute value 10 +// Actual: -9 +// +// Note that both the matcher description and its parameter are +// printed, making the message human-friendly. +// +// In the matcher definition body, you can write 'foo_type' to +// reference the type of a parameter named 'foo'. For example, in the +// body of MATCHER_P(HasAbsoluteValue, value) above, you can write +// 'value_type' to refer to the type of 'value'. +// +// We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P$n to +// support multi-parameter matchers. +// +// Describing Parameterized Matchers +// ================================= +// +// The last argument to MATCHER*() is a string-typed expression. The +// expression can reference all of the matcher's parameters and a +// special bool-typed variable named 'negation'. When 'negation' is +// false, the expression should evaluate to the matcher's description; +// otherwise it should evaluate to the description of the negation of +// the matcher. For example, +// +// using testing::PrintToString; +// +// MATCHER_P2(InClosedRange, low, hi, +// string(negation ? "is not" : "is") + " in range [" + +// PrintToString(low) + ", " + PrintToString(hi) + "]") { +// return low <= arg && arg <= hi; +// } +// ... +// EXPECT_THAT(3, InClosedRange(4, 6)); +// EXPECT_THAT(3, Not(InClosedRange(2, 4))); +// +// would generate two failures that contain the text: +// +// Expected: is in range [4, 6] +// ... +// Expected: is not in range [2, 4] +// +// If you specify "" as the description, the failure message will +// contain the sequence of words in the matcher name followed by the +// parameter values printed as a tuple. For example, +// +// MATCHER_P2(InClosedRange, low, hi, "") { ... } +// ... +// EXPECT_THAT(3, InClosedRange(4, 6)); +// EXPECT_THAT(3, Not(InClosedRange(2, 4))); +// +// would generate two failures that contain the text: +// +// Expected: in closed range (4, 6) +// ... +// Expected: not (in closed range (2, 4)) +// +// Types of Matcher Parameters +// =========================== +// +// For the purpose of typing, you can view +// +// MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... } +// +// as shorthand for +// +// template +// FooMatcherPk +// Foo(p1_type p1, ..., pk_type pk) { ... } +// +// When you write Foo(v1, ..., vk), the compiler infers the types of +// the parameters v1, ..., and vk for you. If you are not happy with +// the result of the type inference, you can specify the types by +// explicitly instantiating the template, as in Foo(5, +// false). As said earlier, you don't get to (or need to) specify +// 'arg_type' as that's determined by the context in which the matcher +// is used. You can assign the result of expression Foo(p1, ..., pk) +// to a variable of type FooMatcherPk. This +// can be useful when composing matchers. +// +// While you can instantiate a matcher template with reference types, +// passing the parameters by pointer usually makes your code more +// readable. If, however, you still want to pass a parameter by +// reference, be aware that in the failure message generated by the +// matcher you will see the value of the referenced object but not its +// address. +// +// Explaining Match Results +// ======================== +// +// Sometimes the matcher description alone isn't enough to explain why +// the match has failed or succeeded. For example, when expecting a +// long string, it can be very helpful to also print the diff between +// the expected string and the actual one. To achieve that, you can +// optionally stream additional information to a special variable +// named result_listener, whose type is a pointer to class +// MatchResultListener: +// +// MATCHER_P(EqualsLongString, str, "") { +// if (arg == str) return true; +// +// *result_listener << "the difference: " +/// << DiffStrings(str, arg); +// return false; +// } +// +// Overloading Matchers +// ==================== +// +// You can overload matchers with different numbers of parameters: +// +// MATCHER_P(Blah, a, description_string1) { ... } +// MATCHER_P2(Blah, a, b, description_string2) { ... } +// +// Caveats +// ======= +// +// When defining a new matcher, you should also consider implementing +// MatcherInterface or using MakePolymorphicMatcher(). These +// approaches require more work than the MATCHER* macros, but also +// give you more control on the types of the value being matched and +// the matcher parameters, which may leads to better compiler error +// messages when the matcher is used wrong. They also allow +// overloading matchers based on parameter types (as opposed to just +// based on the number of parameters). +// +// MATCHER*() can only be used in a namespace scope. The reason is +// that C++ doesn't yet allow function-local types to be used to +// instantiate templates. The up-coming C++0x standard will fix this. +// Once that's done, we'll consider supporting using MATCHER*() inside +// a function. +// +// More Information +// ================ +// +// To learn more about using these macros, please search for 'MATCHER' +// on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md + +$range i 0..n +$for i + +[[ +$var macro_name = [[$if i==0 [[MATCHER]] $elif i==1 [[MATCHER_P]] + $else [[MATCHER_P$i]]]] +$var class_name = [[name##Matcher[[$if i==0 [[]] $elif i==1 [[P]] + $else [[P$i]]]]]] +$range j 0..i-1 +$var template = [[$if i==0 [[]] $else [[ + + template <$for j, [[typename p$j##_type]]>\ +]]]] +$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] +$var impl_ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] +$var impl_inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] +$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] +$var params = [[$for j, [[p$j]]]] +$var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]] +$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]] +$var param_field_decls = [[$for j +[[ + + p$j##_type p$j;\ +]]]] +$var param_field_decls2 = [[$for j +[[ + + p$j##_type p$j;\ +]]]] + +#define $macro_name(name$for j [[, p$j]], description)\$template + class $class_name {\ + public:\ + template \ + class gmock_Impl : public ::testing::MatcherInterface {\ + public:\ + [[$if i==1 [[explicit ]]]]gmock_Impl($impl_ctor_param_list)\ + $impl_inits {}\ + virtual bool MatchAndExplain(\ + arg_type arg, ::testing::MatchResultListener* result_listener) const;\ + virtual void DescribeTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(false);\ + }\ + virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + *gmock_os << FormatDescription(true);\ + }\$param_field_decls + private:\ + ::testing::internal::string FormatDescription(bool negation) const {\ + const ::testing::internal::string gmock_description = (description);\ + if (!gmock_description.empty()) {\ + return gmock_description;\ + }\ + return ::testing::internal::FormatMatcherDescription(\ + negation, #name, \ + ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ + ::testing::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])));\ + }\ + GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ + };\ + template \ + operator ::testing::Matcher() const {\ + return ::testing::Matcher(\ + new gmock_Impl($params));\ + }\ + [[$if i==1 [[explicit ]]]]$class_name($ctor_param_list)$inits {\ + }\$param_field_decls2 + private:\ + GTEST_DISALLOW_ASSIGN_($class_name);\ + };\$template + inline $class_name$param_types name($param_types_and_names) {\ + return $class_name$param_types($params);\ + }\$template + template \ + bool $class_name$param_types::gmock_Impl::MatchAndExplain(\ + arg_type arg, \ + ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ + const +]] + + +#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h new file mode 100644 index 00000000000..af71fbdfd78 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h @@ -0,0 +1,427 @@ +// This file was GENERATED by command: +// pump.py gmock-generated-nice-strict.h.pump +// DO NOT EDIT BY HAND!!! + +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: wan@google.com (Zhanyong Wan) + +// Implements class templates NiceMock, NaggyMock, and StrictMock. +// +// Given a mock class MockFoo that is created using Google Mock, +// NiceMock is a subclass of MockFoo that allows +// uninteresting calls (i.e. calls to mock methods that have no +// EXPECT_CALL specs), NaggyMock is a subclass of MockFoo +// that prints a warning when an uninteresting call occurs, and +// StrictMock is a subclass of MockFoo that treats all +// uninteresting calls as errors. +// +// Currently a mock is naggy by default, so MockFoo and +// NaggyMock behave like the same. However, we will soon +// switch the default behavior of mocks to be nice, as that in general +// leads to more maintainable tests. When that happens, MockFoo will +// stop behaving like NaggyMock and start behaving like +// NiceMock. +// +// NiceMock, NaggyMock, and StrictMock "inherit" the constructors of +// their respective base class. Therefore you can write +// NiceMock(5, "a") to construct a nice mock where MockFoo +// has a constructor that accepts (int, const char*), for example. +// +// A known limitation is that NiceMock, NaggyMock, +// and StrictMock only works for mock methods defined using +// the MOCK_METHOD* family of macros DIRECTLY in the MockFoo class. +// If a mock method is defined in a base class of MockFoo, the "nice" +// or "strict" modifier may not affect it, depending on the compiler. +// In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT +// supported. + +#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ +#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ + +#include "gmock/gmock-spec-builders.h" +#include "gmock/internal/gmock-port.h" + +namespace testing { + +namespace internal { + +// NiceMockBase serves as a mix-in to establish the "uninteresting call" +// behavior for NiceMock on construction. It accomplishes this via CRTP to get +// access to the derived MockClass. +template +class NiceMockBase { + protected: + NiceMockBase(); + + ~NiceMockBase(); +}; + +} // namespace internal + +template +class NiceMock : public MockClass, public internal::NiceMockBase { + public: + NiceMock() : MockClass() {} + +#if GTEST_LANG_CXX11 + // Ideally, we would inherit base class's constructors through a using + // declaration, which would preserve their visibility. However, many existing + // tests rely on the fact that current implementation reexports protected + // constructors as public. These tests would need to be cleaned up first. + + // Single argument constructor is special-cased so that it can be + // made explicit. + template + explicit NiceMock(A&& arg) : MockClass(std::forward(arg)) {} + + template + NiceMock(A1&& arg1, A2&& arg2, An&&... args) + : MockClass(std::forward(arg1), std::forward(arg2), + std::forward(args)...) {} +#else + // C++98 doesn't have variadic templates, so we have to define one + // for each arity. + template + explicit NiceMock(const A1& a1) : MockClass(a1) {} + template + NiceMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {} + + template + NiceMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {} + + template + NiceMock(const A1& a1, const A2& a2, const A3& a3, + const A4& a4) : MockClass(a1, a2, a3, a4) {} + + template + NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5) : MockClass(a1, a2, a3, a4, a5) {} + + template + NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) {} + + template + NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5, + a6, a7) {} + + template + NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1, + a2, a3, a4, a5, a6, a7, a8) {} + + template + NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7, const A8& a8, + const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) {} + + template + NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, + const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {} + +#endif // GTEST_LANG_CXX11 + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock); +}; + +namespace internal { + +template +NiceMockBase::NiceMockBase() { + ::testing::Mock::AllowUninterestingCalls( + internal::ImplicitCast_( + static_cast *>(this))); +} + +template +NiceMockBase::~NiceMockBase() { + ::testing::Mock::UnregisterCallReaction( + internal::ImplicitCast_( + static_cast*>(this))); +} + +} // namespace internal + +namespace internal { + +// NaggyMockBase serves as a mix-in to establish the "uninteresting call" +// behavior for NaggyMock on construction. It accomplishes this via CRTP to get +// access to the derived MockClass. +template +class NaggyMockBase { + protected: + NaggyMockBase(); + + ~NaggyMockBase(); +}; + +} // namespace internal + +template +class NaggyMock : public MockClass, public internal::NaggyMockBase { + public: + NaggyMock() : MockClass() {} + +#if GTEST_LANG_CXX11 + // Ideally, we would inherit base class's constructors through a using + // declaration, which would preserve their visibility. However, many existing + // tests rely on the fact that current implementation reexports protected + // constructors as public. These tests would need to be cleaned up first. + + // Single argument constructor is special-cased so that it can be + // made explicit. + template + explicit NaggyMock(A&& arg) : MockClass(std::forward(arg)) {} + + template + NaggyMock(A1&& arg1, A2&& arg2, An&&... args) + : MockClass(std::forward(arg1), std::forward(arg2), + std::forward(args)...) {} +#else + // C++98 doesn't have variadic templates, so we have to define one + // for each arity. + template + explicit NaggyMock(const A1& a1) : MockClass(a1) {} + template + NaggyMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {} + + template + NaggyMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {} + + template + NaggyMock(const A1& a1, const A2& a2, const A3& a3, + const A4& a4) : MockClass(a1, a2, a3, a4) {} + + template + NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5) : MockClass(a1, a2, a3, a4, a5) {} + + template + NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) {} + + template + NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5, + a6, a7) {} + + template + NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1, + a2, a3, a4, a5, a6, a7, a8) {} + + template + NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7, const A8& a8, + const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) {} + + template + NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, + const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {} + +#endif // GTEST_LANG_CXX11 + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(NaggyMock); +}; + +namespace internal { + +template +NaggyMockBase::NaggyMockBase() { + ::testing::Mock::WarnUninterestingCalls( + internal::ImplicitCast_( + static_cast *>(this))); +} + +template +NaggyMockBase::~NaggyMockBase() { + ::testing::Mock::UnregisterCallReaction( + internal::ImplicitCast_( + static_cast*>(this))); +} + +} // namespace internal + +namespace internal { + +// StrictMockBase serves as a mix-in to establish the "uninteresting call" +// behavior for StrictMock on construction. It accomplishes this via CRTP to get +// access to the derived MockClass. +template +class StrictMockBase { + protected: + StrictMockBase(); + + ~StrictMockBase(); +}; + +} // namespace internal + +template +class StrictMock : public MockClass, + public internal::StrictMockBase { + public: + StrictMock() : MockClass() {} + +#if GTEST_LANG_CXX11 + // Ideally, we would inherit base class's constructors through a using + // declaration, which would preserve their visibility. However, many existing + // tests rely on the fact that current implementation reexports protected + // constructors as public. These tests would need to be cleaned up first. + + // Single argument constructor is special-cased so that it can be + // made explicit. + template + explicit StrictMock(A&& arg) : MockClass(std::forward(arg)) {} + + template + StrictMock(A1&& arg1, A2&& arg2, An&&... args) + : MockClass(std::forward(arg1), std::forward(arg2), + std::forward(args)...) {} +#else + // C++98 doesn't have variadic templates, so we have to define one + // for each arity. + template + explicit StrictMock(const A1& a1) : MockClass(a1) {} + template + StrictMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {} + + template + StrictMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, + a3) {} + + template + StrictMock(const A1& a1, const A2& a2, const A3& a3, + const A4& a4) : MockClass(a1, a2, a3, a4) {} + + template + StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5) : MockClass(a1, a2, a3, a4, a5) {} + + template + StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) {} + + template + StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5, + a6, a7) {} + + template + StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1, + a2, a3, a4, a5, a6, a7, a8) {} + + template + StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7, const A8& a8, + const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) {} + + template + StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, + const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {} + +#endif // GTEST_LANG_CXX11 + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(StrictMock); +}; + +namespace internal { + +template +StrictMockBase::StrictMockBase() { + ::testing::Mock::FailUninterestingCalls( + internal::ImplicitCast_( + static_cast *>(this))); +} + +template +StrictMockBase::~StrictMockBase() { + ::testing::Mock::UnregisterCallReaction( + internal::ImplicitCast_( + static_cast*>(this))); +} + +} // namespace internal + +// The following specializations catch some (relatively more common) +// user errors of nesting nice and strict mocks. They do NOT catch +// all possible errors. + +// These specializations are declared but not defined, as NiceMock, +// NaggyMock, and StrictMock cannot be nested. + +template +class NiceMock >; +template +class NiceMock >; +template +class NiceMock >; + +template +class NaggyMock >; +template +class NaggyMock >; +template +class NaggyMock >; + +template +class StrictMock >; +template +class StrictMock >; +template +class StrictMock >; + +} // namespace testing + +#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump new file mode 100644 index 00000000000..3ee1ce7f309 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump @@ -0,0 +1,161 @@ +$$ -*- mode: c++; -*- +$$ This is a Pump source file. Please use Pump to convert it to +$$ gmock-generated-nice-strict.h. +$$ +$var n = 10 $$ The maximum arity we support. +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: wan@google.com (Zhanyong Wan) + +// Implements class templates NiceMock, NaggyMock, and StrictMock. +// +// Given a mock class MockFoo that is created using Google Mock, +// NiceMock is a subclass of MockFoo that allows +// uninteresting calls (i.e. calls to mock methods that have no +// EXPECT_CALL specs), NaggyMock is a subclass of MockFoo +// that prints a warning when an uninteresting call occurs, and +// StrictMock is a subclass of MockFoo that treats all +// uninteresting calls as errors. +// +// Currently a mock is naggy by default, so MockFoo and +// NaggyMock behave like the same. However, we will soon +// switch the default behavior of mocks to be nice, as that in general +// leads to more maintainable tests. When that happens, MockFoo will +// stop behaving like NaggyMock and start behaving like +// NiceMock. +// +// NiceMock, NaggyMock, and StrictMock "inherit" the constructors of +// their respective base class, with up-to $n arguments. Therefore +// you can write NiceMock(5, "a") to construct a nice mock +// where MockFoo has a constructor that accepts (int, const char*), +// for example. +// +// A known limitation is that NiceMock, NaggyMock, +// and StrictMock only works for mock methods defined using +// the MOCK_METHOD* family of macros DIRECTLY in the MockFoo class. +// If a mock method is defined in a base class of MockFoo, the "nice" +// or "strict" modifier may not affect it, depending on the compiler. +// In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT +// supported. +// +// Another known limitation is that the constructors of the base mock +// cannot have arguments passed by non-const reference, which are +// banned by the Google C++ style guide anyway. + +#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ +#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ + +#include "gmock/gmock-spec-builders.h" +#include "gmock/internal/gmock-port.h" + +namespace testing { + +$range kind 0..2 +$for kind [[ + +$var clazz=[[$if kind==0 [[NiceMock]] + $elif kind==1 [[NaggyMock]] + $else [[StrictMock]]]] + +$var method=[[$if kind==0 [[AllowUninterestingCalls]] + $elif kind==1 [[WarnUninterestingCalls]] + $else [[FailUninterestingCalls]]]] + +template +class $clazz : public MockClass { + public: + // We don't factor out the constructor body to a common method, as + // we have to avoid a possible clash with members of MockClass. + $clazz() { + ::testing::Mock::$method( + internal::ImplicitCast_(this)); + } + + // C++ doesn't (yet) allow inheritance of constructors, so we have + // to define it for each arity. + template + explicit $clazz(const A1& a1) : MockClass(a1) { + ::testing::Mock::$method( + internal::ImplicitCast_(this)); + } + +$range i 2..n +$for i [[ +$range j 1..i + template <$for j, [[typename A$j]]> + $clazz($for j, [[const A$j& a$j]]) : MockClass($for j, [[a$j]]) { + ::testing::Mock::$method( + internal::ImplicitCast_(this)); + } + + +]] + virtual ~$clazz() { + ::testing::Mock::UnregisterCallReaction( + internal::ImplicitCast_(this)); + } + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_($clazz); +}; + +]] + +// The following specializations catch some (relatively more common) +// user errors of nesting nice and strict mocks. They do NOT catch +// all possible errors. + +// These specializations are declared but not defined, as NiceMock, +// NaggyMock, and StrictMock cannot be nested. + +template +class NiceMock >; +template +class NiceMock >; +template +class NiceMock >; + +template +class NaggyMock >; +template +class NaggyMock >; +template +class NaggyMock >; + +template +class StrictMock >; +template +class StrictMock >; +template +class StrictMock >; + +} // namespace testing + +#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ diff --git a/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-matchers.h b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-matchers.h new file mode 100644 index 00000000000..0ac3b299902 --- /dev/null +++ b/handwritten/cloud-profiler/third_party/gtest/googlemock/include/gmock/gmock-matchers.h @@ -0,0 +1,5273 @@ +// Copyright 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: wan@google.com (Zhanyong Wan) + +// Google Mock - a framework for writing C++ mock classes. +// +// This file implements some commonly used argument matchers. More +// matchers can be defined by the user implementing the +// MatcherInterface interface if necessary. + +#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ +#define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ + +#include +#include +#include +#include +#include // NOLINT +#include +#include +#include +#include +#include "gtest/gtest.h" +#include "gmock/internal/gmock-internal-utils.h" +#include "gmock/internal/gmock-port.h" + +#if GTEST_HAS_STD_INITIALIZER_LIST_ +# include // NOLINT -- must be after gtest.h +#endif + +namespace testing { + +// To implement a matcher Foo for type T, define: +// 1. a class FooMatcherImpl that implements the +// MatcherInterface interface, and +// 2. a factory function that creates a Matcher object from a +// FooMatcherImpl*. +// +// The two-level delegation design makes it possible to allow a user +// to write "v" instead of "Eq(v)" where a Matcher is expected, which +// is impossible if we pass matchers by pointers. It also eases +// ownership management as Matcher objects can now be copied like +// plain values. + +// MatchResultListener is an abstract class. Its << operator can be +// used by a matcher to explain why a value matches or doesn't match. +// +// TODO(wan@google.com): add method +// bool InterestedInWhy(bool result) const; +// to indicate whether the listener is interested in why the match +// result is 'result'. +class MatchResultListener { + public: + // Creates a listener object with the given underlying ostream. The + // listener does not own the ostream, and does not dereference it + // in the constructor or destructor. + explicit MatchResultListener(::std::ostream* os) : stream_(os) {} + virtual ~MatchResultListener() = 0; // Makes this class abstract. + + // Streams x to the underlying ostream; does nothing if the ostream + // is NULL. + template + MatchResultListener& operator<<(const T& x) { + if (stream_ != NULL) + *stream_ << x; + return *this; + } + + // Returns the underlying ostream. + ::std::ostream* stream() { return stream_; } + + // Returns true iff the listener is interested in an explanation of + // the match result. A matcher's MatchAndExplain() method can use + // this information to avoid generating the explanation when no one + // intends to hear it. + bool IsInterested() const { return stream_ != NULL; } + + private: + ::std::ostream* const stream_; + + GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener); +}; + +inline MatchResultListener::~MatchResultListener() { +} + +// An instance of a subclass of this knows how to describe itself as a +// matcher. +class MatcherDescriberInterface { + public: + virtual ~MatcherDescriberInterface() {} + + // Describes this matcher to an ostream. The function should print + // a verb phrase that describes the property a value matching this + // matcher should have. The subject of the verb phrase is the value + // being matched. For example, the DescribeTo() method of the Gt(7) + // matcher prints "is greater than 7". + virtual void DescribeTo(::std::ostream* os) const = 0; + + // Describes the negation of this matcher to an ostream. For + // example, if the description of this matcher is "is greater than + // 7", the negated description could be "is not greater than 7". + // You are not required to override this when implementing + // MatcherInterface, but it is highly advised so that your matcher + // can produce good error messages. + virtual void DescribeNegationTo(::std::ostream* os) const { + *os << "not ("; + DescribeTo(os); + *os << ")"; + } +}; + +// The implementation of a matcher. +template +class MatcherInterface : public MatcherDescriberInterface { + public: + // Returns true iff the matcher matches x; also explains the match + // result to 'listener' if necessary (see the next paragraph), in + // the form of a non-restrictive relative clause ("which ...", + // "whose ...", etc) that describes x. For example, the + // MatchAndExplain() method of the Pointee(...) matcher should + // generate an explanation like "which points to ...". + // + // Implementations of MatchAndExplain() should add an explanation of + // the match result *if and only if* they can provide additional + // information that's not already present (or not obvious) in the + // print-out of x and the matcher's description. Whether the match + // succeeds is not a factor in deciding whether an explanation is + // needed, as sometimes the caller needs to print a failure message + // when the match succeeds (e.g. when the matcher is used inside + // Not()). + // + // For example, a "has at least 10 elements" matcher should explain + // what the actual element count is, regardless of the match result, + // as it is useful information to the reader; on the other hand, an + // "is empty" matcher probably only needs to explain what the actual + // size is when the match fails, as it's redundant to say that the + // size is 0 when the value is already known to be empty. + // + // You should override this method when defining a new matcher. + // + // It's the responsibility of the caller (Google Mock) to guarantee + // that 'listener' is not NULL. This helps to simplify a matcher's + // implementation when it doesn't care about the performance, as it + // can talk to 'listener' without checking its validity first. + // However, in order to implement dummy listeners efficiently, + // listener->stream() may be NULL. + virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0; + + // Inherits these methods from MatcherDescriberInterface: + // virtual void DescribeTo(::std::ostream* os) const = 0; + // virtual void DescribeNegationTo(::std::ostream* os) const; +}; + +namespace internal { + +// Converts a MatcherInterface to a MatcherInterface. +template +class MatcherInterfaceAdapter : public MatcherInterface { + public: + explicit MatcherInterfaceAdapter(const MatcherInterface* impl) + : impl_(impl) {} + virtual ~MatcherInterfaceAdapter() { delete impl_; } + + virtual void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); } + + virtual void DescribeNegationTo(::std::ostream* os) const { + impl_->DescribeNegationTo(os); + } + + virtual bool MatchAndExplain(const T& x, + MatchResultListener* listener) const { + return impl_->MatchAndExplain(x, listener); + } + + private: + const MatcherInterface* const impl_; + + GTEST_DISALLOW_COPY_AND_ASSIGN_(MatcherInterfaceAdapter); +}; + +} // namespace internal + +// A match result listener that stores the explanation in a string. +class StringMatchResultListener : public MatchResultListener { + public: + StringMatchResultListener() : MatchResultListener(&ss_) {} + + // Returns the explanation accumulated so far. + std::string str() const { return ss_.str(); } + + // Clears the explanation accumulated so far. + void Clear() { ss_.str(""); } + + private: + ::std::stringstream ss_; + + GTEST_DISALLOW_COPY_AND_ASSIGN_(StringMatchResultListener); +}; + +namespace internal { + +struct AnyEq { + template + bool operator()(const A& a, const B& b) const { return a == b; } +}; +struct AnyNe { + template + bool operator()(const A& a, const B& b) const { return a != b; } +}; +struct AnyLt { + template + bool operator()(const A& a, const B& b) const { return a < b; } +}; +struct AnyGt { + template + bool operator()(const A& a, const B& b) const { return a > b; } +}; +struct AnyLe { + template + bool operator()(const A& a, const B& b) const { return a <= b; } +}; +struct AnyGe { + template + bool operator()(const A& a, const B& b) const { return a >= b; } +}; + +// A match result listener that ignores the explanation. +class DummyMatchResultListener : public MatchResultListener { + public: + DummyMatchResultListener() : MatchResultListener(NULL) {} + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener); +}; + +// A match result listener that forwards the explanation to a given +// ostream. The difference between this and MatchResultListener is +// that the former is concrete. +class StreamMatchResultListener : public MatchResultListener { + public: + explicit StreamMatchResultListener(::std::ostream* os) + : MatchResultListener(os) {} + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener); +}; + +// An internal class for implementing Matcher, which will derive +// from it. We put functionalities common to all Matcher +// specializations here to avoid code duplication. +template +class MatcherBase { + public: + // Returns true iff the matcher matches x; also explains the match + // result to 'listener'. + bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) x, + MatchResultListener* listener) const { + return impl_->MatchAndExplain(x, listener); + } + + // Returns true iff this matcher matches x. + bool Matches(GTEST_REFERENCE_TO_CONST_(T) x) const { + DummyMatchResultListener dummy; + return MatchAndExplain(x, &dummy); + } + + // Describes this matcher to an ostream. + void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); } + + // Describes the negation of this matcher to an ostream. + void DescribeNegationTo(::std::ostream* os) const { + impl_->DescribeNegationTo(os); + } + + // Explains why x matches, or doesn't match, the matcher. + void ExplainMatchResultTo(GTEST_REFERENCE_TO_CONST_(T) x, + ::std::ostream* os) const { + StreamMatchResultListener listener(os); + MatchAndExplain(x, &listener); + } + + // Returns the describer for this matcher object; retains ownership + // of the describer, which is only guaranteed to be alive when + // this matcher object is alive. + const MatcherDescriberInterface* GetDescriber() const { + return impl_.get(); + } + + protected: + MatcherBase() {} + + // Constructs a matcher from its implementation. + explicit MatcherBase( + const MatcherInterface* impl) + : impl_(impl) {} + + template + explicit MatcherBase( + const MatcherInterface* impl, + typename internal::EnableIf< + !internal::IsSame::value>::type* = + NULL) + : impl_(new internal::MatcherInterfaceAdapter(impl)) {} + + virtual ~MatcherBase() {} + + private: + // shared_ptr (util/gtl/shared_ptr.h) and linked_ptr have similar + // interfaces. The former dynamically allocates a chunk of memory + // to hold the reference count, while the latter tracks all + // references using a circular linked list without allocating + // memory. It has been observed that linked_ptr performs better in + // typical scenarios. However, shared_ptr can out-perform + // linked_ptr when there are many more uses of the copy constructor + // than the default constructor. + // + // If performance becomes a problem, we should see if using + // shared_ptr helps. + ::testing::internal::linked_ptr< + const MatcherInterface > + impl_; +}; + +} // namespace internal + +// A Matcher is a copyable and IMMUTABLE (except by assignment) +// object that can check whether a value of type T matches. The +// implementation of Matcher is just a linked_ptr to const +// MatcherInterface, so copying is fairly cheap. Don't inherit +// from Matcher! +template +class Matcher : public internal::MatcherBase { + public: + // Constructs a null matcher. Needed for storing Matcher objects in STL + // containers. A default-constructed matcher is not yet initialized. You + // cannot use it until a valid value has been assigned to it. + explicit Matcher() {} // NOLINT + + // Constructs a matcher from its implementation. + explicit Matcher(const MatcherInterface* impl) + : internal::MatcherBase(impl) {} + + template + explicit Matcher(const MatcherInterface* impl, + typename internal::EnableIf::value>::type* = NULL) + : internal::MatcherBase(impl) {} + + // Implicit constructor here allows people to write + // EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) sometimes + Matcher(T value); // NOLINT +}; + +// The following two specializations allow the user to write str +// instead of Eq(str) and "foo" instead of Eq("foo") when a std::string +// matcher is expected. +template <> +class GTEST_API_ Matcher + : public internal::MatcherBase { + public: + Matcher() {} + + explicit Matcher(const MatcherInterface* impl) + : internal::MatcherBase(impl) {} + + // Allows the user to write str instead of Eq(str) sometimes, where + // str is a std::string object. + Matcher(const std::string& s); // NOLINT + +#if GTEST_HAS_GLOBAL_STRING + // Allows the user to write str instead of Eq(str) sometimes, where + // str is a ::string object. + Matcher(const ::string& s); // NOLINT +#endif // GTEST_HAS_GLOBAL_STRING + + // Allows the user to write "foo" instead of Eq("foo") sometimes. + Matcher(const char* s); // NOLINT +}; + +template <> +class GTEST_API_ Matcher + : public internal::MatcherBase { + public: + Matcher() {} + + explicit Matcher(const MatcherInterface* impl) + : internal::MatcherBase(impl) {} + explicit Matcher(const MatcherInterface* impl) + : internal::MatcherBase(impl) {} + + // Allows the user to write str instead of Eq(str) sometimes, where + // str is a string object. + Matcher(const std::string& s); // NOLINT + +#if GTEST_HAS_GLOBAL_STRING + // Allows the user to write str instead of Eq(str) sometimes, where + // str is a ::string object. + Matcher(const ::string& s); // NOLINT +#endif // GTEST_HAS_GLOBAL_STRING + + // Allows the user to write "foo" instead of Eq("foo") sometimes. + Matcher(const char* s); // NOLINT +}; + +#if GTEST_HAS_GLOBAL_STRING +// The following two specializations allow the user to write str +// instead of Eq(str) and "foo" instead of Eq("foo") when a ::string +// matcher is expected. +template <> +class GTEST_API_ Matcher + : public internal::MatcherBase { + public: + Matcher() {} + + explicit Matcher(const MatcherInterface* impl) + : internal::MatcherBase(impl) {} + + // Allows the user to write str instead of Eq(str) sometimes, where + // str is a std::string object. + Matcher(const std::string& s); // NOLINT + + // Allows the user to write str instead of Eq(str) sometimes, where + // str is a ::string object. + Matcher(const ::string& s); // NOLINT + + // Allows the user to write "foo" instead of Eq("foo") sometimes. + Matcher(const char* s); // NOLINT +}; + +template <> +class GTEST_API_ Matcher< ::string> + : public internal::MatcherBase< ::string> { + public: + Matcher() {} + + explicit Matcher(const MatcherInterface* impl) + : internal::MatcherBase< ::string>(impl) {} + explicit Matcher(const MatcherInterface< ::string>* impl) + : internal::MatcherBase< ::string>(impl) {} + + // Allows the user to write str instead of Eq(str) sometimes, where + // str is a std::string object. + Matcher(const std::string& s); // NOLINT + + // Allows the user to write str instead of Eq(str) sometimes, where + // str is a ::string object. + Matcher(const ::string& s); // NOLINT + + // Allows the user to write "foo" instead of Eq("foo") sometimes. + Matcher(const char* s); // NOLINT +}; +#endif // GTEST_HAS_GLOBAL_STRING + +#if GTEST_HAS_ABSL +// The following two specializations allow the user to write str +// instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view +// matcher is expected. +template <> +class GTEST_API_ Matcher + : public internal::MatcherBase { + public: + Matcher() {} + + explicit Matcher(const MatcherInterface* impl) + : internal::MatcherBase(impl) {} + + // Allows the user to write str instead of Eq(str) sometimes, where + // str is a std::string object. + Matcher(const std::string& s); // NOLINT + +#if GTEST_HAS_GLOBAL_STRING + // Allows the user to write str instead of Eq(str) sometimes, where + // str is a ::string object. + Matcher(const ::string& s); // NOLINT +#endif // GTEST_HAS_GLOBAL_STRING + + // Allows the user to write "foo" instead of Eq("foo") sometimes. + Matcher(const char* s); // NOLINT + + // Allows the user to pass absl::string_views directly. + Matcher(absl::string_view s); // NOLINT +}; + +template <> +class GTEST_API_ Matcher + : public internal::MatcherBase { + public: + Matcher() {} + + explicit Matcher(const MatcherInterface* impl) + : internal::MatcherBase(impl) {} + explicit Matcher(const MatcherInterface* impl) + : internal::MatcherBase(impl) {} + + // Allows the user to write str instead of Eq(str) sometimes, where + // str is a std::string object. + Matcher(const std::string& s); // NOLINT + +#if GTEST_HAS_GLOBAL_STRING + // Allows the user to write str instead of Eq(str) sometimes, where + // str is a ::string object. + Matcher(const ::string& s); // NOLINT +#endif // GTEST_HAS_GLOBAL_STRING + + // Allows the user to write "foo" instead of Eq("foo") sometimes. + Matcher(const char* s); // NOLINT + + // Allows the user to pass absl::string_views directly. + Matcher(absl::string_view s); // NOLINT +}; +#endif // GTEST_HAS_ABSL + +// Prints a matcher in a human-readable format. +template +std::ostream& operator<<(std::ostream& os, const Matcher& matcher) { + matcher.DescribeTo(&os); + return os; +} + +// The PolymorphicMatcher class template makes it easy to implement a +// polymorphic matcher (i.e. a matcher that can match values of more +// than one type, e.g. Eq(n) and NotNull()). +// +// To define a polymorphic matcher, a user should provide an Impl +// class that has a DescribeTo() method and a DescribeNegationTo() +// method, and define a member function (or member function template) +// +// bool MatchAndExplain(const Value& value, +// MatchResultListener* listener) const; +// +// See the definition of NotNull() for a complete example. +template +class PolymorphicMatcher { + public: + explicit PolymorphicMatcher(const Impl& an_impl) : impl_(an_impl) {} + + // Returns a mutable reference to the underlying matcher + // implementation object. + Impl& mutable_impl() { return impl_; } + + // Returns an immutable reference to the underlying matcher + // implementation object. + const Impl& impl() const { return impl_; } + + template + operator Matcher() const { + return Matcher(new MonomorphicImpl(impl_)); + } + + private: + template + class MonomorphicImpl : public MatcherInterface { + public: + explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {} + + virtual void DescribeTo(::std::ostream* os) const { + impl_.DescribeTo(os); + } + + virtual void DescribeNegationTo(::std::ostream* os) const { + impl_.DescribeNegationTo(os); + } + + virtual bool MatchAndExplain(T x, MatchResultListener* listener) const { + return impl_.MatchAndExplain(x, listener); + } + + private: + const Impl impl_; + + GTEST_DISALLOW_ASSIGN_(MonomorphicImpl); + }; + + Impl impl_; + + GTEST_DISALLOW_ASSIGN_(PolymorphicMatcher); +}; + +// Creates a matcher from its implementation. This is easier to use +// than the Matcher constructor as it doesn't require you to +// explicitly write the template argument, e.g. +// +// MakeMatcher(foo); +// vs +// Matcher(foo); +template +inline Matcher MakeMatcher(const MatcherInterface* impl) { + return Matcher(impl); +} + +// Creates a polymorphic matcher from its implementation. This is +// easier to use than the PolymorphicMatcher constructor as it +// doesn't require you to explicitly write the template argument, e.g. +// +// MakePolymorphicMatcher(foo); +// vs +// PolymorphicMatcher(foo); +template +inline PolymorphicMatcher MakePolymorphicMatcher(const Impl& impl) { + return PolymorphicMatcher(impl); +} + +// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION +// and MUST NOT BE USED IN USER CODE!!! +namespace internal { + +// The MatcherCastImpl class template is a helper for implementing +// MatcherCast(). We need this helper in order to partially +// specialize the implementation of MatcherCast() (C++ allows +// class/struct templates to be partially specialized, but not +// function templates.). + +// This general version is used when MatcherCast()'s argument is a +// polymorphic matcher (i.e. something that can be converted to a +// Matcher but is not one yet; for example, Eq(value)) or a value (for +// example, "hello"). +template +class MatcherCastImpl { + public: + static Matcher Cast(const M& polymorphic_matcher_or_value) { + // M can be a polymorphic matcher, in which case we want to use + // its conversion operator to create Matcher. Or it can be a value + // that should be passed to the Matcher's constructor. + // + // We can't call Matcher(polymorphic_matcher_or_value) when M is a + // polymorphic matcher because it'll be ambiguous if T has an implicit + // constructor from M (this usually happens when T has an implicit + // constructor from any type). + // + // It won't work to unconditionally implict_cast + // polymorphic_matcher_or_value to Matcher because it won't trigger + // a user-defined conversion from M to T if one exists (assuming M is + // a value). + return CastImpl( + polymorphic_matcher_or_value, + BooleanConstant< + internal::ImplicitlyConvertible >::value>(), + BooleanConstant< + internal::ImplicitlyConvertible::value>()); + } + + private: + template + static Matcher CastImpl(const M& polymorphic_matcher_or_value, + BooleanConstant /* convertible_to_matcher */, + BooleanConstant) { + // M is implicitly convertible to Matcher, which means that either + // M is a polymorphic matcher or Matcher has an implicit constructor + // from M. In both cases using the implicit conversion will produce a + // matcher. + // + // Even if T has an implicit constructor from M, it won't be called because + // creating Matcher would require a chain of two user-defined conversions + // (first to create T from M and then to create Matcher from T). + return polymorphic_matcher_or_value; + } + + // M can't be implicitly converted to Matcher, so M isn't a polymorphic + // matcher. It's a value of a type implicitly convertible to T. Use direct + // initialization to create a matcher. + static Matcher CastImpl( + const M& value, BooleanConstant /* convertible_to_matcher */, + BooleanConstant /* convertible_to_T */) { + return Matcher(ImplicitCast_(value)); + } + + // M can't be implicitly converted to either Matcher or T. Attempt to use + // polymorphic matcher Eq(value) in this case. + // + // Note that we first attempt to perform an implicit cast on the value and + // only fall back to the polymorphic Eq() matcher afterwards because the + // latter calls bool operator==(const Lhs& lhs, const Rhs& rhs) in the end + // which might be undefined even when Rhs is implicitly convertible to Lhs + // (e.g. std::pair vs. std::pair). + // + // We don't define this method inline as we need the declaration of Eq(). + static Matcher CastImpl( + const M& value, BooleanConstant /* convertible_to_matcher */, + BooleanConstant /* convertible_to_T */); +}; + +// This more specialized version is used when MatcherCast()'s argument +// is already a Matcher. This only compiles when type T can be +// statically converted to type U. +template +class MatcherCastImpl > { + public: + static Matcher Cast(const Matcher& source_matcher) { + return Matcher(new Impl(source_matcher)); + } + + private: + class Impl : public MatcherInterface { + public: + explicit Impl(const Matcher& source_matcher) + : source_matcher_(source_matcher) {} + + // We delegate the matching logic to the source matcher. + virtual bool MatchAndExplain(T x, MatchResultListener* listener) const { +#if GTEST_LANG_CXX11 + using FromType = typename std::remove_cv::type>::type>::type; + using ToType = typename std::remove_cv::type>::type>::type; + // Do not allow implicitly converting base*/& to derived*/&. + static_assert( + // Do not trigger if only one of them is a pointer. That implies a + // regular conversion and not a down_cast. + (std::is_pointer::type>::value != + std::is_pointer::type>::value) || + std::is_same::value || + !std::is_base_of::value, + "Can't implicitly convert from to "); +#endif // GTEST_LANG_CXX11 + + return source_matcher_.MatchAndExplain(static_cast(x), listener); + } + + virtual void DescribeTo(::std::ostream* os) const { + source_matcher_.DescribeTo(os); + } + + virtual void DescribeNegationTo(::std::ostream* os) const { + source_matcher_.DescribeNegationTo(os); + } + + private: + const Matcher source_matcher_; + + GTEST_DISALLOW_ASSIGN_(Impl); + }; +}; + +// This even more specialized version is used for efficiently casting +// a matcher to its own type. +template +class MatcherCastImpl > { + public: + static Matcher Cast(const Matcher& matcher) { return matcher; } +}; + +} // namespace internal + +// In order to be safe and clear, casting between different matcher +// types is done explicitly via MatcherCast(m), which takes a +// matcher m and returns a Matcher. It compiles only when T can be +// statically converted to the argument type of m. +template +inline Matcher MatcherCast(const M& matcher) { + return internal::MatcherCastImpl::Cast(matcher); +} + +// Implements SafeMatcherCast(). +// +// We use an intermediate class to do the actual safe casting as Nokia's +// Symbian compiler cannot decide between +// template ... (M) and +// template ... (const Matcher&) +// for function templates but can for member function templates. +template +class SafeMatcherCastImpl { + public: + // This overload handles polymorphic matchers and values only since + // monomorphic matchers are handled by the next one. + template + static inline Matcher Cast(const M& polymorphic_matcher_or_value) { + return internal::MatcherCastImpl::Cast(polymorphic_matcher_or_value); + } + + // This overload handles monomorphic matchers. + // + // In general, if type T can be implicitly converted to type U, we can + // safely convert a Matcher to a Matcher (i.e. Matcher is + // contravariant): just keep a copy of the original Matcher, convert the + // argument from type T to U, and then pass it to the underlying Matcher. + // The only exception is when U is a reference and T is not, as the + // underlying Matcher may be interested in the argument's address, which + // is not preserved in the conversion from T to U. + template + static inline Matcher Cast(const Matcher& matcher) { + // Enforce that T can be implicitly converted to U. + GTEST_COMPILE_ASSERT_((internal::ImplicitlyConvertible::value), + T_must_be_implicitly_convertible_to_U); + // Enforce that we are not converting a non-reference type T to a reference + // type U. + GTEST_COMPILE_ASSERT_( + internal::is_reference::value || !internal::is_reference::value, + cannot_convert_non_reference_arg_to_reference); + // In case both T and U are arithmetic types, enforce that the + // conversion is not lossy. + typedef GTEST_REMOVE_REFERENCE_AND_CONST_(T) RawT; + typedef GTEST_REMOVE_REFERENCE_AND_CONST_(U) RawU; + const bool kTIsOther = GMOCK_KIND_OF_(RawT) == internal::kOther; + const bool kUIsOther = GMOCK_KIND_OF_(RawU) == internal::kOther; + GTEST_COMPILE_ASSERT_( + kTIsOther || kUIsOther || + (internal::LosslessArithmeticConvertible::value), + conversion_of_arithmetic_types_must_be_lossless); + return MatcherCast(matcher); + } +}; + +template +inline Matcher SafeMatcherCast(const M& polymorphic_matcher) { + return SafeMatcherCastImpl::Cast(polymorphic_matcher); +} + +// A() returns a matcher that matches any value of type T. +template +Matcher A(); + +// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION +// and MUST NOT BE USED IN USER CODE!!! +namespace internal { + +// If the explanation is not empty, prints it to the ostream. +inline void PrintIfNotEmpty(const std::string& explanation, + ::std::ostream* os) { + if (explanation != "" && os != NULL) { + *os << ", " << explanation; + } +} + +// Returns true if the given type name is easy to read by a human. +// This is used to decide whether printing the type of a value might +// be helpful. +inline bool IsReadableTypeName(const std::string& type_name) { + // We consider a type name readable if it's short or doesn't contain + // a template or function type. + return (type_name.length() <= 20 || + type_name.find_first_of("<(") == std::string::npos); +} + +// Matches the value against the given matcher, prints the value and explains +// the match result to the listener. Returns the match result. +// 'listener' must not be NULL. +// Value cannot be passed by const reference, because some matchers take a +// non-const argument. +template +bool MatchPrintAndExplain(Value& value, const Matcher& matcher, + MatchResultListener* listener) { + if (!listener->IsInterested()) { + // If the listener is not interested, we do not need to construct the + // inner explanation. + return matcher.Matches(value); + } + + StringMatchResultListener inner_listener; + const bool match = matcher.MatchAndExplain(value, &inner_listener); + + UniversalPrint(value, listener->stream()); +#if GTEST_HAS_RTTI + const std::string& type_name = GetTypeName(); + if (IsReadableTypeName(type_name)) + *listener->stream() << " (of type " << type_name << ")"; +#endif + PrintIfNotEmpty(inner_listener.str(), listener->stream()); + + return match; +} + +// An internal helper class for doing compile-time loop on a tuple's +// fields. +template +class TuplePrefix { + public: + // TuplePrefix::Matches(matcher_tuple, value_tuple) returns true + // iff the first N fields of matcher_tuple matches the first N + // fields of value_tuple, respectively. + template + static bool Matches(const MatcherTuple& matcher_tuple, + const ValueTuple& value_tuple) { + return TuplePrefix::Matches(matcher_tuple, value_tuple) + && get(matcher_tuple).Matches(get(value_tuple)); + } + + // TuplePrefix::ExplainMatchFailuresTo(matchers, values, os) + // describes failures in matching the first N fields of matchers + // against the first N fields of values. If there is no failure, + // nothing will be streamed to os. + template + static void ExplainMatchFailuresTo(const MatcherTuple& matchers, + const ValueTuple& values, + ::std::ostream* os) { + // First, describes failures in the first N - 1 fields. + TuplePrefix::ExplainMatchFailuresTo(matchers, values, os); + + // Then describes the failure (if any) in the (N - 1)-th (0-based) + // field. + typename tuple_element::type matcher = + get(matchers); + typedef typename tuple_element::type Value; + GTEST_REFERENCE_TO_CONST_(Value) value = get(values); + StringMatchResultListener listener; + if (!matcher.MatchAndExplain(value, &listener)) { + // TODO(wan): include in the message the name of the parameter + // as used in MOCK_METHOD*() when possible. + *os << " Expected arg #" << N - 1 << ": "; + get(matchers).DescribeTo(os); + *os << "\n Actual: "; + // We remove the reference in type Value to prevent the + // universal printer from printing the address of value, which + // isn't interesting to the user most of the time. The + // matcher's MatchAndExplain() method handles the case when + // the address is interesting. + internal::UniversalPrint(value, os); + PrintIfNotEmpty(listener.str(), os); + *os << "\n"; + } + } +}; + +// The base case. +template <> +class TuplePrefix<0> { + public: + template + static bool Matches(const MatcherTuple& /* matcher_tuple */, + const ValueTuple& /* value_tuple */) { + return true; + } + + template + static void ExplainMatchFailuresTo(const MatcherTuple& /* matchers */, + const ValueTuple& /* values */, + ::std::ostream* /* os */) {} +}; + +// TupleMatches(matcher_tuple, value_tuple) returns true iff all +// matchers in matcher_tuple match the corresponding fields in +// value_tuple. It is a compiler error if matcher_tuple and +// value_tuple have different number of fields or incompatible field +// types. +template +bool TupleMatches(const MatcherTuple& matcher_tuple, + const ValueTuple& value_tuple) { + // Makes sure that matcher_tuple and value_tuple have the same + // number of fields. + GTEST_COMPILE_ASSERT_(tuple_size::value == + tuple_size::value, + matcher_and_value_have_different_numbers_of_fields); + return TuplePrefix::value>:: + Matches(matcher_tuple, value_tuple); +} + +// Describes failures in matching matchers against values. If there +// is no failure, nothing will be streamed to os. +template +void ExplainMatchFailureTupleTo(const MatcherTuple& matchers, + const ValueTuple& values, + ::std::ostream* os) { + TuplePrefix::value>::ExplainMatchFailuresTo( + matchers, values, os); +} + +// TransformTupleValues and its helper. +// +// TransformTupleValuesHelper hides the internal machinery that +// TransformTupleValues uses to implement a tuple traversal. +template +class TransformTupleValuesHelper { + private: + typedef ::testing::tuple_size TupleSize; + + public: + // For each member of tuple 't', taken in order, evaluates '*out++ = f(t)'. + // Returns the final value of 'out' in case the caller needs it. + static OutIter Run(Func f, const Tuple& t, OutIter out) { + return IterateOverTuple()(f, t, out); + } + + private: + template + struct IterateOverTuple { + OutIter operator() (Func f, const Tup& t, OutIter out) const { + *out++ = f(::testing::get(t)); + return IterateOverTuple()(f, t, out); + } + }; + template + struct IterateOverTuple { + OutIter operator() (Func /* f */, const Tup& /* t */, OutIter out) const { + return out; + } + }; +}; + +// Successively invokes 'f(element)' on each element of the tuple 't', +// appending each result to the 'out' iterator. Returns the final value +// of 'out'. +template +OutIter TransformTupleValues(Func f, const Tuple& t, OutIter out) { + return TransformTupleValuesHelper::Run(f, t, out); +} + +// Implements A(). +template +class AnyMatcherImpl : public MatcherInterface { + public: + virtual bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) /* x */, + MatchResultListener* /* listener */) const { + return true; + } + virtual void DescribeTo(::std::ostream* os) const { *os << "is anything"; } + virtual void DescribeNegationTo(::std::ostream* os) const { + // This is mostly for completeness' safe, as it's not very useful + // to write Not(A()). However we cannot completely rule out + // such a possibility, and it doesn't hurt to be prepared. + *os << "never matches"; + } +}; + +// Implements _, a matcher that matches any value of any +// type. This is a polymorphic matcher, so we need a template type +// conversion operator to make it appearing as a Matcher for any +// type T. +class AnythingMatcher { + public: + template + operator Matcher() const { return A(); } +}; + +// Implements a matcher that compares a given value with a +// pre-supplied value using one of the ==, <=, <, etc, operators. The +// two values being compared don't have to have the same type. +// +// The matcher defined here is polymorphic (for example, Eq(5) can be +// used to match an int, a short, a double, etc). Therefore we use +// a template type conversion operator in the implementation. +// +// The following template definition assumes that the Rhs parameter is +// a "bare" type (i.e. neither 'const T' nor 'T&'). +template +class ComparisonBase { + public: + explicit ComparisonBase(const Rhs& rhs) : rhs_(rhs) {} + template + operator Matcher() const { + return MakeMatcher(new Impl(rhs_)); + } + + private: + template + class Impl : public MatcherInterface { + public: + explicit Impl(const Rhs& rhs) : rhs_(rhs) {} + virtual bool MatchAndExplain( + Lhs lhs, MatchResultListener* /* listener */) const { + return Op()(lhs, rhs_); + } + virtual void DescribeTo(::std::ostream* os) const { + *os << D::Desc() << " "; + UniversalPrint(rhs_, os); + } + virtual void DescribeNegationTo(::std::ostream* os) const { + *os << D::NegatedDesc() << " "; + UniversalPrint(rhs_, os); + } + private: + Rhs rhs_; + GTEST_DISALLOW_ASSIGN_(Impl); + }; + Rhs rhs_; + GTEST_DISALLOW_ASSIGN_(ComparisonBase); +}; + +template +class EqMatcher : public ComparisonBase, Rhs, AnyEq> { + public: + explicit EqMatcher(const Rhs& rhs) + : ComparisonBase, Rhs, AnyEq>(rhs) { } + static const char* Desc() { return "is equal to"; } + static const char* NegatedDesc() { return "isn't equal to"; } +}; +template +class NeMatcher : public ComparisonBase, Rhs, AnyNe> { + public: + explicit NeMatcher(const Rhs& rhs) + : ComparisonBase, Rhs, AnyNe>(rhs) { } + static const char* Desc() { return "isn't equal to"; } + static const char* NegatedDesc() { return "is equal to"; } +}; +template +class LtMatcher : public ComparisonBase, Rhs, AnyLt> { + public: + explicit LtMatcher(const Rhs& rhs) + : ComparisonBase, Rhs, AnyLt>(rhs) { } + static const char* Desc() { return "is <"; } + static const char* NegatedDesc() { return "isn't <"; } +}; +template +class GtMatcher : public ComparisonBase, Rhs, AnyGt> { + public: + explicit GtMatcher(const Rhs& rhs) + : ComparisonBase, Rhs, AnyGt>(rhs) { } + static const char* Desc() { return "is >"; } + static const char* NegatedDesc() { return "isn't >"; } +}; +template +class LeMatcher : public ComparisonBase, Rhs, AnyLe> { + public: + explicit LeMatcher(const Rhs& rhs) + : ComparisonBase, Rhs, AnyLe>(rhs) { } + static const char* Desc() { return "is <="; } + static const char* NegatedDesc() { return "isn't <="; } +}; +template +class GeMatcher : public ComparisonBase, Rhs, AnyGe> { + public: + explicit GeMatcher(const Rhs& rhs) + : ComparisonBase, Rhs, AnyGe>(rhs) { } + static const char* Desc() { return "is >="; } + static const char* NegatedDesc() { return "isn't >="; } +}; + +// Implements the polymorphic IsNull() matcher, which matches any raw or smart +// pointer that is NULL. +class IsNullMatcher { + public: + template + bool MatchAndExplain(const Pointer& p, + MatchResultListener* /* listener */) const { +#if GTEST_LANG_CXX11 + return p == nullptr; +#else // GTEST_LANG_CXX11 + return GetRawPointer(p) == NULL; +#endif // GTEST_LANG_CXX11 + } + + void DescribeTo(::std::ostream* os) const { *os << "is NULL"; } + void DescribeNegationTo(::std::ostream* os) const { + *os << "isn't NULL"; + } +}; + +// Implements the polymorphic NotNull() matcher, which matches any raw or smart +// pointer that is not NULL. +class NotNullMatcher { + public: + template + bool MatchAndExplain(const Pointer& p, + MatchResultListener* /* listener */) const { +#if GTEST_LANG_CXX11 + return p != nullptr; +#else // GTEST_LANG_CXX11 + return GetRawPointer(p) != NULL; +#endif // GTEST_LANG_CXX11 + } + + void DescribeTo(::std::ostream* os) const { *os << "isn't NULL"; } + void DescribeNegationTo(::std::ostream* os) const { + *os << "is NULL"; + } +}; + +// Ref(variable) matches any argument that is a reference to +// 'variable'. This matcher is polymorphic as it can match any +// super type of the type of 'variable'. +// +// The RefMatcher template class implements Ref(variable). It can +// only be instantiated with a reference type. This prevents a user +// from mistakenly using Ref(x) to match a non-reference function +// argument. For example, the following will righteously cause a +// compiler error: +// +// int n; +// Matcher m1 = Ref(n); // This won't compile. +// Matcher m2 = Ref(n); // This will compile. +template +class RefMatcher; + +template +class RefMatcher { + // Google Mock is a generic framework and thus needs to support + // mocking any function types, including those that take non-const + // reference arguments. Therefore the template parameter T (and + // Super below) can be instantiated to either a const type or a + // non-const type. + public: + // RefMatcher() takes a T& instead of const T&, as we want the + // compiler to catch using Ref(const_value) as a matcher for a + // non-const reference. + explicit RefMatcher(T& x) : object_(x) {} // NOLINT + + template + operator Matcher() const { + // By passing object_ (type T&) to Impl(), which expects a Super&, + // we make sure that Super is a super type of T. In particular, + // this catches using Ref(const_value) as a matcher for a + // non-const reference, as you cannot implicitly convert a const + // reference to a non-const reference. + return MakeMatcher(new Impl(object_)); + } + + private: + template + class Impl : public MatcherInterface { + public: + explicit Impl(Super& x) : object_(x) {} // NOLINT + + // MatchAndExplain() takes a Super& (as opposed to const Super&) + // in order to match the interface MatcherInterface. + virtual bool MatchAndExplain( + Super& x, MatchResultListener* listener) const { + *listener << "which is located @" << static_cast(&x); + return &x == &object_; + } + + virtual void DescribeTo(::std::ostream* os) const { + *os << "references the variable "; + UniversalPrinter::Print(object_, os); + } + + virtual void DescribeNegationTo(::std::ostream* os) const { + *os << "does not reference the variable "; + UniversalPrinter::Print(object_, os); + } + + private: + const Super& object_; + + GTEST_DISALLOW_ASSIGN_(Impl); + }; + + T& object_; + + GTEST_DISALLOW_ASSIGN_(RefMatcher); +}; + +// Polymorphic helper functions for narrow and wide string matchers. +inline bool CaseInsensitiveCStringEquals(const char* lhs, const char* rhs) { + return String::CaseInsensitiveCStringEquals(lhs, rhs); +} + +inline bool CaseInsensitiveCStringEquals(const wchar_t* lhs, + const wchar_t* rhs) { + return String::CaseInsensitiveWideCStringEquals(lhs, rhs); +} + +// String comparison for narrow or wide strings that can have embedded NUL +// characters. +template +bool CaseInsensitiveStringEquals(const StringType& s1, + const StringType& s2) { + // Are the heads equal? + if (!CaseInsensitiveCStringEquals(s1.c_str(), s2.c_str())) { + return false; + } + + // Skip the equal heads. + const typename StringType::value_type nul = 0; + const size_t i1 = s1.find(nul), i2 = s2.find(nul); + + // Are we at the end of either s1 or s2? + if (i1 == StringType::npos || i2 == StringType::npos) { + return i1 == i2; + } + + // Are the tails equal? + return CaseInsensitiveStringEquals(s1.substr(i1 + 1), s2.substr(i2 + 1)); +} + +// String matchers. + +// Implements equality-based string matchers like StrEq, StrCaseNe, and etc. +template +class StrEqualityMatcher { + public: + StrEqualityMatcher(const StringType& str, bool expect_eq, + bool case_sensitive) + : string_(str), expect_eq_(expect_eq), case_sensitive_(case_sensitive) {} + +#if GTEST_HAS_ABSL + bool MatchAndExplain(const absl::string_view& s, + MatchResultListener* listener) const { + if (s.data() == NULL) { + return !expect_eq_; + } + // This should fail to compile if absl::string_view is used with wide + // strings. + const StringType& str = string(s); + return MatchAndExplain(str, listener); + } +#endif // GTEST_HAS_ABSL + + // Accepts pointer types, particularly: + // const char* + // char* + // const wchar_t* + // wchar_t* + template + bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { + if (s == NULL) { + return !expect_eq_; + } + return MatchAndExplain(StringType(s), listener); + } + + // Matches anything that can convert to StringType. + // + // This is a template, not just a plain function with const StringType&, + // because absl::string_view has some interfering non-explicit constructors. + template + bool MatchAndExplain(const MatcheeStringType& s, + MatchResultListener* /* listener */) const { + const StringType& s2(s); + const bool eq = case_sensitive_ ? s2 == string_ : + CaseInsensitiveStringEquals(s2, string_); + return expect_eq_ == eq; + } + + void DescribeTo(::std::ostream* os) const { + DescribeToHelper(expect_eq_, os); + } + + void DescribeNegationTo(::std::ostream* os) const { + DescribeToHelper(!expect_eq_, os); + } + + private: + void DescribeToHelper(bool expect_eq, ::std::ostream* os) const { + *os << (expect_eq ? "is " : "isn't "); + *os << "equal to "; + if (!case_sensitive_) { + *os << "(ignoring case) "; + } + UniversalPrint(string_, os); + } + + const StringType string_; + const bool expect_eq_; + const bool case_sensitive_; + + GTEST_DISALLOW_ASSIGN_(StrEqualityMatcher); +}; + +// Implements the polymorphic HasSubstr(substring) matcher, which +// can be used as a Matcher as long as T can be converted to a +// string. +template +class HasSubstrMatcher { + public: + explicit HasSubstrMatcher(const StringType& substring) + : substring_(substring) {} + +#if GTEST_HAS_ABSL + bool MatchAndExplain(const absl::string_view& s, + MatchResultListener* listener) const { + if (s.data() == NULL) { + return false; + } + // This should fail to compile if absl::string_view is used with wide + // strings. + const StringType& str = string(s); + return MatchAndExplain(str, listener); + } +#endif // GTEST_HAS_ABSL + + // Accepts pointer types, particularly: + // const char* + // char* + // const wchar_t* + // wchar_t* + template + bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { + return s != NULL && MatchAndExplain(StringType(s), listener); + } + + // Matches anything that can convert to StringType. + // + // This is a template, not just a plain function with const StringType&, + // because absl::string_view has some interfering non-explicit constructors. + template + bool MatchAndExplain(const MatcheeStringType& s, + MatchResultListener* /* listener */) const { + const StringType& s2(s); + return s2.find(substring_) != StringType::npos; + } + + // Describes what this matcher matches. + void DescribeTo(::std::ostream* os) const { + *os << "has substring "; + UniversalPrint(substring_, os); + } + + void DescribeNegationTo(::std::ostream* os) const { + *os << "has no substring "; + UniversalPrint(substring_, os); + } + + private: + const StringType substring_; + + GTEST_DISALLOW_ASSIGN_(HasSubstrMatcher); +}; + +// Implements the polymorphic StartsWith(substring) matcher, which +// can be used as a Matcher as long as T can be converted to a +// string. +template +class StartsWithMatcher { + public: + explicit StartsWithMatcher(const StringType& prefix) : prefix_(prefix) { + } + +#if GTEST_HAS_ABSL + bool MatchAndExplain(const absl::string_view& s, + MatchResultListener* listener) const { + if (s.data() == NULL) { + return false; + } + // This should fail to compile if absl::string_view is used with wide + // strings. + const StringType& str = string(s); + return MatchAndExplain(str, listener); + } +#endif // GTEST_HAS_ABSL + + // Accepts pointer types, particularly: + // const char* + // char* + // const wchar_t* + // wchar_t* + template + bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { + return s != NULL && MatchAndExplain(StringType(s), listener); + } + + // Matches anything that can convert to StringType. + // + // This is a template, not just a plain function with const StringType&, + // because absl::string_view has some interfering non-explicit constructors. + template + bool MatchAndExplain(const MatcheeStringType& s, + MatchResultListener* /* listener */) const { + const StringType& s2(s); + return s2.length() >= prefix_.length() && + s2.substr(0, prefix_.length()) == prefix_; + } + + void DescribeTo(::std::ostream* os) const { + *os << "starts with "; + UniversalPrint(prefix_, os); + } + + void DescribeNegationTo(::std::ostream* os) const { + *os << "doesn't start with "; + UniversalPrint(prefix_, os); + } + + private: + const StringType prefix_; + + GTEST_DISALLOW_ASSIGN_(StartsWithMatcher); +}; + +// Implements the polymorphic EndsWith(substring) matcher, which +// can be used as a Matcher as long as T can be converted to a +// string. +template +class EndsWithMatcher { + public: + explicit EndsWithMatcher(const StringType& suffix) : suffix_(suffix) {} + +#if GTEST_HAS_ABSL + bool MatchAndExplain(const absl::string_view& s, + MatchResultListener* listener) const { + if (s.data() == NULL) { + return false; + } + // This should fail to compile if absl::string_view is used with wide + // strings. + const StringType& str = string(s); + return MatchAndExplain(str, listener); + } +#endif // GTEST_HAS_ABSL + + // Accepts pointer types, particularly: + // const char* + // char* + // const wchar_t* + // wchar_t* + template + bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { + return s != NULL && MatchAndExplain(StringType(s), listener); + } + + // Matches anything that can convert to StringType. + // + // This is a template, not just a plain function with const StringType&, + // because absl::string_view has some interfering non-explicit constructors. + template + bool MatchAndExplain(const MatcheeStringType& s, + MatchResultListener* /* listener */) const { + const StringType& s2(s); + return s2.length() >= suffix_.length() && + s2.substr(s2.length() - suffix_.length()) == suffix_; + } + + void DescribeTo(::std::ostream* os) const { + *os << "ends with "; + UniversalPrint(suffix_, os); + } + + void DescribeNegationTo(::std::ostream* os) const { + *os << "doesn't end with "; + UniversalPrint(suffix_, os); + } + + private: + const StringType suffix_; + + GTEST_DISALLOW_ASSIGN_(EndsWithMatcher); +}; + +// Implements polymorphic matchers MatchesRegex(regex) and +// ContainsRegex(regex), which can be used as a Matcher as long as +// T can be converted to a string. +class MatchesRegexMatcher { + public: + MatchesRegexMatcher(const RE* regex, bool full_match) + : regex_(regex), full_match_(full_match) {} + +#if GTEST_HAS_ABSL + bool MatchAndExplain(const absl::string_view& s, + MatchResultListener* listener) const { + return s.data() && MatchAndExplain(string(s), listener); + } +#endif // GTEST_HAS_ABSL + + // Accepts pointer types, particularly: + // const char* + // char* + // const wchar_t* + // wchar_t* + template + bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { + return s != NULL && MatchAndExplain(std::string(s), listener); + } + + // Matches anything that can convert to std::string. + // + // This is a template, not just a plain function with const std::string&, + // because absl::string_view has some interfering non-explicit constructors. + template + bool MatchAndExplain(const MatcheeStringType& s, + MatchResultListener* /* listener */) const { + const std::string& s2(s); + return full_match_ ? RE::FullMatch(s2, *regex_) : + RE::PartialMatch(s2, *regex_); + } + + void DescribeTo(::std::ostream* os) const { + *os << (full_match_ ? "matches" : "contains") + << " regular expression "; + UniversalPrinter::Print(regex_->pattern(), os); + } + + void DescribeNegationTo(::std::ostream* os) const { + *os << "doesn't " << (full_match_ ? "match" : "contain") + << " regular expression "; + UniversalPrinter::Print(regex_->pattern(), os); + } + + private: + const internal::linked_ptr regex_; + const bool full_match_; + + GTEST_DISALLOW_ASSIGN_(MatchesRegexMatcher); +}; + +// Implements a matcher that compares the two fields of a 2-tuple +// using one of the ==, <=, <, etc, operators. The two fields being +// compared don't have to have the same type. +// +// The matcher defined here is polymorphic (for example, Eq() can be +// used to match a tuple, a tuple, +// etc). Therefore we use a template type conversion operator in the +// implementation. +template +class PairMatchBase { + public: + template + operator Matcher< ::testing::tuple >() const { + return MakeMatcher(new Impl< ::testing::tuple >); + } + template + operator Matcher&>() const { + return MakeMatcher(new Impl&>); + } + + private: + static ::std::ostream& GetDesc(::std::ostream& os) { // NOLINT + return os << D::Desc(); + } + + template + class Impl : public MatcherInterface { + public: + virtual bool MatchAndExplain( + Tuple args, + MatchResultListener* /* listener */) const { + return Op()(::testing::get<0>(args), ::testing::get<1>(args)); + } + virtual void DescribeTo(::std::ostream* os) const { + *os << "are " << GetDesc; + } + virtual void DescribeNegationTo(::std::ostream* os) const { + *os << "aren't " << GetDesc; + } + }; +}; + +class Eq2Matcher : public PairMatchBase { + public: + static const char* Desc() { return "an equal pair"; } +}; +class Ne2Matcher : public PairMatchBase { + public: + static const char* Desc() { return "an unequal pair"; } +}; +class Lt2Matcher : public PairMatchBase { + public: + static const char* Desc() { return "a pair where the first < the second"; } +}; +class Gt2Matcher : public PairMatchBase { + public: + static const char* Desc() { return "a pair where the first > the second"; } +}; +class Le2Matcher : public PairMatchBase { + public: + static const char* Desc() { return "a pair where the first <= the second"; } +}; +class Ge2Matcher : public PairMatchBase { + public: + static const char* Desc() { return "a pair where the first >= the second"; } +}; + +// Implements the Not(...) matcher for a particular argument type T. +// We do not nest it inside the NotMatcher class template, as that +// will prevent different instantiations of NotMatcher from sharing +// the same NotMatcherImpl class. +template +class NotMatcherImpl : public MatcherInterface { + public: + explicit NotMatcherImpl(const Matcher& matcher) + : matcher_(matcher) {} + + virtual bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) x, + MatchResultListener* listener) const { + return !matcher_.MatchAndExplain(x, listener); + } + + virtual void DescribeTo(::std::ostream* os) const { + matcher_.DescribeNegationTo(os); + } + + virtual void DescribeNegationTo(::std::ostream* os) const { + matcher_.DescribeTo(os); + } + + private: + const Matcher matcher_; + + GTEST_DISALLOW_ASSIGN_(NotMatcherImpl); +}; + +// Implements the Not(m) matcher, which matches a value that doesn't +// match matcher m. +template +class NotMatcher { + public: + explicit NotMatcher(InnerMatcher matcher) : matcher_(matcher) {} + + // This template type conversion operator allows Not(m) to be used + // to match any type m can match. + template + operator Matcher() const { + return Matcher(new NotMatcherImpl(SafeMatcherCast(matcher_))); + } + + private: + InnerMatcher matcher_; + + GTEST_DISALLOW_ASSIGN_(NotMatcher); +}; + +// Implements the AllOf(m1, m2) matcher for a particular argument type +// T. We do not nest it inside the BothOfMatcher class template, as +// that will prevent different instantiations of BothOfMatcher from +// sharing the same BothOfMatcherImpl class. +template +class BothOfMatcherImpl + : public MatcherInterface { + public: + BothOfMatcherImpl(const Matcher& matcher1, const Matcher& matcher2) + : matcher1_(matcher1), matcher2_(matcher2) {} + + virtual void DescribeTo(::std::ostream* os) const { + *os << "("; + matcher1_.DescribeTo(os); + *os << ") and ("; + matcher2_.DescribeTo(os); + *os << ")"; + } + + virtual void DescribeNegationTo(::std::ostream* os) const { + *os << "("; + matcher1_.DescribeNegationTo(os); + *os << ") or ("; + matcher2_.DescribeNegationTo(os); + *os << ")"; + } + + virtual bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) x, + MatchResultListener* listener) const { + // If either matcher1_ or matcher2_ doesn't match x, we only need + // to explain why one of them fails. + StringMatchResultListener listener1; + if (!matcher1_.MatchAndExplain(x, &listener1)) { + *listener << listener1.str(); + return false; + } + + StringMatchResultListener listener2; + if (!matcher2_.MatchAndExplain(x, &listener2)) { + *listener << listener2.str(); + return false; + } + + // Otherwise we need to explain why *both* of them match. + const std::string s1 = listener1.str(); + const std::string s2 = listener2.str(); + + if (s1 == "") { + *listener << s2; + } else { + *listener << s1; + if (s2 != "") { + *listener << ", and " << s2; + } + } + return true; + } + + private: + const Matcher matcher1_; + const Matcher matcher2_; + + GTEST_DISALLOW_ASSIGN_(BothOfMatcherImpl); +}; + +#if GTEST_LANG_CXX11 +// MatcherList provides mechanisms for storing a variable number of matchers in +// a list structure (ListType) and creating a combining matcher from such a +// list. +// The template is defined recursively using the following template parameters: +// * kSize is the length of the MatcherList. +// * Head is the type of the first matcher of the list. +// * Tail denotes the types of the remaining matchers of the list. +template +struct MatcherList { + typedef MatcherList MatcherListTail; + typedef ::std::pair ListType; + + // BuildList stores variadic type values in a nested pair structure. + // Example: + // MatcherList<3, int, string, float>::BuildList(5, "foo", 2.0) will return + // the corresponding result of type pair>. + static ListType BuildList(const Head& matcher, const Tail&... tail) { + return ListType(matcher, MatcherListTail::BuildList(tail...)); + } + + // CreateMatcher creates a Matcher from a given list of matchers (built + // by BuildList()). CombiningMatcher is used to combine the matchers of the + // list. CombiningMatcher must implement MatcherInterface and have a + // constructor taking two Matchers as input. + template class CombiningMatcher> + static Matcher CreateMatcher(const ListType& matchers) { + return Matcher(new CombiningMatcher( + SafeMatcherCast(matchers.first), + MatcherListTail::template CreateMatcher( + matchers.second))); + } +}; + +// The following defines the base case for the recursive definition of +// MatcherList. +template +struct MatcherList<2, Matcher1, Matcher2> { + typedef ::std::pair ListType; + + static ListType BuildList(const Matcher1& matcher1, + const Matcher2& matcher2) { + return ::std::pair(matcher1, matcher2); + } + + template class CombiningMatcher> + static Matcher CreateMatcher(const ListType& matchers) { + return Matcher(new CombiningMatcher( + SafeMatcherCast(matchers.first), + SafeMatcherCast(matchers.second))); + } +}; + +// VariadicMatcher is used for the variadic implementation of +// AllOf(m_1, m_2, ...) and AnyOf(m_1, m_2, ...). +// CombiningMatcher is used to recursively combine the provided matchers +// (of type Args...). +template