Skip to content

Commit 97c7951

Browse files
feat: [Many APIs] add several fields to manage state of database encryption update (#5186)
* 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: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFsbG95ZGIvLk93bEJvdC55YW1sIiwiaCI6IjZhOGM3MzMwNjJkODMzZDExYzUyNDVlZGE1MGY1MTA4ZTBlNTUzMjQifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFwaWdhdGV3YXkvLk93bEJvdC55YW1sIiwiaCI6IjZhOGM3MzMwNjJkODMzZDExYzUyNDVlZGE1MGY1MTA4ZTBlNTUzMjQifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFwaWdlZWNvbm5lY3QvLk93bEJvdC55YW1sIiwiaCI6IjZhOGM3MzMwNjJkODMzZDExYzUyNDVlZGE1MGY1MTA4ZTBlNTUzMjQifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFwaWdlZXJlZ2lzdHJ5Ly5Pd2xCb3QueWFtbCIsImgiOiI2YThjNzMzMDYyZDgzM2QxMWM1MjQ1ZWRhNTBmNTEwOGUwZTU1MzI0In0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFwcGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmE4YzczMzA2MmQ4MzNkMTFjNTI0NWVkYTUwZjUxMDhlMGU1NTMyNCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFzc2V0Ly5Pd2xCb3QueWFtbCIsImgiOiI2YThjNzMzMDYyZDgzM2QxMWM1MjQ1ZWRhNTBmNTEwOGUwZTU1MzI0In0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFzc3VyZWR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bWwiLCJoIjoiNmE4YzczMzA2MmQ4MzNkMTFjNTI0NWVkYTUwZjUxMDhlMGU1NTMyNCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 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 57567db commit 97c7951

110 files changed

Lines changed: 65764 additions & 3988 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/google-cloud-alloydb/src/v1/alloy_d_b_admin_client.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,15 @@ export class AlloyDBAdminClient {
128128
'Please set either universe_domain or universeDomain, but not both.'
129129
);
130130
}
131+
const universeDomainEnvVar =
132+
typeof process === 'object' && typeof process.env === 'object'
133+
? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
134+
: undefined;
131135
this._universeDomain =
132-
opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com';
136+
opts?.universeDomain ??
137+
opts?.universe_domain ??
138+
universeDomainEnvVar ??
139+
'googleapis.com';
133140
this._servicePath = 'alloydb.' + this._universeDomain;
134141
const servicePath =
135142
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
@@ -187,7 +194,7 @@ export class AlloyDBAdminClient {
187194

188195
// Determine the client header string.
189196
const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
190-
if (typeof process !== 'undefined' && 'versions' in process) {
197+
if (typeof process === 'object' && 'versions' in process) {
191198
clientHeader.push(`gl-node/${process.versions.node}`);
192199
} else {
193200
clientHeader.push(`gl-web/${this._gaxModule.version}`);
@@ -625,7 +632,7 @@ export class AlloyDBAdminClient {
625632
*/
626633
static get servicePath() {
627634
if (
628-
typeof process !== undefined &&
635+
typeof process === 'object' &&
629636
typeof process.emitWarning === 'function'
630637
) {
631638
process.emitWarning(
@@ -643,7 +650,7 @@ export class AlloyDBAdminClient {
643650
*/
644651
static get apiEndpoint() {
645652
if (
646-
typeof process !== undefined &&
653+
typeof process === 'object' &&
647654
typeof process.emitWarning === 'function'
648655
) {
649656
process.emitWarning(

packages/google-cloud-alloydb/src/v1alpha/alloy_d_b_admin_client.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,15 @@ export class AlloyDBAdminClient {
128128
'Please set either universe_domain or universeDomain, but not both.'
129129
);
130130
}
131+
const universeDomainEnvVar =
132+
typeof process === 'object' && typeof process.env === 'object'
133+
? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
134+
: undefined;
131135
this._universeDomain =
132-
opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com';
136+
opts?.universeDomain ??
137+
opts?.universe_domain ??
138+
universeDomainEnvVar ??
139+
'googleapis.com';
133140
this._servicePath = 'alloydb.' + this._universeDomain;
134141
const servicePath =
135142
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
@@ -187,7 +194,7 @@ export class AlloyDBAdminClient {
187194

188195
// Determine the client header string.
189196
const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
190-
if (typeof process !== 'undefined' && 'versions' in process) {
197+
if (typeof process === 'object' && 'versions' in process) {
191198
clientHeader.push(`gl-node/${process.versions.node}`);
192199
} else {
193200
clientHeader.push(`gl-web/${this._gaxModule.version}`);
@@ -634,7 +641,7 @@ export class AlloyDBAdminClient {
634641
*/
635642
static get servicePath() {
636643
if (
637-
typeof process !== undefined &&
644+
typeof process === 'object' &&
638645
typeof process.emitWarning === 'function'
639646
) {
640647
process.emitWarning(
@@ -652,7 +659,7 @@ export class AlloyDBAdminClient {
652659
*/
653660
static get apiEndpoint() {
654661
if (
655-
typeof process !== undefined &&
662+
typeof process === 'object' &&
656663
typeof process.emitWarning === 'function'
657664
) {
658665
process.emitWarning(

packages/google-cloud-alloydb/src/v1beta/alloy_d_b_admin_client.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,15 @@ export class AlloyDBAdminClient {
128128
'Please set either universe_domain or universeDomain, but not both.'
129129
);
130130
}
131+
const universeDomainEnvVar =
132+
typeof process === 'object' && typeof process.env === 'object'
133+
? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
134+
: undefined;
131135
this._universeDomain =
132-
opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com';
136+
opts?.universeDomain ??
137+
opts?.universe_domain ??
138+
universeDomainEnvVar ??
139+
'googleapis.com';
133140
this._servicePath = 'alloydb.' + this._universeDomain;
134141
const servicePath =
135142
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
@@ -187,7 +194,7 @@ export class AlloyDBAdminClient {
187194

188195
// Determine the client header string.
189196
const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
190-
if (typeof process !== 'undefined' && 'versions' in process) {
197+
if (typeof process === 'object' && 'versions' in process) {
191198
clientHeader.push(`gl-node/${process.versions.node}`);
192199
} else {
193200
clientHeader.push(`gl-web/${this._gaxModule.version}`);
@@ -633,7 +640,7 @@ export class AlloyDBAdminClient {
633640
*/
634641
static get servicePath() {
635642
if (
636-
typeof process !== undefined &&
643+
typeof process === 'object' &&
637644
typeof process.emitWarning === 'function'
638645
) {
639646
process.emitWarning(
@@ -651,7 +658,7 @@ export class AlloyDBAdminClient {
651658
*/
652659
static get apiEndpoint() {
653660
if (
654-
typeof process !== undefined &&
661+
typeof process === 'object' &&
655662
typeof process.emitWarning === 'function'
656663
) {
657664
process.emitWarning(

packages/google-cloud-alloydb/test/gapic_alloy_d_b_admin_v1.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ describe('v1.AlloyDBAdminClient', () => {
180180
});
181181

182182
if (
183-
typeof process !== 'undefined' &&
183+
typeof process === 'object' &&
184184
typeof process.emitWarning === 'function'
185185
) {
186186
it('throws DeprecationWarning if static servicePath is used', () => {
@@ -216,6 +216,38 @@ describe('v1.AlloyDBAdminClient', () => {
216216
const servicePath = client.apiEndpoint;
217217
assert.strictEqual(servicePath, 'alloydb.example.com');
218218
});
219+
220+
if (typeof process === 'object' && 'env' in process) {
221+
describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => {
222+
it('sets apiEndpoint from environment variable', () => {
223+
const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
224+
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com';
225+
const client = new alloydbadminModule.v1.AlloyDBAdminClient();
226+
const servicePath = client.apiEndpoint;
227+
assert.strictEqual(servicePath, 'alloydb.example.com');
228+
if (saved) {
229+
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved;
230+
} else {
231+
delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
232+
}
233+
});
234+
235+
it('value configured in code has priority over environment variable', () => {
236+
const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
237+
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com';
238+
const client = new alloydbadminModule.v1.AlloyDBAdminClient({
239+
universeDomain: 'configured.example.com',
240+
});
241+
const servicePath = client.apiEndpoint;
242+
assert.strictEqual(servicePath, 'alloydb.configured.example.com');
243+
if (saved) {
244+
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved;
245+
} else {
246+
delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
247+
}
248+
});
249+
});
250+
}
219251
it('does not allow setting both universeDomain and universe_domain', () => {
220252
assert.throws(() => {
221253
new alloydbadminModule.v1.AlloyDBAdminClient({

packages/google-cloud-alloydb/test/gapic_alloy_d_b_admin_v1alpha.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ describe('v1alpha.AlloyDBAdminClient', () => {
180180
});
181181

182182
if (
183-
typeof process !== 'undefined' &&
183+
typeof process === 'object' &&
184184
typeof process.emitWarning === 'function'
185185
) {
186186
it('throws DeprecationWarning if static servicePath is used', () => {
@@ -216,6 +216,38 @@ describe('v1alpha.AlloyDBAdminClient', () => {
216216
const servicePath = client.apiEndpoint;
217217
assert.strictEqual(servicePath, 'alloydb.example.com');
218218
});
219+
220+
if (typeof process === 'object' && 'env' in process) {
221+
describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => {
222+
it('sets apiEndpoint from environment variable', () => {
223+
const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
224+
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com';
225+
const client = new alloydbadminModule.v1alpha.AlloyDBAdminClient();
226+
const servicePath = client.apiEndpoint;
227+
assert.strictEqual(servicePath, 'alloydb.example.com');
228+
if (saved) {
229+
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved;
230+
} else {
231+
delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
232+
}
233+
});
234+
235+
it('value configured in code has priority over environment variable', () => {
236+
const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
237+
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com';
238+
const client = new alloydbadminModule.v1alpha.AlloyDBAdminClient({
239+
universeDomain: 'configured.example.com',
240+
});
241+
const servicePath = client.apiEndpoint;
242+
assert.strictEqual(servicePath, 'alloydb.configured.example.com');
243+
if (saved) {
244+
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved;
245+
} else {
246+
delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
247+
}
248+
});
249+
});
250+
}
219251
it('does not allow setting both universeDomain and universe_domain', () => {
220252
assert.throws(() => {
221253
new alloydbadminModule.v1alpha.AlloyDBAdminClient({

packages/google-cloud-alloydb/test/gapic_alloy_d_b_admin_v1beta.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ describe('v1beta.AlloyDBAdminClient', () => {
180180
});
181181

182182
if (
183-
typeof process !== 'undefined' &&
183+
typeof process === 'object' &&
184184
typeof process.emitWarning === 'function'
185185
) {
186186
it('throws DeprecationWarning if static servicePath is used', () => {
@@ -216,6 +216,38 @@ describe('v1beta.AlloyDBAdminClient', () => {
216216
const servicePath = client.apiEndpoint;
217217
assert.strictEqual(servicePath, 'alloydb.example.com');
218218
});
219+
220+
if (typeof process === 'object' && 'env' in process) {
221+
describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => {
222+
it('sets apiEndpoint from environment variable', () => {
223+
const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
224+
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com';
225+
const client = new alloydbadminModule.v1beta.AlloyDBAdminClient();
226+
const servicePath = client.apiEndpoint;
227+
assert.strictEqual(servicePath, 'alloydb.example.com');
228+
if (saved) {
229+
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved;
230+
} else {
231+
delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
232+
}
233+
});
234+
235+
it('value configured in code has priority over environment variable', () => {
236+
const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
237+
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com';
238+
const client = new alloydbadminModule.v1beta.AlloyDBAdminClient({
239+
universeDomain: 'configured.example.com',
240+
});
241+
const servicePath = client.apiEndpoint;
242+
assert.strictEqual(servicePath, 'alloydb.configured.example.com');
243+
if (saved) {
244+
process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved;
245+
} else {
246+
delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'];
247+
}
248+
});
249+
});
250+
}
219251
it('does not allow setting both universeDomain and universe_domain', () => {
220252
assert.throws(() => {
221253
new alloydbadminModule.v1beta.AlloyDBAdminClient({

0 commit comments

Comments
 (0)