Skip to content

Commit c0c287e

Browse files
authoredFeb 6, 2024
feat: Trusted Private Cloud support, use the universeDomain parameter (#1386)
* feat: Trusted Private Cloud support, use the universeDomain parameter feat: auto populate UUID fields where needed fix: revert changes to streaming retries Use gapic-generator-typescript v4.4.0. PiperOrigin-RevId: 603757799 Source-Link: googleapis/googleapis@1a45bf7 Source-Link: googleapis/googleapis-gen@19ca4b4 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTljYTRiNDVhNTNkMDBjYjdiZGQ5NGI0NDJiNjBiZDIzN2RmZTEyMyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent d30e513 commit c0c287e

11 files changed

+374
-66
lines changed
 

‎samples/generated/v2/bigtable_instance_admin.list_app_profiles.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function main(parent) {
6464
};
6565

6666
// Run request
67-
const iterable = await adminClient.listAppProfilesAsync(request);
67+
const iterable = adminClient.listAppProfilesAsync(request);
6868
for await (const response of iterable) {
6969
console.log(response);
7070
}

‎samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function main(parent) {
7575
};
7676

7777
// Run request
78-
const iterable = await adminClient.listHotTabletsAsync(request);
78+
const iterable = adminClient.listHotTabletsAsync(request);
7979
for await (const response of iterable) {
8080
console.log(response);
8181
}

‎samples/generated/v2/bigtable_table_admin.list_backups.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function main(parent) {
114114
};
115115

116116
// Run request
117-
const iterable = await adminClient.listBackupsAsync(request);
117+
const iterable = adminClient.listBackupsAsync(request);
118118
for await (const response of iterable) {
119119
console.log(response);
120120
}

‎samples/generated/v2/bigtable_table_admin.list_snapshots.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function main(parent) {
5959
};
6060

6161
// Run request
62-
const iterable = await adminClient.listSnapshotsAsync(request);
62+
const iterable = adminClient.listSnapshotsAsync(request);
6363
for await (const response of iterable) {
6464
console.log(response);
6565
}

‎samples/generated/v2/bigtable_table_admin.list_tables.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function main(parent) {
6666
};
6767

6868
// Run request
69-
const iterable = await adminClient.listTablesAsync(request);
69+
const iterable = adminClient.listTablesAsync(request);
7070
for await (const response of iterable) {
7171
console.log(response);
7272
}

‎src/v2/bigtable_client.ts

+65-10
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import type {
2727
import {PassThrough} from 'stream';
2828
import * as protos from '../../protos/protos';
2929
import jsonProtos = require('../../protos/protos.json');
30+
3031
/**
3132
* Client JSON configuration object, loaded from
3233
* `src/v2/bigtable_client_config.json`.
@@ -48,6 +49,8 @@ export class BigtableClient {
4849
private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient;
4950
private _protos: {};
5051
private _defaults: {[method: string]: gax.CallSettings};
52+
private _universeDomain: string;
53+
private _servicePath: string;
5154
auth: gax.GoogleAuth;
5255
descriptors: Descriptors = {
5356
page: {},
@@ -105,8 +108,20 @@ export class BigtableClient {
105108
) {
106109
// Ensure that options include all the required fields.
107110
const staticMembers = this.constructor as typeof BigtableClient;
111+
if (
112+
opts?.universe_domain &&
113+
opts?.universeDomain &&
114+
opts?.universe_domain !== opts?.universeDomain
115+
) {
116+
throw new Error(
117+
'Please set either universe_domain or universeDomain, but not both.'
118+
);
119+
}
120+
this._universeDomain =
121+
opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com';
122+
this._servicePath = 'bigtable.' + this._universeDomain;
108123
const servicePath =
109-
opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath;
124+
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
110125
this._providedCustomServicePath = !!(
111126
opts?.servicePath || opts?.apiEndpoint
112127
);
@@ -121,7 +136,7 @@ export class BigtableClient {
121136
opts.numericEnums = true;
122137

123138
// If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
124-
if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
139+
if (servicePath !== this._servicePath && !('scopes' in opts)) {
125140
opts['scopes'] = staticMembers.scopes;
126141
}
127142

@@ -146,10 +161,10 @@ export class BigtableClient {
146161
this.auth.useJWTAccessWithScope = true;
147162

148163
// Set defaultServicePath on the auth object.
149-
this.auth.defaultServicePath = staticMembers.servicePath;
164+
this.auth.defaultServicePath = this._servicePath;
150165

151166
// Set the default scopes in auth client if needed.
152-
if (servicePath === staticMembers.servicePath) {
167+
if (servicePath === this._servicePath) {
153168
this.auth.defaultScopes = staticMembers.scopes;
154169
}
155170

@@ -189,28 +204,28 @@ export class BigtableClient {
189204
readRows: new this._gaxModule.StreamDescriptor(
190205
this._gaxModule.StreamType.SERVER_STREAMING,
191206
!!opts.fallback,
192-
/* gaxStreamingRetries: */ true
207+
/* gaxStreamingRetries: */ false
193208
),
194209
sampleRowKeys: new this._gaxModule.StreamDescriptor(
195210
this._gaxModule.StreamType.SERVER_STREAMING,
196211
!!opts.fallback,
197-
/* gaxStreamingRetries: */ true
212+
/* gaxStreamingRetries: */ false
198213
),
199214
mutateRows: new this._gaxModule.StreamDescriptor(
200215
this._gaxModule.StreamType.SERVER_STREAMING,
201216
!!opts.fallback,
202-
/* gaxStreamingRetries: */ true
217+
/* gaxStreamingRetries: */ false
203218
),
204219
generateInitialChangeStreamPartitions:
205220
new this._gaxModule.StreamDescriptor(
206221
this._gaxModule.StreamType.SERVER_STREAMING,
207222
!!opts.fallback,
208-
/* gaxStreamingRetries: */ true
223+
/* gaxStreamingRetries: */ false
209224
),
210225
readChangeStream: new this._gaxModule.StreamDescriptor(
211226
this._gaxModule.StreamType.SERVER_STREAMING,
212227
!!opts.fallback,
213-
/* gaxStreamingRetries: */ true
228+
/* gaxStreamingRetries: */ false
214229
),
215230
};
216231

