1 import { Injectable } from '@angular/core';
3 import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
4 import { Observable,throwError } from 'rxjs'
5 import { timer, Subscription, pipe } from 'rxjs';
7 import { cameraData, camerainfo, cameraDetails, monitorDetails, monitorinfo, cameraID, appsPvcs, backupRestore, monitorImage } from './datainterface'
13 export class RoboService {
15 private baseUrl = 'http://localhost:30091';
16 private inventoryBaseUrl = 'http://localhost:30092';
18 private postCameraDetailsUrl = this.inventoryBaseUrl + '/v1/monitor/cameras'
19 private cameraDetailsUrl = this.inventoryBaseUrl + '/v1/monitor/cameras'
20 private monitorDetailsUrl = this.inventoryBaseUrl + '/v1/inventry/table'
21 private monitorImageUrl = this.inventoryBaseUrl + '/v1/inventry/image'
22 private triggerObjUrl = this.inventoryBaseUrl + '/v1/monitor/cameras/'
23 private appsPvcsDetailsUrl = this.baseUrl + '/v1/robo/apps-pvcs'
24 private backupRestoreDetailsUrl = this.baseUrl + '/v1/robo/backup-restore'
25 private postBackupDetailsUrl = this.baseUrl + '/v1/robo/backup'
26 private postRestoreDetailsUrl = this.baseUrl + '/v1/robo/restore'
27 private disasterUrl = this.baseUrl + '/v1/robo/disaster'
29 private cameraDetails_url = './../assets/data/camera.json'
30 private backupRestoreDetails_url = './../assets/data/backuprestore.json'
31 private appsPvcsDetails_url = './../assets/data/appspvc.json'
32 private monitorDetails_url = './../assets/data/inventory.json'
35 constructor(private http:HttpClient) { }
38 headers: new HttpHeaders({
39 'Content-Type':'application/json'
44 headers: new HttpHeaders({
45 'Content-Type':'application/json'
49 postCameraDetails(data): Observable<any> {
52 return this.http.post<any>(this.postCameraDetailsUrl, data)
55 getCameraInfo(): Observable<cameraDetails> {
57 return this.http.get<cameraDetails>(this.cameraDetailsUrl);
60 getMonitorInfo(): Observable<monitorDetails> {
62 return this.http.get<monitorDetails>(this.monitorDetailsUrl);
65 getMonitorImage(): Observable<any> {
67 return this.http.get<any>(this.monitorImageUrl);
71 triggerDetection(data): Observable<any> {
74 this.triggerObjUrl = this.triggerObjUrl + data;
75 return this.http.get<any>(this.triggerObjUrl)
78 getAppsPvcsInfo(): Observable<appsPvcs> {
79 return this.http.get<appsPvcs>(this.appsPvcsDetailsUrl);
82 getBackupRestoreInfo(): Observable<any> {
83 return this.http.get<any>(this.backupRestoreDetailsUrl);
86 disturbCluster(): Observable<any> {
87 return this.http.get<any>(this.disasterUrl);
90 postBackup(data): Observable<any> {
93 return this.http.post<any>(this.postBackupDetailsUrl, data)
96 postRestore(data): Observable<any> {
99 return this.http.post<any>(this.postRestoreDetailsUrl, data)