41 lines
1.6 KiB
TypeScript
41 lines
1.6 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
|
|
import { RPCService } from '@loafer/ng-rpc';
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { Target } from '@overflow/commons-typescript/model/target';
|
|
import { Host, Service } from '@overflow/commons-typescript/model/discovery';
|
|
import {PageParams} from '@overflow/commons-typescript/model/commons/PageParams';
|
|
import {Page} from '@overflow/commons-typescript/model/commons/Page';
|
|
import {Notification} from '@overflow/commons-typescript/model/notification';
|
|
|
|
@Injectable()
|
|
export class TargetService {
|
|
|
|
public constructor(
|
|
private rpcService: RPCService,
|
|
) {
|
|
|
|
}
|
|
|
|
public registDiscoveredTargets(probeID: number, hosts: Host[], services: Service[]): Observable<Target[]> {
|
|
return this.rpcService.call<Target[]>('TargetService.registDiscoveredTargets', probeID, hosts, services);
|
|
}
|
|
//
|
|
// public modify(target: Target): Observable<Target> {
|
|
// return this.rpcService.call<Target>('TargetService.modify', target);
|
|
// }
|
|
|
|
public findExistHostTarget(probeID: number, hostIP: string): Observable<Target> {
|
|
return this.rpcService.call<Target>('TargetService.readExistHostTarget', probeID, hostIP);
|
|
}
|
|
|
|
public findExistServiceTarget(hostID: number, portNumber: number, portType: string): Observable<Target> {
|
|
return this.rpcService.call<Target>('TargetService.readExistServiceTarget', hostID, portNumber, portType);
|
|
}
|
|
|
|
public readAllByProbeID(probeID: number, pageParams: PageParams): Observable<Page<Target>> {
|
|
return this.rpcService.call<Page<Target>>('TargetService.readAllByProbeID', probeID, pageParams);
|
|
}
|
|
}
|