gns3-web-ui/src/app/services/snapshot.service.ts
2019-03-01 05:35:42 -08:00

26 lines
939 B
TypeScript

import { Injectable } from '@angular/core';
import { Server } from '../models/server';
import { HttpServer } from './http-server.service';
import { Snapshot } from '../models/snapshot';
@Injectable()
export class SnapshotService {
constructor(private httpServer: HttpServer) {}
create(server: Server, project_id: string, snapshot: Snapshot) {
return this.httpServer.post<Snapshot>(server, `/projects/${project_id}/snapshots`, snapshot);
}
delete(server: Server, project_id: string, snapshot_id: string) {
return this.httpServer.delete(server, `/projects/${project_id}/snapshots/${snapshot_id}`);
}
list(server: Server, project_id: string) {
return this.httpServer.get<Snapshot[]>(server, `/projects/${project_id}/snapshots`);
}
restore(server: Server, project_id: string, snapshot_id: string) {
return this.httpServer.post(server, `/projects/${project_id}/snapshots/${snapshot_id}/restore`, {});
}
}