Commit e224e9ac authored by ozzeh's avatar ozzeh
Browse files

Add basic Event model

parent c4e3e1a6
from .client import SchemaRegistry, Schema
from .reflection import SchemaReflector
from .models import Event
from .errors import SchemaRegistryError, ModelNotRegisteredError
......@@ -147,6 +147,11 @@ class SchemaRegistry:
include=set(["schema_arn", "schema_name", "schema_version"])
def reflect_event(self) -> Dict[str, SchemaReflector]:
def send_event(
self, event_bus, sender, model: BaseModel, extra_resources: List[str] = None
from typing import List, Optional, Dict, Literal
from datetime import datetime
from pydantic import create_model, BaseModel, Field, PrivateAttr
from pydantic import create_model, BaseModel, Field, PrivateAttr, Json
from .utils import camel_generator
......@@ -57,3 +57,30 @@ class _SchemaVersionsPageModel(_AWSResponseModel):
class _SchemaPageModel(_AWSResponseModel):
schemas: List[_SchemaModel]
class Event(BaseModel):
event_version: str
id: str
detail_type: str = Field(..., alias="detail-type")
detail: Json
source: str
account: str
region: str
time: datetime
resources: List[str]
def schema_registry(self) -> str:
return self.detail_type.split("/", 1)[0]
def schema_version(self) -> str:
return self.detail_type.split(":")[1]
def model_name(self) -> str:
return self.detail_type.split("/")[1].split(":")[0]
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment