Skip to content

Commit

Permalink
fixup! Add contact information to Swagger UI (#6205)
Browse files Browse the repository at this point in the history
  • Loading branch information
achave11-ucsc committed Dec 5, 2024
1 parent bc24fe8 commit d2d5d3d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 16 deletions.
7 changes: 0 additions & 7 deletions lambdas/indexer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@
'title': config.indexer_name,
'description': fd('''
This is the internal API for Azul's indexer component.
## Contact us
For technical and user support please file an issue on
[GitHub](https://github.com/DataBiosphere/azul/issues) or email
`azul-group@ucsc.edu`. To report a security concern or misconduct
please email `azul-group@ucsc.edu`.
'''),
# This property should be updated in any PR connected to an issue
# labeled `API`. Increment the major version for backwards incompatible
Expand Down
2 changes: 1 addition & 1 deletion lambdas/indexer/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.1",
"info": {
"title": "azul-indexer-dev",
"description": "\nThis is the internal API for Azul's indexer component.\n\n## Contact us\n\nFor technical and user support please file an issue on\n[GitHub](https://github.com/DataBiosphere/azul/issues) or email\n`azul-group@ucsc.edu`. To report a security concern or misconduct\nplease email `azul-group@ucsc.edu`.\n",
"description": "\nThis is the internal API for Azul's indexer component.\n\n\n## Contact us\n\nFor technical support please file an issue at\n[GitHub](https://github.com/DataBiosphere/azul/issues) or email\n`azul-group@ucsc.edu`. To report a security concern or misconduct please email\n`azul-group@ucsc.edu`.\n",
"version": "1.1"
},
"paths": {
Expand Down
7 changes: 0 additions & 7 deletions lambdas/service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,6 @@
Also notice that there is only one file. When querying a particular
index, the corresponding entity will always be a singleton like
this.
## Contact us
For technical and user support please file an issue on
[GitHub](https://github.com/DataBiosphere/azul/issues) or email
`azul-group@ucsc.edu`. To report a security concern or misconduct
please email `azul-group@ucsc.edu`.
'''),
# This property should be updated in any PR connected to an issue
# labeled `API`. Increment the major version for backwards incompatible
Expand Down
2 changes: 1 addition & 1 deletion lambdas/service/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.1",
"info": {
"title": "azul-service-dev",
"description": "\n# Overview\n\nAzul is a REST web service for querying metadata associated with\nboth experimental and analysis data from a data repository. In order\nto deliver response times that make it suitable for interactive use\ncases, the set of metadata properties that it exposes for sorting,\nfiltering, and aggregation is limited. Azul provides a uniform view\nof the metadata over a range of diverse schemas, effectively\nshielding clients from changes in the schemas as they occur over\ntime. It does so, however, at the expense of detail in the set of\nmetadata properties it exposes and in the accuracy with which it\naggregates them.\n\nAzul denormalizes and aggregates metadata into several different\nindices for selected entity types. Metadata entities can be queried\nusing the [Index](#operations-tag-Index) endpoints.\n\nA set of indices forms a catalog. There is a default catalog called\n`dcp2` which will be used unless a\ndifferent catalog name is specified using the `catalog` query\nparameter. Metadata from different catalogs is completely\nindependent: a response obtained by querying one catalog does not\nnecessarily correlate to a response obtained by querying another\none. Two catalogs can contain metadata from the same sources or\ndifferent sources. It is only guaranteed that the body of a\nresponse by any given endpoint adheres to one schema,\nindependently of which catalog was specified in the request.\n\nAzul provides the ability to download data and metadata via the\n[Manifests](#operations-tag-Manifests) endpoints. The\n`curl` format manifests can be used to\ndownload data files. Other formats provide various views of the\nmetadata. Manifests can be generated for a selection of files using\nfilters. These filters are interchangeable with the filters used by\nthe [Index](#operations-tag-Index) endpoints.\n\nAzul also provides a [summary](#operations-Index-get_index_summary)\nview of indexed data.\n\n## Data model\n\nAny index, when queried, returns a JSON array of hits. Each hit\nrepresents a metadata entity. Nested in each hit is a summary of the\nproperties of entities associated with the hit. An entity is\nassociated either by a direct edge in the original metadata graph,\nor indirectly as a series of edges. The nested properties are\ngrouped by the type of the associated entity. The properties of all\ndata files associated with a particular sample, for example, are\nlisted under `hits[*].files` in a `/index/samples` response. It is\nimportant to note that while each _hit_ represents a discrete\nentity, the properties nested within that hit are the result of an\naggregation over potentially many associated entities.\n\nTo illustrate this, consider a data file that is part of two\nprojects (a project is a group of related experiments, typically by\none laboratory, institution or consortium). Querying the `files`\nindex for this file yields a hit looking something like:\n\n```\n{\n \"projects\": [\n {\n \"projectTitle\": \"Project One\"\n \"laboratory\": ...,\n ...\n },\n {\n \"projectTitle\": \"Project Two\"\n \"laboratory\": ...,\n ...\n }\n ],\n \"files\": [\n {\n \"format\": \"pdf\",\n \"name\": \"Team description.pdf\",\n ...\n }\n ]\n}\n```\n\nThis example hit contains two kinds of nested entities (a hit in an\nactual Azul response will contain more): There are the two projects\nentities, and the file itself. These nested entities contain\nselected metadata properties extracted in a consistent way. This\nmakes filtering and sorting simple.\n\nAlso notice that there is only one file. When querying a particular\nindex, the corresponding entity will always be a singleton like\nthis.\n\n## Contact us\n\nFor technical and user support please file an issue on\n[GitHub](https://github.com/DataBiosphere/azul/issues) or email\n`azul-group@ucsc.edu`. To report a security concern or misconduct\nplease email `azul-group@ucsc.edu`.\n",
"description": "\n# Overview\n\nAzul is a REST web service for querying metadata associated with\nboth experimental and analysis data from a data repository. In order\nto deliver response times that make it suitable for interactive use\ncases, the set of metadata properties that it exposes for sorting,\nfiltering, and aggregation is limited. Azul provides a uniform view\nof the metadata over a range of diverse schemas, effectively\nshielding clients from changes in the schemas as they occur over\ntime. It does so, however, at the expense of detail in the set of\nmetadata properties it exposes and in the accuracy with which it\naggregates them.\n\nAzul denormalizes and aggregates metadata into several different\nindices for selected entity types. Metadata entities can be queried\nusing the [Index](#operations-tag-Index) endpoints.\n\nA set of indices forms a catalog. There is a default catalog called\n`dcp2` which will be used unless a\ndifferent catalog name is specified using the `catalog` query\nparameter. Metadata from different catalogs is completely\nindependent: a response obtained by querying one catalog does not\nnecessarily correlate to a response obtained by querying another\none. Two catalogs can contain metadata from the same sources or\ndifferent sources. It is only guaranteed that the body of a\nresponse by any given endpoint adheres to one schema,\nindependently of which catalog was specified in the request.\n\nAzul provides the ability to download data and metadata via the\n[Manifests](#operations-tag-Manifests) endpoints. The\n`curl` format manifests can be used to\ndownload data files. Other formats provide various views of the\nmetadata. Manifests can be generated for a selection of files using\nfilters. These filters are interchangeable with the filters used by\nthe [Index](#operations-tag-Index) endpoints.\n\nAzul also provides a [summary](#operations-Index-get_index_summary)\nview of indexed data.\n\n## Data model\n\nAny index, when queried, returns a JSON array of hits. Each hit\nrepresents a metadata entity. Nested in each hit is a summary of the\nproperties of entities associated with the hit. An entity is\nassociated either by a direct edge in the original metadata graph,\nor indirectly as a series of edges. The nested properties are\ngrouped by the type of the associated entity. The properties of all\ndata files associated with a particular sample, for example, are\nlisted under `hits[*].files` in a `/index/samples` response. It is\nimportant to note that while each _hit_ represents a discrete\nentity, the properties nested within that hit are the result of an\naggregation over potentially many associated entities.\n\nTo illustrate this, consider a data file that is part of two\nprojects (a project is a group of related experiments, typically by\none laboratory, institution or consortium). Querying the `files`\nindex for this file yields a hit looking something like:\n\n```\n{\n \"projects\": [\n {\n \"projectTitle\": \"Project One\"\n \"laboratory\": ...,\n ...\n },\n {\n \"projectTitle\": \"Project Two\"\n \"laboratory\": ...,\n ...\n }\n ],\n \"files\": [\n {\n \"format\": \"pdf\",\n \"name\": \"Team description.pdf\",\n ...\n }\n ]\n}\n```\n\nThis example hit contains two kinds of nested entities (a hit in an\nactual Azul response will contain more): There are the two projects\nentities, and the file itself. These nested entities contain\nselected metadata properties extracted in a consistent way. This\nmakes filtering and sorting simple.\n\nAlso notice that there is only one file. When querying a particular\nindex, the corresponding entity will always be a singleton like\nthis.\n\n\n## Contact us\n\nFor technical support please file an issue at\n[GitHub](https://github.com/DataBiosphere/azul/issues) or email\n`azul-group@ucsc.edu`. To report a security concern or misconduct please email\n`azul-group@ucsc.edu`.\n",
"version": "9.3"
},
"tags": [
Expand Down
24 changes: 24 additions & 0 deletions src/azul/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
from azul.collections import (
atuple,
)
from azul.openapi import (
format_description,
)
from azul.types import (
JSON,
)
Expand Down Expand Up @@ -1517,6 +1520,27 @@ def security_contact(self) -> SecurityContact | None:
import json
return json.loads(value)

@property
def contact_us(self) -> str:
try:
email = self.security_contact['email_address']
except TypeError:
# Only the actual shared deployments are configured with a security
# contact. Deployments lacking a security contact use the monitoring
# email since it's the same as the security contact email, except in
# personal deployments. In personal deployments, the monitoring
# email is derived from the value of the `AZUL_OWNER` variable.
email = self.monitoring_email
return format_description(f'''
## Contact us
For technical support please file an issue at
[GitHub](https://github.com/DataBiosphere/azul/issues) or email
`{email}`. To report a security concern or misconduct please email
`{email}`.
''')

@attr.s(frozen=True, kw_only=True, auto_attribs=True)
class SlackIntegration:
workspace_id: str
Expand Down
2 changes: 2 additions & 0 deletions src/azul/chalice.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ def __init__(self,
self.unit_test = unit_test
self.non_interactive_routes: set[tuple[str, str]] = set()
assert 'paths' not in spec, 'The top-level spec must not define paths'
# Inject contact us details into both indexer and service Swagger specs
spec['info']['description'] += config.contact_us
self._specs = copy_json(spec)
self._specs['paths'] = {}
super().__init__(app_name, debug=config.debug > 0, configure_logs=False)
Expand Down

0 comments on commit d2d5d3d

Please sign in to comment.