gns3-web-ui/src/app/services/snapshot.service.ts

26 lines
939 B
TypeScript
Raw Normal View History

2017-11-23 13:18:23 +01:00
import { Injectable } from '@angular/core';
2019-01-15 11:15:54 +01:00
import { Server } from '../models/server';
import { HttpServer } from './http-server.service';
import { Snapshot } from '../models/snapshot';
2017-11-23 13:18:23 +01:00
@Injectable()
export class SnapshotService {
2019-01-15 11:15:54 +01:00
constructor(private httpServer: HttpServer) {}
2017-11-23 13:18:23 +01:00
2018-03-20 16:02:41 +01:00
create(server: Server, project_id: string, snapshot: Snapshot) {
2019-01-15 11:15:54 +01:00
return this.httpServer.post<Snapshot>(server, `/projects/${project_id}/snapshots`, snapshot);
2017-11-23 13:18:23 +01:00
}
delete(server: Server, project_id: string, snapshot_id: string) {
return this.httpServer.delete(server, `/projects/${project_id}/snapshots/${snapshot_id}`);
}
2018-03-20 16:02:41 +01:00
list(server: Server, project_id: string) {
2019-01-15 11:15:54 +01:00
return this.httpServer.get<Snapshot[]>(server, `/projects/${project_id}/snapshots`);
2017-11-23 13:18:23 +01:00
}
restore(server: Server, project_id: string, snapshot_id: string) {
return this.httpServer.post(server, `/projects/${project_id}/snapshots/${snapshot_id}/restore`, {});
}
2017-11-23 13:18:23 +01:00
}