Skip to content

Commit

Permalink
feat: Trusted Private Cloud support, use the universeDomain parameter (
Browse files Browse the repository at this point in the history
…#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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Feb 6, 2024
1 parent d30e513 commit c0c287e
Show file tree
Hide file tree
Showing 11 changed files with 374 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function main(parent) {
};

// Run request
const iterable = await adminClient.listAppProfilesAsync(request);
const iterable = adminClient.listAppProfilesAsync(request);
for await (const response of iterable) {
console.log(response);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function main(parent) {
};

// Run request
const iterable = await adminClient.listHotTabletsAsync(request);
const iterable = adminClient.listHotTabletsAsync(request);
for await (const response of iterable) {
console.log(response);
}
Expand Down
2 changes: 1 addition & 1 deletion samples/generated/v2/bigtable_table_admin.list_backups.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function main(parent) {
};

// Run request
const iterable = await adminClient.listBackupsAsync(request);
const iterable = adminClient.listBackupsAsync(request);
for await (const response of iterable) {
console.log(response);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function main(parent) {
};

// Run request
const iterable = await adminClient.listSnapshotsAsync(request);
const iterable = adminClient.listSnapshotsAsync(request);
for await (const response of iterable) {
console.log(response);
}
Expand Down
2 changes: 1 addition & 1 deletion samples/generated/v2/bigtable_table_admin.list_tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function main(parent) {
};

// Run request
const iterable = await adminClient.listTablesAsync(request);
const iterable = adminClient.listTablesAsync(request);
for await (const response of iterable) {
console.log(response);
}
Expand Down
75 changes: 65 additions & 10 deletions src/v2/bigtable_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import type {
import {PassThrough} from 'stream';
import * as protos from '../../protos/protos';
import jsonProtos = require('../../protos/protos.json');

/**
* Client JSON configuration object, loaded from
* `src/v2/bigtable_client_config.json`.
Expand All @@ -48,6 +49,8 @@ export class BigtableClient {
private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient;
private _protos: {};
private _defaults: {[method: string]: gax.CallSettings};
private _universeDomain: string;
private _servicePath: string;
auth: gax.GoogleAuth;
descriptors: Descriptors = {
page: {},
Expand Down Expand Up @@ -105,8 +108,20 @@ export class BigtableClient {
) {
// Ensure that options include all the required fields.
const staticMembers = this.constructor as typeof BigtableClient;
if (
opts?.universe_domain &&
opts?.universeDomain &&
opts?.universe_domain !== opts?.universeDomain
) {
throw new Error(
'Please set either universe_domain or universeDomain, but not both.'
);
}
this._universeDomain =
opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com';
this._servicePath = 'bigtable.' + this._universeDomain;
const servicePath =
opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath;
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
this._providedCustomServicePath = !!(
opts?.servicePath || opts?.apiEndpoint
);
Expand All @@ -121,7 +136,7 @@ export class BigtableClient {
opts.numericEnums = true;

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

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

// Set defaultServicePath on the auth object.
this.auth.defaultServicePath = staticMembers.servicePath;
this.auth.defaultServicePath = this._servicePath;

// Set the default scopes in auth client if needed.
if (servicePath === staticMembers.servicePath) {
if (servicePath === this._servicePath) {
this.auth.defaultScopes = staticMembers.scopes;
}

Expand Down Expand Up @@ -189,28 +204,28 @@ export class BigtableClient {
readRows: new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.SERVER_STREAMING,
!!opts.fallback,
/* gaxStreamingRetries: */ true
/* gaxStreamingRetries: */ false
),
sampleRowKeys: new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.SERVER_STREAMING,
!!opts.fallback,
/* gaxStreamingRetries: */ true
/* gaxStreamingRetries: */ false
),
mutateRows: new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.SERVER_STREAMING,
!!opts.fallback,
/* gaxStreamingRetries: */ true
/* gaxStreamingRetries: */ false
),
generateInitialChangeStreamPartitions:
new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.SERVER_STREAMING,
!!opts.fallback,
/* gaxStreamingRetries: */ true
/* gaxStreamingRetries: */ false
),
readChangeStream: new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.SERVER_STREAMING,
!!opts.fallback,
/* gaxStreamingRetries: */ true
/* gaxStreamingRetries: */ false
),
};

