Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/generate config json for ftd api docs #122

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

BASE_DIR_PATH = os.path.dirname(os.path.realpath(__file__))
DEFAULT_TEMPLATE_DIR = os.path.join(BASE_DIR_PATH, 'templates')
STATIC_TEMPLATE_DIR = os.path.join(DEFAULT_TEMPLATE_DIR, 'static')
FTD_ANSIBLE_STATIC_TEMPLATE_DIR = os.path.join(DEFAULT_TEMPLATE_DIR, 'static', 'ftd_ansible')
FTD_API_STATIC_TEMPLATE_DIR = os.path.join(DEFAULT_TEMPLATE_DIR, 'static', 'ftd_api')
DEFAULT_SAMPLES_DIR = os.path.join(os.path.dirname(BASE_DIR_PATH), 'samples')
DEFAULT_DIST_DIR = os.path.join(BASE_DIR_PATH, 'dist')
DEFAULT_MODULE_DIR = os.path.join(os.path.dirname(BASE_DIR_PATH), 'library')
Expand Down Expand Up @@ -202,7 +203,7 @@ def _generate_ansible_docs(args, api_spec, template_ctx):
.generate_doc_files(args.dist, args.models)
generator.ModuleDocGenerator(DEFAULT_TEMPLATE_DIR, template_ctx, DEFAULT_MODULE_DIR) \
.generate_doc_files(args.dist)
generator.StaticDocGenerator(DEFAULT_TEMPLATE_DIR, template_ctx, STATIC_TEMPLATE_DIR) \
generator.StaticDocGenerator(DEFAULT_TEMPLATE_DIR, template_ctx, FTD_ANSIBLE_STATIC_TEMPLATE_DIR) \
.generate_doc_files(args.dist)


Expand All @@ -216,6 +217,8 @@ def _generate_ftd_api_docs(args, api_spec, template_ctx, errors_codes):
if errors_codes:
generator.ErrorDocGenerator(DEFAULT_TEMPLATE_DIR, template_ctx) \
.generate_doc_files(args.dist, errors_codes)
generator.StaticDocGenerator(DEFAULT_TEMPLATE_DIR, template_ctx, FTD_API_STATIC_TEMPLATE_DIR) \
.generate_doc_files(args.dist)


def _generate_docs(args, api_client):
Expand All @@ -230,6 +233,7 @@ def _generate_docs(args, api_client):
_generate_ansible_docs(args, api_spec, template_ctx)
elif args.doctype == DocType.ftd_api:
error_codes = api_client.fetch_error_codes()
template_ctx['error_codes'] = bool(error_codes)
_generate_ftd_api_docs(args, api_spec, template_ctx, error_codes)


Expand Down
37 changes: 37 additions & 0 deletions docs/templates/static/ftd_api/config.json.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"items": [
{
"title": "Overview",
"items": [
{
"title": "Introduction to Firepower Threat Defense REST API",
"content": "introduction/intro.md"
},
{
"title": "Authenticating Your REST API Client Using OAuth",
"content": "introduction/auth.md"
},
{
"title": "Deploying Configuration Changes",
"content": "introduction/deploy_config.md"
}
]
},
{% if error_codes %}
{
"title": "Error Codes",
"content": "error_codes.md"
},
{% endif %}
{
"title": "Resources",
"type": "config",
"content": "resources/config.json"
},
{
"title": "Models",
"type": "config",
"content": "models/config.json"
}
]
}