@@ -317,21 +332,61 @@ export class BigtableClient {
317332

318333
/**
319334
* The DNS address for this API service.
335+
* @deprecated
320336
* @returns {string} The DNS address for this service.
321337
*/
322338
static get servicePath() {
339+
if (
340+
typeof process !== undefined &&
341+
typeof process.emitWarning === 'function'
342+
) {
343+
process.emitWarning(
344+
'Static servicePath is deprecated, please use the instance method instead.',
345+
'DeprecationWarning'
346+
);
347+
}
323348
return 'bigtable.googleapis.com';
324349
}
325350

326351
/**
327-
* The DNS address for this API service - same as servicePath(),
352+
* The DNS address for this API service - same as servicePath,
328353
* exists for compatibility reasons.
354+
* @deprecated
329355
* @returns {string} The DNS address for this service.
330356
*/
331357
static get apiEndpoint() {
358+
if (
359+
typeof process !== undefined &&
360+
typeof process.emitWarning === 'function'
361+
) {
362+
process.emitWarning(
363+
'Static apiEndpoint is deprecated, please use the instance method instead.',
364+
'DeprecationWarning'
365+
);
366+
}
332367
return 'bigtable.googleapis.com';
333368
}
334369

370+
/**
371+
* The DNS address for this API service.
372+
* @returns {string} The DNS address for this service.
373+
*/
374+
get servicePath() {
375+
return this._servicePath;
376+
}
377+
378+
/**
379+
* The DNS address for this API service - same as servicePath().
380+
* @returns {string} The DNS address for this service.
381+
*/
382+
get apiEndpoint() {
383+
return this._servicePath;
384+
}
385+
386+
get universeDomain() {
387+
return this._universeDomain;
388+
}
389+
335390
/**
336391
* The port for this API service.
337392
* @returns {number} The default port for this service.

‎src/v2/bigtable_instance_admin_client.ts

+60-5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import type {
3131
import {Transform} from 'stream';
3232
import * as protos from '../../protos/protos';
3333
import jsonProtos = require('../../protos/protos.json');
34+
3435
/**
3536
* Client JSON configuration object, loaded from
3637
* `src/v2/bigtable_instance_admin_client_config.json`.
@@ -54,6 +55,8 @@ export class BigtableInstanceAdminClient {
5455
private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient;
5556
private _protos: {};
5657
private _defaults: {[method: string]: gax.CallSettings};
58+
private _universeDomain: string;
59+
private _servicePath: string;
5760
auth: gax.GoogleAuth;
5861
descriptors: Descriptors = {
5962
page: {},
@@ -113,8 +116,20 @@ export class BigtableInstanceAdminClient {
113116
// Ensure that options include all the required fields.
114117
const staticMembers = this
115118
.constructor as typeof BigtableInstanceAdminClient;
119+
if (
120+
opts?.universe_domain &&
121+
opts?.universeDomain &&
122+
opts?.universe_domain !== opts?.universeDomain
123+
) {
124+
throw new Error(
125+
'Please set either universe_domain or universeDomain, but not both.'
126+
);
127+
}
128+
this._universeDomain =
129+
opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com';
130+
this._servicePath = 'bigtableadmin.' + this._universeDomain;
116131
const servicePath =
117-
opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath;
132+
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
118133
this._providedCustomServicePath = !!(
119134
opts?.servicePath || opts?.apiEndpoint
120135
);
@@ -129,7 +144,7 @@ export class BigtableInstanceAdminClient {
129144
opts.numericEnums = true;
130145

131146
// If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
132-
if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
147+
if (servicePath !== this._servicePath && !('scopes' in opts)) {
133148
opts['scopes'] = staticMembers.scopes;
134149
}
135150

@@ -154,10 +169,10 @@ export class BigtableInstanceAdminClient {
154169
this.auth.useJWTAccessWithScope = true;
155170

156171
// Set defaultServicePath on the auth object.
157-
this.auth.defaultServicePath = staticMembers.servicePath;
172+
this.auth.defaultServicePath = this._servicePath;
158173

159174
// Set the default scopes in auth client if needed.
160-
if (servicePath === staticMembers.servicePath) {
175+
if (servicePath === this._servicePath) {
161176
this.auth.defaultScopes = staticMembers.scopes;
162177
}
163178

@@ -435,21 +450,61 @@ export class BigtableInstanceAdminClient {
435450

436451
/**
437452
* The DNS address for this API service.
453+
* @deprecated
438454
* @returns {string} The DNS address for this service.
439455
*/
440456
static get servicePath() {
457+
if (
458+
typeof process !== undefined &&
459+
typeof process.emitWarning === 'function'
460+
) {
461+
process.emitWarning(
462+
'Static servicePath is deprecated, please use the instance method instead.',
463+
'DeprecationWarning'
464+
);
465+
}
441466
return 'bigtableadmin.googleapis.com';
442467
}
443468

444469
/**
445-
* The DNS address for this API service - same as servicePath(),
470+
* The DNS address for this API service - same as servicePath,
446471
* exists for compatibility reasons.
472+
* @deprecated
447473
* @returns {string} The DNS address for this service.
448474
*/
449475
static get apiEndpoint() {
476+
if (
477+
typeof process !== undefined &&
478+
typeof process.emitWarning === 'function'
479+
) {
480+
process.emitWarning(
481+
'Static apiEndpoint is deprecated, please use the instance method instead.',
482+
'DeprecationWarning'
483+
);
484+
}
450485
return 'bigtableadmin.googleapis.com';
451486
}
452487

488+
/**
489+
* The DNS address for this API service.
490+
* @returns {string} The DNS address for this service.
491+
*/
492+
get servicePath() {
493+
return this._servicePath;
494+
}
495+
496+
/**
497+
* The DNS address for this API service - same as servicePath().
498+
* @returns {string} The DNS address for this service.
499+
*/
500+
get apiEndpoint() {
501+
return this._servicePath;
502+
}
503+
504+
get universeDomain() {
505+
return this._universeDomain;
506+
}
507+
453508
/**
454509
* The port for this API service.
455510
* @returns {number} The default port for this service.

0 commit comments

Comments
 (0)