From cafacaa9138a5afa85df7e1c69c8a0fd8f1c11ea Mon Sep 17 00:00:00 2001 From: dev0128 Date: Wed, 13 Nov 2024 08:48:07 +0900 Subject: [PATCH] fix: Modify scripts for new provider support --- config.py | 11 +++++-- diagrams/snowflake/bugworkload.py | 43 ++++++++++++++++++++++++++++ diagrams/snowflake/workload.py | 43 ++++++++++++++++++++++++++++ docs/nodes/snowflake.md | 60 +++++++++++++++++++++++++++++++++++++++ scripts/generate.py | 10 ++++--- scripts/resource.py | 6 ++++ website/i18n/en.json | 3 ++ website/sidebars.json | 1 + 8 files changed, 171 insertions(+), 6 deletions(-) create mode 100644 diagrams/snowflake/bugworkload.py create mode 100644 diagrams/snowflake/workload.py create mode 100644 docs/nodes/snowflake.md diff --git a/config.py b/config.py index dc0590b..d9aa513 100644 --- a/config.py +++ b/config.py @@ -29,6 +29,7 @@ PROVIDERS = ( "generic", "openstack", "outscale", + "snowflake", ) ######################### @@ -59,6 +60,7 @@ FILE_PREFIXES = { "outscale": (), "generic": (), "openstack": (), + "snowflake": (), } ######################### @@ -87,8 +89,9 @@ UPPER_WORDS = { "generic": ("vpn", "ios", "xen", "sql", "lxc"), "outscale": ("osc",), "openstack": ("rpm", "loci", "nfv", "ec2api"), - "pve": ("pve"), - "ibm": ("ibm"), + "pve": ("pve"), # string? or tuple? + "ibm": ("ibm"), # string? or tuple? + "snowflake": ("sn",), } TITLE_WORDS = { @@ -110,6 +113,9 @@ TITLE_WORDS = { "ibm": { "ibm": "IBMCloud" }, + "snowflake": { + "snowflake": "Snowflake" + } } # TODO: check if the classname exists @@ -468,4 +474,5 @@ ALIASES = { "Tripleo": "TripleO", } }, + "snowflake": {}, } diff --git a/diagrams/snowflake/bugworkload.py b/diagrams/snowflake/bugworkload.py new file mode 100644 index 0000000..0f7bd74 --- /dev/null +++ b/diagrams/snowflake/bugworkload.py @@ -0,0 +1,43 @@ +# This module is automatically generated by autogen.sh. DO NOT EDIT. + +from . import _Snowflake + + +class _Bugworkload(_Snowflake): + _type = "bugworkload" + _icon_dir = "resources/snowflake/bugworkload" + + +class AiMl(_Bugworkload): + _icon = "ai-ml.png" + + +class Applications(_Bugworkload): + _icon = "applications.png" + + +class Collaboration(_Bugworkload): + _icon = "collaboration.png" + + +class Cybersecurity(_Bugworkload): + _icon = "cybersecurity.png" + + +class DataEngineering(_Bugworkload): + _icon = "data-engineering.png" + + +class DataLake(_Bugworkload): + _icon = "data-lake.png" + + +class DataWarehouse(_Bugworkload): + _icon = "data-warehouse.png" + + +class Unistore(_Bugworkload): + _icon = "unistore.png" + + +# Aliases diff --git a/diagrams/snowflake/workload.py b/diagrams/snowflake/workload.py new file mode 100644 index 0000000..6603101 --- /dev/null +++ b/diagrams/snowflake/workload.py @@ -0,0 +1,43 @@ +# This module is automatically generated by autogen.sh. DO NOT EDIT. + +from . import _Snowflake + + +class _Workload(_Snowflake): + _type = "workload" + _icon_dir = "resources/snowflake/workload" + + +class AiMl(_Workload): + _icon = "ai-ml.png" + + +class Applications(_Workload): + _icon = "applications.png" + + +class Collaboration(_Workload): + _icon = "collaboration.png" + + +class Cybersecurity(_Workload): + _icon = "cybersecurity.png" + + +class DataEngineering(_Workload): + _icon = "data-engineering.png" + + +class DataLake(_Workload): + _icon = "data-lake.png" + + +class DataWarehouse(_Workload): + _icon = "data-warehouse.png" + + +class Unistore(_Workload): + _icon = "unistore.png" + + +# Aliases diff --git a/docs/nodes/snowflake.md b/docs/nodes/snowflake.md new file mode 100644 index 0000000..4e37961 --- /dev/null +++ b/docs/nodes/snowflake.md @@ -0,0 +1,60 @@ +--- +id: snowflake +title: Snowflake +--- + +Node classes list of the snowflake provider. + +## snowflake.bugworkload + + +AiMl +**diagrams.snowflake.bugworkload.AiMl** + +Applications +**diagrams.snowflake.bugworkload.Applications** + +Collaboration +**diagrams.snowflake.bugworkload.Collaboration** + +Cybersecurity +**diagrams.snowflake.bugworkload.Cybersecurity** + +DataEngineering +**diagrams.snowflake.bugworkload.DataEngineering** + +DataLake +**diagrams.snowflake.bugworkload.DataLake** + +DataWarehouse +**diagrams.snowflake.bugworkload.DataWarehouse** + +Unistore +**diagrams.snowflake.bugworkload.Unistore** + +## snowflake.workload + + +AiMl +**diagrams.snowflake.workload.AiMl** + +Applications +**diagrams.snowflake.workload.Applications** + +Collaboration +**diagrams.snowflake.workload.Collaboration** + +Cybersecurity +**diagrams.snowflake.workload.Cybersecurity** + +DataEngineering +**diagrams.snowflake.workload.DataEngineering** + +DataLake +**diagrams.snowflake.workload.DataLake** + +DataWarehouse +**diagrams.snowflake.workload.DataWarehouse** + +Unistore +**diagrams.snowflake.workload.Unistore** diff --git a/scripts/generate.py b/scripts/generate.py index 299f394..6d417f3 100644 --- a/scripts/generate.py +++ b/scripts/generate.py @@ -42,11 +42,11 @@ def gen_classes(pvd: str, typ: str, paths: Iterable[str]) -> str: def gen_apidoc(pvd: str, typ_paths: dict) -> str: try: - default_tmp = cfg.TMPL_APIDOC.split('.') - tmpl_file = f"{default_tmp[0]}_{pvd}.{default_tmp[1]}" - tmpl = load_tmpl(tmpl_file) + default_tmp = cfg.TMPL_APIDOC.split(".") + tmpl_file = f"{default_tmp[0]}_{pvd}.{default_tmp[1]}" + tmpl = load_tmpl(tmpl_file) except exceptions.TemplateNotFound: - tmpl = load_tmpl(cfg.TMPL_APIDOC) + tmpl = load_tmpl(cfg.TMPL_APIDOC) # TODO: remove def _gen_class_name(path: str) -> str: @@ -68,6 +68,8 @@ def gen_apidoc(pvd: str, typ_paths: dict) -> str: def make_module(pvd: str, typ: str, classes: str) -> None: """Create a module file""" mod_path = os.path.join(app_root_dir(pvd), f"{typ}.py") + os.makedirs(os.path.dirname(mod_path), exist_ok=True) + with open(mod_path, "w+") as f: f.write(classes) diff --git a/scripts/resource.py b/scripts/resource.py index cdea937..d7ac3b3 100644 --- a/scripts/resource.py +++ b/scripts/resource.py @@ -84,6 +84,7 @@ def cleaner_k8s(f): break return f.lower() + def cleaner_digitalocean(f): f = f.replace("-32", "") for p in cfg.FILE_PREFIXES["digitalocean"]: @@ -135,6 +136,10 @@ def cleaner_openstack(f): return f.lower() +def cleaner_snowflake(f): + return f.lower() + + cleaners = { "onprem": cleaner_onprem, "aws": cleaner_aws, @@ -152,6 +157,7 @@ cleaners = { "outscale": cleaner_outscale, "generic": cleaner_generic, "openstack": cleaner_openstack, + "snowflake": cleaner_snowflake, } diff --git a/website/i18n/en.json b/website/i18n/en.json index 7af9afd..0a0724f 100644 --- a/website/i18n/en.json +++ b/website/i18n/en.json @@ -76,6 +76,9 @@ }, "nodes/saas": { "title": "Saas" + }, + "nodes/snowflake": { + "title": "Snowflake" } }, "links": { diff --git a/website/sidebars.json b/website/sidebars.json index 6693b59..13d8eba 100644 --- a/website/sidebars.json +++ b/website/sidebars.json @@ -24,6 +24,7 @@ "nodes/digitalocean", "nodes/elastic", "nodes/outscale", + "nodes/snowflake", "nodes/generic", "nodes/programming", "nodes/saas",