member_webapp/@overflow/target/service/target.service.ts

41 lines
1.6 KiB
TypeScript
Raw Normal View History

2018-04-06 11:02:18 +00:00
import { Injectable } from '@angular/core';
2018-05-24 06:44:13 +00:00
import { RPCService } from '@loafer/ng-rpc';
2018-06-05 11:31:29 +00:00
import { Observable } from 'rxjs';
2018-04-06 11:02:18 +00:00
2018-05-02 08:25:38 +00:00
import { Target } from '@overflow/commons-typescript/model/target';
2018-06-05 11:25:04 +00:00
import { Host, Service } from '@overflow/commons-typescript/model/discovery';
2018-06-06 10:36:51 +00:00
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';
2018-04-06 11:02:18 +00:00
@Injectable()
export class TargetService {
public constructor(
private rpcService: RPCService,
) {
}
2018-06-06 08:57:19 +00:00
public registDiscoveredTargets(probeID: number, hosts: Host[], services: Service[]): Observable<Target[]> {
return this.rpcService.call<Target[]>('TargetService.registDiscoveredTargets', probeID, hosts, services);
2018-06-05 11:25:04 +00:00
}
2018-06-06 10:36:51 +00:00
//
// public modify(target: Target): Observable<Target> {
// return this.rpcService.call<Target>('TargetService.modify', target);
// }
2018-04-06 11:02:18 +00:00
2018-06-05 13:01:01 +00:00
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);
}
2018-06-06 10:36:51 +00:00
public readAllByProbeID(probeID: number, pageParams: PageParams): Observable<Page<Target>> {
return this.rpcService.call<Page<Target>>('TargetService.readAllByProbeID', probeID, pageParams);
}
2018-04-06 11:02:18 +00:00
}