Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 1 | import {Injectable} from "@angular/core"; |
| 2 | import {HttpClient} from "@angular/common/http"; |
| 3 | import {Observable} from "rxjs"; |
| 4 | import {Constants} from "../../utils/constants"; |
| 5 | import {ServiceInstance} from "../../models/serviceInstance"; |
| 6 | |
| 7 | @Injectable() |
| 8 | export class MsoService { |
| 9 | httpClient: HttpClient; |
| 10 | |
| 11 | constructor(http: HttpClient) { |
| 12 | this.httpClient = http; |
| 13 | } |
| 14 | |
| 15 | |
| 16 | public submitMsoTask(instanceFields): Observable<any> { |
| 17 | let path = Constants.Path.SERVICES_JOB_INFO_PATH + '/bulk'; |
| 18 | return this.httpClient.post(path, instanceFields); |
| 19 | } |
| 20 | |
| 21 | public retryMsoTask(jobId: string): Observable<any> { |
| 22 | let pathQuery = Constants.Path.SERVICES_JOB_INFO_PATH + '/retry/' + jobId; |
| 23 | return this.httpClient.post<any>(pathQuery, null); |
| 24 | } |
| 25 | |
| 26 | public retryBulkMsoTask(jobId: string, instanceFields: ServiceInstance): Observable<any> { |
| 27 | let pathQuery = Constants.Path.SERVICES_JOB_INFO_PATH + '/retryJobWithChangedData/'+ jobId; |
| 28 | return this.httpClient.post<any>(pathQuery, instanceFields); |
| 29 | } |
| 30 | |
| 31 | public createVnf(requestDetails, serviceInstanceId): Observable<any> { |
| 32 | let pathQuery: string = Constants.Path.MSO_CREATE_VNF_INSTANCE + serviceInstanceId; |
| 33 | |
| 34 | return this.httpClient.post( pathQuery, { |
| 35 | requestDetails : requestDetails |
| 36 | }); |
| 37 | } |
| 38 | } |