@google-cloud/pubsub-api 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -0
- package/build/protos/google/pubsub/v1/pubsub.proto +2588 -0
- package/build/protos/google/pubsub/v1/schema.proto +409 -0
- package/build/protos/protos.d.ts +18963 -0
- package/build/protos/protos.js +1 -0
- package/build/protos/protos.json +1 -0
- package/build/src/index.d.ts +17 -0
- package/build/src/index.js +32 -0
- package/build/src/index.js.map +1 -0
- package/build/src/v1/gapic_metadata.json +424 -0
- package/build/src/v1/index.d.ts +3 -0
- package/build/src/v1/index.js +27 -0
- package/build/src/v1/index.js.map +1 -0
- package/build/src/v1/publisher_client.d.ts +835 -0
- package/build/src/v1/publisher_client.js +1260 -0
- package/build/src/v1/publisher_client.js.map +1 -0
- package/build/src/v1/publisher_client_config.json +97 -0
- package/build/src/v1/publisher_proto_list.json +4 -0
- package/build/src/v1/schema_service_client.d.ts +745 -0
- package/build/src/v1/schema_service_client.js +1176 -0
- package/build/src/v1/schema_service_client.js.map +1 -0
- package/build/src/v1/schema_service_client_config.json +79 -0
- package/build/src/v1/schema_service_proto_list.json +4 -0
- package/build/src/v1/subscriber_client.d.ts +1159 -0
- package/build/src/v1/subscriber_client.js +1491 -0
- package/build/src/v1/subscriber_client.js.map +1 -0
- package/build/src/v1/subscriber_client_config.json +136 -0
- package/build/src/v1/subscriber_proto_list.json +4 -0
- package/package.json +66 -0
|
@@ -0,0 +1,1176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2026 Google LLC
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
//
|
|
16
|
+
// ** This file is automatically generated by gapic-generator-typescript. **
|
|
17
|
+
// ** https://github.com/googleapis/gapic-generator-typescript **
|
|
18
|
+
// ** All changes to this file may be overwritten. **
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.SchemaServiceClient = void 0;
|
|
21
|
+
const jsonProtos = require("../../protos/protos.json");
|
|
22
|
+
const google_gax_1 = require("google-gax");
|
|
23
|
+
/**
|
|
24
|
+
* Client JSON configuration object, loaded from
|
|
25
|
+
* `src/v1/schema_service_client_config.json`.
|
|
26
|
+
* This file defines retry strategy and timeouts for all API methods in this library.
|
|
27
|
+
*/
|
|
28
|
+
const gapicConfig = require("./schema_service_client_config.json");
|
|
29
|
+
const version = require('../../../package.json').version;
|
|
30
|
+
/**
|
|
31
|
+
* Service for doing schema-related operations.
|
|
32
|
+
* @class
|
|
33
|
+
* @memberof v1
|
|
34
|
+
*/
|
|
35
|
+
class SchemaServiceClient {
|
|
36
|
+
_terminated = false;
|
|
37
|
+
_opts;
|
|
38
|
+
_providedCustomServicePath;
|
|
39
|
+
_gaxModule;
|
|
40
|
+
_gaxGrpc;
|
|
41
|
+
_protos;
|
|
42
|
+
_defaults;
|
|
43
|
+
_universeDomain;
|
|
44
|
+
_servicePath;
|
|
45
|
+
_log = google_gax_1.loggingUtils.log('pubsub-api');
|
|
46
|
+
auth;
|
|
47
|
+
descriptors = {
|
|
48
|
+
page: {},
|
|
49
|
+
stream: {},
|
|
50
|
+
longrunning: {},
|
|
51
|
+
batching: {},
|
|
52
|
+
};
|
|
53
|
+
warn;
|
|
54
|
+
innerApiCalls;
|
|
55
|
+
iamClient;
|
|
56
|
+
pathTemplates;
|
|
57
|
+
schemaServiceStub;
|
|
58
|
+
/**
|
|
59
|
+
* Construct an instance of SchemaServiceClient.
|
|
60
|
+
*
|
|
61
|
+
* @param {object} [options] - The configuration object.
|
|
62
|
+
* The options accepted by the constructor are described in detail
|
|
63
|
+
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
|
|
64
|
+
* The common options are:
|
|
65
|
+
* @param {object} [options.credentials] - Credentials object.
|
|
66
|
+
* @param {string} [options.credentials.client_email]
|
|
67
|
+
* @param {string} [options.credentials.private_key]
|
|
68
|
+
* @param {string} [options.email] - Account email address. Required when
|
|
69
|
+
* using a .pem or .p12 keyFilename.
|
|
70
|
+
* @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
|
|
71
|
+
* .p12 key downloaded from the Google Developers Console. If you provide
|
|
72
|
+
* a path to a JSON file, the projectId option below is not necessary.
|
|
73
|
+
* NOTE: .pem and .p12 require you to specify options.email as well.
|
|
74
|
+
* @param {number} [options.port] - The port on which to connect to
|
|
75
|
+
* the remote host.
|
|
76
|
+
* @param {string} [options.projectId] - The project ID from the Google
|
|
77
|
+
* Developer's Console, e.g. 'grape-spaceship-123'. We will also check
|
|
78
|
+
* the environment variable GCLOUD_PROJECT for your project ID. If your
|
|
79
|
+
* app is running in an environment which supports
|
|
80
|
+
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
|
|
81
|
+
* your project ID will be detected automatically.
|
|
82
|
+
* @param {string} [options.apiEndpoint] - The domain name of the
|
|
83
|
+
* API remote host.
|
|
84
|
+
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
|
|
85
|
+
* Follows the structure of {@link gapicConfig}.
|
|
86
|
+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
|
|
87
|
+
* For more information, please check the
|
|
88
|
+
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
|
|
89
|
+
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
|
|
90
|
+
* need to avoid loading the default gRPC version and want to use the fallback
|
|
91
|
+
* HTTP implementation. Load only fallback version and pass it to the constructor:
|
|
92
|
+
* ```
|
|
93
|
+
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
|
|
94
|
+
* const client = new SchemaServiceClient({fallback: true}, gax);
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
constructor(opts, gaxInstance) {
|
|
98
|
+
// Ensure that options include all the required fields.
|
|
99
|
+
const staticMembers = this.constructor;
|
|
100
|
+
if (opts?.universe_domain &&
|
|
101
|
+
opts?.universeDomain &&
|
|
102
|
+
opts?.universe_domain !== opts?.universeDomain) {
|
|
103
|
+
throw new Error('Please set either universe_domain or universeDomain, but not both.');
|
|
104
|
+
}
|
|
105
|
+
const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
|
|
106
|
+
? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
|
|
107
|
+
: undefined;
|
|
108
|
+
this._universeDomain =
|
|
109
|
+
opts?.universeDomain ??
|
|
110
|
+
opts?.universe_domain ??
|
|
111
|
+
universeDomainEnvVar ??
|
|
112
|
+
'googleapis.com';
|
|
113
|
+
this._servicePath = 'pubsub.' + this._universeDomain;
|
|
114
|
+
const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
|
|
115
|
+
this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
|
|
116
|
+
const port = opts?.port || staticMembers.port;
|
|
117
|
+
const clientConfig = opts?.clientConfig ?? {};
|
|
118
|
+
const fallback = opts?.fallback ??
|
|
119
|
+
(typeof window !== 'undefined' && typeof window?.fetch === 'function');
|
|
120
|
+
opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
|
|
121
|
+
// Request numeric enum values if REST transport is used.
|
|
122
|
+
opts.numericEnums = true;
|
|
123
|
+
// If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
|
|
124
|
+
if (servicePath !== this._servicePath && !('scopes' in opts)) {
|
|
125
|
+
opts['scopes'] = staticMembers.scopes;
|
|
126
|
+
}
|
|
127
|
+
// Load google-gax module synchronously if needed
|
|
128
|
+
if (!gaxInstance) {
|
|
129
|
+
gaxInstance = require('google-gax');
|
|
130
|
+
}
|
|
131
|
+
// Choose either gRPC or proto-over-HTTP implementation of google-gax.
|
|
132
|
+
this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance;
|
|
133
|
+
// Create a `gaxGrpc` object, with any grpc-specific options sent to the client.
|
|
134
|
+
this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
|
|
135
|
+
// Save options to use in initialize() method.
|
|
136
|
+
this._opts = opts;
|
|
137
|
+
// Save the auth object to the client, for use by other methods.
|
|
138
|
+
this.auth = this._gaxGrpc.auth;
|
|
139
|
+
// Set useJWTAccessWithScope on the auth object.
|
|
140
|
+
this.auth.useJWTAccessWithScope = true;
|
|
141
|
+
// Set defaultServicePath on the auth object.
|
|
142
|
+
this.auth.defaultServicePath = this._servicePath;
|
|
143
|
+
// Set the default scopes in auth client if needed.
|
|
144
|
+
if (servicePath === this._servicePath) {
|
|
145
|
+
this.auth.defaultScopes = staticMembers.scopes;
|
|
146
|
+
}
|
|
147
|
+
this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts);
|
|
148
|
+
// Determine the client header string.
|
|
149
|
+
const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
|
|
150
|
+
if (typeof process === 'object' && 'versions' in process) {
|
|
151
|
+
clientHeader.push(`gl-node/${process.versions.node}`);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
clientHeader.push(`gl-web/${this._gaxModule.version}`);
|
|
155
|
+
}
|
|
156
|
+
if (!opts.fallback) {
|
|
157
|
+
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
|
|
161
|
+
}
|
|
162
|
+
if (opts.libName && opts.libVersion) {
|
|
163
|
+
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
|
|
164
|
+
}
|
|
165
|
+
// Load the applicable protos.
|
|
166
|
+
this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
|
|
167
|
+
// This API contains "path templates"; forward-slash-separated
|
|
168
|
+
// identifiers to uniquely identify resources within the API.
|
|
169
|
+
// Create useful helper objects for these.
|
|
170
|
+
this.pathTemplates = {
|
|
171
|
+
projectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}'),
|
|
172
|
+
projectTopicsPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/topics/{topic}'),
|
|
173
|
+
schemaPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/schemas/{schema}'),
|
|
174
|
+
snapshotPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/snapshots/{snapshot}'),
|
|
175
|
+
subscriptionPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/subscriptions/{subscription}'),
|
|
176
|
+
};
|
|
177
|
+
// Some of the methods on this service return "paged" results,
|
|
178
|
+
// (e.g. 50 results at a time, with tokens to get subsequent
|
|
179
|
+
// pages). Denote the keys used for pagination and results.
|
|
180
|
+
this.descriptors.page = {
|
|
181
|
+
listSchemas: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'schemas'),
|
|
182
|
+
listSchemaRevisions: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'schemas'),
|
|
183
|
+
};
|
|
184
|
+
// Put together the default options sent with requests.
|
|
185
|
+
this._defaults = this._gaxGrpc.constructSettings('google.pubsub.v1.SchemaService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
|
|
186
|
+
// Set up a dictionary of "inner API calls"; the core implementation
|
|
187
|
+
// of calling the API is handled in `google-gax`, with this code
|
|
188
|
+
// merely providing the destination and request information.
|
|
189
|
+
this.innerApiCalls = {};
|
|
190
|
+
// Add a warn function to the client constructor so it can be easily tested.
|
|
191
|
+
this.warn = this._gaxModule.warn;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Initialize the client.
|
|
195
|
+
* Performs asynchronous operations (such as authentication) and prepares the client.
|
|
196
|
+
* This function will be called automatically when any class method is called for the
|
|
197
|
+
* first time, but if you need to initialize it before calling an actual method,
|
|
198
|
+
* feel free to call initialize() directly.
|
|
199
|
+
*
|
|
200
|
+
* You can await on this method if you want to make sure the client is initialized.
|
|
201
|
+
*
|
|
202
|
+
* @returns {Promise} A promise that resolves to an authenticated service stub.
|
|
203
|
+
*/
|
|
204
|
+
initialize() {
|
|
205
|
+
// If the client stub promise is already initialized, return immediately.
|
|
206
|
+
if (this.schemaServiceStub) {
|
|
207
|
+
return this.schemaServiceStub;
|
|
208
|
+
}
|
|
209
|
+
// Put together the "service stub" for
|
|
210
|
+
// google.pubsub.v1.SchemaService.
|
|
211
|
+
this.schemaServiceStub = this._gaxGrpc.createStub(this._opts.fallback
|
|
212
|
+
? this._protos.lookupService('google.pubsub.v1.SchemaService')
|
|
213
|
+
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
214
|
+
this._protos.google.pubsub.v1.SchemaService, this._opts, this._providedCustomServicePath);
|
|
215
|
+
// Iterate over each of the methods that the service provides
|
|
216
|
+
// and create an API call method for each.
|
|
217
|
+
const schemaServiceStubMethods = [
|
|
218
|
+
'createSchema',
|
|
219
|
+
'getSchema',
|
|
220
|
+
'listSchemas',
|
|
221
|
+
'listSchemaRevisions',
|
|
222
|
+
'commitSchema',
|
|
223
|
+
'rollbackSchema',
|
|
224
|
+
'deleteSchemaRevision',
|
|
225
|
+
'deleteSchema',
|
|
226
|
+
'validateSchema',
|
|
227
|
+
'validateMessage',
|
|
228
|
+
];
|
|
229
|
+
for (const methodName of schemaServiceStubMethods) {
|
|
230
|
+
const callPromise = this.schemaServiceStub.then((stub) => (...args) => {
|
|
231
|
+
if (this._terminated) {
|
|
232
|
+
return Promise.reject('The client has already been closed.');
|
|
233
|
+
}
|
|
234
|
+
const func = stub[methodName];
|
|
235
|
+
return func.apply(stub, args);
|
|
236
|
+
}, (err) => () => {
|
|
237
|
+
throw err;
|
|
238
|
+
});
|
|
239
|
+
const descriptor = this.descriptors.page[methodName] || undefined;
|
|
240
|
+
const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
|
|
241
|
+
this.innerApiCalls[methodName] = apiCall;
|
|
242
|
+
}
|
|
243
|
+
return this.schemaServiceStub;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* The DNS address for this API service.
|
|
247
|
+
* @deprecated Use the apiEndpoint method of the client instance.
|
|
248
|
+
* @returns {string} The DNS address for this service.
|
|
249
|
+
*/
|
|
250
|
+
static get servicePath() {
|
|
251
|
+
if (typeof process === 'object' &&
|
|
252
|
+
typeof process.emitWarning === 'function') {
|
|
253
|
+
process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
|
|
254
|
+
}
|
|
255
|
+
return 'pubsub.googleapis.com';
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* The DNS address for this API service - same as servicePath.
|
|
259
|
+
* @deprecated Use the apiEndpoint method of the client instance.
|
|
260
|
+
* @returns {string} The DNS address for this service.
|
|
261
|
+
*/
|
|
262
|
+
static get apiEndpoint() {
|
|
263
|
+
if (typeof process === 'object' &&
|
|
264
|
+
typeof process.emitWarning === 'function') {
|
|
265
|
+
process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
|
|
266
|
+
}
|
|
267
|
+
return 'pubsub.googleapis.com';
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* The DNS address for this API service.
|
|
271
|
+
* @returns {string} The DNS address for this service.
|
|
272
|
+
*/
|
|
273
|
+
get apiEndpoint() {
|
|
274
|
+
return this._servicePath;
|
|
275
|
+
}
|
|
276
|
+
get universeDomain() {
|
|
277
|
+
return this._universeDomain;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* The port for this API service.
|
|
281
|
+
* @returns {number} The default port for this service.
|
|
282
|
+
*/
|
|
283
|
+
static get port() {
|
|
284
|
+
return 443;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* The scopes needed to make gRPC calls for every method defined
|
|
288
|
+
* in this service.
|
|
289
|
+
* @returns {string[]} List of default scopes.
|
|
290
|
+
*/
|
|
291
|
+
static get scopes() {
|
|
292
|
+
return [
|
|
293
|
+
'https://www.googleapis.com/auth/cloud-platform',
|
|
294
|
+
'https://www.googleapis.com/auth/pubsub',
|
|
295
|
+
];
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Return the project ID used by this class.
|
|
299
|
+
* @returns {Promise} A promise that resolves to string containing the project ID.
|
|
300
|
+
*/
|
|
301
|
+
getProjectId(callback) {
|
|
302
|
+
if (callback) {
|
|
303
|
+
this.auth.getProjectId(callback);
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
return this.auth.getProjectId();
|
|
307
|
+
}
|
|
308
|
+
createSchema(request, optionsOrCallback, callback) {
|
|
309
|
+
request = request || {};
|
|
310
|
+
let options;
|
|
311
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
312
|
+
callback = optionsOrCallback;
|
|
313
|
+
options = {};
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
options = optionsOrCallback;
|
|
317
|
+
}
|
|
318
|
+
options = options || {};
|
|
319
|
+
options.otherArgs = options.otherArgs || {};
|
|
320
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
321
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
322
|
+
this._gaxModule.routingHeader.fromParams({
|
|
323
|
+
parent: request.parent ?? '',
|
|
324
|
+
});
|
|
325
|
+
this.initialize().catch((err) => {
|
|
326
|
+
throw err;
|
|
327
|
+
});
|
|
328
|
+
this._log.info('createSchema request %j', request);
|
|
329
|
+
const wrappedCallback = callback
|
|
330
|
+
? (error, response, options, rawResponse) => {
|
|
331
|
+
this._log.info('createSchema response %j', response);
|
|
332
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
333
|
+
}
|
|
334
|
+
: undefined;
|
|
335
|
+
return this.innerApiCalls
|
|
336
|
+
.createSchema(request, options, wrappedCallback)
|
|
337
|
+
?.then(([response, options, rawResponse]) => {
|
|
338
|
+
this._log.info('createSchema response %j', response);
|
|
339
|
+
return [response, options, rawResponse];
|
|
340
|
+
})
|
|
341
|
+
.catch((error) => {
|
|
342
|
+
if (error &&
|
|
343
|
+
'statusDetails' in error &&
|
|
344
|
+
error.statusDetails instanceof Array) {
|
|
345
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
346
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
347
|
+
}
|
|
348
|
+
throw error;
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
getSchema(request, optionsOrCallback, callback) {
|
|
352
|
+
request = request || {};
|
|
353
|
+
let options;
|
|
354
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
355
|
+
callback = optionsOrCallback;
|
|
356
|
+
options = {};
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
options = optionsOrCallback;
|
|
360
|
+
}
|
|
361
|
+
options = options || {};
|
|
362
|
+
options.otherArgs = options.otherArgs || {};
|
|
363
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
364
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
365
|
+
this._gaxModule.routingHeader.fromParams({
|
|
366
|
+
name: request.name ?? '',
|
|
367
|
+
});
|
|
368
|
+
this.initialize().catch((err) => {
|
|
369
|
+
throw err;
|
|
370
|
+
});
|
|
371
|
+
this._log.info('getSchema request %j', request);
|
|
372
|
+
const wrappedCallback = callback
|
|
373
|
+
? (error, response, options, rawResponse) => {
|
|
374
|
+
this._log.info('getSchema response %j', response);
|
|
375
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
376
|
+
}
|
|
377
|
+
: undefined;
|
|
378
|
+
return this.innerApiCalls
|
|
379
|
+
.getSchema(request, options, wrappedCallback)
|
|
380
|
+
?.then(([response, options, rawResponse]) => {
|
|
381
|
+
this._log.info('getSchema response %j', response);
|
|
382
|
+
return [response, options, rawResponse];
|
|
383
|
+
})
|
|
384
|
+
.catch((error) => {
|
|
385
|
+
if (error &&
|
|
386
|
+
'statusDetails' in error &&
|
|
387
|
+
error.statusDetails instanceof Array) {
|
|
388
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
389
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
390
|
+
}
|
|
391
|
+
throw error;
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
commitSchema(request, optionsOrCallback, callback) {
|
|
395
|
+
request = request || {};
|
|
396
|
+
let options;
|
|
397
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
398
|
+
callback = optionsOrCallback;
|
|
399
|
+
options = {};
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
options = optionsOrCallback;
|
|
403
|
+
}
|
|
404
|
+
options = options || {};
|
|
405
|
+
options.otherArgs = options.otherArgs || {};
|
|
406
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
407
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
408
|
+
this._gaxModule.routingHeader.fromParams({
|
|
409
|
+
name: request.name ?? '',
|
|
410
|
+
});
|
|
411
|
+
this.initialize().catch((err) => {
|
|
412
|
+
throw err;
|
|
413
|
+
});
|
|
414
|
+
this._log.info('commitSchema request %j', request);
|
|
415
|
+
const wrappedCallback = callback
|
|
416
|
+
? (error, response, options, rawResponse) => {
|
|
417
|
+
this._log.info('commitSchema response %j', response);
|
|
418
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
419
|
+
}
|
|
420
|
+
: undefined;
|
|
421
|
+
return this.innerApiCalls
|
|
422
|
+
.commitSchema(request, options, wrappedCallback)
|
|
423
|
+
?.then(([response, options, rawResponse]) => {
|
|
424
|
+
this._log.info('commitSchema response %j', response);
|
|
425
|
+
return [response, options, rawResponse];
|
|
426
|
+
})
|
|
427
|
+
.catch((error) => {
|
|
428
|
+
if (error &&
|
|
429
|
+
'statusDetails' in error &&
|
|
430
|
+
error.statusDetails instanceof Array) {
|
|
431
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
432
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
433
|
+
}
|
|
434
|
+
throw error;
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
rollbackSchema(request, optionsOrCallback, callback) {
|
|
438
|
+
request = request || {};
|
|
439
|
+
let options;
|
|
440
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
441
|
+
callback = optionsOrCallback;
|
|
442
|
+
options = {};
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
options = optionsOrCallback;
|
|
446
|
+
}
|
|
447
|
+
options = options || {};
|
|
448
|
+
options.otherArgs = options.otherArgs || {};
|
|
449
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
450
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
451
|
+
this._gaxModule.routingHeader.fromParams({
|
|
452
|
+
name: request.name ?? '',
|
|
453
|
+
});
|
|
454
|
+
this.initialize().catch((err) => {
|
|
455
|
+
throw err;
|
|
456
|
+
});
|
|
457
|
+
this._log.info('rollbackSchema request %j', request);
|
|
458
|
+
const wrappedCallback = callback
|
|
459
|
+
? (error, response, options, rawResponse) => {
|
|
460
|
+
this._log.info('rollbackSchema response %j', response);
|
|
461
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
462
|
+
}
|
|
463
|
+
: undefined;
|
|
464
|
+
return this.innerApiCalls
|
|
465
|
+
.rollbackSchema(request, options, wrappedCallback)
|
|
466
|
+
?.then(([response, options, rawResponse]) => {
|
|
467
|
+
this._log.info('rollbackSchema response %j', response);
|
|
468
|
+
return [response, options, rawResponse];
|
|
469
|
+
})
|
|
470
|
+
.catch((error) => {
|
|
471
|
+
if (error &&
|
|
472
|
+
'statusDetails' in error &&
|
|
473
|
+
error.statusDetails instanceof Array) {
|
|
474
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
475
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
476
|
+
}
|
|
477
|
+
throw error;
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
deleteSchemaRevision(request, optionsOrCallback, callback) {
|
|
481
|
+
request = request || {};
|
|
482
|
+
let options;
|
|
483
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
484
|
+
callback = optionsOrCallback;
|
|
485
|
+
options = {};
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
options = optionsOrCallback;
|
|
489
|
+
}
|
|
490
|
+
options = options || {};
|
|
491
|
+
options.otherArgs = options.otherArgs || {};
|
|
492
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
493
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
494
|
+
this._gaxModule.routingHeader.fromParams({
|
|
495
|
+
name: request.name ?? '',
|
|
496
|
+
});
|
|
497
|
+
this.initialize().catch((err) => {
|
|
498
|
+
throw err;
|
|
499
|
+
});
|
|
500
|
+
this._log.info('deleteSchemaRevision request %j', request);
|
|
501
|
+
const wrappedCallback = callback
|
|
502
|
+
? (error, response, options, rawResponse) => {
|
|
503
|
+
this._log.info('deleteSchemaRevision response %j', response);
|
|
504
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
505
|
+
}
|
|
506
|
+
: undefined;
|
|
507
|
+
return this.innerApiCalls
|
|
508
|
+
.deleteSchemaRevision(request, options, wrappedCallback)
|
|
509
|
+
?.then(([response, options, rawResponse]) => {
|
|
510
|
+
this._log.info('deleteSchemaRevision response %j', response);
|
|
511
|
+
return [response, options, rawResponse];
|
|
512
|
+
})
|
|
513
|
+
.catch((error) => {
|
|
514
|
+
if (error &&
|
|
515
|
+
'statusDetails' in error &&
|
|
516
|
+
error.statusDetails instanceof Array) {
|
|
517
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
518
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
519
|
+
}
|
|
520
|
+
throw error;
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
deleteSchema(request, optionsOrCallback, callback) {
|
|
524
|
+
request = request || {};
|
|
525
|
+
let options;
|
|
526
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
527
|
+
callback = optionsOrCallback;
|
|
528
|
+
options = {};
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
options = optionsOrCallback;
|
|
532
|
+
}
|
|
533
|
+
options = options || {};
|
|
534
|
+
options.otherArgs = options.otherArgs || {};
|
|
535
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
536
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
537
|
+
this._gaxModule.routingHeader.fromParams({
|
|
538
|
+
name: request.name ?? '',
|
|
539
|
+
});
|
|
540
|
+
this.initialize().catch((err) => {
|
|
541
|
+
throw err;
|
|
542
|
+
});
|
|
543
|
+
this._log.info('deleteSchema request %j', request);
|
|
544
|
+
const wrappedCallback = callback
|
|
545
|
+
? (error, response, options, rawResponse) => {
|
|
546
|
+
this._log.info('deleteSchema response %j', response);
|
|
547
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
548
|
+
}
|
|
549
|
+
: undefined;
|
|
550
|
+
return this.innerApiCalls
|
|
551
|
+
.deleteSchema(request, options, wrappedCallback)
|
|
552
|
+
?.then(([response, options, rawResponse]) => {
|
|
553
|
+
this._log.info('deleteSchema response %j', response);
|
|
554
|
+
return [response, options, rawResponse];
|
|
555
|
+
})
|
|
556
|
+
.catch((error) => {
|
|
557
|
+
if (error &&
|
|
558
|
+
'statusDetails' in error &&
|
|
559
|
+
error.statusDetails instanceof Array) {
|
|
560
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
561
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
562
|
+
}
|
|
563
|
+
throw error;
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
validateSchema(request, optionsOrCallback, callback) {
|
|
567
|
+
request = request || {};
|
|
568
|
+
let options;
|
|
569
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
570
|
+
callback = optionsOrCallback;
|
|
571
|
+
options = {};
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
options = optionsOrCallback;
|
|
575
|
+
}
|
|
576
|
+
options = options || {};
|
|
577
|
+
options.otherArgs = options.otherArgs || {};
|
|
578
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
579
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
580
|
+
this._gaxModule.routingHeader.fromParams({
|
|
581
|
+
parent: request.parent ?? '',
|
|
582
|
+
});
|
|
583
|
+
this.initialize().catch((err) => {
|
|
584
|
+
throw err;
|
|
585
|
+
});
|
|
586
|
+
this._log.info('validateSchema request %j', request);
|
|
587
|
+
const wrappedCallback = callback
|
|
588
|
+
? (error, response, options, rawResponse) => {
|
|
589
|
+
this._log.info('validateSchema response %j', response);
|
|
590
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
591
|
+
}
|
|
592
|
+
: undefined;
|
|
593
|
+
return this.innerApiCalls
|
|
594
|
+
.validateSchema(request, options, wrappedCallback)
|
|
595
|
+
?.then(([response, options, rawResponse]) => {
|
|
596
|
+
this._log.info('validateSchema response %j', response);
|
|
597
|
+
return [response, options, rawResponse];
|
|
598
|
+
})
|
|
599
|
+
.catch((error) => {
|
|
600
|
+
if (error &&
|
|
601
|
+
'statusDetails' in error &&
|
|
602
|
+
error.statusDetails instanceof Array) {
|
|
603
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
604
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
605
|
+
}
|
|
606
|
+
throw error;
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
validateMessage(request, optionsOrCallback, callback) {
|
|
610
|
+
request = request || {};
|
|
611
|
+
let options;
|
|
612
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
613
|
+
callback = optionsOrCallback;
|
|
614
|
+
options = {};
|
|
615
|
+
}
|
|
616
|
+
else {
|
|
617
|
+
options = optionsOrCallback;
|
|
618
|
+
}
|
|
619
|
+
options = options || {};
|
|
620
|
+
options.otherArgs = options.otherArgs || {};
|
|
621
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
622
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
623
|
+
this._gaxModule.routingHeader.fromParams({
|
|
624
|
+
parent: request.parent ?? '',
|
|
625
|
+
});
|
|
626
|
+
this.initialize().catch((err) => {
|
|
627
|
+
throw err;
|
|
628
|
+
});
|
|
629
|
+
this._log.info('validateMessage request %j', request);
|
|
630
|
+
const wrappedCallback = callback
|
|
631
|
+
? (error, response, options, rawResponse) => {
|
|
632
|
+
this._log.info('validateMessage response %j', response);
|
|
633
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
634
|
+
}
|
|
635
|
+
: undefined;
|
|
636
|
+
return this.innerApiCalls
|
|
637
|
+
.validateMessage(request, options, wrappedCallback)
|
|
638
|
+
?.then(([response, options, rawResponse]) => {
|
|
639
|
+
this._log.info('validateMessage response %j', response);
|
|
640
|
+
return [response, options, rawResponse];
|
|
641
|
+
})
|
|
642
|
+
.catch((error) => {
|
|
643
|
+
if (error &&
|
|
644
|
+
'statusDetails' in error &&
|
|
645
|
+
error.statusDetails instanceof Array) {
|
|
646
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
647
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
648
|
+
}
|
|
649
|
+
throw error;
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
listSchemas(request, optionsOrCallback, callback) {
|
|
653
|
+
request = request || {};
|
|
654
|
+
let options;
|
|
655
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
656
|
+
callback = optionsOrCallback;
|
|
657
|
+
options = {};
|
|
658
|
+
}
|
|
659
|
+
else {
|
|
660
|
+
options = optionsOrCallback;
|
|
661
|
+
}
|
|
662
|
+
options = options || {};
|
|
663
|
+
options.otherArgs = options.otherArgs || {};
|
|
664
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
665
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
666
|
+
this._gaxModule.routingHeader.fromParams({
|
|
667
|
+
parent: request.parent ?? '',
|
|
668
|
+
});
|
|
669
|
+
this.initialize().catch((err) => {
|
|
670
|
+
throw err;
|
|
671
|
+
});
|
|
672
|
+
const wrappedCallback = callback
|
|
673
|
+
? (error, values, nextPageRequest, rawResponse) => {
|
|
674
|
+
this._log.info('listSchemas values %j', values);
|
|
675
|
+
callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
|
|
676
|
+
}
|
|
677
|
+
: undefined;
|
|
678
|
+
this._log.info('listSchemas request %j', request);
|
|
679
|
+
return this.innerApiCalls
|
|
680
|
+
.listSchemas(request, options, wrappedCallback)
|
|
681
|
+
?.then(([response, input, output]) => {
|
|
682
|
+
this._log.info('listSchemas values %j', response);
|
|
683
|
+
return [response, input, output];
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Equivalent to `listSchemas`, but returns a NodeJS Stream object.
|
|
688
|
+
* @param {Object} request
|
|
689
|
+
* The request object that will be sent.
|
|
690
|
+
* @param {string} request.parent
|
|
691
|
+
* Required. The name of the project in which to list schemas.
|
|
692
|
+
* Format is `projects/{project-id}`.
|
|
693
|
+
* @param {google.pubsub.v1.SchemaView} request.view
|
|
694
|
+
* The set of Schema fields to return in the response. If not set, returns
|
|
695
|
+
* Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
|
|
696
|
+
* retrieve all fields.
|
|
697
|
+
* @param {number} request.pageSize
|
|
698
|
+
* Maximum number of schemas to return.
|
|
699
|
+
* @param {string} request.pageToken
|
|
700
|
+
* The value returned by the last `ListSchemasResponse`; indicates that
|
|
701
|
+
* this is a continuation of a prior `ListSchemas` call, and that the
|
|
702
|
+
* system should return the next page of data.
|
|
703
|
+
* @param {object} [options]
|
|
704
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
705
|
+
* @returns {Stream}
|
|
706
|
+
* An object stream which emits an object representing {@link protos.google.pubsub.v1.Schema|Schema} on 'data' event.
|
|
707
|
+
* The client library will perform auto-pagination by default: it will call the API as many
|
|
708
|
+
* times as needed. Note that it can affect your quota.
|
|
709
|
+
* We recommend using `listSchemasAsync()`
|
|
710
|
+
* method described below for async iteration which you can stop as needed.
|
|
711
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
712
|
+
* for more details and examples.
|
|
713
|
+
*/
|
|
714
|
+
listSchemasStream(request, options) {
|
|
715
|
+
request = request || {};
|
|
716
|
+
options = options || {};
|
|
717
|
+
options.otherArgs = options.otherArgs || {};
|
|
718
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
719
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
720
|
+
this._gaxModule.routingHeader.fromParams({
|
|
721
|
+
parent: request.parent ?? '',
|
|
722
|
+
});
|
|
723
|
+
const defaultCallSettings = this._defaults['listSchemas'];
|
|
724
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
725
|
+
this.initialize().catch((err) => {
|
|
726
|
+
throw err;
|
|
727
|
+
});
|
|
728
|
+
this._log.info('listSchemas stream %j', request);
|
|
729
|
+
return this.descriptors.page.listSchemas.createStream(this.innerApiCalls.listSchemas, request, callSettings);
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Equivalent to `listSchemas`, but returns an iterable object.
|
|
733
|
+
*
|
|
734
|
+
* `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
|
|
735
|
+
* @param {Object} request
|
|
736
|
+
* The request object that will be sent.
|
|
737
|
+
* @param {string} request.parent
|
|
738
|
+
* Required. The name of the project in which to list schemas.
|
|
739
|
+
* Format is `projects/{project-id}`.
|
|
740
|
+
* @param {google.pubsub.v1.SchemaView} request.view
|
|
741
|
+
* The set of Schema fields to return in the response. If not set, returns
|
|
742
|
+
* Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
|
|
743
|
+
* retrieve all fields.
|
|
744
|
+
* @param {number} request.pageSize
|
|
745
|
+
* Maximum number of schemas to return.
|
|
746
|
+
* @param {string} request.pageToken
|
|
747
|
+
* The value returned by the last `ListSchemasResponse`; indicates that
|
|
748
|
+
* this is a continuation of a prior `ListSchemas` call, and that the
|
|
749
|
+
* system should return the next page of data.
|
|
750
|
+
* @param {object} [options]
|
|
751
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
752
|
+
* @returns {Object}
|
|
753
|
+
* An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
|
|
754
|
+
* When you iterate the returned iterable, each element will be an object representing
|
|
755
|
+
* {@link protos.google.pubsub.v1.Schema|Schema}. The API will be called under the hood as needed, once per the page,
|
|
756
|
+
* so you can stop the iteration when you don't need more results.
|
|
757
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
758
|
+
* for more details and examples.
|
|
759
|
+
* @example <caption>include:samples/generated/v1/schema_service.list_schemas.js</caption>
|
|
760
|
+
* region_tag:pubsub_v1_generated_SchemaService_ListSchemas_async
|
|
761
|
+
*/
|
|
762
|
+
listSchemasAsync(request, options) {
|
|
763
|
+
request = request || {};
|
|
764
|
+
options = options || {};
|
|
765
|
+
options.otherArgs = options.otherArgs || {};
|
|
766
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
767
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
768
|
+
this._gaxModule.routingHeader.fromParams({
|
|
769
|
+
parent: request.parent ?? '',
|
|
770
|
+
});
|
|
771
|
+
const defaultCallSettings = this._defaults['listSchemas'];
|
|
772
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
773
|
+
this.initialize().catch((err) => {
|
|
774
|
+
throw err;
|
|
775
|
+
});
|
|
776
|
+
this._log.info('listSchemas iterate %j', request);
|
|
777
|
+
return this.descriptors.page.listSchemas.asyncIterate(this.innerApiCalls['listSchemas'], request, callSettings);
|
|
778
|
+
}
|
|
779
|
+
listSchemaRevisions(request, optionsOrCallback, callback) {
|
|
780
|
+
request = request || {};
|
|
781
|
+
let options;
|
|
782
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
783
|
+
callback = optionsOrCallback;
|
|
784
|
+
options = {};
|
|
785
|
+
}
|
|
786
|
+
else {
|
|
787
|
+
options = optionsOrCallback;
|
|
788
|
+
}
|
|
789
|
+
options = options || {};
|
|
790
|
+
options.otherArgs = options.otherArgs || {};
|
|
791
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
792
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
793
|
+
this._gaxModule.routingHeader.fromParams({
|
|
794
|
+
name: request.name ?? '',
|
|
795
|
+
});
|
|
796
|
+
this.initialize().catch((err) => {
|
|
797
|
+
throw err;
|
|
798
|
+
});
|
|
799
|
+
const wrappedCallback = callback
|
|
800
|
+
? (error, values, nextPageRequest, rawResponse) => {
|
|
801
|
+
this._log.info('listSchemaRevisions values %j', values);
|
|
802
|
+
callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
|
|
803
|
+
}
|
|
804
|
+
: undefined;
|
|
805
|
+
this._log.info('listSchemaRevisions request %j', request);
|
|
806
|
+
return this.innerApiCalls
|
|
807
|
+
.listSchemaRevisions(request, options, wrappedCallback)
|
|
808
|
+
?.then(([response, input, output]) => {
|
|
809
|
+
this._log.info('listSchemaRevisions values %j', response);
|
|
810
|
+
return [response, input, output];
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Equivalent to `listSchemaRevisions`, but returns a NodeJS Stream object.
|
|
815
|
+
* @param {Object} request
|
|
816
|
+
* The request object that will be sent.
|
|
817
|
+
* @param {string} request.name
|
|
818
|
+
* Required. The name of the schema to list revisions for.
|
|
819
|
+
* @param {google.pubsub.v1.SchemaView} request.view
|
|
820
|
+
* The set of Schema fields to return in the response. If not set, returns
|
|
821
|
+
* Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
|
|
822
|
+
* retrieve all fields.
|
|
823
|
+
* @param {number} request.pageSize
|
|
824
|
+
* The maximum number of revisions to return per page.
|
|
825
|
+
* @param {string} request.pageToken
|
|
826
|
+
* The page token, received from a previous ListSchemaRevisions call.
|
|
827
|
+
* Provide this to retrieve the subsequent page.
|
|
828
|
+
* @param {object} [options]
|
|
829
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
830
|
+
* @returns {Stream}
|
|
831
|
+
* An object stream which emits an object representing {@link protos.google.pubsub.v1.Schema|Schema} on 'data' event.
|
|
832
|
+
* The client library will perform auto-pagination by default: it will call the API as many
|
|
833
|
+
* times as needed. Note that it can affect your quota.
|
|
834
|
+
* We recommend using `listSchemaRevisionsAsync()`
|
|
835
|
+
* method described below for async iteration which you can stop as needed.
|
|
836
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
837
|
+
* for more details and examples.
|
|
838
|
+
*/
|
|
839
|
+
listSchemaRevisionsStream(request, options) {
|
|
840
|
+
request = request || {};
|
|
841
|
+
options = options || {};
|
|
842
|
+
options.otherArgs = options.otherArgs || {};
|
|
843
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
844
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
845
|
+
this._gaxModule.routingHeader.fromParams({
|
|
846
|
+
name: request.name ?? '',
|
|
847
|
+
});
|
|
848
|
+
const defaultCallSettings = this._defaults['listSchemaRevisions'];
|
|
849
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
850
|
+
this.initialize().catch((err) => {
|
|
851
|
+
throw err;
|
|
852
|
+
});
|
|
853
|
+
this._log.info('listSchemaRevisions stream %j', request);
|
|
854
|
+
return this.descriptors.page.listSchemaRevisions.createStream(this.innerApiCalls.listSchemaRevisions, request, callSettings);
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Equivalent to `listSchemaRevisions`, but returns an iterable object.
|
|
858
|
+
*
|
|
859
|
+
* `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
|
|
860
|
+
* @param {Object} request
|
|
861
|
+
* The request object that will be sent.
|
|
862
|
+
* @param {string} request.name
|
|
863
|
+
* Required. The name of the schema to list revisions for.
|
|
864
|
+
* @param {google.pubsub.v1.SchemaView} request.view
|
|
865
|
+
* The set of Schema fields to return in the response. If not set, returns
|
|
866
|
+
* Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
|
|
867
|
+
* retrieve all fields.
|
|
868
|
+
* @param {number} request.pageSize
|
|
869
|
+
* The maximum number of revisions to return per page.
|
|
870
|
+
* @param {string} request.pageToken
|
|
871
|
+
* The page token, received from a previous ListSchemaRevisions call.
|
|
872
|
+
* Provide this to retrieve the subsequent page.
|
|
873
|
+
* @param {object} [options]
|
|
874
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
875
|
+
* @returns {Object}
|
|
876
|
+
* An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
|
|
877
|
+
* When you iterate the returned iterable, each element will be an object representing
|
|
878
|
+
* {@link protos.google.pubsub.v1.Schema|Schema}. The API will be called under the hood as needed, once per the page,
|
|
879
|
+
* so you can stop the iteration when you don't need more results.
|
|
880
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
881
|
+
* for more details and examples.
|
|
882
|
+
* @example <caption>include:samples/generated/v1/schema_service.list_schema_revisions.js</caption>
|
|
883
|
+
* region_tag:pubsub_v1_generated_SchemaService_ListSchemaRevisions_async
|
|
884
|
+
*/
|
|
885
|
+
listSchemaRevisionsAsync(request, options) {
|
|
886
|
+
request = request || {};
|
|
887
|
+
options = options || {};
|
|
888
|
+
options.otherArgs = options.otherArgs || {};
|
|
889
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
890
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
891
|
+
this._gaxModule.routingHeader.fromParams({
|
|
892
|
+
name: request.name ?? '',
|
|
893
|
+
});
|
|
894
|
+
const defaultCallSettings = this._defaults['listSchemaRevisions'];
|
|
895
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
896
|
+
this.initialize().catch((err) => {
|
|
897
|
+
throw err;
|
|
898
|
+
});
|
|
899
|
+
this._log.info('listSchemaRevisions iterate %j', request);
|
|
900
|
+
return this.descriptors.page.listSchemaRevisions.asyncIterate(this.innerApiCalls['listSchemaRevisions'], request, callSettings);
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Gets the access control policy for a resource. Returns an empty policy
|
|
904
|
+
* if the resource exists and does not have a policy set.
|
|
905
|
+
*
|
|
906
|
+
* @param {Object} request
|
|
907
|
+
* The request object that will be sent.
|
|
908
|
+
* @param {string} request.resource
|
|
909
|
+
* REQUIRED: The resource for which the policy is being requested.
|
|
910
|
+
* See the operation documentation for the appropriate value for this field.
|
|
911
|
+
* @param {Object} [request.options]
|
|
912
|
+
* OPTIONAL: A `GetPolicyOptions` object for specifying options to
|
|
913
|
+
* `GetIamPolicy`. This field is only used by Cloud IAM.
|
|
914
|
+
*
|
|
915
|
+
* This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}.
|
|
916
|
+
* @param {Object} [options]
|
|
917
|
+
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
|
918
|
+
* retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details.
|
|
919
|
+
* @param {function(?Error, ?Object)} [callback]
|
|
920
|
+
* The function which will be called with the result of the API call.
|
|
921
|
+
*
|
|
922
|
+
* The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}.
|
|
923
|
+
* @returns {Promise} - The promise which resolves to an array.
|
|
924
|
+
* The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}.
|
|
925
|
+
* The promise has a method named "cancel" which cancels the ongoing API call.
|
|
926
|
+
*/
|
|
927
|
+
getIamPolicy(request, options, callback) {
|
|
928
|
+
return this.iamClient.getIamPolicy(request, options, callback);
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Returns permissions that a caller has on the specified resource. If the
|
|
932
|
+
* resource does not exist, this will return an empty set of
|
|
933
|
+
* permissions, not a NOT_FOUND error.
|
|
934
|
+
*
|
|
935
|
+
* Note: This operation is designed to be used for building
|
|
936
|
+
* permission-aware UIs and command-line tools, not for authorization
|
|
937
|
+
* checking. This operation may "fail open" without warning.
|
|
938
|
+
*
|
|
939
|
+
* @param {Object} request
|
|
940
|
+
* The request object that will be sent.
|
|
941
|
+
* @param {string} request.resource
|
|
942
|
+
* REQUIRED: The resource for which the policy detail is being requested.
|
|
943
|
+
* See the operation documentation for the appropriate value for this field.
|
|
944
|
+
* @param {string[]} request.permissions
|
|
945
|
+
* The set of permissions to check for the `resource`. Permissions with
|
|
946
|
+
* wildcards (such as '*' or 'storage.*') are not allowed. For more
|
|
947
|
+
* information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }.
|
|
948
|
+
* @param {Object} [options]
|
|
949
|
+
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
|
950
|
+
* retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details.
|
|
951
|
+
* @param {function(?Error, ?Object)} [callback]
|
|
952
|
+
* The function which will be called with the result of the API call.
|
|
953
|
+
*
|
|
954
|
+
* The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}.
|
|
955
|
+
* @returns {Promise} - The promise which resolves to an array.
|
|
956
|
+
* The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}.
|
|
957
|
+
* The promise has a method named "cancel" which cancels the ongoing API call.
|
|
958
|
+
*/
|
|
959
|
+
setIamPolicy(request, options, callback) {
|
|
960
|
+
return this.iamClient.setIamPolicy(request, options, callback);
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Returns permissions that a caller has on the specified resource. If the
|
|
964
|
+
* resource does not exist, this will return an empty set of
|
|
965
|
+
* permissions, not a NOT_FOUND error.
|
|
966
|
+
*
|
|
967
|
+
* Note: This operation is designed to be used for building
|
|
968
|
+
* permission-aware UIs and command-line tools, not for authorization
|
|
969
|
+
* checking. This operation may "fail open" without warning.
|
|
970
|
+
*
|
|
971
|
+
* @param {Object} request
|
|
972
|
+
* The request object that will be sent.
|
|
973
|
+
* @param {string} request.resource
|
|
974
|
+
* REQUIRED: The resource for which the policy detail is being requested.
|
|
975
|
+
* See the operation documentation for the appropriate value for this field.
|
|
976
|
+
* @param {string[]} request.permissions
|
|
977
|
+
* The set of permissions to check for the `resource`. Permissions with
|
|
978
|
+
* wildcards (such as '*' or 'storage.*') are not allowed. For more
|
|
979
|
+
* information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }.
|
|
980
|
+
* @param {Object} [options]
|
|
981
|
+
* Optional parameters. You can override the default settings for this call, e.g, timeout,
|
|
982
|
+
* retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details.
|
|
983
|
+
* @param {function(?Error, ?Object)} [callback]
|
|
984
|
+
* The function which will be called with the result of the API call.
|
|
985
|
+
*
|
|
986
|
+
* The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}.
|
|
987
|
+
* @returns {Promise} - The promise which resolves to an array.
|
|
988
|
+
* The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}.
|
|
989
|
+
* The promise has a method named "cancel" which cancels the ongoing API call.
|
|
990
|
+
*
|
|
991
|
+
*/
|
|
992
|
+
testIamPermissions(request, options, callback) {
|
|
993
|
+
return this.iamClient.testIamPermissions(request, options, callback);
|
|
994
|
+
}
|
|
995
|
+
// --------------------
|
|
996
|
+
// -- Path templates --
|
|
997
|
+
// --------------------
|
|
998
|
+
/**
|
|
999
|
+
* Return a fully-qualified project resource name string.
|
|
1000
|
+
*
|
|
1001
|
+
* @param {string} project
|
|
1002
|
+
* @returns {string} Resource name string.
|
|
1003
|
+
*/
|
|
1004
|
+
projectPath(project) {
|
|
1005
|
+
return this.pathTemplates.projectPathTemplate.render({
|
|
1006
|
+
project: project,
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Parse the project from Project resource.
|
|
1011
|
+
*
|
|
1012
|
+
* @param {string} projectName
|
|
1013
|
+
* A fully-qualified path representing Project resource.
|
|
1014
|
+
* @returns {string} A string representing the project.
|
|
1015
|
+
*/
|
|
1016
|
+
matchProjectFromProjectName(projectName) {
|
|
1017
|
+
return this.pathTemplates.projectPathTemplate.match(projectName).project;
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Return a fully-qualified projectTopics resource name string.
|
|
1021
|
+
*
|
|
1022
|
+
* @param {string} project
|
|
1023
|
+
* @param {string} topic
|
|
1024
|
+
* @returns {string} Resource name string.
|
|
1025
|
+
*/
|
|
1026
|
+
projectTopicsPath(project, topic) {
|
|
1027
|
+
return this.pathTemplates.projectTopicsPathTemplate.render({
|
|
1028
|
+
project: project,
|
|
1029
|
+
topic: topic,
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Parse the project from ProjectTopics resource.
|
|
1034
|
+
*
|
|
1035
|
+
* @param {string} projectTopicsName
|
|
1036
|
+
* A fully-qualified path representing project_topics resource.
|
|
1037
|
+
* @returns {string} A string representing the project.
|
|
1038
|
+
*/
|
|
1039
|
+
matchProjectFromProjectTopicsName(projectTopicsName) {
|
|
1040
|
+
return this.pathTemplates.projectTopicsPathTemplate.match(projectTopicsName)
|
|
1041
|
+
.project;
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Parse the topic from ProjectTopics resource.
|
|
1045
|
+
*
|
|
1046
|
+
* @param {string} projectTopicsName
|
|
1047
|
+
* A fully-qualified path representing project_topics resource.
|
|
1048
|
+
* @returns {string} A string representing the topic.
|
|
1049
|
+
*/
|
|
1050
|
+
matchTopicFromProjectTopicsName(projectTopicsName) {
|
|
1051
|
+
return this.pathTemplates.projectTopicsPathTemplate.match(projectTopicsName)
|
|
1052
|
+
.topic;
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Return a fully-qualified schema resource name string.
|
|
1056
|
+
*
|
|
1057
|
+
* @param {string} project
|
|
1058
|
+
* @param {string} schema
|
|
1059
|
+
* @returns {string} Resource name string.
|
|
1060
|
+
*/
|
|
1061
|
+
schemaPath(project, schema) {
|
|
1062
|
+
return this.pathTemplates.schemaPathTemplate.render({
|
|
1063
|
+
project: project,
|
|
1064
|
+
schema: schema,
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
/**
|
|
1068
|
+
* Parse the project from Schema resource.
|
|
1069
|
+
*
|
|
1070
|
+
* @param {string} schemaName
|
|
1071
|
+
* A fully-qualified path representing Schema resource.
|
|
1072
|
+
* @returns {string} A string representing the project.
|
|
1073
|
+
*/
|
|
1074
|
+
matchProjectFromSchemaName(schemaName) {
|
|
1075
|
+
return this.pathTemplates.schemaPathTemplate.match(schemaName).project;
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* Parse the schema from Schema resource.
|
|
1079
|
+
*
|
|
1080
|
+
* @param {string} schemaName
|
|
1081
|
+
* A fully-qualified path representing Schema resource.
|
|
1082
|
+
* @returns {string} A string representing the schema.
|
|
1083
|
+
*/
|
|
1084
|
+
matchSchemaFromSchemaName(schemaName) {
|
|
1085
|
+
return this.pathTemplates.schemaPathTemplate.match(schemaName).schema;
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* Return a fully-qualified snapshot resource name string.
|
|
1089
|
+
*
|
|
1090
|
+
* @param {string} project
|
|
1091
|
+
* @param {string} snapshot
|
|
1092
|
+
* @returns {string} Resource name string.
|
|
1093
|
+
*/
|
|
1094
|
+
snapshotPath(project, snapshot) {
|
|
1095
|
+
return this.pathTemplates.snapshotPathTemplate.render({
|
|
1096
|
+
project: project,
|
|
1097
|
+
snapshot: snapshot,
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* Parse the project from Snapshot resource.
|
|
1102
|
+
*
|
|
1103
|
+
* @param {string} snapshotName
|
|
1104
|
+
* A fully-qualified path representing Snapshot resource.
|
|
1105
|
+
* @returns {string} A string representing the project.
|
|
1106
|
+
*/
|
|
1107
|
+
matchProjectFromSnapshotName(snapshotName) {
|
|
1108
|
+
return this.pathTemplates.snapshotPathTemplate.match(snapshotName).project;
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Parse the snapshot from Snapshot resource.
|
|
1112
|
+
*
|
|
1113
|
+
* @param {string} snapshotName
|
|
1114
|
+
* A fully-qualified path representing Snapshot resource.
|
|
1115
|
+
* @returns {string} A string representing the snapshot.
|
|
1116
|
+
*/
|
|
1117
|
+
matchSnapshotFromSnapshotName(snapshotName) {
|
|
1118
|
+
return this.pathTemplates.snapshotPathTemplate.match(snapshotName).snapshot;
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Return a fully-qualified subscription resource name string.
|
|
1122
|
+
*
|
|
1123
|
+
* @param {string} project
|
|
1124
|
+
* @param {string} subscription
|
|
1125
|
+
* @returns {string} Resource name string.
|
|
1126
|
+
*/
|
|
1127
|
+
subscriptionPath(project, subscription) {
|
|
1128
|
+
return this.pathTemplates.subscriptionPathTemplate.render({
|
|
1129
|
+
project: project,
|
|
1130
|
+
subscription: subscription,
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
/**
|
|
1134
|
+
* Parse the project from Subscription resource.
|
|
1135
|
+
*
|
|
1136
|
+
* @param {string} subscriptionName
|
|
1137
|
+
* A fully-qualified path representing Subscription resource.
|
|
1138
|
+
* @returns {string} A string representing the project.
|
|
1139
|
+
*/
|
|
1140
|
+
matchProjectFromSubscriptionName(subscriptionName) {
|
|
1141
|
+
return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName)
|
|
1142
|
+
.project;
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Parse the subscription from Subscription resource.
|
|
1146
|
+
*
|
|
1147
|
+
* @param {string} subscriptionName
|
|
1148
|
+
* A fully-qualified path representing Subscription resource.
|
|
1149
|
+
* @returns {string} A string representing the subscription.
|
|
1150
|
+
*/
|
|
1151
|
+
matchSubscriptionFromSubscriptionName(subscriptionName) {
|
|
1152
|
+
return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName)
|
|
1153
|
+
.subscription;
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* Terminate the gRPC channel and close the client.
|
|
1157
|
+
*
|
|
1158
|
+
* The client will no longer be usable and all future behavior is undefined.
|
|
1159
|
+
* @returns {Promise} A promise that resolves when the client is closed.
|
|
1160
|
+
*/
|
|
1161
|
+
close() {
|
|
1162
|
+
if (this.schemaServiceStub && !this._terminated) {
|
|
1163
|
+
return this.schemaServiceStub.then((stub) => {
|
|
1164
|
+
this._log.info('ending gRPC channel');
|
|
1165
|
+
this._terminated = true;
|
|
1166
|
+
stub.close();
|
|
1167
|
+
this.iamClient.close().catch((err) => {
|
|
1168
|
+
throw err;
|
|
1169
|
+
});
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
return Promise.resolve();
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
exports.SchemaServiceClient = SchemaServiceClient;
|
|
1176
|
+
//# sourceMappingURL=schema_service_client.js.map
|