> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# events

# `prefect.events.schemas.events`

## Functions

### `matches` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L198](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L198)</sup>

```python theme={null}
matches(expected: str, value: Optional[str]) -> bool
```

Returns true if the given value matches the expected string, which may
include a a negation prefix ("!this-value") or a wildcard suffix
("any-value-starting-with\*")

## Classes

### `Resource` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L43](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L43)</sup>

An observable business object of interest to the user

**Methods:**

#### `as_label_value_array` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/labelling.py#L96](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/labelling.py#L96)</sup>

```python theme={null}
as_label_value_array(self) -> List[Dict[str, str]]
```

#### `enforce_maximum_labels` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L47](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L47)</sup>

```python theme={null}
enforce_maximum_labels(self) -> Self
```

#### `get` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/labelling.py#L93](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/labelling.py#L93)</sup>

```python theme={null}
get(self, label: str, default: Optional[str] = None) -> Optional[str]
```

#### `has_all_labels` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/labelling.py#L103](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/labelling.py#L103)</sup>

```python theme={null}
has_all_labels(self, labels: Dict[str, str]) -> bool
```

#### `id` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L66](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L66)</sup>

```python theme={null}
id(self) -> str
```

#### `items` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/labelling.py#L80](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/labelling.py#L80)</sup>

```python theme={null}
items(self) -> Iterable[Tuple[str, str]]
```

#### `keys` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/labelling.py#L77](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/labelling.py#L77)</sup>

```python theme={null}
keys(self) -> Iterable[str]
```

#### `labels` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/labelling.py#L100](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/labelling.py#L100)</sup>

```python theme={null}
labels(self) -> LabelDiver
```

#### `name` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L70](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L70)</sup>

```python theme={null}
name(self) -> Optional[str]
```

#### `prefect_object_id` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L73](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L73)</sup>

```python theme={null}
prefect_object_id(self, kind: str) -> UUID
```

Extracts the UUID from an event's resource ID if it's the expected kind
of prefect resource

#### `requires_resource_id` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L57](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L57)</sup>

```python theme={null}
requires_resource_id(self) -> Self
```

### `RelatedResource` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L84](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L84)</sup>

A Resource with a specific role in an Event

**Methods:**

#### `enforce_maximum_labels` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L47](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L47)</sup>

```python theme={null}
enforce_maximum_labels(self) -> Self
```

#### `id` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L66](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L66)</sup>

```python theme={null}
id(self) -> str
```

#### `name` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L70](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L70)</sup>

```python theme={null}
name(self) -> Optional[str]
```

#### `prefect_object_id` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L73](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L73)</sup>

```python theme={null}
prefect_object_id(self, kind: str) -> UUID
```

Extracts the UUID from an event's resource ID if it's the expected kind
of prefect resource

#### `requires_resource_id` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L57](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L57)</sup>

```python theme={null}
requires_resource_id(self) -> Self
```

#### `requires_resource_role` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L88](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L88)</sup>

```python theme={null}
requires_resource_role(self) -> Self
```

#### `role` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L99](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L99)</sup>

```python theme={null}
role(self) -> str
```

### `Event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L114](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L114)</sup>

The client-side view of an event that has happened to a Resource

**Methods:**

#### `find_resource_label` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L173](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L173)</sup>

```python theme={null}
find_resource_label(self, label: str) -> Optional[str]
```

Finds the value of the given label in this event's resource or one of its
related resources.  If the label starts with `related:<role>:`, search for the
first matching label in a related resource with that role.

#### `involved_resources` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L157](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L157)</sup>

```python theme={null}
involved_resources(self) -> Sequence[Resource]
```

#### `model_validate_list` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L56](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56)</sup>

```python theme={null}
model_validate_list(cls, obj: Any) -> list[Self]
```

#### `reset_fields` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L85](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85)</sup>

```python theme={null}
reset_fields(self: Self) -> Self
```

Reset the fields of the model that are in the `_reset_fields` set.

**Returns:**

* A new instance of the model with the reset fields.

#### `resource_in_role` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L161](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L161)</sup>

```python theme={null}
resource_in_role(self) -> Mapping[str, RelatedResource]
```

Returns a mapping of roles to the first related resource in that role

#### `resources_in_role` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L166](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L166)</sup>

```python theme={null}
resources_in_role(self) -> Mapping[str, Sequence[RelatedResource]]
```

Returns a mapping of roles to related resources in that role

#### `size_bytes` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L153](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L153)</sup>

```python theme={null}
size_bytes(self) -> int
```

### `ReceivedEvent` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L186](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L186)</sup>

The server-side view of an event that has happened to a Resource after it has
been received by the server

**Methods:**

#### `is_set` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/concurrency/primitives.py#L55](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/concurrency/primitives.py#L55)</sup>

```python theme={null}
is_set(self)
```

#### `set` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/concurrency/primitives.py#L34](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/concurrency/primitives.py#L34)</sup>

```python theme={null}
set(self) -> None
```

Set the flag, notifying all waiters.

Unlike `asyncio.Event`, waiters may not be notified immediately when this is
called; instead, notification will be placed on the owning loop of each waiter
for thread safety.

#### `wait` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/concurrency/primitives.py#L58](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/concurrency/primitives.py#L58)</sup>

```python theme={null}
wait(self) -> Literal[True]
```

Block until the internal flag is true.

If the internal flag is true on entry, return True immediately.
Otherwise, block until another `set()` is called, then return True.

### `ResourceSpecification` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L218](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L218)</sup>

**Methods:**

#### `deepcopy` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L287](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L287)</sup>

```python theme={null}
deepcopy(self) -> 'ResourceSpecification'
```

#### `get` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L274](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L274)</sup>

```python theme={null}
get(self, key: str, default: Optional[Union[str, List[str]]] = None) -> Optional[List[str]]
```

#### `includes` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L232](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L232)</sup>

```python theme={null}
includes(self, candidates: Iterable[Resource]) -> bool
```

#### `items` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L247](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L247)</sup>

```python theme={null}
items(self) -> Iterable[Tuple[str, List[str]]]
```

#### `matches` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L240](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L240)</sup>

```python theme={null}
matches(self, resource: Resource) -> bool
```

#### `matches_every_resource` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L219](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L219)</sup>

```python theme={null}
matches_every_resource(self) -> bool
```

#### `matches_every_resource_of_kind` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L222](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L222)</sup>

```python theme={null}
matches_every_resource_of_kind(self, prefix: str) -> bool
```

#### `pop` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L264](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/events.py#L264)</sup>

```python theme={null}
pop(self, key: str, default: Optional[Union[str, List[str]]] = None) -> Optional[List[str]]
```
