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

build: update gapic-generator-typescript to v4.4.1 #1489

Merged
merged 5 commits into from
Feb 9, 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
2 changes: 1 addition & 1 deletion samples/generated/v2/config_service_v2.list_buckets.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function main(parent) {
};

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

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

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

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

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

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

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

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

// Run request
const iterable = await loggingClient.listLogMetricsAsync(request);
const iterable = loggingClient.listLogMetricsAsync(request);
for await (const response of iterable) {
console.log(response);
}
Expand Down
58 changes: 52 additions & 6 deletions src/v2/config_service_v2_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/config_service_v2_client_config.json`.
Expand All @@ -52,6 +53,8 @@ export class ConfigServiceV2Client {
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 @@ -110,8 +113,20 @@ export class ConfigServiceV2Client {
) {
// Ensure that options include all the required fields.
const staticMembers = this.constructor as typeof ConfigServiceV2Client;
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 = 'logging.' + this._universeDomain;
const servicePath =
opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath;
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
this._providedCustomServicePath = !!(
opts?.servicePath || opts?.apiEndpoint
);
Expand All @@ -126,7 +141,7 @@ export class ConfigServiceV2Client {
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 @@ -151,10 +166,10 @@ export class ConfigServiceV2Client {
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 @@ -558,21 +573,52 @@ export class ConfigServiceV2Client {

/**
* The DNS address for this API service.
* @deprecated Use the apiEndpoint method of the client instance.
* @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 'logging.googleapis.com';
}

/**
* The DNS address for this API service - same as servicePath(),
* exists for compatibility reasons.
* The DNS address for this API service - same as servicePath.
* @deprecated Use the apiEndpoint method of the client instance.
* @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 'logging.googleapis.com';
}

/**
* The DNS address for this API service.
* @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
60 changes: 53 additions & 7 deletions src/v2/logging_service_v2_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import type {
import {Transform, PassThrough} from 'stream';
import * as protos from '../../protos/protos';
import jsonProtos = require('../../protos/protos.json');

/**
* Client JSON configuration object, loaded from
* `src/v2/logging_service_v2_client_config.json`.
Expand All @@ -50,6 +51,8 @@ export class LoggingServiceV2Client {
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 @@ -107,8 +110,20 @@ export class LoggingServiceV2Client {
) {
// Ensure that options include all the required fields.
const staticMembers = this.constructor as typeof LoggingServiceV2Client;
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 = 'logging.' + this._universeDomain;
const servicePath =
opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath;
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
this._providedCustomServicePath = !!(
opts?.servicePath || opts?.apiEndpoint
);
Expand All @@ -123,7 +138,7 @@ export class LoggingServiceV2Client {
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 @@ -148,10 +163,10 @@ export class LoggingServiceV2Client {
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 @@ -313,7 +328,7 @@ export class LoggingServiceV2Client {
tailLogEntries: new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.BIDI_STREAMING,
!!opts.fallback,
/* gaxStreamingRetries: */ true
/* gaxStreamingRetries: */ false
),
};

Expand Down Expand Up @@ -437,21 +452,52 @@ export class LoggingServiceV2Client {

/**
* The DNS address for this API service.
* @deprecated Use the apiEndpoint method of the client instance.
* @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 'logging.googleapis.com';
}

/**
* The DNS address for this API service - same as servicePath(),
* exists for compatibility reasons.
* The DNS address for this API service - same as servicePath.
* @deprecated Use the apiEndpoint method of the client instance.
* @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 'logging.googleapis.com';
}

/**
* The DNS address for this API service.
* @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
Loading