Expand Down Expand Up @@ -317,21 +332,61 @@ export class BigtableClient {

/**
* The DNS address for this API service.
* @deprecated
* @returns {string} The DNS address for this service.
*/
static get servicePath() {
if (
typeof process !== undefined &&
typeof process.emitWarning === 'function'
) {
process.emitWarning(
'Static servicePath is deprecated, please use the instance method instead.',
'DeprecationWarning'
);
}
return 'bigtable.googleapis.com';
}

/**
* The DNS address for this API service - same as servicePath(),
* The DNS address for this API service - same as servicePath,
* exists for compatibility reasons.
* @deprecated
* @returns {string} The DNS address for this service.
*/
static get apiEndpoint() {
if (
typeof process !== undefined &&
typeof process.emitWarning === 'function'
) {
process.emitWarning(
'Static apiEndpoint is deprecated, please use the instance method instead.',
'DeprecationWarning'
);
}
return 'bigtable.googleapis.com';
}

/**
* The DNS address for this API service.
* @returns {string} The DNS address for this service.
*/
get servicePath() {
return this._servicePath;
}

/**
* The DNS address for this API service - same as servicePath().
* @returns {string} The DNS address for this service.
*/
get apiEndpoint() {
return this._servicePath;
}

get universeDomain() {
return this._universeDomain;
}

/**
* The port for this API service.
* @returns {number} The default port for this service.
Expand Down
65 changes: 60 additions & 5 deletions src/v2/bigtable_instance_admin_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import type {
import {Transform} from 'stream';
import * as protos from '../../protos/protos';
import jsonProtos = require('../../protos/protos.json');

/**
* Client JSON configuration object, loaded from
* `src/v2/bigtable_instance_admin_client_config.json`.
Expand All @@ -54,6 +55,8 @@ export class BigtableInstanceAdminClient {
private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient;
private _protos: {};
private _defaults: {[method: string]: gax.CallSettings};
private _universeDomain: string;
private _servicePath: string;
auth: gax.GoogleAuth;
descriptors: Descriptors = {
page: {},
Expand Down Expand Up @@ -113,8 +116,20 @@ export class BigtableInstanceAdminClient {
// Ensure that options include all the required fields.
const staticMembers = this
.constructor as typeof BigtableInstanceAdminClient;
if (
opts?.universe_domain &&
opts?.universeDomain &&
opts?.universe_domain !== opts?.universeDomain
) {
throw new Error(
'Please set either universe_domain or universeDomain, but not both.'
);
}
this._universeDomain =
opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com';
this._servicePath = 'bigtableadmin.' + this._universeDomain;
const servicePath =
opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath;
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
this._providedCustomServicePath = !!(
opts?.servicePath || opts?.apiEndpoint
);
Expand All @@ -129,7 +144,7 @@ export class BigtableInstanceAdminClient {
opts.numericEnums = true;

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

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

// Set defaultServicePath on the auth object.
this.auth.defaultServicePath = staticMembers.servicePath;
this.auth.defaultServicePath = this._servicePath;

// Set the default scopes in auth client if needed.
if (servicePath === staticMembers.servicePath) {
if (servicePath === this._servicePath) {
this.auth.defaultScopes = staticMembers.scopes;
}

Expand Down Expand Up @@ -435,21 +450,61 @@ export class BigtableInstanceAdminClient {

/**
* The DNS address for this API service.
* @deprecated
* @returns {string} The DNS address for this service.
*/
static get servicePath() {
if (
typeof process !== undefined &&
typeof process.emitWarning === 'function'
) {
process.emitWarning(
'Static servicePath is deprecated, please use the instance method instead.',
'DeprecationWarning'
);
}
return 'bigtableadmin.googleapis.com';
}

/**
* The DNS address for this API service - same as servicePath(),
* The DNS address for this API service - same as servicePath,
* exists for compatibility reasons.
* @deprecated
* @returns {string} The DNS address for this service.
*/
static get apiEndpoint() {
if (
typeof process !== undefined &&
typeof process.emitWarning === 'function'
) {
process.emitWarning(
'Static apiEndpoint is deprecated, please use the instance method instead.',
'DeprecationWarning'
);
}
return 'bigtableadmin.googleapis.com';
}

/**
* The DNS address for this API service.
* @returns {string} The DNS address for this service.
*/
get servicePath() {
return this._servicePath;
}

/**
* The DNS address for this API service - same as servicePath().
* @returns {string} The DNS address for this service.
*/
get apiEndpoint() {
return this._servicePath;
}

get universeDomain() {
return this._universeDomain;
}

/**
* The port for this API service.
* @returns {number} The default port for this service.
Expand Down
Loading

0 comments on commit c0c287e

Please sign in to comment.