1 import { HttpClient } from '@angular/common/http';
2 import { Injectable } from '@angular/core';
4 import { cdEncode } from '../decorators/cd-encode';
5 import { ApiModule } from './api.module';
11 export class IscsiService {
12 constructor(private http: HttpClient) {}
15 return this.http.get(`api/iscsi/target`);
18 getTarget(target_iqn: string) {
19 return this.http.get(`api/iscsi/target/${target_iqn}`);
22 updateTarget(target_iqn: string, target: any) {
23 return this.http.put(`api/iscsi/target/${target_iqn}`, target, { observe: 'response' });
27 return this.http.get(`ui-api/iscsi/status`);
31 return this.http.get(`ui-api/iscsi/settings`);
35 return this.http.get(`ui-api/iscsi/version`);
39 return this.http.get(`ui-api/iscsi/portals`);
42 createTarget(target: any) {
43 return this.http.post(`api/iscsi/target`, target, { observe: 'response' });
46 deleteTarget(target_iqn: string) {
47 return this.http.delete(`api/iscsi/target/${target_iqn}`, { observe: 'response' });
51 return this.http.get(`api/iscsi/discoveryauth`);
54 updateDiscovery(auth: any) {
55 return this.http.put(`api/iscsi/discoveryauth`, auth);
59 return this.http.get(`ui-api/iscsi/overview`);