generated from ghga-de/microservice-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standardized Kafka Event Config Classes (GSI-1407) (#56)
* Add standardized topic/type configs * Update readme * Fix some typos and exports * Fix naming inconsistencies * Remove changes that are for later * Shorten config field names
- Loading branch information
1 parent
23ee005
commit 67f115e
Showing
9 changed files
with
636 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln | ||
# for the German Human Genome-Phenome Archive (GHGA) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"""Standardized topic/type configurations for Kafka events""" | ||
|
||
from .stateful import ( # noqa: F401 | ||
DatasetEventsConfig, | ||
ResourceEventsConfig, | ||
UserEventsConfig, | ||
) | ||
from .stateless import ( # noqa: F401 | ||
AccessRequestCreatedEventsConfig, | ||
AccessRequestDeniedEventsConfig, | ||
DownloadServedEventsConfig, | ||
FileDeletedEventsConfig, | ||
FileDeletionRequestEventsConfig, | ||
FileInternallyRegisteredEventsConfig, | ||
FileInterrogationFailureEventsConfig, | ||
FileInterrogationSuccessEventsConfig, | ||
FileMetadataEventsConfig, | ||
FileRegisteredForDownloadEventsConfig, | ||
FileStagedEventsConfig, | ||
FileStagingRequestedEventsConfig, | ||
FileUploadReceivedEventsConfig, | ||
IvaChangeEventsConfig, | ||
NotificationEventsConfig, | ||
SecondFactorRecreatedEventsConfig, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln | ||
# for the German Human Genome-Phenome Archive (GHGA) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"""Config classes for stateful events""" | ||
|
||
from pydantic import Field | ||
from pydantic_settings import BaseSettings | ||
|
||
__all__ = [ | ||
"DatasetEventsConfig", | ||
"ResourceEventsConfig", | ||
"UserEventsConfig", | ||
] | ||
|
||
|
||
class DatasetEventsConfig(BaseSettings): | ||
"""For dataset change events.""" | ||
|
||
dataset_change_topic: str = Field( | ||
..., | ||
description="Name of the topic announcing, among other things, the list of" | ||
+ " files included in a new dataset.", | ||
examples=["metadata_datasets"], | ||
) | ||
dataset_deletion_type: str = Field( | ||
..., | ||
description="Type used for events announcing a new dataset overview.", | ||
examples=["dataset_deleted"], | ||
) | ||
dataset_upsertion_type: str = Field( | ||
..., | ||
description="Type used for events announcing a new dataset overview.", | ||
examples=["dataset_created"], | ||
) | ||
|
||
|
||
class ResourceEventsConfig(BaseSettings): | ||
"""For searchable metadata resource change events.""" | ||
|
||
resource_change_topic: str = Field( | ||
..., | ||
description="Name of the topic used for events informing other services about" | ||
+ " resource changes, i.e. deletion or insertion.", | ||
examples=["searchable_resources"], | ||
) | ||
resource_deletion_type: str = Field( | ||
..., | ||
description="Type used for events indicating the deletion of a previously" | ||
+ " existing resource.", | ||
examples=["searchable_resource_deleted"], | ||
) | ||
resource_upsertion_type: str = Field( | ||
..., | ||
description="Type used for events indicating the upsert of a resource.", | ||
examples=["searchable_resource_upserted"], | ||
) | ||
|
||
|
||
class UserEventsConfig(BaseSettings): | ||
"""Config for communication changes to user data, done via outbox. | ||
The upsertion and deletion event types are hardcoded by `hexkit`. | ||
""" | ||
|
||
user_topic: str = Field( | ||
default="users", | ||
description="The name of the topic containing user events.", | ||
) |
Oops, something went wrong.