mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-22 11:29:28 +08:00
Massive refactor (#165)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
export enum TrafficSplitMethod {
|
||||
POD = "pod",
|
||||
SMI = "smi",
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a string to the TrafficSplitMethod enum
|
||||
* @param str The traffic split method (case insensitive)
|
||||
* @returns The TrafficSplitMethod enum or undefined if it can't be parsed
|
||||
*/
|
||||
export const parseTrafficSplitMethod = (
|
||||
str: string
|
||||
): TrafficSplitMethod | undefined =>
|
||||
TrafficSplitMethod[
|
||||
Object.keys(TrafficSplitMethod).filter(
|
||||
(k) =>
|
||||
TrafficSplitMethod[k].toString().toLowerCase() === str.toLowerCase()
|
||||
)[0] as keyof typeof TrafficSplitMethod
|
||||
];
|
||||
Reference in New Issue
Block a user