mirror of https://github.com/portainer/portainer
24 lines
705 B
TypeScript
24 lines
705 B
TypeScript
|
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||
|
import { EnvironmentId } from '@/portainer/environments/types';
|
||
|
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`;
|
||
|
}
|