2022-09-26 19:43:24 +00:00
|
|
|
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
2022-10-23 06:53:25 +00:00
|
|
|
import { EnvironmentId } from '@/react/portainer/environments/types';
|
2022-09-26 19:43:24 +00:00
|
|
|
import {
|
|
|
|
KubernetesApiListResponse,
|
|
|
|
V1IngressClass,
|
|
|
|
} from '@/react/kubernetes/services/kubernetes/types';
|
|
|
|
|
|
|
|
export async function getAllIngressClasses(environmentId: EnvironmentId) {
|
|
|
|
try {
|
|
|
|
const {
|
|
|
|
data: { items },
|
|
|
|
} = await axios.get<KubernetesApiListResponse<V1IngressClass[]>>(
|
|
|
|
urlBuilder(environmentId)
|
|
|
|
);
|
|
|
|
return items;
|
|
|
|
} catch (error) {
|
|
|
|
throw parseAxiosError(error as Error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function urlBuilder(environmentId: EnvironmentId) {
|
|
|
|
return `endpoints/${environmentId}/kubernetes/apis/networking.k8s.io/v1/ingressclasses`;
|
|
|
|
}
|