1 import { HttpClient, HttpParams } from '@angular/common/http';
2 import { Injectable } from '@angular/core';
4 import { Observable } from 'rxjs';
6 import { Daemon } from '../models/daemon.interface';
7 import { CephService } from '../models/service.interface';
8 import { ApiModule } from './api.module';
13 export class CephServiceService {
14 private url = 'api/service';
16 constructor(private http: HttpClient) {}
18 list(serviceName?: string): Observable<CephService[]> {
19 const options = serviceName
20 ? { params: new HttpParams().set('service_name', serviceName) }
22 return this.http.get<CephService[]>(this.url, options);
25 getDaemons(serviceName?: string): Observable<Daemon[]> {
26 return this.http.get<Daemon[]>(`${this.url}/${serviceName}/daemons`);