From 229823f93e248ca1b74ef8921db9ff03f2036e82 Mon Sep 17 00:00:00 2001 From: "Hasko, Vladimir" Date: Tue, 13 Jun 2023 08:06:51 +0000 Subject: [PATCH 1/2] enabling WAFD on public portal Reviewed-by: tischrei Co-authored-by: Hasko, Vladimir Co-committed-by: Hasko, Vladimir --- otc_metadata/data/services.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/otc_metadata/data/services.yaml b/otc_metadata/data/services.yaml index 7b653414..3ff770de 100644 --- a/otc_metadata/data/services.yaml +++ b/otc_metadata/data/services.yaml @@ -1085,8 +1085,7 @@ documents: service_type: waf title: User Guide type: umn - - environment: internal - hc_location: api/dwaf + - hc_location: api/dwaf html_location: docs/wafd/api-ref link: /web-application-firewall-dedicated/api-ref/ pdf_name: wafd-api-ref @@ -1094,8 +1093,7 @@ documents: service_type: wafd title: API Reference type: api-ref - - environment: internal - hc_location: usermanual/dwaf + - hc_location: usermanual/dwaf html_location: docs/wafd/umn link: /web-application-firewall-dedicated/umn/ pdf_name: wafd-umn @@ -2028,7 +2026,7 @@ services: service_title: Dedicated Web Application Firewall service_type: wafd service_uri: web-application-firewall-dedicated - environment: internal + environment: public teams: - name: docs-security-services-rw permission: write From f9a83705e1c797148c2aac06c91e86492691128e Mon Sep 17 00:00:00 2001 From: "Gode, Sebastian" Date: Tue, 13 Jun 2023 08:15:04 +0000 Subject: [PATCH 2/2] Added function for search listing Reviewed-by: tischrei Co-authored-by: Gode, Sebastian Co-committed-by: Gode, Sebastian --- otc_metadata/services.py | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/otc_metadata/services.py b/otc_metadata/services.py index 195b067e..f62ca3c0 100644 --- a/otc_metadata/services.py +++ b/otc_metadata/services.py @@ -113,6 +113,48 @@ class Services(object): res[cat]["docs"].append(res_doc) return res + def service_types_with_doc_types(self, environment=None): + """Retrieve type and title from services and corresponding docs. + As well as a list of all doc_types. + + :param str environment: Optional service environment. + """ + service_list = [] + doc_types = [] + + for service in self.all_services: + if not service["service_title"]: + continue + if not service["service_type"]: + continue + + doc_list = [] + for doc in self.all_docs: + if "environment" in doc: + if doc["environment"] != environment: + continue + if doc["service_type"] == service["service_type"]: + doc_list.append({ + "title": doc["title"], + "type": doc["type"] + }) + + if doc["type"] not in doc_types: + doc_types.append(doc["type"]) + + service_list.append({ + "service_title": service["service_title"], + "service_type": service["service_type"], + "docs": doc_list + }) + + res = { + "services": service_list, + "doc_types": doc_types + } + + return res + def docs_by_service_category(self, category, environment=None): """List services matching category