2022-09-21 04:49:42 +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-21 04:49:42 +00:00
|
|
|
|
|
|
|
import { Configuration } from './types';
|
|
|
|
|
|
|
|
export async function getConfigMaps(
|
|
|
|
environmentId: EnvironmentId,
|
|
|
|
namespace: string
|
|
|
|
) {
|
|
|
|
try {
|
|
|
|
const { data: configmaps } = await axios.get<Configuration[]>(
|
|
|
|
`kubernetes/${environmentId}/namespaces/${namespace}/configmaps`
|
|
|
|
);
|
|
|
|
return configmaps;
|
|
|
|
} catch (e) {
|
|
|
|
throw parseAxiosError(e as Error, 'Unable to retrieve configmaps');
|
|
|
|
}
|
|
|
|
}
|