1 import { HttpClient } from '@angular/common/http';
2 import { Injectable } from '@angular/core';
4 import { Observable } from 'rxjs';
9 export class MgrModuleService {
10 private url = 'api/mgr/module';
12 constructor(private http: HttpClient) {}
15 * Get the list of Ceph Mgr modules and their state (enabled/disabled).
16 * @return {Observable<Object[]>}
18 list(): Observable<Object[]> {
19 return this.http.get<Object[]>(`${this.url}`);
23 * Get the Ceph Mgr module configuration.
24 * @param {string} module The name of the mgr module.
25 * @return {Observable<Object>}
27 getConfig(module: string): Observable<Object> {
28 return this.http.get(`${this.url}/${module}`);
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>}
37 updateConfig(module: string, config: object): Observable<Object> {
38 return this.http.put(`${this.url}/${module}`, { config: config });
42 * Enable the Ceph Mgr module.
43 * @param {string} module The name of the mgr module.
45 enable(module: string) {
46 return this.http.post(`${this.url}/${module}/enable`, null);
50 * Disable the Ceph Mgr module.
51 * @param {string} module The name of the mgr module.
53 disable(module: string) {
54 return this.http.post(`${this.url}/${module}/disable`, null);
58 * Get the Ceph Mgr module options.
59 * @param {string} module The name of the mgr module.
60 * @return {Observable<Object>}
62 getOptions(module: string): Observable<Object> {
63 return this.http.get(`${this.url}/${module}/options`);