Skip to content

Commit 852f3eb

Browse files
feat: Trusted Private Cloud support, use the universeDomain parameter (#5028)
* build: update gapic-generator-typescript to v4.4.1 PiperOrigin-RevId: 604765466 Source-Link: googleapis/googleapis@40203ca Source-Link: googleapis/googleapis-gen@07b7f3d Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXRhbGVudC8uT3dsQm90LnlhbWwiLCJoIjoiMDdiN2YzZGFkOGFhMTkxMmQ0YWNkY2ZkNjM2NWJiNDIzNmU0YjU0YiJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXRhc2tzLy5Pd2xCb3QueWFtbCIsImgiOiIwN2I3ZjNkYWQ4YWExOTEyZDRhY2RjZmQ2MzY1YmI0MjM2ZTRiNTRiIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXRleHR0b3NwZWVjaC8uT3dsQm90LnlhbWwiLCJoIjoiMDdiN2YzZGFkOGFhMTkxMmQ0YWNkY2ZkNjM2NWJiNDIzNmU0YjU0YiJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXRwdS8uT3dsQm90LnlhbWwiLCJoIjoiMDdiN2YzZGFkOGFhMTkxMmQ0YWNkY2ZkNjM2NWJiNDIzNmU0YjU0YiJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXRyYW5zbGF0ZS8uT3dsQm90LnlhbWwiLCJoIjoiMDdiN2YzZGFkOGFhMTkxMmQ0YWNkY2ZkNjM2NWJiNDIzNmU0YjU0YiJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXZpZGVvLWxpdmVzdHJlYW0vLk93bEJvdC55YW1sIiwiaCI6IjA3YjdmM2RhZDhhYTE5MTJkNGFjZGNmZDYzNjViYjQyMzZlNGI1NGIifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLX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yaXR5c2Nhbm5lci8uT3dsQm90LnlhbWwiLCJoIjoiMDdiN2YzZGFkOGFhMTkxMmQ0YWNkY2ZkNjM2NWJiNDIzNmU0YjU0YiJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdvcmtmbG93cy1leGVjdXRpb25zLy5Pd2xCb3QueWFtbCIsImgiOiIwN2I3ZjNkYWQ4YWExOTEyZDRhY2RjZmQ2MzY1YmI0MjM2ZTRiNTRiIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdvcmtzdGF0aW9ucy8uT3dsQm90LnlhbWwiLCJoIjoiMDdiN2YzZGFkOGFhMTkxMmQ0YWNkY2ZkNjM2NWJiNDIzNmU0YjU0YiJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRhdGFmbG93Ly5Pd2xCb3QueWFtbCIsImgiOiIwN2I3ZjNkYWQ4YWExOTEyZDRhY2RjZmQ2MzY1YmI0MjM2ZTRiNTRiIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRldnRvb2xzLWFydGlmYWN0cmVnaXN0cnkvLk93bEJvdC55YW1sIiwiaCI6IjA3YjdmM2RhZDhhYTE5MTJkNGFjZGNmZDYzNjViYjQyMzZlNGI1NGIifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRldnRvb2xzLWNsb3VkYnVpbGQvLk93bEJvdC55YW1sIiwiaCI6IjA3YjdmM2RhZDhhYTE5MTJkNGFjZGNmZDYzNjViYjQyMzZlNGI1NGIifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRldnRvb2xzLWNsb3VkcHJvZmlsZXIvLk93bEJvdC55YW1sIiwiaCI6IjA3YjdmM2RhZDhhYTE5MTJkNGFjZGNmZDYzNjViYjQyMzZlNGI1NGIifQ== * 🦉 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 * feat: Trusted Private Cloud support, use the universeDomain parameter 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 88763bb commit 852f3eb

233 files changed

Lines changed: 6212 additions & 895 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-talent/samples/generated/v4/company_service.list_companies.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function main(parent) {
6565
};
6666

6767
// Run request
68-
const iterable = await talentClient.listCompaniesAsync(request);
68+
const iterable = talentClient.listCompaniesAsync(request);
6969
for await (const response of iterable) {
7070
console.log(response);
7171
}

packages/google-cloud-talent/samples/generated/v4/job_service.list_jobs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function main(parent, filter) {
8989
};
9090

9191
// Run request
92-
const iterable = await talentClient.listJobsAsync(request);
92+
const iterable = talentClient.listJobsAsync(request);
9393
for await (const response of iterable) {
9494
console.log(response);
9595
}

packages/google-cloud-talent/samples/generated/v4/tenant_service.list_tenants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function main(parent) {
5757
};
5858

5959
// Run request
60-
const iterable = await talentClient.listTenantsAsync(request);
60+
const iterable = talentClient.listTenantsAsync(request);
6161
for await (const response of iterable) {
6262
console.log(response);
6363
}

packages/google-cloud-talent/samples/generated/v4beta1/company_service.list_companies.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function main(parent) {
6767
};
6868

6969
// Run request
70-
const iterable = await talentClient.listCompaniesAsync(request);
70+
const iterable = talentClient.listCompaniesAsync(request);
7171
for await (const response of iterable) {
7272
console.log(response);
7373
}

packages/google-cloud-talent/samples/generated/v4beta1/job_service.list_jobs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function main(parent, filter) {
9191
};
9292

9393
// Run request
94-
const iterable = await talentClient.listJobsAsync(request);
94+
const iterable = talentClient.listJobsAsync(request);
9595
for await (const response of iterable) {
9696
console.log(response);
9797
}

packages/google-cloud-talent/samples/generated/v4beta1/tenant_service.list_tenants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function main(parent) {
5757
};
5858

5959
// Run request
60-
const iterable = await talentClient.listTenantsAsync(request);
60+
const iterable = talentClient.listTenantsAsync(request);
6161
for await (const response of iterable) {
6262
console.log(response);
6363
}

packages/google-cloud-talent/src/v4/company_service_client.ts

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import type {
2929
import {Transform} from 'stream';
3030
import * as protos from '../../protos/protos';
3131
import jsonProtos = require('../../protos/protos.json');
32+
3233
/**
3334
* Client JSON configuration object, loaded from
3435
* `src/v4/company_service_client_config.json`.
@@ -50,6 +51,8 @@ export class CompanyServiceClient {
5051
private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient;
5152
private _protos: {};
5253
private _defaults: {[method: string]: gax.CallSettings};
54+
private _universeDomain: string;
55+
private _servicePath: string;
5356
auth: gax.GoogleAuth;
5457
descriptors: Descriptors = {
5558
page: {},
@@ -107,8 +110,20 @@ export class CompanyServiceClient {
107110
) {
108111
// Ensure that options include all the required fields.
109112
const staticMembers = this.constructor as typeof CompanyServiceClient;
113+
if (
114+
opts?.universe_domain &&
115+
opts?.universeDomain &&
116+
opts?.universe_domain !== opts?.universeDomain
117+
) {
118+
throw new Error(
119+
'Please set either universe_domain or universeDomain, but not both.'
120+
);
121+
}
122+
this._universeDomain =
123+
opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com';
124+
this._servicePath = 'jobs.' + this._universeDomain;
110125
const servicePath =
111-
opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath;
126+
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
112127
this._providedCustomServicePath = !!(
113128
opts?.servicePath || opts?.apiEndpoint
114129
);
@@ -123,7 +138,7 @@ export class CompanyServiceClient {
123138
opts.numericEnums = true;
124139

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

@@ -148,10 +163,10 @@ export class CompanyServiceClient {
148163
this.auth.useJWTAccessWithScope = true;
149164

150165
// Set defaultServicePath on the auth object.
151-
this.auth.defaultServicePath = staticMembers.servicePath;
166+
this.auth.defaultServicePath = this._servicePath;
152167

153168
// Set the default scopes in auth client if needed.
154-
if (servicePath === staticMembers.servicePath) {
169+
if (servicePath === this._servicePath) {
155170
this.auth.defaultScopes = staticMembers.scopes;
156171
}
157172

@@ -286,21 +301,52 @@ export class CompanyServiceClient {
286301

287302
/**
288303
* The DNS address for this API service.
304+
* @deprecated Use the apiEndpoint method of the client instance.
289305
* @returns {string} The DNS address for this service.
290306
*/
291307
static get servicePath() {
308+
if (
309+
typeof process !== undefined &&
310+
typeof process.emitWarning === 'function'
311+
) {
312+
process.emitWarning(
313+
'Static servicePath is deprecated, please use the instance method instead.',
314+
'DeprecationWarning'
315+
);
316+
}
292317
return 'jobs.googleapis.com';
293318
}
294319

295320
/**
296-
* The DNS address for this API service - same as servicePath(),
297-
* exists for compatibility reasons.
321+
* The DNS address for this API service - same as servicePath.
322+
* @deprecated Use the apiEndpoint method of the client instance.
298323
* @returns {string} The DNS address for this service.
299324
*/
300325
static get apiEndpoint() {
326+
if (
327+
typeof process !== undefined &&
328+
typeof process.emitWarning === 'function'
329+
) {
330+
process.emitWarning(
331+
'Static apiEndpoint is deprecated, please use the instance method instead.',
332+
'DeprecationWarning'
333+
);
334+
}
301335
return 'jobs.googleapis.com';
302336
}
303337

338+
/**
339+
* The DNS address for this API service.
340+
* @returns {string} The DNS address for this service.
341+
*/
342+
get apiEndpoint() {
343+
return this._servicePath;
344+
}
345+
346+
get universeDomain() {
347+
return this._universeDomain;
348+
}
349+
304350
/**
305351
* The port for this API service.
306352
* @returns {number} The default port for this service.

packages/google-cloud-talent/src/v4/completion_client.ts

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import type {
2727

2828
import * as protos from '../../protos/protos';
2929
import jsonProtos = require('../../protos/protos.json');
30+
3031
/**
3132
* Client JSON configuration object, loaded from
3233
* `src/v4/completion_client_config.json`.
@@ -48,6 +49,8 @@ export class CompletionClient {
4849
private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient;
4950
private _protos: {};
5051
private _defaults: {[method: string]: gax.CallSettings};
52+
private _universeDomain: string;
53+
private _servicePath: string;
5154
auth: gax.GoogleAuth;
5255
descriptors: Descriptors = {
5356
page: {},
@@ -105,8 +108,20 @@ export class CompletionClient {
105108
) {
106109
// Ensure that options include all the required fields.
107110
const staticMembers = this.constructor as typeof CompletionClient;
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 = 'jobs.' + this._universeDomain;
108123
const servicePath =
109-
opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath;
124+
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
110125
this._providedCustomServicePath = !!(
111126
opts?.servicePath || opts?.apiEndpoint
112127
);
@@ -121,7 +136,7 @@ export class CompletionClient {
121136
opts.numericEnums = true;
122137

123138
// 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)) {
125140
opts['scopes'] = staticMembers.scopes;
126141
}
127142

@@ -146,10 +161,10 @@ export class CompletionClient {
146161
this.auth.useJWTAccessWithScope = true;
147162

148163
// Set defaultServicePath on the auth object.
149-
this.auth.defaultServicePath = staticMembers.servicePath;
164+
this.auth.defaultServicePath = this._servicePath;
150165

151166
// Set the default scopes in auth client if needed.
152-
if (servicePath === staticMembers.servicePath) {
167+
if (servicePath === this._servicePath) {
153168
this.auth.defaultScopes = staticMembers.scopes;
154169
}
155170

@@ -267,21 +282,52 @@ export class CompletionClient {
267282

268283
/**
269284
* The DNS address for this API service.
285+
* @deprecated Use the apiEndpoint method of the client instance.
270286
* @returns {string} The DNS address for this service.
271287
*/
272288
static get servicePath() {
289+
if (
290+
typeof process !== undefined &&
291+
typeof process.emitWarning === 'function'
292+
) {
293+
process.emitWarning(
294+
'Static servicePath is deprecated, please use the instance method instead.',
295+
'DeprecationWarning'
296+
);
297+
}
273298
return 'jobs.googleapis.com';
274299
}
275300

276301
/**
277-
* The DNS address for this API service - same as servicePath(),
278-
* exists for compatibility reasons.
302+
* The DNS address for this API service - same as servicePath.
303+
* @deprecated Use the apiEndpoint method of the client instance.
279304
* @returns {string} The DNS address for this service.
280305
*/
281306
static get apiEndpoint() {
307+
if (
308+
typeof process !== undefined &&
309+
typeof process.emitWarning === 'function'
310+
) {
311+
process.emitWarning(
312+
'Static apiEndpoint is deprecated, please use the instance method instead.',
313+
'DeprecationWarning'
314+
);
315+
}
282316
return 'jobs.googleapis.com';
283317
}
284318

319+
/**
320+
* The DNS address for this API service.
321+
* @returns {string} The DNS address for this service.
322+
*/
323+
get apiEndpoint() {
324+
return this._servicePath;
325+
}
326+
327+
get universeDomain() {
328+
return this._universeDomain;
329+
}
330+
285331
/**
286332
* The port for this API service.
287333
* @returns {number} The default port for this service.

0 commit comments

Comments
 (0)