summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/src/app/shared/api/cluster.service.ts
blob: 6b435d6ffed1dc15a7c5a4de19e9a2d650a7acfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';

import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class ClusterService {
  baseURL = 'api/cluster';

  constructor(private http: HttpClient) {}

  getStatus(): Observable<string> {
    return this.http.get<string>(`${this.baseURL}`, {
      headers: { Accept: 'application/vnd.ceph.api.v0.1+json' }
    });
  }

  updateStatus(status: string) {
    return this.http.put(
      `${this.baseURL}`,
      { status: status },
      { headers: { Accept: 'application/vnd.ceph.api.v0.1+json' } }
    );
  }
}