1 import { HttpClient } from '@angular/common/http';
2 import { Injectable } from '@angular/core';
4 import { I18n } from '@ngx-translate/i18n-polyfill';
6 import { ApiModule } from './api.module';
11 export class NfsService {
12 apiPath = 'api/nfs-ganesha';
13 uiApiPath = 'ui-api/nfs-ganesha';
18 help: this.i18n('Allows all operations')
22 help: this.i18n('Allows only operations that do not modify the server')
26 help: this.i18n('Does not allow read or write operations, but allows any other operation')
31 'Does not allow read, write, or any operation that modifies file \
32 attributes or directory content'
37 help: this.i18n('Allows no access at all')
44 descr: this.i18n('CephFS')
48 descr: this.i18n('Object Gateway')
52 nfsSquash = ['no_root_squash', 'root_id_squash', 'root_squash', 'all_squash'];
54 constructor(private http: HttpClient, private i18n: I18n) {}
57 return this.http.get(`${this.apiPath}/export`);
60 get(clusterId: string, exportId: string) {
61 return this.http.get(`${this.apiPath}/export/${clusterId}/${exportId}`);
65 return this.http.post(`${this.apiPath}/export`, nfs, { observe: 'response' });
68 update(clusterId: string, id: string, nfs: any) {
69 return this.http.put(`${this.apiPath}/export/${clusterId}/${id}`, nfs, { observe: 'response' });
72 delete(clusterId: string, exportId: string) {
73 return this.http.delete(`${this.apiPath}/export/${clusterId}/${exportId}`, {
78 lsDir(fs_name: string, root_dir: string) {
79 return this.http.get(`${this.uiApiPath}/lsdir/${fs_name}?root_dir=${root_dir}`);
82 buckets(user_id: string) {
83 return this.http.get(`${this.uiApiPath}/rgw/buckets?user_id=${user_id}`);
87 return this.http.get(`${this.uiApiPath}/cephx/clients`);
91 return this.http.get(`${this.uiApiPath}/fsals`);
95 return this.http.get(`${this.uiApiPath}/cephfs/filesystems`);
99 return this.http.get(`${this.apiPath}/daemon`);
102 start(host_name: string) {
103 return this.http.put(`${this.apiPath}/service/${host_name}/start`, null, {
108 stop(host_name: string) {
109 return this.http.put(`${this.apiPath}/service/${host_name}/stop`, null, {