@@ -43,9 +43,9 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
4343 tags : [ 'access:ml:canGetJobs' ] ,
4444 } ,
4545 } ,
46- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
46+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , response } ) => {
4747 try {
48- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.jobs' ) ;
48+ const results = await legacyClient . callAsInternalUser ( 'ml.jobs' ) ;
4949 return response . ok ( {
5050 body : results ,
5151 } ) ;
@@ -74,10 +74,10 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
7474 tags : [ 'access:ml:canGetJobs' ] ,
7575 } ,
7676 } ,
77- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
77+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
7878 try {
7979 const { jobId } = request . params ;
80- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.jobs' , { jobId } ) ;
80+ const results = await legacyClient . callAsInternalUser ( 'ml.jobs' , { jobId } ) ;
8181 return response . ok ( {
8282 body : results ,
8383 } ) ;
@@ -105,9 +105,9 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
105105 tags : [ 'access:ml:canGetJobs' ] ,
106106 } ,
107107 } ,
108- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
108+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , response } ) => {
109109 try {
110- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.jobStats' ) ;
110+ const results = await legacyClient . callAsInternalUser ( 'ml.jobStats' ) ;
111111 return response . ok ( {
112112 body : results ,
113113 } ) ;
@@ -136,10 +136,10 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
136136 tags : [ 'access:ml:canGetJobs' ] ,
137137 } ,
138138 } ,
139- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
139+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
140140 try {
141141 const { jobId } = request . params ;
142- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.jobStats' , { jobId } ) ;
142+ const results = await legacyClient . callAsInternalUser ( 'ml.jobStats' , { jobId } ) ;
143143 return response . ok ( {
144144 body : results ,
145145 } ) ;
@@ -172,10 +172,10 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
172172 tags : [ 'access:ml:canCreateJob' ] ,
173173 } ,
174174 } ,
175- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
175+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
176176 try {
177177 const { jobId } = request . params ;
178- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.addJob' , {
178+ const results = await legacyClient . callAsInternalUser ( 'ml.addJob' , {
179179 jobId,
180180 body : request . body ,
181181 } ) ;
@@ -209,10 +209,10 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
209209 tags : [ 'access:ml:canUpdateJob' ] ,
210210 } ,
211211 } ,
212- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
212+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
213213 try {
214214 const { jobId } = request . params ;
215- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.updateJob' , {
215+ const results = await legacyClient . callAsInternalUser ( 'ml.updateJob' , {
216216 jobId,
217217 body : request . body ,
218218 } ) ;
@@ -244,10 +244,10 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
244244 tags : [ 'access:ml:canOpenJob' ] ,
245245 } ,
246246 } ,
247- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
247+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
248248 try {
249249 const { jobId } = request . params ;
250- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.openJob' , {
250+ const results = await legacyClient . callAsInternalUser ( 'ml.openJob' , {
251251 jobId,
252252 } ) ;
253253 return response . ok ( {
@@ -278,7 +278,7 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
278278 tags : [ 'access:ml:canCloseJob' ] ,
279279 } ,
280280 } ,
281- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
281+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
282282 try {
283283 const options : { jobId : string ; force ?: boolean } = {
284284 jobId : request . params . jobId ,
@@ -287,7 +287,7 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
287287 if ( force !== undefined ) {
288288 options . force = force ;
289289 }
290- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.closeJob' , options ) ;
290+ const results = await legacyClient . callAsInternalUser ( 'ml.closeJob' , options ) ;
291291 return response . ok ( {
292292 body : results ,
293293 } ) ;
@@ -316,7 +316,7 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
316316 tags : [ 'access:ml:canDeleteJob' ] ,
317317 } ,
318318 } ,
319- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
319+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
320320 try {
321321 const options : { jobId : string ; force ?: boolean } = {
322322 jobId : request . params . jobId ,
@@ -325,7 +325,7 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
325325 if ( force !== undefined ) {
326326 options . force = force ;
327327 }
328- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.deleteJob' , options ) ;
328+ const results = await legacyClient . callAsInternalUser ( 'ml.deleteJob' , options ) ;
329329 return response . ok ( {
330330 body : results ,
331331 } ) ;
@@ -352,9 +352,9 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
352352 tags : [ 'access:ml:canCreateJob' ] ,
353353 } ,
354354 } ,
355- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
355+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
356356 try {
357- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.validateDetector' , {
357+ const results = await legacyClient . callAsInternalUser ( 'ml.validateDetector' , {
358358 body : request . body ,
359359 } ) ;
360360 return response . ok ( {
@@ -387,11 +387,11 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
387387 tags : [ 'access:ml:canForecastJob' ] ,
388388 } ,
389389 } ,
390- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
390+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
391391 try {
392392 const jobId = request . params . jobId ;
393393 const duration = request . body . duration ;
394- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.forecast' , {
394+ const results = await legacyClient . callAsInternalUser ( 'ml.forecast' , {
395395 jobId,
396396 duration,
397397 } ) ;
@@ -428,9 +428,9 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
428428 tags : [ 'access:ml:canGetJobs' ] ,
429429 } ,
430430 } ,
431- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
431+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
432432 try {
433- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.records' , {
433+ const results = await legacyClient . callAsInternalUser ( 'ml.records' , {
434434 jobId : request . params . jobId ,
435435 body : request . body ,
436436 } ) ;
@@ -467,9 +467,9 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
467467 tags : [ 'access:ml:canGetJobs' ] ,
468468 } ,
469469 } ,
470- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
470+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
471471 try {
472- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.buckets' , {
472+ const results = await legacyClient . callAsInternalUser ( 'ml.buckets' , {
473473 jobId : request . params . jobId ,
474474 timestamp : request . params . timestamp ,
475475 body : request . body ,
@@ -507,9 +507,9 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
507507 tags : [ 'access:ml:canGetJobs' ] ,
508508 } ,
509509 } ,
510- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
510+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
511511 try {
512- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.overallBuckets' , {
512+ const results = await legacyClient . callAsInternalUser ( 'ml.overallBuckets' , {
513513 jobId : request . params . jobId ,
514514 top_n : request . body . topN ,
515515 bucket_span : request . body . bucketSpan ,
@@ -544,9 +544,9 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
544544 tags : [ 'access:ml:canGetJobs' ] ,
545545 } ,
546546 } ,
547- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
547+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
548548 try {
549- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.categories' , {
549+ const results = await legacyClient . callAsInternalUser ( 'ml.categories' , {
550550 jobId : request . params . jobId ,
551551 categoryId : request . params . categoryId ,
552552 } ) ;
@@ -578,9 +578,9 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
578578 tags : [ 'access:ml:canGetJobs' ] ,
579579 } ,
580580 } ,
581- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
581+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
582582 try {
583- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.modelSnapshots' , {
583+ const results = await legacyClient . callAsInternalUser ( 'ml.modelSnapshots' , {
584584 jobId : request . params . jobId ,
585585 } ) ;
586586 return response . ok ( {
@@ -611,9 +611,9 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
611611 tags : [ 'access:ml:canGetJobs' ] ,
612612 } ,
613613 } ,
614- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
614+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
615615 try {
616- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.modelSnapshots' , {
616+ const results = await legacyClient . callAsInternalUser ( 'ml.modelSnapshots' , {
617617 jobId : request . params . jobId ,
618618 snapshotId : request . params . snapshotId ,
619619 } ) ;
@@ -647,9 +647,9 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
647647 tags : [ 'access:ml:canCreateJob' ] ,
648648 } ,
649649 } ,
650- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
650+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
651651 try {
652- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.updateModelSnapshot' , {
652+ const results = await legacyClient . callAsInternalUser ( 'ml.updateModelSnapshot' , {
653653 jobId : request . params . jobId ,
654654 snapshotId : request . params . snapshotId ,
655655 body : request . body ,
@@ -682,9 +682,9 @@ export function jobRoutes({ router, mlLicense }: RouteInitialization) {
682682 tags : [ 'access:ml:canCreateJob' ] ,
683683 } ,
684684 } ,
685- mlLicense . fullLicenseAPIGuard ( async ( context , request , response ) => {
685+ mlLicense . fullLicenseAPIGuard ( async ( { legacyClient , request, response } ) => {
686686 try {
687- const results = await context . ml ! . mlClient . callAsInternalUser ( 'ml.deleteModelSnapshot' , {
687+ const results = await legacyClient . callAsInternalUser ( 'ml.deleteModelSnapshot' , {
688688 jobId : request . params . jobId ,
689689 snapshotId : request . params . snapshotId ,
690690 } ) ;
0 commit comments