]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
1 | import { HttpClient, HttpParams } from '@angular/common/http'; |
2 | import { Injectable } from '@angular/core'; | |
3 | ||
4 | import { Observable } from 'rxjs'; | |
5 | ||
6 | import { Daemon } from '../models/daemon.interface'; | |
1911f103 | 7 | import { CephServiceSpec } from '../models/service.interface'; |
9f95a23c TL |
8 | import { ApiModule } from './api.module'; |
9 | ||
10 | @Injectable({ | |
11 | providedIn: ApiModule | |
12 | }) | |
13 | export class CephServiceService { | |
14 | private url = 'api/service'; | |
15 | ||
16 | constructor(private http: HttpClient) {} | |
17 | ||
1911f103 | 18 | list(serviceName?: string): Observable<CephServiceSpec[]> { |
9f95a23c TL |
19 | const options = serviceName |
20 | ? { params: new HttpParams().set('service_name', serviceName) } | |
21 | : {}; | |
1911f103 | 22 | return this.http.get<CephServiceSpec[]>(this.url, options); |
9f95a23c TL |
23 | } |
24 | ||
25 | getDaemons(serviceName?: string): Observable<Daemon[]> { | |
26 | return this.http.get<Daemon[]>(`${this.url}/${serviceName}/daemons`); | |
27 | } | |
28 | } |