1 import { HttpClient } from '@angular/common/http';
2 import { Injectable } from '@angular/core';
7 export class NfsService {
8 apiPath = 'api/nfs-ganesha';
9 uiApiPath = 'ui-api/nfs-ganesha';
14 help: $localize`Allows all operations`
18 help: $localize`Allows only operations that do not modify the server`
22 help: $localize`Does not allow read or write operations, but allows any other operation`
26 help: $localize`Does not allow read, write, or any operation that modifies file attributes or directory content`
30 help: $localize`Allows no access at all`
37 descr: $localize`CephFS`
41 descr: $localize`Object Gateway`
45 nfsSquash = ['no_root_squash', 'root_id_squash', 'root_squash', 'all_squash'];
47 constructor(private http: HttpClient) {}
50 return this.http.get(`${this.apiPath}/export`);
53 get(clusterId: string, exportId: string) {
54 return this.http.get(`${this.apiPath}/export/${clusterId}/${exportId}`);
58 return this.http.post(`${this.apiPath}/export`, nfs, { observe: 'response' });
61 update(clusterId: string, id: string, nfs: any) {
62 return this.http.put(`${this.apiPath}/export/${clusterId}/${id}`, nfs, { observe: 'response' });
65 delete(clusterId: string, exportId: string) {
66 return this.http.delete(`${this.apiPath}/export/${clusterId}/${exportId}`, {
71 lsDir(fs_name: string, root_dir: string) {
72 return this.http.get(`${this.uiApiPath}/lsdir/${fs_name}?root_dir=${root_dir}`);
75 buckets(user_id: string) {
76 return this.http.get(`${this.uiApiPath}/rgw/buckets?user_id=${user_id}`);
80 return this.http.get(`${this.uiApiPath}/cephx/clients`);
84 return this.http.get(`${this.uiApiPath}/fsals`);
88 return this.http.get(`${this.uiApiPath}/cephfs/filesystems`);
92 return this.http.get(`${this.apiPath}/daemon`);
95 start(host_name: string) {
96 return this.http.put(`${this.apiPath}/service/${host_name}/start`, null, {
101 stop(host_name: string) {
102 return this.http.put(`${this.apiPath}/service/${host_name}/stop`, null, {