-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
codegenerator.py
31 lines (28 loc) · 1.21 KB
/
codegenerator.py
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
29
30
31
from opnsense_cli.code_generators.puppet_code.type.template_vars import PuppetTypeTemplateVars
from opnsense_cli.code_generators.puppet_code.base import PuppetCodeGenerator
from opnsense_cli.template_engines.base import TemplateEngine
from opnsense_cli.factories import ObjectTypeFromDataFactory
class PuppetTypeCodeGenerator(PuppetCodeGenerator):
def __init__(
self,
template_engine: TemplateEngine,
type_factory: ObjectTypeFromDataFactory,
template,
group,
command,
find_uuid_by_column,
create_command_params,
update_command_params,
):
super().__init__(create_command_params, type_factory, find_uuid_by_column, group, command)
self._template_engine = template_engine
self._template = template
self._update_command_params = update_command_params
def _get_template_vars(self):
return PuppetTypeTemplateVars(
click_command=self._click_command,
click_group=self._click_group,
find_uuid_by_column=self._find_uuid_by_column,
examples=self._get_code_fragment("TEMPLATE_TYPE_example"),
attributes=self._get_code_fragment("TEMPLATE_TYPE_attributes"),
)