Files
grafana/public/app/api/utils.ts
Ashley Harrison 30bf2bcde1 API client generation: create a central getAPIBaseURL function (#99961)
* create a getAPIBaseURL function

* use base url in iam api
2025-02-03 13:05:47 +00:00

14 lines
449 B
TypeScript

import { config } from '@grafana/runtime';
export const getAPINamespace = () => config.namespace;
/**
* Get a base URL for a k8s API endpoint with parameterised namespace given it's group and version
* @param group the k8s group, e.g. dashboard.grafana.app
* @param version e.g. v0alpha1
* @returns
*/
export const getAPIBaseURL = (group: string, version: string) => {
return `/apis/${group}/${version}/namespaces/${getAPINamespace()}`;
};