]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.ts
import ceph 16.2.6
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / api / nfs.service.ts
1 import { HttpClient } from '@angular/common/http';
2 import { Injectable } from '@angular/core';
3
4 @Injectable({
5 providedIn: 'root'
6 })
7 export class NfsService {
8 apiPath = 'api/nfs-ganesha';
9 uiApiPath = 'ui-api/nfs-ganesha';
10
11 nfsAccessType = [
12 {
13 value: 'RW',
14 help: $localize`Allows all operations`
15 },
16 {
17 value: 'RO',
18 help: $localize`Allows only operations that do not modify the server`
19 },
20 {
21 value: 'MDONLY',
22 help: $localize`Does not allow read or write operations, but allows any other operation`
23 },
24 {
25 value: 'MDONLY_RO',
26 help: $localize`Does not allow read, write, or any operation that modifies file attributes or directory content`
27 },
28 {
29 value: 'NONE',
30 help: $localize`Allows no access at all`
31 }
32 ];
33
34 nfsFsal = [
35 {
36 value: 'CEPH',
37 descr: $localize`CephFS`
38 },
39 {
40 value: 'RGW',
41 descr: $localize`Object Gateway`
42 }
43 ];
44
45 nfsSquash = ['no_root_squash', 'root_id_squash', 'root_squash', 'all_squash'];
46
47 constructor(private http: HttpClient) {}
48
49 list() {
50 return this.http.get(`${this.apiPath}/export`);
51 }
52
53 get(clusterId: string, exportId: string) {
54 return this.http.get(`${this.apiPath}/export/${clusterId}/${exportId}`);
55 }
56
57 create(nfs: any) {
58 return this.http.post(`${this.apiPath}/export`, nfs, { observe: 'response' });
59 }
60
61 update(clusterId: string, id: string, nfs: any) {
62 return this.http.put(`${this.apiPath}/export/${clusterId}/${id}`, nfs, { observe: 'response' });
63 }
64
65 delete(clusterId: string, exportId: string) {
66 return this.http.delete(`${this.apiPath}/export/${clusterId}/${exportId}`, {
67 observe: 'response'
68 });
69 }
70
71 lsDir(fs_name: string, root_dir: string) {
72 return this.http.get(`${this.uiApiPath}/lsdir/${fs_name}?root_dir=${root_dir}`);
73 }
74
75 buckets(user_id: string) {
76 return this.http.get(`${this.uiApiPath}/rgw/buckets?user_id=${user_id}`);
77 }
78
79 clients() {
80 return this.http.get(`${this.uiApiPath}/cephx/clients`);
81 }
82
83 fsals() {
84 return this.http.get(`${this.uiApiPath}/fsals`);
85 }
86
87 filesystems() {
88 return this.http.get(`${this.uiApiPath}/cephfs/filesystems`);
89 }
90
91 daemon() {
92 return this.http.get(`${this.apiPath}/daemon`);
93 }
94
95 start(host_name: string) {
96 return this.http.put(`${this.apiPath}/service/${host_name}/start`, null, {
97 observe: 'response'
98 });
99 }
100
101 stop(host_name: string) {
102 return this.http.put(`${this.apiPath}/service/${host_name}/stop`, null, {
103 observe: 'response'
104 });
105 }
106 }