Skip to content

Commit 417b82b

Browse files
committed
[ML] fix ml api services (#69681)
1 parent 188def4 commit 417b82b

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

  • x-pack/plugins/ml/public/application/services/ml_api_service

x-pack/plugins/ml/public/application/services/ml_api_service/index.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ export type MlApiServices = ReturnType<typeof mlApiServicesProvider>;
109109
export const ml = mlApiServicesProvider(new HttpService(proxyHttpStart));
110110

111111
export function mlApiServicesProvider(httpService: HttpService) {
112-
const { http } = httpService;
113112
return {
114113
getJobs(obj?: { jobId?: string }) {
115114
const jobId = obj && obj.jobId ? `/${obj.jobId}` : '';
@@ -142,14 +141,14 @@ export function mlApiServicesProvider(httpService: HttpService) {
142141
},
143142

144143
closeJob({ jobId }: { jobId: string }) {
145-
return http<any>({
144+
return httpService.http<any>({
146145
path: `${basePath()}/anomaly_detectors/${jobId}/_close`,
147146
method: 'POST',
148147
});
149148
},
150149

151150
forceCloseJob({ jobId }: { jobId: string }) {
152-
return http<any>({
151+
return httpService.http<any>({
153152
path: `${basePath()}/anomaly_detectors/${jobId}/_close?force=true`,
154153
method: 'POST',
155154
});
@@ -278,14 +277,14 @@ export function mlApiServicesProvider(httpService: HttpService) {
278277
},
279278

280279
stopDatafeed({ datafeedId }: { datafeedId: string }) {
281-
return http<any>({
280+
return httpService.http<any>({
282281
path: `${basePath()}/datafeeds/${datafeedId}/_stop`,
283282
method: 'POST',
284283
});
285284
},
286285

287286
forceStopDatafeed({ datafeedId }: { datafeedId: string }) {
288-
return http<any>({
287+
return httpService.http<any>({
289288
path: `${basePath()}/datafeeds/${datafeedId}/_stop?force=true`,
290289
method: 'POST',
291290
});
@@ -697,7 +696,7 @@ export function mlApiServicesProvider(httpService: HttpService) {
697696
},
698697

699698
getModelSnapshots(jobId: string, snapshotId?: string) {
700-
return http<GetModelSnapshotsResponse>({
699+
return httpService.http<GetModelSnapshotsResponse>({
701700
path: `${basePath()}/anomaly_detectors/${jobId}/model_snapshots${
702701
snapshotId !== undefined ? `/${snapshotId}` : ''
703702
}`,
@@ -709,15 +708,15 @@ export function mlApiServicesProvider(httpService: HttpService) {
709708
snapshotId: string,
710709
body: { description?: string; retain?: boolean }
711710
) {
712-
return http<any>({
711+
return httpService.http<any>({
713712
path: `${basePath()}/anomaly_detectors/${jobId}/model_snapshots/${snapshotId}/_update`,
714713
method: 'POST',
715714
body: JSON.stringify(body),
716715
});
717716
},
718717

719718
deleteModelSnapshot(jobId: string, snapshotId: string) {
720-
return http<any>({
719+
return httpService.http<any>({
721720
path: `${basePath()}/anomaly_detectors/${jobId}/model_snapshots/${snapshotId}`,
722721
method: 'DELETE',
723722
});

0 commit comments

Comments
 (0)