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