esgf_playground_utils.models.kafka

Models relating to Kakfa payloads for the ESGF-Playground.

Classes

_Payload

Base model for payloads in a Kafka message, provides the required collection_id attribute.

CreatePayload

Model describing a CREATE payload. This must be sent as a POST request.

RevokePayload

Model describing a REVOKE payload. This must be sent as a PATCH or DELETE request.

PartialUpdatePayload

Model describing a PARTIAL_UPDATE payload. This must be sent as a PATCH request.

UpdatePayload

Model describing a UPDATE payload. This must be sent as a PATCH or PUT request.

Data

Model describing the DATA component of a Kafka message. This contains the payload itself.

Auth

Model describing the AUTH component of a Kafka message.

AuthData

Model describing Auth component of a Kafka message in more detail.

Publisher

Model describing the PUBLISHER component of a Kafka message. This is the name and version of the software used

Metadata

Multiple metadata attributes required for ESGF but not part of the STAC payload.

ExtendedMetadata

An extension of the Metadata Model for Publish Events.

KafkaEvent

The full content of a Kafka message, containing both the STAC payload, the request description and the ESGF

ErrorType

Enum describing the source of the error that occurred.

Error

Error event published to the Kafka error queue.

Module Contents

class esgf_playground_utils.models.kafka._Payload(/, **data: Any)

Bases: pydantic.BaseModel

Base model for payloads in a Kafka message, provides the required collection_id attribute.

Warning

This model should not be used directly.

collection_id: str
class esgf_playground_utils.models.kafka.CreatePayload(/, **data: Any)

Bases: _Payload

Model describing a CREATE payload. This must be sent as a POST request.

method: Literal['POST']
item: stac_pydantic.item.Item
class esgf_playground_utils.models.kafka.RevokePayload(/, **data: Any)

Bases: _Payload

Model describing a REVOKE payload. This must be sent as a PATCH or DELETE request.

Note

It is intended that the PATCH request is interpreted as a “soft” delete, simply updating the item to signify that it is revoked.

The DELETE request will operate as a “hard” delete strictly removing the item from the STAC index.

Danger

The behaviour of either of these actions is not yet fully defined.

method: Literal['PATCH', 'DELETE']
item_id: str
class esgf_playground_utils.models.kafka.PartialUpdatePayload(/, **data: Any)

Bases: _Payload

Model describing a PARTIAL_UPDATE payload. This must be sent as a PATCH request.

method: Literal['PATCH']
item: Dict[str, Any]
item_id: str
class esgf_playground_utils.models.kafka.UpdatePayload(/, **data: Any)

Bases: _Payload

Model describing a UPDATE payload. This must be sent as a PATCH or PUT request.

method: Literal['PUT', 'PATCH']
item: stac_pydantic.item.Item
item_id: str
class esgf_playground_utils.models.kafka.Data(/, **data: Any)

Bases: pydantic.BaseModel

Model describing the DATA component of a Kafka message. This contains the payload itself.

Note

Whilst the type and version attributes are available, it is not expected that these will change for a significant length of time.

type: Literal['STAC']
version: Literal['1.0.0']
payload: CreatePayload | RevokePayload | UpdatePayload | PartialUpdatePayload
class esgf_playground_utils.models.kafka.Auth(/, **data: Any)

Bases: pydantic.BaseModel

Model describing the AUTH component of a Kafka message.

Note

This is not an authorisation token or other verified identity. It is the simply an indication of the institute providing the message.

client_id: str
server: str
class esgf_playground_utils.models.kafka.AuthData(/, **data: Any)

Bases: pydantic.BaseModel

Model describing Auth component of a Kafka message in more detail.

auth_policy_id: str
client_id: str
requester_data: Dict[str, str]
class esgf_playground_utils.models.kafka.Publisher(/, **data: Any)

Bases: pydantic.BaseModel

Model describing the PUBLISHER component of a Kafka message. This is the name and version of the software used to publish the Kafka message.

package: str
version: str
class esgf_playground_utils.models.kafka.Metadata(/, **data: Any)

Bases: pydantic.BaseModel

Multiple metadata attributes required for ESGF but not part of the STAC payload.

auth: Auth | AuthData
publisher: Publisher
time: datetime.datetime
schema_version: str
class esgf_playground_utils.models.kafka.ExtendedMetadata(/, **data: Any)

Bases: Metadata

An extension of the Metadata Model for Publish Events.

event_id: str
request_id: str
class esgf_playground_utils.models.kafka.KafkaEvent(/, **data: Any)

Bases: pydantic.BaseModel

The full content of a Kafka message, containing both the STAC payload, the request description and the ESGF mandated metadata.

metadata: Metadata | ExtendedMetadata
data: Data
class esgf_playground_utils.models.kafka.ErrorType

Bases: str, enum.Enum

Enum describing the source of the error that occurred.

payload = 'payload'
stac_server = 'stac_server'
kafka = 'kafka'
unknown = 'unknown'
class esgf_playground_utils.models.kafka.Error(/, **data: Any)

Bases: pydantic.BaseModel

Error event published to the Kafka error queue.

original_payload: str
node: str
traceback: str
error_type: ErrorType