2023-10-11 19:32:02 +00:00
|
|
|
import { CreateNamespaceFormValues, CreateNamespacePayload } from './types';
|
|
|
|
|
|
|
|
export function transformFormValuesToNamespacePayload(
|
2023-10-16 18:15:44 +00:00
|
|
|
createNamespaceFormValues: CreateNamespaceFormValues,
|
|
|
|
owner: string
|
2023-10-11 19:32:02 +00:00
|
|
|
): CreateNamespacePayload {
|
|
|
|
const memoryInBytes =
|
|
|
|
Number(createNamespaceFormValues.resourceQuota.memory) * 10 ** 6;
|
|
|
|
return {
|
|
|
|
Name: createNamespaceFormValues.name,
|
2023-10-16 18:15:44 +00:00
|
|
|
Owner: owner,
|
2023-10-11 19:32:02 +00:00
|
|
|
ResourceQuota: {
|
|
|
|
enabled: createNamespaceFormValues.resourceQuota.enabled,
|
|
|
|
cpu: createNamespaceFormValues.resourceQuota.cpu,
|
|
|
|
memory: `${memoryInBytes}`,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|