1 import { HttpClient } from '@angular/common/http';
2 import { Injectable } from '@angular/core';
4 import { I18n } from '@ngx-translate/i18n-polyfill';
6 import { CrushRuleConfig } from '../models/crush-rule';
7 import { ApiModule } from './api.module';
12 export class CrushRuleService {
13 apiPath = 'api/crush_rule';
16 // Copied from /doc/rados/operations/crush-map.rst
17 root: this.i18n(`The name of the node under which data should be placed.`),
18 failure_domain: this.i18n(`The type of CRUSH nodes across which we should separate replicas.`),
19 device_class: this.i18n(`The device class data should be placed on.`)
22 constructor(private http: HttpClient, private i18n: I18n) {}
24 create(rule: CrushRuleConfig) {
25 return this.http.post(this.apiPath, rule, { observe: 'response' });
28 delete(name: string) {
29 return this.http.delete(`${this.apiPath}/${name}`, { observe: 'response' });
33 return this.http.get(`ui-${this.apiPath}/info`);