Skip to content

Commit 8504bbc

Browse files
committed
[A] Conditionally disable the POST /{catalog}/{action} endpoint
1 parent 4ef53dc commit 8504bbc

File tree

3 files changed

+2
-110
lines changed

3 files changed

+2
-110
lines changed

lambdas/indexer/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
# changes and reset the minor version to zero. Otherwise, increment only
5454
# the minor version for backwards compatible changes. A backwards
5555
# compatible change is one that does not require updates to clients.
56-
'version': '3.3',
56+
'version': '4.0',
5757
'description': fd('''
5858
This is the internal API for Azul's indexer component.
5959
''')

lambdas/indexer/openapi.json

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -721,115 +721,6 @@
721721
]
722722
}
723723
},
724-
"/{catalog}/{action}": {
725-
"post": {
726-
"tags": [
727-
"Indexing"
728-
],
729-
"summary": "Notify the indexer to perform an action on a bundle",
730-
"description": "\nQueue a bundle for addition to or deletion from the index.\n\nThe request must be authenticated using HMAC via the ``signature``\nheader. Each Azul deployment has its own unique HMAC key. The HMAC\ncomponents are the request method, request path, and the SHA256\ndigest of the request body.\n\nA valid HMAC header proves that the client is in possession of the\nsecret HMAC key and that the request wasn't tampered with while\ntravelling between client and service, even though the latter is not\nstrictly necessary considering that TLS is used to encrypt the\nentire exchange. Internal clients can obtain the secret key from the\nenvironment they are running in, and that they share with the\nservice. External clients must have been given the secret key. The\nnow-defunct DSS was such an external client. The Azul indexer\nprovided the HMAC secret to DSS when it registered with DSS to be\nnotified about bundle additions/deletions. These days only internal\nclients use this endpoint.\n",
731-
"requestBody": {
732-
"description": "Contents of the notification",
733-
"required": true,
734-
"content": {
735-
"application/json": {
736-
"schema": {
737-
"type": "object",
738-
"properties": {
739-
"bundle_fqid": {
740-
"type": "object",
741-
"properties": {
742-
"uuid": {
743-
"type": "string"
744-
},
745-
"version": {
746-
"type": "string"
747-
},
748-
"source": {
749-
"type": "object",
750-
"properties": {
751-
"id": {
752-
"type": "string"
753-
},
754-
"spec": {
755-
"type": "string"
756-
}
757-
},
758-
"required": [
759-
"id",
760-
"spec"
761-
],
762-
"additionalProperties": false
763-
}
764-
},
765-
"required": [
766-
"uuid",
767-
"version",
768-
"source"
769-
],
770-
"additionalProperties": false
771-
}
772-
},
773-
"required": [
774-
"bundle_fqid"
775-
],
776-
"additionalProperties": false
777-
}
778-
}
779-
}
780-
},
781-
"parameters": [
782-
{
783-
"name": "catalog",
784-
"in": "path",
785-
"required": true,
786-
"schema": {
787-
"type": "string",
788-
"enum": [
789-
"dcp2"
790-
]
791-
},
792-
"description": "The name of the catalog to notify."
793-
},
794-
{
795-
"name": "action",
796-
"in": "path",
797-
"required": true,
798-
"schema": {
799-
"type": "string",
800-
"enum": [
801-
"add",
802-
"delete"
803-
]
804-
},
805-
"description": "Which action to perform."
806-
},
807-
{
808-
"name": "signature",
809-
"in": "header",
810-
"required": true,
811-
"schema": {
812-
"type": "string"
813-
},
814-
"description": "HMAC authentication signature."
815-
}
816-
],
817-
"responses": {
818-
"200": {
819-
"description": "Notification was successfully queued for processing"
820-
},
821-
"400": {
822-
"description": "Request was rejected due to malformed parameters"
823-
},
824-
"401": {
825-
"description": "Request lacked a valid HMAC header"
826-
},
827-
"504": {
828-
"description": "\nRequest timed out. When handling this response, clients\nshould wait the number of seconds specified in the\n`Retry-After` header and then retry the request.\n"
829-
}
830-
}
831-
}
832-
},
833724
"/schemas/{facility}/{schema_name}/{version_and_extension}": {
834725
"get": {
835726
"summary": "Retrieve JSON schemas",

src/azul/indexer/index_controller.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def handlers(self) -> dict[str, Any]:
7070
@self.app.route(
7171
'/{catalog}/{action}',
7272
methods=['POST'],
73+
enabled=config.enable_bundle_notifications,
7374
spec={
7475
'tags': ['Indexing'],
7576
'summary': 'Notify the indexer to perform an action on a bundle',

0 commit comments

Comments
 (0)