diff options
Diffstat (limited to 'src/pybind/mgr/dashboard/frontend/src/app/shared/api/daemon.service.ts')
-rw-r--r-- | src/pybind/mgr/dashboard/frontend/src/app/shared/api/daemon.service.ts | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/daemon.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/daemon.service.ts new file mode 100644 index 000000000..0912e6931 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/daemon.service.ts @@ -0,0 +1,36 @@ +import { HttpClient } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; + +import { cdEncode } from '~/app/shared/decorators/cd-encode'; +import { Daemon } from '../models/daemon.interface'; + +@cdEncode +@Injectable({ + providedIn: 'root' +}) +export class DaemonService { + private url = 'api/daemon'; + + constructor(private http: HttpClient) {} + + action(daemonName: string, actionType: string) { + return this.http.put( + `${this.url}/${daemonName}`, + { + action: actionType, + container_image: null + }, + { + headers: { Accept: 'application/vnd.ceph.api.v0.1+json' }, + observe: 'response' + } + ); + } + + list(daemonTypes: string[]): Observable<Daemon[]> { + return this.http.get<Daemon[]>(this.url, { + params: { daemon_types: daemonTypes } + }); + } +} |