@@ -49,6 +49,7 @@ const version = require('../../../package.json').version;
49
49
export class ServiceUsageClient {
50
50
private _terminated = false ;
51
51
private _opts : ClientOptions ;
52
+ private _providedCustomServicePath : boolean ;
52
53
private _gaxModule : typeof gax | typeof gax . fallback ;
53
54
private _gaxGrpc : gax . GrpcClient | gax . fallback . GrpcClient ;
54
55
private _protos : { } ;
@@ -60,6 +61,7 @@ export class ServiceUsageClient {
60
61
longrunning : { } ,
61
62
batching : { } ,
62
63
} ;
64
+ warn : ( code : string , message : string , warnType ?: string ) => void ;
63
65
innerApiCalls : { [ name : string ] : Function } ;
64
66
operationsClient : gax . OperationsClient ;
65
67
serviceUsageStub ?: Promise < { [ name : string ] : Function } > ;
@@ -103,6 +105,9 @@ export class ServiceUsageClient {
103
105
const staticMembers = this . constructor as typeof ServiceUsageClient ;
104
106
const servicePath =
105
107
opts ?. servicePath || opts ?. apiEndpoint || staticMembers . servicePath ;
108
+ this . _providedCustomServicePath = ! ! (
109
+ opts ?. servicePath || opts ?. apiEndpoint
110
+ ) ;
106
111
const port = opts ?. port || staticMembers . port ;
107
112
const clientConfig = opts ?. clientConfig ?? { } ;
108
113
const fallback =
@@ -356,6 +361,9 @@ export class ServiceUsageClient {
356
361
// of calling the API is handled in `google-gax`, with this code
357
362
// merely providing the destination and request information.
358
363
this . innerApiCalls = { } ;
364
+
365
+ // Add a warn function to the client constructor so it can be easily tested.
366
+ this . warn = gax . warn ;
359
367
}
360
368
361
369
/**
@@ -384,7 +392,8 @@ export class ServiceUsageClient {
384
392
)
385
393
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
386
394
( this . _protos as any ) . google . api . serviceusage . v1beta1 . ServiceUsage ,
387
- this . _opts
395
+ this . _opts ,
396
+ this . _providedCustomServicePath
388
397
) as Promise < { [ method : string ] : Function } > ;
389
398
390
399
// Iterate over each of the methods that the service provides
@@ -592,7 +601,7 @@ export class ServiceUsageClient {
592
601
name : request . name || '' ,
593
602
} ) ;
594
603
this . initialize ( ) ;
595
- gax . warn (
604
+ this . warn (
596
605
'DEP$ServiceUsage-$GetService' ,
597
606
'GetService is deprecated and may be removed in a future version.' ,
598
607
'DeprecationWarning'
@@ -923,7 +932,7 @@ export class ServiceUsageClient {
923
932
name : request . name || '' ,
924
933
} ) ;
925
934
this . initialize ( ) ;
926
- gax . warn (
935
+ this . warn (
927
936
'DEP$ServiceUsage-$EnableService' ,
928
937
'EnableService is deprecated and may be removed in a future version.' ,
929
938
'DeprecationWarning'
@@ -954,6 +963,11 @@ export class ServiceUsageClient {
954
963
protos . google . api . serviceusage . v1beta1 . OperationMetadata
955
964
>
956
965
> {
966
+ this . warn (
967
+ 'DEP$ServiceUsage-$checkEnableServiceProgress' ,
968
+ 'checkEnableServiceProgress is deprecated and may be removed in a future version.' ,
969
+ 'DeprecationWarning'
970
+ ) ;
957
971
const request = new operationsProtos . google . longrunning . GetOperationRequest (
958
972
{ name}
959
973
) ;
@@ -1085,7 +1099,7 @@ export class ServiceUsageClient {
1085
1099
name : request . name || '' ,
1086
1100
} ) ;
1087
1101
this . initialize ( ) ;
1088
- gax . warn (
1102
+ this . warn (
1089
1103
'DEP$ServiceUsage-$DisableService' ,
1090
1104
'DisableService is deprecated and may be removed in a future version.' ,
1091
1105
'DeprecationWarning'
@@ -1116,6 +1130,11 @@ export class ServiceUsageClient {
1116
1130
protos . google . api . serviceusage . v1beta1 . OperationMetadata
1117
1131
>
1118
1132
> {
1133
+ this . warn (
1134
+ 'DEP$ServiceUsage-$checkDisableServiceProgress' ,
1135
+ 'checkDisableServiceProgress is deprecated and may be removed in a future version.' ,
1136
+ 'DeprecationWarning'
1137
+ ) ;
1119
1138
const request = new operationsProtos . google . longrunning . GetOperationRequest (
1120
1139
{ name}
1121
1140
) ;
@@ -1258,7 +1277,7 @@ export class ServiceUsageClient {
1258
1277
parent : request . parent || '' ,
1259
1278
} ) ;
1260
1279
this . initialize ( ) ;
1261
- gax . warn (
1280
+ this . warn (
1262
1281
'DEP$ServiceUsage-$BatchEnableServices' ,
1263
1282
'BatchEnableServices is deprecated and may be removed in a future version.' ,
1264
1283
'DeprecationWarning'
@@ -1289,6 +1308,11 @@ export class ServiceUsageClient {
1289
1308
protos . google . api . serviceusage . v1beta1 . OperationMetadata
1290
1309
>
1291
1310
> {
1311
+ this . warn (
1312
+ 'DEP$ServiceUsage-$checkBatchEnableServicesProgress' ,
1313
+ 'checkBatchEnableServicesProgress is deprecated and may be removed in a future version.' ,
1314
+ 'DeprecationWarning'
1315
+ ) ;
1292
1316
const request = new operationsProtos . google . longrunning . GetOperationRequest (
1293
1317
{ name}
1294
1318
) ;
@@ -2842,7 +2866,7 @@ export class ServiceUsageClient {
2842
2866
parent : request . parent || '' ,
2843
2867
} ) ;
2844
2868
this . initialize ( ) ;
2845
- gax . warn (
2869
+ this . warn (
2846
2870
'DEP$ServiceUsage-$ListServices' ,
2847
2871
'ListServices is deprecated and may be removed in a future version.' ,
2848
2872
'DeprecationWarning'
@@ -2897,7 +2921,7 @@ export class ServiceUsageClient {
2897
2921
} ) ;
2898
2922
const callSettings = new gax . CallSettings ( options ) ;
2899
2923
this . initialize ( ) ;
2900
- gax . warn (
2924
+ this . warn (
2901
2925
'DEP$ServiceUsage-$ListServices' ,
2902
2926
'ListServices is deprecated and may be removed in a future version.' ,
2903
2927
'DeprecationWarning'
@@ -2963,7 +2987,7 @@ export class ServiceUsageClient {
2963
2987
options = options || { } ;
2964
2988
const callSettings = new gax . CallSettings ( options ) ;
2965
2989
this . initialize ( ) ;
2966
- gax . warn (
2990
+ this . warn (
2967
2991
'DEP$ServiceUsage-$ListServices' ,
2968
2992
'ListServices is deprecated and may be removed in a future version.' ,
2969
2993
'DeprecationWarning'
0 commit comments