2023-06-11 21:46:48 +00:00
|
|
|
import { IngressClassList } from 'kubernetes-types/networking/v1';
|
|
|
|
|
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
|
|
|
|
|
|
|
export async function getAllIngressClasses(environmentId: EnvironmentId) {
|
|
|
|
try {
|
|
|
|
const {
|
|
|
|
data: { items },
|
2023-06-11 21:46:48 +00:00
|
|
|
} = await axios.get<IngressClassList>(urlBuilder(environmentId));
|
2022-09-26 19:43:24 +00:00
|
|
|
return items;
|
|
|
|
} catch (error) {
|
|
|
|
throw parseAxiosError(error as Error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function urlBuilder(environmentId: EnvironmentId) {
|
|
|
|
return `endpoints/${environmentId}/kubernetes/apis/networking.k8s.io/v1/ingressclasses`;
|
|
|
|
}
|