summaryrefslogtreecommitdiffstats
path: root/integrations/gen_docs_integrations.py
diff options
context:
space:
mode:
Diffstat (limited to 'integrations/gen_docs_integrations.py')
-rw-r--r--integrations/gen_docs_integrations.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/integrations/gen_docs_integrations.py b/integrations/gen_docs_integrations.py
index d6306e811a..27d2ce72e3 100644
--- a/integrations/gen_docs_integrations.py
+++ b/integrations/gen_docs_integrations.py
@@ -25,6 +25,9 @@ def cleanup():
for element in Path("integrations/cloud-notifications").glob('**/*/'):
if "integrations" in str(element) and not "metadata.yaml" in str(element):
shutil.rmtree(element)
+ for element in Path("integrations/cloud-authentication").glob('**/*/'):
+ if "integrations" in str(element) and not "metadata.yaml" in str(element):
+ shutil.rmtree(element)
def generate_category_from_name(category_fragment, category_array):
"""
@@ -80,6 +83,9 @@ def add_custom_edit_url(markdown_string, meta_yaml_link, sidebar_label_string, m
elif mode == 'agent-notifications':
path_to_md_file = meta_yaml_link.replace("metadata.yaml", "README")
+ elif mode == 'cloud-authentication':
+ path_to_md_file = meta_yaml_link.replace("metadata.yaml", f'integrations/{clean_string(sidebar_label_string)}')
+
output = markdown_string.replace(
"<!--startmeta",
f'<!--startmeta\ncustom_edit_url: \"{path_to_md_file}.md\"')
@@ -244,6 +250,39 @@ endmeta-->
except Exception as e:
print("Exception in notification md construction", e, integration['id'])
+
+ # AUTHENTICATIONS
+ elif mode == 'authentication':
+ if True:
+ # initiate the variables for the authentication method
+ meta_yaml = integration['edit_link'].replace("blob", "edit")
+ sidebar_label = integration['meta']['name']
+ learn_rel_path = generate_category_from_name(integration['meta']['categories'][0].split("."), categories)
+
+ # build the markdown string
+ md = \
+ f"""<!--startmeta
+meta_yaml: "{meta_yaml}"
+sidebar_label: "{sidebar_label}"
+learn_status: "Published"
+learn_rel_path: "{learn_rel_path.replace("authentication", "Authentication")}"
+message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE AUTHENTICATION'S metadata.yaml FILE"
+endmeta-->
+
+{create_overview(integration, integration['meta']['icon_filename'])}"""
+
+ if integration['setup']:
+ md += f"""
+{integration['setup']}
+"""
+
+ if integration['troubleshooting']:
+ md += f"""
+{integration['troubleshooting']}
+"""
+
+ # except Exception as e:
+ # print("Exception in authentication md construction", e, integration['id'])
if "community" in integration['meta'].keys():
community = "<img src=\"https://img.shields.io/badge/maintained%20by-Community-blue\" />"
@@ -329,6 +368,29 @@ def write_to_file(path, md, meta_yaml, sidebar_label, community, mode='default')
except FileNotFoundError as e:
print("Exception in writing to file", e)
+ elif mode == 'authentication':
+
+ name = clean_string(integration['meta']['name'])
+
+ if not Path(f'{path}/integrations').exists():
+ Path(f'{path}/integrations').mkdir()
+
+ # proper_edit_name = meta_yaml.replace(
+ # "metadata.yaml", f'integrations/{clean_string(sidebar_label)}.md\"')
+
+ md = add_custom_edit_url(md, meta_yaml, sidebar_label, mode='cloud-authentication')
+
+ finalpath = f'{path}/integrations/{name}.md'
+
+ try:
+ clean_and_write(
+ md,
+ Path(finalpath)
+ )
+
+ except FileNotFoundError as e:
+ print("Exception in writing to file", e)
+
def make_symlinks(symlink_dict):
"""
@@ -386,5 +448,12 @@ for integration in integrations:
path = build_path(meta_yaml)
write_to_file(path, md, meta_yaml, sidebar_label, community, mode='notification')
+ elif integration['integration_type'] == "authentication":
+
+ meta_yaml, sidebar_label, learn_rel_path, md, community = build_readme_from_integration(
+ integration, mode='authentication')
+ path = build_path(meta_yaml)
+ write_to_file(path, md, meta_yaml, sidebar_label, community, mode='authentication')
+
make_symlinks(symlink_dict)