Skip to content

Commit ca43327

Browse files
authored
[batch, auth, monitoring, ci] API documentation additions and fixes (#14833)
## Change Description Updates batch service openapi documentation to fix tabulation bugs and add request and response object definitions. Adds openapi and swagger documentation for the ci, auth and monitoring services. ## Security Assessment - This change has a medium security impact ### Impact Description New endpoints added to auth, ci and monitoring, but in analogy to the existing batch swagger and monitoring endpoints. They take no parameters, are intentionally public, and serve only minimally templated content from system setup variables for version and base path. (Reviewers: please confirm the security impact before approving)
1 parent 00c3128 commit ca43327

File tree

7 files changed

+1980
-129
lines changed

7 files changed

+1980
-129
lines changed

auth/auth/auth.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from gear.auth import AIOHTTPHandler, get_session_id
3434
from gear.cloud_config import get_global_config
3535
from gear.profiling import install_profiler_if_requested
36-
from hailtop import httpx, uvloopx
36+
from hailtop import __version__, httpx, uvloopx
3737
from hailtop.auth import AzureFlow, Flow, GoogleFlow, IdentityProvider
3838
from hailtop.config import get_deploy_config
3939
from hailtop.hail_logging import AccessLogger
@@ -45,6 +45,7 @@
4545
setup_aiohttp_jinja2,
4646
setup_common_static_routes,
4747
web_security_headers,
48+
web_security_headers_swagger,
4849
)
4950

5051
from .auth_utils import is_valid_username, validate_credentials_secret_name_input
@@ -221,6 +222,20 @@ async def get_healthcheck(_) -> web.Response:
221222
return web.Response()
222223

223224

225+
@routes.get('/swagger')
226+
@web_security_headers_swagger
227+
async def swagger(request):
228+
page_context = {'service': 'auth', 'base_path': deploy_config.base_path('auth')}
229+
return await render_template('auth', request, None, 'swagger.html', page_context)
230+
231+
232+
@routes.get('/openapi.yaml')
233+
@web_security_headers
234+
async def openapi(request):
235+
page_context = {'base_path': deploy_config.base_path('auth'), 'spec_version': __version__}
236+
return await render_template('auth', request, None, 'openapi.yaml', page_context)
237+
238+
224239
@routes.get('')
225240
@routes.get('/')
226241
@web_security_headers

0 commit comments

Comments
 (0)