Skip to content
This repository was archived by the owner on Mar 11, 2026. It is now read-only.

Commit e702831

Browse files
feat: support regapic LRO
PiperOrigin-RevId: 456946341 Source-Link: googleapis/googleapis@88fd18d Source-Link: googleapis/googleapis-gen@accfa37 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWNjZmEzNzFmNjY3NDM5MzEzMzM1YzY0MDQyYjA2M2MxYzUzMTAyZSJ9 Source-Link: googleapis/googleapis@ae65014 Source-Link: googleapis/googleapis-gen@b09ede4 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjA5ZWRlNDM1Y2NlMTEwNDQ2ZDRhYjlmNjJhMDgxYjU3MWQzN2UzZiJ9 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 503216a commit e702831

4 files changed

Lines changed: 70 additions & 31 deletions

File tree

.jsdoc.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ module.exports = {
4646
systemName: '@google-cloud/logging',
4747
theme: 'lumen',
4848
default: {
49-
outputSourceFiles: false,
50-
staticFiles: {
51-
include: [
52-
'_static'
53-
]
54-
}
49+
outputSourceFiles: false
5550
}
5651
},
5752
markdown: {

src/v2/config_service_v2_client.ts

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
CallOptions,
2424
Descriptors,
2525
ClientOptions,
26+
GrpcClientOptions,
2627
LROperation,
2728
PaginationCallback,
2829
GaxCall,
@@ -72,7 +73,7 @@ export class ConfigServiceV2Client {
7273
*
7374
* @param {object} [options] - The configuration object.
7475
* The options accepted by the constructor are described in detail
75-
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
76+
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
7677
* The common options are:
7778
* @param {object} [options.credentials] - Credentials object.
7879
* @param {string} [options.credentials.client_email]
@@ -95,11 +96,10 @@ export class ConfigServiceV2Client {
9596
* API remote host.
9697
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
9798
* Follows the structure of {@link gapicConfig}.
98-
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
99-
* In fallback mode, a special browser-compatible transport implementation is used
100-
* instead of gRPC transport. In browser context (if the `window` object is defined)
101-
* the fallback mode is enabled automatically; set `options.fallback` to `false`
102-
* if you need to override this behavior.
99+
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
100+
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
101+
* For more information, please check the
102+
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
103103
*/
104104
constructor(opts?: ClientOptions) {
105105
// Ensure that options include all the required fields.
@@ -291,16 +291,63 @@ export class ConfigServiceV2Client {
291291
};
292292

293293
const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
294-
295294
// This API contains "long-running operations", which return a
296295
// an Operation object that allows for tracking of the operation,
297296
// rather than holding a request open.
298-
297+
const lroOptions: GrpcClientOptions = {
298+
auth: this.auth,
299+
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
300+
};
301+
if (opts.fallback === 'rest') {
302+
lroOptions.protoJson = protoFilesRoot;
303+
lroOptions.httpRules = [
304+
{
305+
selector: 'google.longrunning.Operations.CancelOperation',
306+
post: '/v2/{name=*/*/locations/*/operations/*}:cancel',
307+
body: '*',
308+
additional_bindings: [
309+
{
310+
post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',
311+
body: '*',
312+
},
313+
{
314+
post: '/v2/{name=organizations/*/locations/*/operations/*}:cancel',
315+
body: '*',
316+
},
317+
{
318+
post: '/v2/{name=folders/*/locations/*/operations/*}:cancel',
319+
body: '*',
320+
},
321+
{
322+
post: '/v2/{name=billingAccounts/*/locations/*/operations/*}:cancel',
323+
body: '*',
324+
},
325+
],
326+
},
327+
{
328+
selector: 'google.longrunning.Operations.GetOperation',
329+
get: '/v2/{name=*/*/locations/*/operations/*}',
330+
additional_bindings: [
331+
{get: '/v2/{name=projects/*/locations/*/operations/*}'},
332+
{get: '/v2/{name=organizations/*/locations/*/operations/*}'},
333+
{get: '/v2/{name=folders/*/locations/*/operations/*}'},
334+
{get: '/v2/{name=billingAccounts/*/operations/*}'},
335+
],
336+
},
337+
{
338+
selector: 'google.longrunning.Operations.ListOperations',
339+
get: '/v2/{name=*/*/locations/*}/operations',
340+
additional_bindings: [
341+
{get: '/v2/{name=projects/*/locations/*}/operations'},
342+
{get: '/v2/{name=organizations/*/locations/*}/operations'},
343+
{get: '/v2/{name=folders/*/locations/*}/operations'},
344+
{get: '/v2/{name=billingAccounts/*/locations/*}/operations'},
345+
],
346+
},
347+
];
348+
}
299349
this.operationsClient = this._gaxModule
300-
.lro({
301-
auth: this.auth,
302-
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
303-
})
350+
.lro(lroOptions)
304351
.operationsClient(opts);
305352
const copyLogEntriesResponse = protoFilesRoot.lookup(
306353
'.google.logging.v2.CopyLogEntriesResponse'

src/v2/logging_service_v2_client.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class LoggingServiceV2Client {
7272
*
7373
* @param {object} [options] - The configuration object.
7474
* The options accepted by the constructor are described in detail
75-
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
75+
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
7676
* The common options are:
7777
* @param {object} [options.credentials] - Credentials object.
7878
* @param {string} [options.credentials.client_email]
@@ -95,11 +95,10 @@ export class LoggingServiceV2Client {
9595
* API remote host.
9696
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
9797
* Follows the structure of {@link gapicConfig}.
98-
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
99-
* In fallback mode, a special browser-compatible transport implementation is used
100-
* instead of gRPC transport. In browser context (if the `window` object is defined)
101-
* the fallback mode is enabled automatically; set `options.fallback` to `false`
102-
* if you need to override this behavior.
98+
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
99+
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
100+
* For more information, please check the
101+
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
103102
*/
104103
constructor(opts?: ClientOptions) {
105104
// Ensure that options include all the required fields.
@@ -292,7 +291,6 @@ export class LoggingServiceV2Client {
292291
};
293292

294293
const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
295-
296294
// Some methods on this API support automatically batching
297295
// requests; denote this.
298296

src/v2/metrics_service_v2_client.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class MetricsServiceV2Client {
7070
*
7171
* @param {object} [options] - The configuration object.
7272
* The options accepted by the constructor are described in detail
73-
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
73+
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
7474
* The common options are:
7575
* @param {object} [options.credentials] - Credentials object.
7676
* @param {string} [options.credentials.client_email]
@@ -93,11 +93,10 @@ export class MetricsServiceV2Client {
9393
* API remote host.
9494
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
9595
* Follows the structure of {@link gapicConfig}.
96-
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
97-
* In fallback mode, a special browser-compatible transport implementation is used
98-
* instead of gRPC transport. In browser context (if the `window` object is defined)
99-
* the fallback mode is enabled automatically; set `options.fallback` to `false`
100-
* if you need to override this behavior.
96+
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
97+
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
98+
* For more information, please check the
99+
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
101100
*/
102101
constructor(opts?: ClientOptions) {
103102
// Ensure that options include all the required fields.

0 commit comments

Comments
 (0)