]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.ts
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / api / nfs.service.ts
CommitLineData
11fdf7f2
TL
1import { HttpClient } from '@angular/common/http';
2import { Injectable } from '@angular/core';
3
11fdf7f2 4@Injectable({
f67539c2 5 providedIn: 'root'
11fdf7f2
TL
6})
7export class NfsService {
8 apiPath = 'api/nfs-ganesha';
9 uiApiPath = 'ui-api/nfs-ganesha';
10
11 nfsAccessType = [
12 {
13 value: 'RW',
f67539c2 14 help: $localize`Allows all operations`
11fdf7f2
TL
15 },
16 {
17 value: 'RO',
f67539c2 18 help: $localize`Allows only operations that do not modify the server`
11fdf7f2
TL
19 },
20 {
21 value: 'MDONLY',
f67539c2 22 help: $localize`Does not allow read or write operations, but allows any other operation`
11fdf7f2
TL
23 },
24 {
25 value: 'MDONLY_RO',
f67539c2 26 help: $localize`Does not allow read, write, or any operation that modifies file attributes or directory content`
11fdf7f2
TL
27 },
28 {
29 value: 'NONE',
f67539c2 30 help: $localize`Allows no access at all`
11fdf7f2
TL
31 }
32 ];
33
34 nfsFsal = [
35 {
36 value: 'CEPH',
f67539c2 37 descr: $localize`CephFS`
11fdf7f2
TL
38 },
39 {
40 value: 'RGW',
f67539c2 41 descr: $localize`Object Gateway`
11fdf7f2
TL
42 }
43 ];
44
45 nfsSquash = ['no_root_squash', 'root_id_squash', 'root_squash', 'all_squash'];
46
f67539c2 47 constructor(private http: HttpClient) {}
11fdf7f2
TL
48
49 list() {
50 return this.http.get(`${this.apiPath}/export`);
51 }
52
9f95a23c 53 get(clusterId: string, exportId: string) {
11fdf7f2
TL
54 return this.http.get(`${this.apiPath}/export/${clusterId}/${exportId}`);
55 }
56
9f95a23c 57 create(nfs: any) {
11fdf7f2
TL
58 return this.http.post(`${this.apiPath}/export`, nfs, { observe: 'response' });
59 }
60
9f95a23c 61 update(clusterId: string, id: string, nfs: any) {
11fdf7f2
TL
62 return this.http.put(`${this.apiPath}/export/${clusterId}/${id}`, nfs, { observe: 'response' });
63 }
64
9f95a23c 65 delete(clusterId: string, exportId: string) {
11fdf7f2
TL
66 return this.http.delete(`${this.apiPath}/export/${clusterId}/${exportId}`, {
67 observe: 'response'
68 });
69 }
70
f91f0fd5
TL
71 lsDir(fs_name: string, root_dir: string) {
72 return this.http.get(`${this.uiApiPath}/lsdir/${fs_name}?root_dir=${root_dir}`);
11fdf7f2
TL
73 }
74
9f95a23c 75 buckets(user_id: string) {
11fdf7f2
TL
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}