1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/main/routes/helm/releases/get-release-values-route.injectable.ts
Janne Savolainen 79587514d8
Make response of route typed
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
2022-03-11 09:24:13 +02:00

40 lines
1.2 KiB
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { apiPrefix } from "../../../../common/vars";
import type { Route } from "../../../router";
import { helmService } from "../../../helm/helm-service";
import { routeInjectionToken } from "../../../router/router.injectable";
import { getInjectable } from "@ogre-tools/injectable";
import { getBoolean } from "../../../utils/parse-query";
import { contentTypes } from "../../../router";
const getReleaseRouteValuesInjectable = getInjectable({
id: "get-release-values-route",
instantiate: (): Route<string> => ({
method: "get",
path: `${apiPrefix}/v2/releases/{namespace}/{release}/values`,
handler: async (request) => {
const { cluster, params: { namespace, release }, query } = request;
const all = getBoolean(query, "all");
return {
response: await helmService.getReleaseValues(release, {
cluster,
namespace,
all,
}),
contentType: contentTypes.txt,
};
},
}),
injectionToken: routeInjectionToken,
});
export default getReleaseRouteValuesInjectable;