]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/mgr-module.service.ts
update ceph source to reef 18.2.1
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / api / mgr-module.service.ts
1 import { HttpClient } from '@angular/common/http';
2 import { Injectable } from '@angular/core';
3
4 import { Observable } from 'rxjs';
5
6 @Injectable({
7 providedIn: 'root'
8 })
9 export class MgrModuleService {
10 private url = 'api/mgr/module';
11
12 constructor(private http: HttpClient) {}
13
14 /**
15 * Get the list of Ceph Mgr modules and their state (enabled/disabled).
16 * @return {Observable<Object[]>}
17 */
18 list(): Observable<Object[]> {
19 return this.http.get<Object[]>(`${this.url}`);
20 }
21
22 /**
23 * Get the Ceph Mgr module configuration.
24 * @param {string} module The name of the mgr module.
25 * @return {Observable<Object>}
26 */
27 getConfig(module: string): Observable<Object> {
28 return this.http.get(`${this.url}/${module}`);
29 }
30
31 /**
32 * Update the Ceph Mgr module configuration.
33 * @param {string} module The name of the mgr module.
34 * @param {object} config The configuration.
35 * @return {Observable<Object>}
36 */
37 updateConfig(module: string, config: object): Observable<Object> {
38 return this.http.put(`${this.url}/${module}`, { config: config });
39 }
40
41 /**
42 * Enable the Ceph Mgr module.
43 * @param {string} module The name of the mgr module.
44 */
45 enable(module: string) {
46 return this.http.post(`${this.url}/${module}/enable`, null);
47 }
48
49 /**
50 * Disable the Ceph Mgr module.
51 * @param {string} module The name of the mgr module.
52 */
53 disable(module: string) {
54 return this.http.post(`${this.url}/${module}/disable`, null);
55 }
56
57 /**
58 * Get the Ceph Mgr module options.
59 * @param {string} module The name of the mgr module.
60 * @return {Observable<Object>}
61 */
62 getOptions(module: string): Observable<Object> {
63 return this.http.get(`${this.url}/${module}/options`);
64 }
65 }