diff --git a/docs/rest-api.yml b/docs/rest-api.yml index 4ea54864..310c9dde 100644 --- a/docs/rest-api.yml +++ b/docs/rest-api.yml @@ -689,6 +689,11 @@ definitions: description: The command used to start the service (if managed) items: type: string + info: + type: object + description: | + Additional information a deployment can attach to a service. + JupyterHub does not use this field. Token: type: object properties: diff --git a/jupyterhub/apihandlers/services.py b/jupyterhub/apihandlers/services.py index 7c4bfb61..b0c5134e 100644 --- a/jupyterhub/apihandlers/services.py +++ b/jupyterhub/apihandlers/services.py @@ -23,6 +23,7 @@ def service_model(service): 'prefix': service.server.base_url if service.server else '', 'command': service.command, 'pid': service.proc.pid if service.proc else 0, + 'info': service.info } class ServiceListAPIHandler(APIHandler): diff --git a/jupyterhub/services/service.py b/jupyterhub/services/service.py index 6ec52b5d..49a78a41 100644 --- a/jupyterhub/services/service.py +++ b/jupyterhub/services/service.py @@ -175,6 +175,13 @@ class Service(LoggingConfigurable): If unspecified, an API token will be generated for managed services. """ ).tag(input=True) + + info = Dict( + help="""Provide a place to include miscellaneous information about the service, + provided through the configuration + """ + ).tag(input=True) + # Managed service API: spawner = Any() diff --git a/jupyterhub/tests/test_api.py b/jupyterhub/tests/test_api.py index 6a736023..f93c63ad 100644 --- a/jupyterhub/tests/test_api.py +++ b/jupyterhub/tests/test_api.py @@ -1525,6 +1525,7 @@ def test_get_services(app, mockservice_url): 'pid': mockservice.proc.pid, 'prefix': mockservice.server.base_url, 'url': mockservice.url, + 'info': {}, } } @@ -1551,6 +1552,7 @@ def test_get_service(app, mockservice_url): 'pid': mockservice.proc.pid, 'prefix': mockservice.server.base_url, 'url': mockservice.url, + 'info': {}, } r = yield api_request(app, 'services/%s' % mockservice.name,