Merge branch 'main' into index_search

This commit is contained in:
Tino Schreiber 2023-06-13 08:58:05 +00:00
commit 239f7c24e3
2 changed files with 45 additions and 5 deletions

View File

@ -1085,8 +1085,7 @@ documents:
service_type: waf service_type: waf
title: User Guide title: User Guide
type: umn type: umn
- environment: internal - hc_location: api/dwaf
hc_location: api/dwaf
html_location: docs/wafd/api-ref html_location: docs/wafd/api-ref
link: /web-application-firewall-dedicated/api-ref/ link: /web-application-firewall-dedicated/api-ref/
pdf_name: wafd-api-ref pdf_name: wafd-api-ref
@ -1094,8 +1093,7 @@ documents:
service_type: wafd service_type: wafd
title: API Reference title: API Reference
type: api-ref type: api-ref
- environment: internal - hc_location: usermanual/dwaf
hc_location: usermanual/dwaf
html_location: docs/wafd/umn html_location: docs/wafd/umn
link: /web-application-firewall-dedicated/umn/ link: /web-application-firewall-dedicated/umn/
pdf_name: wafd-umn pdf_name: wafd-umn
@ -2028,7 +2026,7 @@ services:
service_title: Dedicated Web Application Firewall service_title: Dedicated Web Application Firewall
service_type: wafd service_type: wafd
service_uri: web-application-firewall-dedicated service_uri: web-application-firewall-dedicated
environment: internal environment: public
teams: teams:
- name: docs-security-services-rw - name: docs-security-services-rw
permission: write permission: write

View File

@ -113,6 +113,48 @@ class Services(object):
res[cat]["docs"].append(res_doc) res[cat]["docs"].append(res_doc)
return res 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): def docs_by_service_category(self, category, environment=None):
"""List services matching category """List services matching category