Skip to content

Commit

Permalink
[ML] fix ml api services (#69681) (#69685)
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov authored Jun 23, 2020
1 parent b81e70a commit b2eec07
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export type MlApiServices = ReturnType<typeof mlApiServicesProvider>;
export const ml = mlApiServicesProvider(new HttpService(proxyHttpStart));

export function mlApiServicesProvider(httpService: HttpService) {
const { http } = httpService;
return {
getJobs(obj?: { jobId?: string }) {
const jobId = obj && obj.jobId ? `/${obj.jobId}` : '';
Expand Down Expand Up @@ -142,14 +141,14 @@ export function mlApiServicesProvider(httpService: HttpService) {
},

closeJob({ jobId }: { jobId: string }) {
return http<any>({
return httpService.http<any>({
path: `${basePath()}/anomaly_detectors/${jobId}/_close`,
method: 'POST',
});
},

forceCloseJob({ jobId }: { jobId: string }) {
return http<any>({
return httpService.http<any>({
path: `${basePath()}/anomaly_detectors/${jobId}/_close?force=true`,
method: 'POST',
});
Expand Down Expand Up @@ -278,14 +277,14 @@ export function mlApiServicesProvider(httpService: HttpService) {
},

stopDatafeed({ datafeedId }: { datafeedId: string }) {
return http<any>({
return httpService.http<any>({
path: `${basePath()}/datafeeds/${datafeedId}/_stop`,
method: 'POST',
});
},

forceStopDatafeed({ datafeedId }: { datafeedId: string }) {
return http<any>({
return httpService.http<any>({
path: `${basePath()}/datafeeds/${datafeedId}/_stop?force=true`,
method: 'POST',
});
Expand Down Expand Up @@ -697,7 +696,7 @@ export function mlApiServicesProvider(httpService: HttpService) {
},

getModelSnapshots(jobId: string, snapshotId?: string) {
return http<GetModelSnapshotsResponse>({
return httpService.http<GetModelSnapshotsResponse>({
path: `${basePath()}/anomaly_detectors/${jobId}/model_snapshots${
snapshotId !== undefined ? `/${snapshotId}` : ''
}`,
Expand All @@ -709,15 +708,15 @@ export function mlApiServicesProvider(httpService: HttpService) {
snapshotId: string,
body: { description?: string; retain?: boolean }
) {
return http<any>({
return httpService.http<any>({
path: `${basePath()}/anomaly_detectors/${jobId}/model_snapshots/${snapshotId}/_update`,
method: 'POST',
body: JSON.stringify(body),
});
},

deleteModelSnapshot(jobId: string, snapshotId: string) {
return http<any>({
return httpService.http<any>({
path: `${basePath()}/anomaly_detectors/${jobId}/model_snapshots/${snapshotId}`,
method: 'DELETE',
});
Expand Down

0 comments on commit b2eec07

Please sign in to comment.