Skip to content

Commit

Permalink
feat: add several fields to manage state of database encryption update (
Browse files Browse the repository at this point in the history
#1495)

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

PiperOrigin-RevId: 619289281

Source-Link: googleapis/googleapis@3a7c334

Source-Link: googleapis/googleapis-gen@6a8c733
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmE4YzczMzA2MmQ4MzNkMTFjNTI0NWVkYTUwZjUxMDhlMGU1NTMyNCJ9

* 🦉 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] committed Apr 2, 2024
1 parent cee3b46 commit 4137f7b
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 15 deletions.
15 changes: 11 additions & 4 deletions src/v2/config_service_v2_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 122,15 @@ export class ConfigServiceV2Client {
'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 = 'logging.' this._universeDomain;
const servicePath =
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
Expand Down Expand Up @@ -175,7 182,7 @@ export class ConfigServiceV2Client {

// 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 @@ -578,7 585,7 @@ export class ConfigServiceV2Client {
*/
static get servicePath() {
if (
typeof process !== undefined &&
typeof process === 'object' &&
typeof process.emitWarning === 'function'
) {
process.emitWarning(
Expand All @@ -596,7 603,7 @@ export class ConfigServiceV2Client {
*/
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/v2/logging_service_v2_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 119,15 @@ export class LoggingServiceV2Client {
'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 = 'logging.' this._universeDomain;
const servicePath =
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
Expand Down Expand Up @@ -172,7 179,7 @@ export class LoggingServiceV2Client {

// 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 @@ -457,7 464,7 @@ export class LoggingServiceV2Client {
*/
static get servicePath() {
if (
typeof process !== undefined &&
typeof process === 'object' &&
typeof process.emitWarning === 'function'
) {
process.emitWarning(
Expand All @@ -475,7 482,7 @@ export class LoggingServiceV2Client {
*/
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/v2/metrics_service_v2_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 119,15 @@ export class MetricsServiceV2Client {
'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 = 'logging.' this._universeDomain;
const servicePath =
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
Expand Down Expand Up @@ -172,7 179,7 @@ export class MetricsServiceV2Client {

// 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 @@ -404,7 411,7 @@ export class MetricsServiceV2Client {
*/
static get servicePath() {
if (
typeof process !== undefined &&
typeof process === 'object' &&
typeof process.emitWarning === 'function'
) {
process.emitWarning(
Expand All @@ -422,7 429,7 @@ export class MetricsServiceV2Client {
*/
static get apiEndpoint() {
if (
typeof process !== undefined &&
typeof process === 'object' &&
typeof process.emitWarning === 'function'
) {
process.emitWarning(
Expand Down
34 changes: 33 additions & 1 deletion test/gapic_config_service_v2_v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 174,7 @@ describe('v2.ConfigServiceV2Client', () => {
});

if (
typeof process !== 'undefined' &&
typeof process === 'object' &&
typeof process.emitWarning === 'function'
) {
it('throws DeprecationWarning if static servicePath is used', () => {
Expand Down Expand Up @@ -210,6 210,38 @@ describe('v2.ConfigServiceV2Client', () => {
const servicePath = client.apiEndpoint;
assert.strictEqual(servicePath, 'logging.example.com');
});

if (typeof process === 'object' && 'env' in process) {
describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => {
it('sets apiEndpoint from environment variable', () => {
const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com';
const client = new configservicev2Module.v2.ConfigServiceV2Client();
const servicePath = client.apiEndpoint;
assert.strictEqual(servicePath, 'logging.example.com');
if (saved) {
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved;
} else {
delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
}
});

it('value configured in code has priority over environment variable', () => {
const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com';
const client = new configservicev2Module.v2.ConfigServiceV2Client({
universeDomain: 'configured.example.com',
});
const servicePath = client.apiEndpoint;
assert.strictEqual(servicePath, 'logging.configured.example.com');
if (saved) {
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved;
} else {
delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
}
});
});
}
it('does not allow setting both universeDomain and universe_domain', () => {
assert.throws(() => {
new configservicev2Module.v2.ConfigServiceV2Client({
Expand Down
34 changes: 33 additions & 1 deletion test/gapic_logging_service_v2_v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 156,7 @@ describe('v2.LoggingServiceV2Client', () => {
});

if (
typeof process !== 'undefined' &&
typeof process === 'object' &&
typeof process.emitWarning === 'function'
) {
it('throws DeprecationWarning if static servicePath is used', () => {
Expand Down Expand Up @@ -192,6 192,38 @@ describe('v2.LoggingServiceV2Client', () => {
const servicePath = client.apiEndpoint;
assert.strictEqual(servicePath, 'logging.example.com');
});

if (typeof process === 'object' && 'env' in process) {
describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => {
it('sets apiEndpoint from environment variable', () => {
const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com';
const client = new loggingservicev2Module.v2.LoggingServiceV2Client();
const servicePath = client.apiEndpoint;
assert.strictEqual(servicePath, 'logging.example.com');
if (saved) {
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved;
} else {
delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
}
});

it('value configured in code has priority over environment variable', () => {
const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com';
const client = new loggingservicev2Module.v2.LoggingServiceV2Client({
universeDomain: 'configured.example.com',
});
const servicePath = client.apiEndpoint;
assert.strictEqual(servicePath, 'logging.configured.example.com');
if (saved) {
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved;
} else {
delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
}
});
});
}
it('does not allow setting both universeDomain and universe_domain', () => {
assert.throws(() => {
new loggingservicev2Module.v2.LoggingServiceV2Client({
Expand Down
34 changes: 33 additions & 1 deletion test/gapic_metrics_service_v2_v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 142,7 @@ describe('v2.MetricsServiceV2Client', () => {
});

if (
typeof process !== 'undefined' &&
typeof process === 'object' &&
typeof process.emitWarning === 'function'
) {
it('throws DeprecationWarning if static servicePath is used', () => {
Expand Down Expand Up @@ -178,6 178,38 @@ describe('v2.MetricsServiceV2Client', () => {
const servicePath = client.apiEndpoint;
assert.strictEqual(servicePath, 'logging.example.com');
});

if (typeof process === 'object' && 'env' in process) {
describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => {
it('sets apiEndpoint from environment variable', () => {
const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com';
const client = new metricsservicev2Module.v2.MetricsServiceV2Client();
const servicePath = client.apiEndpoint;
assert.strictEqual(servicePath, 'logging.example.com');
if (saved) {
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved;
} else {
delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
}
});

it('value configured in code has priority over environment variable', () => {
const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com';
const client = new metricsservicev2Module.v2.MetricsServiceV2Client({
universeDomain: 'configured.example.com',
});
const servicePath = client.apiEndpoint;
assert.strictEqual(servicePath, 'logging.configured.example.com');
if (saved) {
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved;
} else {
delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
}
});
});
}
it('does not allow setting both universeDomain and universe_domain', () => {
assert.throws(() => {
new metricsservicev2Module.v2.MetricsServiceV2Client({
Expand Down

0 comments on commit 4137f7b

Please sign in to comment.