Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add several fields to manage state of database encryption update #433

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions samples/customer_record_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ $root.CustomerRecord = (function () {
options.longs === String
? long.toString()
: options.longs === Number
? long.toNumber()
: long;
? long.toNumber()
: long;
} else object.rowNum = options.longs === String ? '0' : 0;
}
if (message.customerName != null && message.hasOwnProperty('customerName'))
Expand All @@ -239,11 +239,11 @@ $root.CustomerRecord = (function () {
options.longs === String
? $util.Long.prototype.toString.call(message.rowNum)
: options.longs === Number
? new $util.LongBits(
message.rowNum.low >>> 0,
message.rowNum.high >>> 0
).toNumber()
: message.rowNum;
? new $util.LongBits(
message.rowNum.low >>> 0,
message.rowNum.high >>> 0
).toNumber()
: message.rowNum;
return object;
};

Expand Down
94 changes: 46 additions & 48 deletions samples/sample_data_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,8 @@ $root.SampleData = (function () {
message.float64Col = Number(object.float64Col);
if (object.int64Col != null)
if ($util.Long)
(message.int64Col = $util.Long.fromValue(
object.int64Col
)).unsigned = false;
(message.int64Col = $util.Long.fromValue(object.int64Col)).unsigned =
false;
else if (typeof object.int64Col === 'string')
message.int64Col = parseInt(object.int64Col, 10);
else if (typeof object.int64Col === 'number')
Expand All @@ -577,9 +576,8 @@ $root.SampleData = (function () {
if (object.stringCol != null) message.stringCol = String(object.stringCol);
if (object.dateCol != null)
if ($util.Long)
(message.dateCol = $util.Long.fromValue(
object.dateCol
)).unsigned = false;
(message.dateCol = $util.Long.fromValue(object.dateCol)).unsigned =
false;
else if (typeof object.dateCol === 'string')
message.dateCol = parseInt(object.dateCol, 10);
else if (typeof object.dateCol === 'number')
Expand Down Expand Up @@ -696,8 +694,8 @@ $root.SampleData = (function () {
options.longs === String
? long.toString()
: options.longs === Number
? long.toNumber()
: long;
? long.toNumber()
: long;
} else object.int64Col = options.longs === String ? '0' : 0;
object.stringCol = '';
if ($util.Long) {
Expand All @@ -706,8 +704,8 @@ $root.SampleData = (function () {
options.longs === String
? long.toString()
: options.longs === Number
? long.toNumber()
: long;
? long.toNumber()
: long;
} else object.dateCol = options.longs === String ? '0' : 0;
object.datetimeCol = '';
object.geographyCol = '';
Expand All @@ -720,8 +718,8 @@ $root.SampleData = (function () {
options.longs === String
? long.toString()
: options.longs === Number
? long.toNumber()
: long;
? long.toNumber()
: long;
} else object.timestampCol = options.longs === String ? '0' : 0;
object.structCol = null;
if ($util.Long) {
Expand All @@ -730,8 +728,8 @@ $root.SampleData = (function () {
options.longs === String
? long.toString()
: options.longs === Number
? long.toNumber()
: long;
? long.toNumber()
: long;
} else object.rowNum = options.longs === String ? '0' : 0;
}
if (message.boolCol != null && message.hasOwnProperty('boolCol'))
Expand All @@ -741,8 +739,8 @@ $root.SampleData = (function () {
options.bytes === String
? $util.base64.encode(message.bytesCol, 0, message.bytesCol.length)
: options.bytes === Array
? Array.prototype.slice.call(message.bytesCol)
: message.bytesCol;
? Array.prototype.slice.call(message.bytesCol)
: message.bytesCol;
if (message.float64Col != null && message.hasOwnProperty('float64Col'))
object.float64Col =
options.json && !isFinite(message.float64Col)
Expand All @@ -759,11 +757,11 @@ $root.SampleData = (function () {
options.longs === String
? $util.Long.prototype.toString.call(message.int64Col)
: options.longs === Number
? new $util.LongBits(
message.int64Col.low >>> 0,
message.int64Col.high >>> 0
).toNumber()
: message.int64Col;
? new $util.LongBits(
message.int64Col.low >>> 0,
message.int64Col.high >>> 0
).toNumber()
: message.int64Col;
if (message.stringCol != null && message.hasOwnProperty('stringCol'))
object.stringCol = message.stringCol;
if (message.dateCol != null && message.hasOwnProperty('dateCol'))
Expand All @@ -775,11 +773,11 @@ $root.SampleData = (function () {
options.longs === String
? $util.Long.prototype.toString.call(message.dateCol)
: options.longs === Number
? new $util.LongBits(
message.dateCol.low >>> 0,
message.dateCol.high >>> 0
).toNumber()
: message.dateCol;
? new $util.LongBits(
message.dateCol.low >>> 0,
message.dateCol.high >>> 0
).toNumber()
: message.dateCol;
if (message.datetimeCol != null && message.hasOwnProperty('datetimeCol'))
object.datetimeCol = message.datetimeCol;
if (message.geographyCol != null && message.hasOwnProperty('geographyCol'))
Expand All @@ -804,11 +802,11 @@ $root.SampleData = (function () {
options.longs === String
? $util.Long.prototype.toString.call(message.timestampCol)
: options.longs === Number
? new $util.LongBits(
message.timestampCol.low >>> 0,
message.timestampCol.high >>> 0
).toNumber()
: message.timestampCol;
? new $util.LongBits(
message.timestampCol.low >>> 0,
message.timestampCol.high >>> 0
).toNumber()
: message.timestampCol;
if (message.int64List && message.int64List.length) {
object.int64List = [];
for (var j = 0; j < message.int64List.length; ++j)
Expand All @@ -822,11 +820,11 @@ $root.SampleData = (function () {
options.longs === String
? $util.Long.prototype.toString.call(message.int64List[j])
: options.longs === Number
? new $util.LongBits(
message.int64List[j].low >>> 0,
message.int64List[j].high >>> 0
).toNumber()
: message.int64List[j];
? new $util.LongBits(
message.int64List[j].low >>> 0,
message.int64List[j].high >>> 0
).toNumber()
: message.int64List[j];
}
if (message.structCol != null && message.hasOwnProperty('structCol'))
object.structCol = $root.SampleData.SampleStruct.toObject(
Expand All @@ -850,11 +848,11 @@ $root.SampleData = (function () {
options.longs === String
? $util.Long.prototype.toString.call(message.rowNum)
: options.longs === Number
? new $util.LongBits(
message.rowNum.low >>> 0,
message.rowNum.high >>> 0
).toNumber()
: message.rowNum;
? new $util.LongBits(
message.rowNum.low >>> 0,
message.rowNum.high >>> 0
).toNumber()
: message.rowNum;
return object;
};

Expand Down Expand Up @@ -1076,8 +1074,8 @@ $root.SampleData = (function () {
options.longs === String
? long.toString()
: options.longs === Number
? long.toNumber()
: long;
? long.toNumber()
: long;
} else object.subIntCol = options.longs === String ? '0' : 0;
if (message.subIntCol != null && message.hasOwnProperty('subIntCol'))
if (typeof message.subIntCol === 'number')
Expand All @@ -1090,11 +1088,11 @@ $root.SampleData = (function () {
options.longs === String
? $util.Long.prototype.toString.call(message.subIntCol)
: options.longs === Number
? new $util.LongBits(
message.subIntCol.low >>> 0,
message.subIntCol.high >>> 0
).toNumber()
: message.subIntCol;
? new $util.LongBits(
message.subIntCol.low >>> 0,
message.subIntCol.high >>> 0
).toNumber()
: message.subIntCol;
return object;
};

Expand Down
5 changes: 2 additions & 3 deletions src/managedwriter/stream_connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,8 @@ export class StreamConnection extends EventEmitter {
}
// This header is required so that the BigQuery Storage API
// knows which region to route the request to.
callOptions.otherArgs.headers[
'x-goog-request-params'
] = `write_stream=${streamId}`;
callOptions.otherArgs.headers['x-goog-request-params'] =
`write_stream=${streamId}`;
return callOptions;
}

Expand Down
15 changes: 11 additions & 4 deletions src/v1/big_query_read_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,15 @@ export class BigQueryReadClient {
'Please set either universe_domain or universeDomain, but not both.'
);
}
const universeDomainEnvVar =
typeof process === 'object' && typeof process.env === 'object'
? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
: undefined;
this._universeDomain =
opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com';
opts?.universeDomain ??
opts?.universe_domain ??
universeDomainEnvVar ??
'googleapis.com';
this._servicePath = 'bigquerystorage.' + this._universeDomain;
const servicePath =
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
Expand Down Expand Up @@ -169,7 +176,7 @@ export class BigQueryReadClient {

// Determine the client header string.
const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
if (typeof process !== 'undefined' && 'versions' in process) {
if (typeof process === 'object' && 'versions' in process) {
clientHeader.push(`gl-node/${process.versions.node}`);
} else {
clientHeader.push(`gl-web/${this._gaxModule.version}`);
Expand Down Expand Up @@ -318,7 +325,7 @@ export class BigQueryReadClient {
*/
static get servicePath() {
if (
typeof process !== undefined &&
typeof process === 'object' &&
typeof process.emitWarning === 'function'
) {
process.emitWarning(
Expand All @@ -336,7 +343,7 @@ export class BigQueryReadClient {
*/
static get apiEndpoint() {
if (
typeof process !== undefined &&
typeof process === 'object' &&
typeof process.emitWarning === 'function'
) {
process.emitWarning(
Expand Down
15 changes: 11 additions & 4 deletions src/v1/big_query_write_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,15 @@ export class BigQueryWriteClient {
'Please set either universe_domain or universeDomain, but not both.'
);
}
const universeDomainEnvVar =
typeof process === 'object' && typeof process.env === 'object'
? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
: undefined;
this._universeDomain =
opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com';
opts?.universeDomain ??
opts?.universe_domain ??
universeDomainEnvVar ??
'googleapis.com';
this._servicePath = 'bigquerystorage.' + this._universeDomain;
const servicePath =
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
Expand Down Expand Up @@ -172,7 +179,7 @@ export class BigQueryWriteClient {

// Determine the client header string.
const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
if (typeof process !== 'undefined' && 'versions' in process) {
if (typeof process === 'object' && 'versions' in process) {
clientHeader.push(`gl-node/${process.versions.node}`);
} else {
clientHeader.push(`gl-web/${this._gaxModule.version}`);
Expand Down Expand Up @@ -324,7 +331,7 @@ export class BigQueryWriteClient {
*/
static get servicePath() {
if (
typeof process !== undefined &&
typeof process === 'object' &&
typeof process.emitWarning === 'function'
) {
process.emitWarning(
Expand All @@ -342,7 +349,7 @@ export class BigQueryWriteClient {
*/
static get apiEndpoint() {
if (
typeof process !== undefined &&
typeof process === 'object' &&
typeof process.emitWarning === 'function'
) {
process.emitWarning(
Expand Down
15 changes: 11 additions & 4 deletions src/v1beta1/big_query_storage_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,15 @@ export class BigQueryStorageClient {
'Please set either universe_domain or universeDomain, but not both.'
);
}
const universeDomainEnvVar =
typeof process === 'object' && typeof process.env === 'object'
? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
: undefined;
this._universeDomain =
opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com';
opts?.universeDomain ??
opts?.universe_domain ??
universeDomainEnvVar ??
'googleapis.com';
this._servicePath = 'bigquerystorage.' + this._universeDomain;
const servicePath =
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
Expand Down Expand Up @@ -174,7 +181,7 @@ export class BigQueryStorageClient {

// Determine the client header string.
const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
if (typeof process !== 'undefined' && 'versions' in process) {
if (typeof process === 'object' && 'versions' in process) {
clientHeader.push(`gl-node/${process.versions.node}`);
} else {
clientHeader.push(`gl-web/${this._gaxModule.version}`);
Expand Down Expand Up @@ -320,7 +327,7 @@ export class BigQueryStorageClient {
*/
static get servicePath() {
if (
typeof process !== undefined &&
typeof process === 'object' &&
typeof process.emitWarning === 'function'
) {
process.emitWarning(
Expand All @@ -338,7 +345,7 @@ export class BigQueryStorageClient {
*/
static get apiEndpoint() {
if (
typeof process !== undefined &&
typeof process === 'object' &&
typeof process.emitWarning === 'function'
) {
process.emitWarning(
Expand Down
Loading
Loading