All files / src/app/shared/api iscsi.service.ts

96.97% Statements 32/33
66.67% Branches 2/3
91.67% Functions 11/12
96.77% Lines 30/31

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 1099x 9x   9x 9x           9x 56x   56x                                                                       56x                             9x 15x     9x 1x     9x 2x     9x 1x     9x 35x     9x 14x     9x 3x     9x 1x     9x 5x     9x 2x     9x     9x  
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
 
import { cdEncode } from '../decorators/cd-encode';
import { ApiModule } from './api.module';
 
@cdEncode
@Injectable({
  providedIn: ApiModule
})
export class IscsiService {
  constructor(private http: HttpClient) {}
 
  targetAdvancedSettings = {
    cmdsn_depth: {
      help: ''
    },
    dataout_timeout: {
      help: ''
    },
    first_burst_length: {
      help: ''
    },
    immediate_data: {
      help: ''
    },
    initial_r2t: {
      help: ''
    },
    max_burst_length: {
      help: ''
    },
    max_outstanding_r2t: {
      help: ''
    },
    max_recv_data_segment_length: {
      help: ''
    },
    max_xmit_data_segment_length: {
      help: ''
    },
    nopin_response_timeout: {
      help: ''
    },
    nopin_timeout: {
      help: ''
    }
  };
 
  imageAdvancedSettings = {
    hw_max_sectors: {
      help: ''
    },
    max_data_area_mb: {
      help: ''
    },
    osd_op_timeout: {
      help: ''
    },
    qfull_timeout: {
      help: ''
    }
  };
 
  listTargets() {
    return this.http.get(`api/iscsi/target`);
  }
 
  getTarget(target_iqn) {
    return this.http.get(`api/iscsi/target/${target_iqn}`);
  }
 
  updateTarget(target_iqn, target) {
    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`);
  }
 
  portals() {
    return this.http.get(`ui-api/iscsi/portals`);
  }
 
  createTarget(target) {
    return this.http.post(`api/iscsi/target`, target, { observe: 'response' });
  }
 
  deleteTarget(target_iqn) {
    return this.http.delete(`api/iscsi/target/${target_iqn}`, { observe: 'response' });
  }
 
  getDiscovery() {
    return this.http.get(`api/iscsi/discoveryauth`);
  }
 
  updateDiscovery(auth) {
    return this.http.put(`api/iscsi/discoveryauth`, auth);
  }
 
  overview() {
    return this.http.get(`ui-api/iscsi/overview`);
  }
}