forked from DocHubTeam/DocHubExamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.yaml
More file actions
28 lines (26 loc) · 1.61 KB
/
functions.yaml
File metadata and controls
28 lines (26 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
functions:
# Описание
# Функция формирует строку ресурсов для вывода в карточке развертывания системы. На вход принимает 3 парметра:
# context - сюда мы передаем значения ресурсов
# mult - мулитипликатор, т.е. у каждой среды есть мультиплкатор на который мы увеличиваем ресурсы, если не нужно увеличивать, то передаем 1
# output_type - вид возвращаемой строк: short - короткий варинат без типов ресурсов, full - полный вариант
# Примеры
# $eval($functions.get_resources,{"context": $, "mult": multiplier, "output_type": "short"})
# $eval($functions.get_resources,{"context": $, "mult": 1, "output_type": "full"})
get_resources: >
(
$context := $.context;
$mult := $.mult;
$output_type := $.output_type;
$output_type = "short"
? "RAM: " & $context.ram * $mult & "Gb" & "\n"
& "CPU: " & $context.cpu * $mult & "Core" & "\n"
& ($context.storage_size > 0
? "Storage: " & $context.storage_size * $mult & "Gb")
: "RAM: " & $context.ram * $mult & "Gb" & "\n"
& "CPU type: " & $context.cpu_type & "\n"
& "CPU: " & $context.cpu * $mult & "Core" & "\n"
& ($context.storage_size > 0
? "Storage type: " & $context.storage_type & "\n"
& "Storage: " & $context.storage_size * $mult & "Gb" : "")
)