summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/src/app/shared/api/iscsi.service.ts
blob: 9ef0310c7ccf68069ad7e0494775060a80d43daa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';

import { cdEncode } from '../decorators/cd-encode';

@cdEncode
@Injectable({
  providedIn: 'root'
})
export class IscsiService {
  constructor(private http: HttpClient) {}

  listTargets() {
    return this.http.get(`api/iscsi/target`);
  }

  getTarget(target_iqn: string) {
    return this.http.get(`api/iscsi/target/${target_iqn}`);
  }

  updateTarget(target_iqn: string, target: any) {
    return this.http.put(`api/iscsi/target/${target_iqn}`, target, { observe: 'response' });
  }

  status() {
    return this.http.get(`ui-api/iscsi/status`);
  }

  settings() {
    return this.http.get(`ui-api/iscsi/settings`);
  }

  version() {
    return this.http.get(`ui-api/iscsi/version`);
  }

  portals() {
    return this.http.get(`ui-api/iscsi/portals`);
  }

  createTarget(target: any) {
    return this.http.post(`api/iscsi/target`, target, { observe: 'response' });
  }

  deleteTarget(target_iqn: string) {
    return this.http.delete(`api/iscsi/target/${target_iqn}`, { observe: 'response' });
  }

  getDiscovery() {
    return this.http.get(`api/iscsi/discoveryauth`);
  }

  updateDiscovery(auth: any) {
    return this.http.put(`api/iscsi/discoveryauth`, auth);
  }

  overview() {
    return this.http.get(`ui-api/iscsi/overview`);
  }
}