2 * ========================LICENSE_START=================================
5 * Copyright (C) 2019 AT&T Intellectual Property
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ========================LICENSE_END===================================
21 import { Injectable } from '@angular/core';
22 import { HttpClient } from '@angular/common/http';
23 import { V1PodList } from '@kubernetes/client-node';
24 import { Observable } from 'rxjs';
27 * Services for calling the Controlpanel caas-ingress endpoints to get Kubernetes details.
32 export class CaasIngressService {
34 private basePath = 'api/caas-ingress';
35 private podsPath = 'pods';
37 private buildPath(...args: any[]) {
38 let result = this.basePath;
39 args.forEach(part => {
40 result = result + '/' + part;
45 constructor(private httpClient: HttpClient) {
46 // injects to variable httpClient
51 * @returns Observable that should yield a V1PodList
53 getPodList(cluster: string, namespace: string): Observable<V1PodList> {
54 const url = this.buildPath('pods', 'cluster', cluster, 'namespace', namespace);
55 return this.httpClient.get<V1PodList>(url);