mirror of
https://github.com/Azure/k8s-set-context.git
synced 2026-06-27 09:39:27 +08:00
Refactor entire project (#39)
- Use more modern TypeScript conventions - Use JavaScript Kubernetes Client - Add unit tests - Add integration tests - Add TypeScript compile verify workflow - Switch codeowners
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
export enum Method {
|
||||
KUBECONFIG = "kubeconfig",
|
||||
SERVICE_ACCOUNT = "service-account",
|
||||
SERVICE_PRINCIPAL = "service-principal",
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a string to the Method enum
|
||||
* @param str The method (case insensitive)
|
||||
* @returns The Method enum or undefined if it can't be parsed
|
||||
*/
|
||||
export const parseMethod = (str: string): Method | undefined =>
|
||||
Method[
|
||||
Object.keys(Method).filter(
|
||||
(k) => Method[k].toString().toLowerCase() === str.toLowerCase()
|
||||
)[0] as keyof typeof Method
|
||||
];
|
||||
Reference in New Issue
Block a user