k8ts
Version:
Powerful framework for building Kubernetes manifests in TypeScript.
27 lines (26 loc) • 670 B
text/typescript
import { MakeError } from "../../../error"
import { Backend } from "./backend"
export function parseBackend(backend?: Backend) {
switch (backend?.type) {
case undefined:
case null:
return {}
case "HostPath":
return {
hostPath: {
path: backend.path,
type: backend.type
}
}
case "Local":
return {
local: {
path: backend.path
}
}
default:
throw new MakeError(`Unknown backend kind!`, {
backend
})
}
}