@@ -27,6 +27,7 @@ import type {
27
27
import { PassThrough } from 'stream' ;
28
28
import * as protos from '../../protos/protos' ;
29
29
import jsonProtos = require( '../../protos/protos.json' ) ;
30
+
30
31
/**
31
32
* Client JSON configuration object, loaded from
32
33
* `src/v2/bigtable_client_config.json`.
@@ -48,6 +49,8 @@ export class BigtableClient {
48
49
private _gaxGrpc : gax . GrpcClient | gax . fallback . GrpcClient ;
49
50
private _protos : { } ;
50
51
private _defaults : { [ method : string ] : gax . CallSettings } ;
52
+ private _universeDomain : string ;
53
+ private _servicePath : string ;
51
54
auth : gax . GoogleAuth ;
52
55
descriptors : Descriptors = {
53
56
page : { } ,
@@ -105,8 +108,20 @@ export class BigtableClient {
105
108
) {
106
109
// Ensure that options include all the required fields.
107
110
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 ;
108
123
const servicePath =
109
- opts ?. servicePath || opts ?. apiEndpoint || staticMembers . servicePath ;
124
+ opts ?. servicePath || opts ?. apiEndpoint || this . _servicePath ;
110
125
this . _providedCustomServicePath = ! ! (
111
126
opts ?. servicePath || opts ?. apiEndpoint
112
127
) ;
@@ -121,7 +136,7 @@ export class BigtableClient {
121
136
opts . numericEnums = true ;
122
137
123
138
// 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 ) ) {
125
140
opts [ 'scopes' ] = staticMembers . scopes ;
126
141
}
127
142
@@ -146,10 +161,10 @@ export class BigtableClient {
146
161
this . auth . useJWTAccessWithScope = true ;
147
162
148
163
// Set defaultServicePath on the auth object.
149
- this . auth . defaultServicePath = staticMembers . servicePath ;
164
+ this . auth . defaultServicePath = this . _servicePath ;
150
165
151
166
// Set the default scopes in auth client if needed.
152
- if ( servicePath === staticMembers . servicePath ) {
167
+ if ( servicePath === this . _servicePath ) {
153
168
this . auth . defaultScopes = staticMembers . scopes ;
154
169
}
155
170
@@ -189,28 +204,28 @@ export class BigtableClient {
189
204
readRows : new this . _gaxModule . StreamDescriptor (
190
205
this . _gaxModule . StreamType . SERVER_STREAMING ,
191
206
! ! opts . fallback ,
192
- /* gaxStreamingRetries: */ true
207
+ /* gaxStreamingRetries: */ false
193
208
) ,
194
209
sampleRowKeys : new this . _gaxModule . StreamDescriptor (
195
210
this . _gaxModule . StreamType . SERVER_STREAMING ,
196
211
! ! opts . fallback ,
197
- /* gaxStreamingRetries: */ true
212
+ /* gaxStreamingRetries: */ false
198
213
) ,
199
214
mutateRows : new this . _gaxModule . StreamDescriptor (
200
215
this . _gaxModule . StreamType . SERVER_STREAMING ,
201
216
! ! opts . fallback ,
202
- /* gaxStreamingRetries: */ true
217
+ /* gaxStreamingRetries: */ false
203
218
) ,
204
219
generateInitialChangeStreamPartitions :
205
220
new this . _gaxModule . StreamDescriptor (
206
221
this . _gaxModule . StreamType . SERVER_STREAMING ,
207
222
! ! opts . fallback ,
208
- /* gaxStreamingRetries: */ true
223
+ /* gaxStreamingRetries: */ false
209
224
) ,
210
225
readChangeStream : new this . _gaxModule . StreamDescriptor (
211
226
this . _gaxModule . StreamType . SERVER_STREAMING ,
212
227
! ! opts . fallback ,
213
- /* gaxStreamingRetries: */ true
228
+ /* gaxStreamingRetries: */ false
214
229
) ,
215
230
} ;
216
231
@@ -317,21 +332,61 @@ export class BigtableClient {
317
332
318
333
/**
319
334
* The DNS address for this API service.
335
+ * @deprecated
320
336
* @returns {string } The DNS address for this service.
321
337
*/
322
338
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
+ }
323
348
return 'bigtable.googleapis.com' ;
324
349
}
325
350
326
351
/**
327
- * The DNS address for this API service - same as servicePath() ,
352
+ * The DNS address for this API service - same as servicePath,
328
353
* exists for compatibility reasons.
354
+ * @deprecated
329
355
* @returns {string } The DNS address for this service.
330
356
*/
331
357
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
+ }
332
367
return 'bigtable.googleapis.com' ;
333
368
}
334
369
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
+
335
390
/**
336
391
* The port for this API service.
337
392
* @returns {number } The default port for this service.
0 commit comments