* ========================LICENSE_END===================================
*/
-import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
import { V1PodList } from '@kubernetes/client-node';
import { Observable } from 'rxjs';
+import { CommonService } from '../common/common.service';
/**
* Services for calling the Dashboard's caas-ingress endpoints to get Kubernetes details.
})
export class CaasIngressService {
- private basePath = 'api/caas-ingress';
+ private component = 'caas-ingress';
private podsPath = 'pods';
- private buildPath(...args: any[]) {
- let result = this.basePath;
- args.forEach(part => {
- result = result + '/' + part;
- });
- return result;
- }
-
- constructor(private httpClient: HttpClient) {
+ constructor(
+ private httpClient: HttpClient,
+ private commonSvc: CommonService) {
// injects to variable httpClient
}
* Gets list of pods
* @returns Observable that should yield a V1PodList
*/
- getPodList(cluster: string, namespace: string): Observable<V1PodList> {
- const url = this.buildPath('pods', 'cluster', cluster, 'namespace', namespace);
+ getPodList(instanceKey: string, cluster: string, namespace: string): Observable<V1PodList> {
+ const url = this.commonSvc.buildPath(instanceKey, this.component, 'pods', 'cluster', cluster, 'namespace', namespace);
return this.httpClient.get<V1PodList>(url);
}