diff options
author | Hugo Valente <82235632+hugovalente-pm@users.noreply.github.com> | 2024-04-10 10:00:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-10 12:00:48 +0300 |
commit | d9c5f204588e196b90046ecd39cbd1e4cb35b69b (patch) | |
tree | 93148e25110667622a8e23204593907f020b304b /integrations/gen_docs_integrations.py | |
parent | f4ada267cbe2311083785a59f8fe9afdbb6911ba (diff) |
add Okta SSO integration (#17351)
* add Okta SSO integration
* add Okta SSO integration
* add new authentication integration logic to the generation script
* apply Ilya's edits
* Apply suggestions from code review
* Update integrations/cloud-authentication/metadata.yaml
* Update okta_sso.md
---------
Co-authored-by: Fotis Voutsas <fotis@netdata.cloud>
Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>
Diffstat (limited to 'integrations/gen_docs_integrations.py')
-rw-r--r-- | integrations/gen_docs_integrations.py | 69 |
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) |