Skip to content

Commit

Permalink
Added payloads for events concerned with file deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz Hahn committed May 23, 2023
1 parent 8e535ac commit a99f113
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ghga_event_schemas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@

"""A package that collects schemas used for events exchanges between GHGA service."""

__version__ = "0.10.1"
__version__ = "0.11.0"
44 changes: 44 additions & 0 deletions ghga_event_schemas/pydantic_.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,50 @@ class Config:

title = "notification"

class FileDeletionRequested(BaseModel):
"""This event is emitted when a request to delete a certain file from the file
backend has been made.
"""

file_id: str = Field(
..., description="The public ID of the file as present in the metadata catalog."
)

class Config:
"""Additional Model Config."""

title = "file_deletion_requested"


class FileDeletionSuccess(FileDeletionRequested):
"""This event is emitted when a service has deleted a file from its database as well
as the S3 buckets it controlls.
"""

# currently identical to the FileDeletionRequested event model.


class Config:
"""Additional Model Config."""

title = "file_deletion_success"

class FileDeletionFailure(FileDeletionRequested):
"""This event is emitted when a service has tried to delete a file from its database as
well as the S3 buckets it controls, but failed.
"""

reason: str = Field(
...,
description="The reason why the deletion failed.",
)

class Config:
"""Additional Model Config."""

title = "file_deletion_success"



# Lists event schemas (values) by event types (key):
schema_registry: dict[str, type[BaseModel]] = {
Expand Down

0 comments on commit a99f113

Please sign in to comment.