1 import { HttpClient } from '@angular/common/http';
2 import { Injectable } from '@angular/core';
4 import { Observable } from 'rxjs';
6 import { ApiModule } from './api.module';
11 export class MgrModuleService {
12 private url = 'api/mgr/module';
14 constructor(private http: HttpClient) {}
17 * Get the list of Ceph Mgr modules and their state (enabled/disabled).
18 * @return {Observable<Object[]>}
20 list(): Observable<Object[]> {
21 return this.http.get<Object[]>(`${this.url}`);
25 * Get the Ceph Mgr module configuration.
26 * @param {string} module The name of the mgr module.
27 * @return {Observable<Object>}
29 getConfig(module: string): Observable<Object> {
30 return this.http.get(`${this.url}/${module}`);
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>}
39 updateConfig(module: string, config: object): Observable<Object> {
40 return this.http.put(`${this.url}/${module}`, { config: config });
44 * Enable the Ceph Mgr module.
45 * @param {string} module The name of the mgr module.
47 enable(module: string) {
48 return this.http.post(`${this.url}/${module}/enable`, null);
52 * Disable the Ceph Mgr module.
53 * @param {string} module The name of the mgr module.
55 disable(module: string) {
56 return this.http.post(`${this.url}/${module}/disable`, null);
60 * Get the Ceph Mgr module options.
61 * @param {string} module The name of the mgr module.
62 * @return {Observable<Object>}
64 getOptions(module: string): Observable<Object> {
65 return this.http.get(`${this.url}/${module}/options`);