export type GetApiKapisResourcesKubesphereIoV1alpha3ResourcesNameArgs = {resources: string, name: string}; export type GetApiKapisResourcesKubesphereIoV1alpha3ResourcesNameOptions = {baseUrl: string, BearerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get cluster scope resource * * GET /kapis/resources.kubesphere.io/v1alpha3/{resources}/{name} */ export const getApiKapisResourcesKubesphereIoV1alpha3ResourcesName = async (args: GetApiKapisResourcesKubesphereIoV1alpha3ResourcesNameArgs, options: GetApiKapisResourcesKubesphereIoV1alpha3ResourcesNameOptions) => { const {baseUrl, fetch: fetchFn = fetch, BearerToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (BearerToken !== undefined) headers.set("Authorization", BearerToken) const url = `${baseUrl.replace(/\/+$/, '')}/kapis/resources.kubesphere.io/v1alpha3/${encodeURIComponent(String(args.resources))}/${encodeURIComponent(String(args.name))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };