1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/common/k8s-api/endpoints/helm-releases.api/request-history.injectable.ts
Sebastian Malton c7d694fe76 Improve injectable filenames compared to the injectables inside
Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-10-04 17:55:31 -04:00

32 lines
1.0 KiB
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import { urlBuilderFor } from "../../../utils/buildUrl";
import { apiBaseInjectionToken } from "../../api-base";
export interface HelmReleaseRevision {
revision: number;
updated: string;
status: string;
chart: string;
app_version: string;
description: string;
}
export type RequestHelmReleaseHistory = (name: string, namespace: string) => Promise<HelmReleaseRevision[]>;
const requestHistoryEnpoint = urlBuilderFor("/v2/releases/:namespace/:name/history");
const requestHelmReleaseHistoryInjectable = getInjectable({
id: "request-helm-release-history",
instantiate: (di): RequestHelmReleaseHistory => {
const apiBase = di.inject(apiBaseInjectionToken);
return (name, namespace) => apiBase.get(requestHistoryEnpoint.compile({ name, namespace }));
},
});
export default requestHelmReleaseHistoryInjectable;