diff --git a/packages/google-cloud-dataproc/src/v1/autoscaling_policy_service_client.ts b/packages/google-cloud-dataproc/src/v1/autoscaling_policy_service_client.ts index 8be9e383a06..38629e31a3b 100644 --- a/packages/google-cloud-dataproc/src/v1/autoscaling_policy_service_client.ts +++ b/packages/google-cloud-dataproc/src/v1/autoscaling_policy_service_client.ts @@ -49,6 +49,7 @@ const version = require('../../../package.json').version; export class AutoscalingPolicyServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -60,6 +61,7 @@ export class AutoscalingPolicyServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; autoscalingPolicyServiceStub?: Promise<{[name: string]: Function}>; @@ -104,6 +106,9 @@ export class AutoscalingPolicyServiceClient { .constructor as typeof AutoscalingPolicyServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -202,6 +207,9 @@ export class AutoscalingPolicyServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -231,7 +239,8 @@ export class AutoscalingPolicyServiceClient { : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.dataproc.v1 .AutoscalingPolicyService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-dataproc/src/v1/cluster_controller_client.ts b/packages/google-cloud-dataproc/src/v1/cluster_controller_client.ts index 8ef94af1a87..201c8b6aa6e 100644 --- a/packages/google-cloud-dataproc/src/v1/cluster_controller_client.ts +++ b/packages/google-cloud-dataproc/src/v1/cluster_controller_client.ts @@ -50,6 +50,7 @@ const version = require('../../../package.json').version; export class ClusterControllerClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -61,6 +62,7 @@ export class ClusterControllerClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -105,6 +107,9 @@ export class ClusterControllerClient { const staticMembers = this.constructor as typeof ClusterControllerClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -282,6 +287,9 @@ export class ClusterControllerClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -310,7 +318,8 @@ export class ClusterControllerClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.dataproc.v1.ClusterController, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-dataproc/src/v1/job_controller_client.ts b/packages/google-cloud-dataproc/src/v1/job_controller_client.ts index 23a6e8f8919..e5db782e840 100644 --- a/packages/google-cloud-dataproc/src/v1/job_controller_client.ts +++ b/packages/google-cloud-dataproc/src/v1/job_controller_client.ts @@ -49,6 +49,7 @@ const version = require('../../../package.json').version; export class JobControllerClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -60,6 +61,7 @@ export class JobControllerClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -104,6 +106,9 @@ export class JobControllerClient { const staticMembers = this.constructor as typeof JobControllerClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -223,6 +228,9 @@ export class JobControllerClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -251,7 +259,8 @@ export class JobControllerClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.dataproc.v1.JobController, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-dataproc/src/v1/workflow_template_service_client.ts b/packages/google-cloud-dataproc/src/v1/workflow_template_service_client.ts index 28d2f74c136..3a3cf992d01 100644 --- a/packages/google-cloud-dataproc/src/v1/workflow_template_service_client.ts +++ b/packages/google-cloud-dataproc/src/v1/workflow_template_service_client.ts @@ -50,6 +50,7 @@ const version = require('../../../package.json').version; export class WorkflowTemplateServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -61,6 +62,7 @@ export class WorkflowTemplateServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -106,6 +108,9 @@ export class WorkflowTemplateServiceClient { .constructor as typeof WorkflowTemplateServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -251,6 +256,9 @@ export class WorkflowTemplateServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -280,7 +288,8 @@ export class WorkflowTemplateServiceClient { : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.dataproc.v1 .WorkflowTemplateService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-dataproc/src/v1beta2/autoscaling_policy_service_client.ts b/packages/google-cloud-dataproc/src/v1beta2/autoscaling_policy_service_client.ts index 8df160436ac..b3ba72f140c 100644 --- a/packages/google-cloud-dataproc/src/v1beta2/autoscaling_policy_service_client.ts +++ b/packages/google-cloud-dataproc/src/v1beta2/autoscaling_policy_service_client.ts @@ -49,6 +49,7 @@ const version = require('../../../package.json').version; export class AutoscalingPolicyServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -60,6 +61,7 @@ export class AutoscalingPolicyServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; autoscalingPolicyServiceStub?: Promise<{[name: string]: Function}>; @@ -104,6 +106,9 @@ export class AutoscalingPolicyServiceClient { .constructor as typeof AutoscalingPolicyServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -202,6 +207,9 @@ export class AutoscalingPolicyServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -231,7 +239,8 @@ export class AutoscalingPolicyServiceClient { : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.dataproc.v1beta2 .AutoscalingPolicyService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-dataproc/src/v1beta2/cluster_controller_client.ts b/packages/google-cloud-dataproc/src/v1beta2/cluster_controller_client.ts index 4943f38eef1..d30fc8c3eed 100644 --- a/packages/google-cloud-dataproc/src/v1beta2/cluster_controller_client.ts +++ b/packages/google-cloud-dataproc/src/v1beta2/cluster_controller_client.ts @@ -50,6 +50,7 @@ const version = require('../../../package.json').version; export class ClusterControllerClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -61,6 +62,7 @@ export class ClusterControllerClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -105,6 +107,9 @@ export class ClusterControllerClient { const staticMembers = this.constructor as typeof ClusterControllerClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -257,6 +262,9 @@ export class ClusterControllerClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -285,7 +293,8 @@ export class ClusterControllerClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.dataproc.v1beta2.ClusterController, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-dataproc/src/v1beta2/job_controller_client.ts b/packages/google-cloud-dataproc/src/v1beta2/job_controller_client.ts index dbee17ff467..e4419b6bb40 100644 --- a/packages/google-cloud-dataproc/src/v1beta2/job_controller_client.ts +++ b/packages/google-cloud-dataproc/src/v1beta2/job_controller_client.ts @@ -49,6 +49,7 @@ const version = require('../../../package.json').version; export class JobControllerClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -60,6 +61,7 @@ export class JobControllerClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -104,6 +106,9 @@ export class JobControllerClient { const staticMembers = this.constructor as typeof JobControllerClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -223,6 +228,9 @@ export class JobControllerClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -251,7 +259,8 @@ export class JobControllerClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.dataproc.v1beta2.JobController, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-dataproc/src/v1beta2/workflow_template_service_client.ts b/packages/google-cloud-dataproc/src/v1beta2/workflow_template_service_client.ts index 740c18992b9..53472f61d7e 100644 --- a/packages/google-cloud-dataproc/src/v1beta2/workflow_template_service_client.ts +++ b/packages/google-cloud-dataproc/src/v1beta2/workflow_template_service_client.ts @@ -50,6 +50,7 @@ const version = require('../../../package.json').version; export class WorkflowTemplateServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -61,6 +62,7 @@ export class WorkflowTemplateServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -106,6 +108,9 @@ export class WorkflowTemplateServiceClient { .constructor as typeof WorkflowTemplateServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -251,6 +256,9 @@ export class WorkflowTemplateServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -280,7 +288,8 @@ export class WorkflowTemplateServiceClient { : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.dataproc.v1beta2 .WorkflowTemplateService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides