export class PolicyService {
private basePath = 'api/policy';
- private policyTypePath = 'policytypes';
- private policyPath = 'policies';
+ policyTypePath = 'policytypes';
+ policyPath = 'policies';
private buildPath(...args: any[]) {
let result = this.basePath;
}
getPolicyInstances(policyTypeId: string): Observable<PolicyInstance[]> {
- const url = this.buildPath(this.policyTypePath, policyTypeId, this.policyPath);
+ const url = this.buildPath(this.policyPath) + '?type=' + policyTypeId;
return this.httpClient.get<PolicyInstance[]>(url);
}
* @returns Observable that should yield a policy instance
*/
getPolicy(policyTypeId: string, policyInstanceId: string): Observable<any> {
- const url = this.buildPath(this.policyTypePath, policyTypeId, this.policyPath, policyInstanceId);
+ const url = this.buildPath(this.policyPath, policyInstanceId) + '?type=' + policyTypeId;
return this.httpClient.get<any>(url);
}
* @returns Observable that should yield a response code, no data
*/
putPolicy(policyTypeId: string, policyInstanceId: string, policyJson: string, ric: string): Observable<any> {
- const url = this.buildPath(this.policyTypePath, policyTypeId, this.policyPath, policyInstanceId) + "?ric=" + ric;
+ const url = this.buildPath(this.policyPath, policyInstanceId) + '?ric=' + ric + '&type=' + policyTypeId;
return this.httpClient.put<PolicyInstanceAck>(url, policyJson, { observe: 'response' });
}
/**
* Deletes a policy instance.
- * @param policyTypeId
+ * @param policyTypeId ID of the policy type that the instance belong to
+ * @param policyInstanceId ID of the instance
* @returns Observable that should yield a response code, no data
*/
deletePolicy(policyTypeId: string, policyInstanceId: string): Observable<any> {
- const url = this.buildPath(this.policyTypePath, policyTypeId, this.policyPath, policyInstanceId);
+ const url = this.buildPath(this.policyPath, policyInstanceId) + '?type=' + policyTypeId;
return this.httpClient.delete(url, { observe: 'response' });
}