X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-frontend%2Fsrc%2Fapp%2Fservices%2Fpolicy%2Fpolicy.service.ts;h=5ffff13b3cab0dc3b4353dceeb442a8cdfed15db;hb=refs%2Fchanges%2F87%2F5587%2F1;hp=482fe875c66ebb31e5a803b23e4bce8dbb10fd57;hpb=7443264a661235f08797ebf0dbb6a512f6485756;p=portal%2Fnonrtric-controlpanel.git diff --git a/webapp-frontend/src/app/services/policy/policy.service.ts b/webapp-frontend/src/app/services/policy/policy.service.ts index 482fe87..5ffff13 100644 --- a/webapp-frontend/src/app/services/policy/policy.service.ts +++ b/webapp-frontend/src/app/services/policy/policy.service.ts @@ -22,8 +22,9 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { PolicyInstance, PolicyInstanceAck, PolicyInstances, PolicyStatus, PolicyType, PolicyTypes } from '../../interfaces/policy.types'; +import { CreatePolicyInstance, PolicyInstance, PolicyInstanceAck, PolicyInstances, PolicyStatus, PolicyType, PolicyTypes } from '../../interfaces/policy.types'; import { ControlpanelSuccessTransport } from '../../interfaces/controlpanel.types'; +import { Ric } from 'src/app/interfaces/ric'; /** * Services for calling the policy endpoints. @@ -33,8 +34,8 @@ import { ControlpanelSuccessTransport } from '../../interfaces/controlpanel.type }) export class PolicyService { - private apiVersion2 = 'v2' - private basePath = ''; + private apiVersion2 = '/v2' + private basePath = '/a1-policy'; policyTypesPath = 'policy-types'; policyPath = 'policies'; @@ -91,9 +92,9 @@ export class PolicyService { * @param policyJson Json with the policy content * @returns Observable that should yield a response code, no data */ - putPolicy(policyTypeId: string, policyInstanceId: string, policyJson: string, ric: string): Observable { - const url = this.buildPath(this.policyPath, policyInstanceId) + '?ric=' + ric + '&type=' + policyTypeId; - return this.httpClient.put(url, policyJson, { observe: 'response' }); + putPolicy(createPolicyInstance: CreatePolicyInstance): Observable { + const url = this.buildPath(this.policyPath); + return this.httpClient.put(url, createPolicyInstance, { observe: 'response' }); } /** @@ -102,14 +103,14 @@ export class PolicyService { * @param policyInstanceId ID of the instance * @returns Observable that should yield a response code, no data */ - deletePolicy(policyTypeId: string, policyInstanceId: string): Observable { - const url = this.buildPath(this.policyPath, policyInstanceId) + '?type=' + policyTypeId; + deletePolicy(policyInstanceId: string): Observable { + const url = this.buildPath(this.policyPath, policyInstanceId); return this.httpClient.delete(url, { observe: 'response' }); } - getRics(policyTypeId: string): Observable { - const url = this.buildPath('rics') + '?policyType=' + policyTypeId; + getRics(policyTypeId: string): Observable { + const url = this.buildPath('rics') + '?policytype_id=' + policyTypeId; return this.httpClient.get(url); } }