diff --git a/src/kio/schema/add_raft_voter/__init__.py b/src/kio/schema/add_raft_voter/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/kio/schema/add_raft_voter/v0/__init__.py b/src/kio/schema/add_raft_voter/v0/__init__.py new file mode 100644 index 00000000..eb1f95ca --- /dev/null +++ b/src/kio/schema/add_raft_voter/v0/__init__.py @@ -0,0 +1,7 @@ +from .request import AddRaftVoterRequest +from .response import AddRaftVoterResponse + +__all__ = ( + "AddRaftVoterRequest", + "AddRaftVoterResponse", +) diff --git a/src/kio/schema/add_raft_voter/v0/request.py b/src/kio/schema/add_raft_voter/v0/request.py new file mode 100644 index 00000000..df706b55 --- /dev/null +++ b/src/kio/schema/add_raft_voter/v0/request.py @@ -0,0 +1,48 @@ +""" +Generated from ``clients/src/main/resources/common/message/AddRaftVoterRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i32Timedelta +from kio.static.primitive import u16 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class Listener: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(80) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + name: str = field(metadata={"kafka_type": "string"}) + """The name of the endpoint""" + host: str = field(metadata={"kafka_type": "string"}) + """The hostname""" + port: u16 = field(metadata={"kafka_type": "uint16"}) + """The port""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class AddRaftVoterRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(80) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + cluster_id: str | None = field(metadata={"kafka_type": "string"}) + timeout: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + voter_id: i32 = field(metadata={"kafka_type": "int32"}) + """The replica id of the voter getting added to the topic partition""" + voter_directory_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The directory id of the voter getting added to the topic partition""" + listeners: tuple[Listener, ...] + """The endpoints that can be used to communicate with the voter""" diff --git a/src/kio/schema/add_raft_voter/v0/response.py b/src/kio/schema/add_raft_voter/v0/response.py new file mode 100644 index 00000000..46780c79 --- /dev/null +++ b/src/kio/schema/add_raft_voter/v0/response.py @@ -0,0 +1,28 @@ +""" +Generated from ``clients/src/main/resources/common/message/AddRaftVoterResponse.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32Timedelta + + +@dataclass(frozen=True, slots=True, kw_only=True) +class AddRaftVoterResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(80) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + throttle_time: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The error code, or 0 if there was no error""" + error_message: str | None = field(metadata={"kafka_type": "string"}) + """The error message, or null if there was no error.""" diff --git a/src/kio/schema/api_versions/v3/response.py b/src/kio/schema/api_versions/v3/response.py index fdc41816..025c8bee 100644 --- a/src/kio/schema/api_versions/v3/response.py +++ b/src/kio/schema/api_versions/v3/response.py @@ -75,7 +75,7 @@ class ApiVersionsResponse: supported_features: tuple[SupportedFeatureKey, ...] = field( metadata={"tag": 0}, default=() ) - """Features supported by the broker.""" + """Features supported by the broker. Note: in v0-v3, features with MinSupportedVersion = 0 are omitted.""" finalized_features_epoch: i64 = field( metadata={"kafka_type": "int64", "tag": 1}, default=i64(-1) ) diff --git a/src/kio/schema/api_versions/v4/__init__.py b/src/kio/schema/api_versions/v4/__init__.py new file mode 100644 index 00000000..56669930 --- /dev/null +++ b/src/kio/schema/api_versions/v4/__init__.py @@ -0,0 +1,7 @@ +from .request import ApiVersionsRequest +from .response import ApiVersionsResponse + +__all__ = ( + "ApiVersionsRequest", + "ApiVersionsResponse", +) diff --git a/src/kio/schema/api_versions/v4/request.py b/src/kio/schema/api_versions/v4/request.py new file mode 100644 index 00000000..52ef38a4 --- /dev/null +++ b/src/kio/schema/api_versions/v4/request.py @@ -0,0 +1,24 @@ +""" +Generated from ``clients/src/main/resources/common/message/ApiVersionsRequest.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ApiVersionsRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(4) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(18) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + client_software_name: str = field(metadata={"kafka_type": "string"}) + """The name of the client.""" + client_software_version: str = field(metadata={"kafka_type": "string"}) + """The version of the client.""" diff --git a/src/kio/schema/api_versions/v4/response.py b/src/kio/schema/api_versions/v4/response.py new file mode 100644 index 00000000..bc7dab9e --- /dev/null +++ b/src/kio/schema/api_versions/v4/response.py @@ -0,0 +1,90 @@ +""" +Generated from ``clients/src/main/resources/common/message/ApiVersionsResponse.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v0.header import ResponseHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32Timedelta +from kio.static.primitive import i64 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ApiVersion: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(4) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(18) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + api_key: i16 = field(metadata={"kafka_type": "int16"}) + """The API index.""" + min_version: i16 = field(metadata={"kafka_type": "int16"}) + """The minimum supported version, inclusive.""" + max_version: i16 = field(metadata={"kafka_type": "int16"}) + """The maximum supported version, inclusive.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class SupportedFeatureKey: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(4) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(18) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + name: str = field(metadata={"kafka_type": "string"}) + """The name of the feature.""" + min_version: i16 = field(metadata={"kafka_type": "int16"}) + """The minimum supported version for the feature.""" + max_version: i16 = field(metadata={"kafka_type": "int16"}) + """The maximum supported version for the feature.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class FinalizedFeatureKey: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(4) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(18) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + name: str = field(metadata={"kafka_type": "string"}) + """The name of the feature.""" + max_version_level: i16 = field(metadata={"kafka_type": "int16"}) + """The cluster-wide finalized max version level for the feature.""" + min_version_level: i16 = field(metadata={"kafka_type": "int16"}) + """The cluster-wide finalized min version level for the feature.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ApiVersionsResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(4) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(18) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The top-level error code.""" + api_keys: tuple[ApiVersion, ...] + """The APIs supported by the broker.""" + throttle_time: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota.""" + supported_features: tuple[SupportedFeatureKey, ...] = field( + metadata={"tag": 0}, default=() + ) + """Features supported by the broker. Note: in v0-v3, features with MinSupportedVersion = 0 are omitted.""" + finalized_features_epoch: i64 = field( + metadata={"kafka_type": "int64", "tag": 1}, default=i64(-1) + ) + """The monotonically increasing epoch for the finalized features information. Valid values are >= 0. A value of -1 is special and represents unknown epoch.""" + finalized_features: tuple[FinalizedFeatureKey, ...] = field( + metadata={"tag": 2}, default=() + ) + """List of cluster-wide finalized features. The information is valid only if FinalizedFeaturesEpoch >= 0.""" + zk_migration_ready: bool = field( + metadata={"kafka_type": "bool", "tag": 3}, default=False + ) + """Set by a KRaft controller if the required configurations for ZK migration are present""" diff --git a/src/kio/schema/begin_quorum_epoch/v0/request.py b/src/kio/schema/begin_quorum_epoch/v0/request.py index 9932b13a..9bf2bb24 100644 --- a/src/kio/schema/begin_quorum_epoch/v0/request.py +++ b/src/kio/schema/begin_quorum_epoch/v0/request.py @@ -22,7 +22,7 @@ class PartitionData: __api_key__: ClassVar[i16] = i16(53) __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader partition_index: i32 = field(metadata={"kafka_type": "int32"}) - """The partition index.""" + """The partition index""" leader_id: BrokerId = field(metadata={"kafka_type": "int32"}) """The ID of the newly elected leader""" leader_epoch: i32 = field(metadata={"kafka_type": "int32"}) @@ -37,7 +37,7 @@ class TopicData: __api_key__: ClassVar[i16] = i16(53) __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader topic_name: TopicName = field(metadata={"kafka_type": "string"}) - """The topic name.""" + """The topic name""" partitions: tuple[PartitionData, ...] diff --git a/src/kio/schema/begin_quorum_epoch/v1/__init__.py b/src/kio/schema/begin_quorum_epoch/v1/__init__.py new file mode 100644 index 00000000..f17eda4a --- /dev/null +++ b/src/kio/schema/begin_quorum_epoch/v1/__init__.py @@ -0,0 +1,7 @@ +from .request import BeginQuorumEpochRequest +from .response import BeginQuorumEpochResponse + +__all__ = ( + "BeginQuorumEpochRequest", + "BeginQuorumEpochResponse", +) diff --git a/src/kio/schema/begin_quorum_epoch/v1/request.py b/src/kio/schema/begin_quorum_epoch/v1/request.py new file mode 100644 index 00000000..5c9425a4 --- /dev/null +++ b/src/kio/schema/begin_quorum_epoch/v1/request.py @@ -0,0 +1,76 @@ +""" +Generated from ``clients/src/main/resources/common/message/BeginQuorumEpochRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.schema.types import BrokerId +from kio.schema.types import TopicName +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import u16 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(53) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + partition_index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index""" + voter_directory_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The directory id of the receiving replica""" + leader_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The ID of the newly elected leader""" + leader_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The epoch of the newly elected leader""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class TopicData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(53) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + topic_name: TopicName = field(metadata={"kafka_type": "string"}) + """The topic name""" + partitions: tuple[PartitionData, ...] + + +@dataclass(frozen=True, slots=True, kw_only=True) +class LeaderEndpoint: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(53) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + name: str = field(metadata={"kafka_type": "string"}) + """The name of the endpoint""" + host: str = field(metadata={"kafka_type": "string"}) + """The node's hostname""" + port: u16 = field(metadata={"kafka_type": "uint16"}) + """The node's port""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class BeginQuorumEpochRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(53) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + cluster_id: str | None = field(metadata={"kafka_type": "string"}, default=None) + voter_id: BrokerId = field(metadata={"kafka_type": "int32"}, default=BrokerId(-1)) + """The replica id of the voter receiving the request""" + topics: tuple[TopicData, ...] + leader_endpoints: tuple[LeaderEndpoint, ...] + """Endpoints for the leader""" diff --git a/src/kio/schema/begin_quorum_epoch/v1/response.py b/src/kio/schema/begin_quorum_epoch/v1/response.py new file mode 100644 index 00000000..eb0440f9 --- /dev/null +++ b/src/kio/schema/begin_quorum_epoch/v1/response.py @@ -0,0 +1,73 @@ +""" +Generated from ``clients/src/main/resources/common/message/BeginQuorumEpochResponse.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.schema.types import BrokerId +from kio.schema.types import TopicName +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import u16 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(53) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + partition_index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + leader_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The ID of the current leader or -1 if the leader is unknown.""" + leader_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The latest known leader epoch""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class TopicData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(53) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_name: TopicName = field(metadata={"kafka_type": "string"}) + """The topic name.""" + partitions: tuple[PartitionData, ...] + + +@dataclass(frozen=True, slots=True, kw_only=True) +class NodeEndpoint: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(53) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + node_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The ID of the associated node""" + host: str = field(metadata={"kafka_type": "string"}) + """The node's hostname""" + port: u16 = field(metadata={"kafka_type": "uint16"}) + """The node's port""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class BeginQuorumEpochResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(53) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The top level error code.""" + topics: tuple[TopicData, ...] + node_endpoints: tuple[NodeEndpoint, ...] = field(metadata={"tag": 0}, default=()) + """Endpoints for all leaders enumerated in PartitionData""" diff --git a/src/kio/schema/broker_registration/v0/request.py b/src/kio/schema/broker_registration/v0/request.py index edfd8e36..6c410b46 100644 --- a/src/kio/schema/broker_registration/v0/request.py +++ b/src/kio/schema/broker_registration/v0/request.py @@ -63,6 +63,6 @@ class BrokerRegistrationRequest: listeners: tuple[Listener, ...] """The listeners of this broker""" features: tuple[Feature, ...] - """The features on this broker""" + """The features on this broker. Note: in v0-v3, features with MinSupportedVersion = 0 are omitted.""" rack: str | None = field(metadata={"kafka_type": "string"}) """The rack which this broker is in.""" diff --git a/src/kio/schema/broker_registration/v1/request.py b/src/kio/schema/broker_registration/v1/request.py index d300f751..220ee5bf 100644 --- a/src/kio/schema/broker_registration/v1/request.py +++ b/src/kio/schema/broker_registration/v1/request.py @@ -63,7 +63,7 @@ class BrokerRegistrationRequest: listeners: tuple[Listener, ...] """The listeners of this broker""" features: tuple[Feature, ...] - """The features on this broker""" + """The features on this broker. Note: in v0-v3, features with MinSupportedVersion = 0 are omitted.""" rack: str | None = field(metadata={"kafka_type": "string"}) """The rack which this broker is in.""" is_migrating_zk_broker: bool = field(metadata={"kafka_type": "bool"}, default=False) diff --git a/src/kio/schema/broker_registration/v2/request.py b/src/kio/schema/broker_registration/v2/request.py index fed9fe5a..69e24fb4 100644 --- a/src/kio/schema/broker_registration/v2/request.py +++ b/src/kio/schema/broker_registration/v2/request.py @@ -63,7 +63,7 @@ class BrokerRegistrationRequest: listeners: tuple[Listener, ...] """The listeners of this broker""" features: tuple[Feature, ...] - """The features on this broker""" + """The features on this broker. Note: in v0-v3, features with MinSupportedVersion = 0 are omitted.""" rack: str | None = field(metadata={"kafka_type": "string"}) """The rack which this broker is in.""" is_migrating_zk_broker: bool = field(metadata={"kafka_type": "bool"}, default=False) diff --git a/src/kio/schema/broker_registration/v3/request.py b/src/kio/schema/broker_registration/v3/request.py index 002df4b1..b316bfbf 100644 --- a/src/kio/schema/broker_registration/v3/request.py +++ b/src/kio/schema/broker_registration/v3/request.py @@ -64,7 +64,7 @@ class BrokerRegistrationRequest: listeners: tuple[Listener, ...] """The listeners of this broker""" features: tuple[Feature, ...] - """The features on this broker""" + """The features on this broker. Note: in v0-v3, features with MinSupportedVersion = 0 are omitted.""" rack: str | None = field(metadata={"kafka_type": "string"}) """The rack which this broker is in.""" is_migrating_zk_broker: bool = field(metadata={"kafka_type": "bool"}, default=False) diff --git a/src/kio/schema/broker_registration/v4/__init__.py b/src/kio/schema/broker_registration/v4/__init__.py new file mode 100644 index 00000000..8d7b5f8c --- /dev/null +++ b/src/kio/schema/broker_registration/v4/__init__.py @@ -0,0 +1,7 @@ +from .request import BrokerRegistrationRequest +from .response import BrokerRegistrationResponse + +__all__ = ( + "BrokerRegistrationRequest", + "BrokerRegistrationResponse", +) diff --git a/src/kio/schema/broker_registration/v4/request.py b/src/kio/schema/broker_registration/v4/request.py new file mode 100644 index 00000000..f880cfc0 --- /dev/null +++ b/src/kio/schema/broker_registration/v4/request.py @@ -0,0 +1,79 @@ +""" +Generated from ``clients/src/main/resources/common/message/BrokerRegistrationRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.schema.types import BrokerId +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i64 +from kio.static.primitive import u16 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class Listener: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(4) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(62) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + name: str = field(metadata={"kafka_type": "string"}) + """The name of the endpoint.""" + host: str = field(metadata={"kafka_type": "string"}) + """The hostname.""" + port: u16 = field(metadata={"kafka_type": "uint16"}) + """The port.""" + security_protocol: i16 = field(metadata={"kafka_type": "int16"}) + """The security protocol.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class Feature: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(4) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(62) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + name: str = field(metadata={"kafka_type": "string"}) + """The feature name.""" + min_supported_version: i16 = field(metadata={"kafka_type": "int16"}) + """The minimum supported feature level.""" + max_supported_version: i16 = field(metadata={"kafka_type": "int16"}) + """The maximum supported feature level.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class BrokerRegistrationRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(4) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(62) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + broker_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The broker ID.""" + cluster_id: str = field(metadata={"kafka_type": "string"}) + """The cluster id of the broker process.""" + incarnation_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The incarnation id of the broker process.""" + listeners: tuple[Listener, ...] + """The listeners of this broker""" + features: tuple[Feature, ...] + """The features on this broker. Note: in v0-v3, features with MinSupportedVersion = 0 are omitted.""" + rack: str | None = field(metadata={"kafka_type": "string"}) + """The rack which this broker is in.""" + is_migrating_zk_broker: bool = field(metadata={"kafka_type": "bool"}, default=False) + """If the required configurations for ZK migration are present, this value is set to true""" + log_dirs: tuple[uuid.UUID | None, ...] = field( + metadata={"kafka_type": "uuid"}, default=() + ) + """Log directories configured in this broker which are available.""" + previous_broker_epoch: i64 = field( + metadata={"kafka_type": "int64"}, default=i64(-1) + ) + """The epoch before a clean shutdown.""" diff --git a/src/kio/schema/broker_registration/v4/response.py b/src/kio/schema/broker_registration/v4/response.py new file mode 100644 index 00000000..7e6558b2 --- /dev/null +++ b/src/kio/schema/broker_registration/v4/response.py @@ -0,0 +1,29 @@ +""" +Generated from ``clients/src/main/resources/common/message/BrokerRegistrationResponse.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32Timedelta +from kio.static.primitive import i64 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class BrokerRegistrationResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(4) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(62) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + throttle_time: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """Duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The error code, or 0 if there was no error.""" + broker_epoch: i64 = field(metadata={"kafka_type": "int64"}, default=i64(-1)) + """The broker's assigned epoch, or -1 if none was assigned.""" diff --git a/src/kio/schema/create_topics/v0/request.py b/src/kio/schema/create_topics/v0/request.py index 8a7522e0..78865888 100644 --- a/src/kio/schema/create_topics/v0/request.py +++ b/src/kio/schema/create_topics/v0/request.py @@ -33,7 +33,7 @@ class CreatableReplicaAssignment: @dataclass(frozen=True, slots=True, kw_only=True) -class CreateableTopicConfig: +class CreatableTopicConfig: __type__: ClassVar = EntityType.nested __version__: ClassVar[i16] = i16(0) __flexible__: ClassVar[bool] = False @@ -60,7 +60,7 @@ class CreatableTopic: """The number of replicas to create for each partition in the topic, or -1 if we are either specifying a manual partition assignment or using the default replication factor.""" assignments: tuple[CreatableReplicaAssignment, ...] """The manual partition assignment, or the empty array if we are using automatic assignment.""" - configs: tuple[CreateableTopicConfig, ...] + configs: tuple[CreatableTopicConfig, ...] """The custom topic configurations to set.""" diff --git a/src/kio/schema/create_topics/v1/request.py b/src/kio/schema/create_topics/v1/request.py index 424f0f74..78930931 100644 --- a/src/kio/schema/create_topics/v1/request.py +++ b/src/kio/schema/create_topics/v1/request.py @@ -33,7 +33,7 @@ class CreatableReplicaAssignment: @dataclass(frozen=True, slots=True, kw_only=True) -class CreateableTopicConfig: +class CreatableTopicConfig: __type__: ClassVar = EntityType.nested __version__: ClassVar[i16] = i16(1) __flexible__: ClassVar[bool] = False @@ -60,7 +60,7 @@ class CreatableTopic: """The number of replicas to create for each partition in the topic, or -1 if we are either specifying a manual partition assignment or using the default replication factor.""" assignments: tuple[CreatableReplicaAssignment, ...] """The manual partition assignment, or the empty array if we are using automatic assignment.""" - configs: tuple[CreateableTopicConfig, ...] + configs: tuple[CreatableTopicConfig, ...] """The custom topic configurations to set.""" diff --git a/src/kio/schema/create_topics/v2/request.py b/src/kio/schema/create_topics/v2/request.py index 6023fc5d..ddd4f31a 100644 --- a/src/kio/schema/create_topics/v2/request.py +++ b/src/kio/schema/create_topics/v2/request.py @@ -33,7 +33,7 @@ class CreatableReplicaAssignment: @dataclass(frozen=True, slots=True, kw_only=True) -class CreateableTopicConfig: +class CreatableTopicConfig: __type__: ClassVar = EntityType.nested __version__: ClassVar[i16] = i16(2) __flexible__: ClassVar[bool] = False @@ -60,7 +60,7 @@ class CreatableTopic: """The number of replicas to create for each partition in the topic, or -1 if we are either specifying a manual partition assignment or using the default replication factor.""" assignments: tuple[CreatableReplicaAssignment, ...] """The manual partition assignment, or the empty array if we are using automatic assignment.""" - configs: tuple[CreateableTopicConfig, ...] + configs: tuple[CreatableTopicConfig, ...] """The custom topic configurations to set.""" diff --git a/src/kio/schema/create_topics/v3/request.py b/src/kio/schema/create_topics/v3/request.py index b6712013..49ff7c97 100644 --- a/src/kio/schema/create_topics/v3/request.py +++ b/src/kio/schema/create_topics/v3/request.py @@ -33,7 +33,7 @@ class CreatableReplicaAssignment: @dataclass(frozen=True, slots=True, kw_only=True) -class CreateableTopicConfig: +class CreatableTopicConfig: __type__: ClassVar = EntityType.nested __version__: ClassVar[i16] = i16(3) __flexible__: ClassVar[bool] = False @@ -60,7 +60,7 @@ class CreatableTopic: """The number of replicas to create for each partition in the topic, or -1 if we are either specifying a manual partition assignment or using the default replication factor.""" assignments: tuple[CreatableReplicaAssignment, ...] """The manual partition assignment, or the empty array if we are using automatic assignment.""" - configs: tuple[CreateableTopicConfig, ...] + configs: tuple[CreatableTopicConfig, ...] """The custom topic configurations to set.""" diff --git a/src/kio/schema/create_topics/v4/request.py b/src/kio/schema/create_topics/v4/request.py index bb43676c..0d7f52c1 100644 --- a/src/kio/schema/create_topics/v4/request.py +++ b/src/kio/schema/create_topics/v4/request.py @@ -33,7 +33,7 @@ class CreatableReplicaAssignment: @dataclass(frozen=True, slots=True, kw_only=True) -class CreateableTopicConfig: +class CreatableTopicConfig: __type__: ClassVar = EntityType.nested __version__: ClassVar[i16] = i16(4) __flexible__: ClassVar[bool] = False @@ -60,7 +60,7 @@ class CreatableTopic: """The number of replicas to create for each partition in the topic, or -1 if we are either specifying a manual partition assignment or using the default replication factor.""" assignments: tuple[CreatableReplicaAssignment, ...] """The manual partition assignment, or the empty array if we are using automatic assignment.""" - configs: tuple[CreateableTopicConfig, ...] + configs: tuple[CreatableTopicConfig, ...] """The custom topic configurations to set.""" diff --git a/src/kio/schema/create_topics/v5/request.py b/src/kio/schema/create_topics/v5/request.py index 899812c5..7509d255 100644 --- a/src/kio/schema/create_topics/v5/request.py +++ b/src/kio/schema/create_topics/v5/request.py @@ -33,7 +33,7 @@ class CreatableReplicaAssignment: @dataclass(frozen=True, slots=True, kw_only=True) -class CreateableTopicConfig: +class CreatableTopicConfig: __type__: ClassVar = EntityType.nested __version__: ClassVar[i16] = i16(5) __flexible__: ClassVar[bool] = True @@ -60,7 +60,7 @@ class CreatableTopic: """The number of replicas to create for each partition in the topic, or -1 if we are either specifying a manual partition assignment or using the default replication factor.""" assignments: tuple[CreatableReplicaAssignment, ...] """The manual partition assignment, or the empty array if we are using automatic assignment.""" - configs: tuple[CreateableTopicConfig, ...] + configs: tuple[CreatableTopicConfig, ...] """The custom topic configurations to set.""" diff --git a/src/kio/schema/create_topics/v6/request.py b/src/kio/schema/create_topics/v6/request.py index 57c62ce2..53336da8 100644 --- a/src/kio/schema/create_topics/v6/request.py +++ b/src/kio/schema/create_topics/v6/request.py @@ -33,7 +33,7 @@ class CreatableReplicaAssignment: @dataclass(frozen=True, slots=True, kw_only=True) -class CreateableTopicConfig: +class CreatableTopicConfig: __type__: ClassVar = EntityType.nested __version__: ClassVar[i16] = i16(6) __flexible__: ClassVar[bool] = True @@ -60,7 +60,7 @@ class CreatableTopic: """The number of replicas to create for each partition in the topic, or -1 if we are either specifying a manual partition assignment or using the default replication factor.""" assignments: tuple[CreatableReplicaAssignment, ...] """The manual partition assignment, or the empty array if we are using automatic assignment.""" - configs: tuple[CreateableTopicConfig, ...] + configs: tuple[CreatableTopicConfig, ...] """The custom topic configurations to set.""" diff --git a/src/kio/schema/create_topics/v7/request.py b/src/kio/schema/create_topics/v7/request.py index 73d77f2c..2a220b81 100644 --- a/src/kio/schema/create_topics/v7/request.py +++ b/src/kio/schema/create_topics/v7/request.py @@ -33,7 +33,7 @@ class CreatableReplicaAssignment: @dataclass(frozen=True, slots=True, kw_only=True) -class CreateableTopicConfig: +class CreatableTopicConfig: __type__: ClassVar = EntityType.nested __version__: ClassVar[i16] = i16(7) __flexible__: ClassVar[bool] = True @@ -60,7 +60,7 @@ class CreatableTopic: """The number of replicas to create for each partition in the topic, or -1 if we are either specifying a manual partition assignment or using the default replication factor.""" assignments: tuple[CreatableReplicaAssignment, ...] """The manual partition assignment, or the empty array if we are using automatic assignment.""" - configs: tuple[CreateableTopicConfig, ...] + configs: tuple[CreatableTopicConfig, ...] """The custom topic configurations to set.""" diff --git a/src/kio/schema/delete_share_group_state/__init__.py b/src/kio/schema/delete_share_group_state/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/kio/schema/delete_share_group_state/v0/__init__.py b/src/kio/schema/delete_share_group_state/v0/__init__.py new file mode 100644 index 00000000..cc56bbad --- /dev/null +++ b/src/kio/schema/delete_share_group_state/v0/__init__.py @@ -0,0 +1,7 @@ +from .request import DeleteShareGroupStateRequest +from .response import DeleteShareGroupStateResponse + +__all__ = ( + "DeleteShareGroupStateRequest", + "DeleteShareGroupStateResponse", +) diff --git a/src/kio/schema/delete_share_group_state/v0/request.py b/src/kio/schema/delete_share_group_state/v0/request.py new file mode 100644 index 00000000..cc871092 --- /dev/null +++ b/src/kio/schema/delete_share_group_state/v0/request.py @@ -0,0 +1,51 @@ +""" +Generated from ``clients/src/main/resources/common/message/DeleteShareGroupStateRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(86) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + partition: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class DeleteStateData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(86) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The topic identifier.""" + partitions: tuple[PartitionData, ...] + """The data for the partitions.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class DeleteShareGroupStateRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(86) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + group_id: str = field(metadata={"kafka_type": "string"}) + """The group identifier.""" + topics: tuple[DeleteStateData, ...] + """The data for the topics.""" diff --git a/src/kio/schema/delete_share_group_state/v0/response.py b/src/kio/schema/delete_share_group_state/v0/response.py new file mode 100644 index 00000000..b72f6aac --- /dev/null +++ b/src/kio/schema/delete_share_group_state/v0/response.py @@ -0,0 +1,54 @@ +""" +Generated from ``clients/src/main/resources/common/message/DeleteShareGroupStateResponse.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionResult: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(86) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + partition: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The error code, or 0 if there was no error.""" + error_message: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The error message, or null if there was no error.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class DeleteStateResult: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(86) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The topic identifier""" + partitions: tuple[PartitionResult, ...] + """The results for the partitions.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class DeleteShareGroupStateResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(86) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + results: tuple[DeleteStateResult, ...] + """The delete results""" diff --git a/src/kio/schema/describe_quorum/v2/__init__.py b/src/kio/schema/describe_quorum/v2/__init__.py new file mode 100644 index 00000000..1f714ca8 --- /dev/null +++ b/src/kio/schema/describe_quorum/v2/__init__.py @@ -0,0 +1,7 @@ +from .request import DescribeQuorumRequest +from .response import DescribeQuorumResponse + +__all__ = ( + "DescribeQuorumRequest", + "DescribeQuorumResponse", +) diff --git a/src/kio/schema/describe_quorum/v2/request.py b/src/kio/schema/describe_quorum/v2/request.py new file mode 100644 index 00000000..1c4e321d --- /dev/null +++ b/src/kio/schema/describe_quorum/v2/request.py @@ -0,0 +1,46 @@ +""" +Generated from ``clients/src/main/resources/common/message/DescribeQuorumRequest.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.schema.types import TopicName +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(2) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(55) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + partition_index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class TopicData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(2) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(55) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + topic_name: TopicName = field(metadata={"kafka_type": "string"}) + """The topic name.""" + partitions: tuple[PartitionData, ...] + + +@dataclass(frozen=True, slots=True, kw_only=True) +class DescribeQuorumRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(2) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(55) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + topics: tuple[TopicData, ...] diff --git a/src/kio/schema/describe_quorum/v2/response.py b/src/kio/schema/describe_quorum/v2/response.py new file mode 100644 index 00000000..b74a0557 --- /dev/null +++ b/src/kio/schema/describe_quorum/v2/response.py @@ -0,0 +1,114 @@ +""" +Generated from ``clients/src/main/resources/common/message/DescribeQuorumResponse.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.schema.types import BrokerId +from kio.schema.types import TopicName +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i64 +from kio.static.primitive import u16 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ReplicaState: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(2) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(55) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + replica_id: BrokerId = field(metadata={"kafka_type": "int32"}) + replica_directory_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + log_end_offset: i64 = field(metadata={"kafka_type": "int64"}) + """The last known log end offset of the follower or -1 if it is unknown""" + last_fetch_timestamp: i64 = field(metadata={"kafka_type": "int64"}, default=i64(-1)) + """The last known leader wall clock time time when a follower fetched from the leader. This is reported as -1 both for the current leader or if it is unknown for a voter""" + last_caught_up_timestamp: i64 = field( + metadata={"kafka_type": "int64"}, default=i64(-1) + ) + """The leader wall clock append time of the offset for which the follower made the most recent fetch request. This is reported as the current time for the leader and -1 if unknown for a voter""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(2) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(55) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + partition_index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + error_message: str | None = field(metadata={"kafka_type": "string"}) + """The error message, or null if there was no error.""" + leader_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The ID of the current leader or -1 if the leader is unknown.""" + leader_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The latest known leader epoch""" + high_watermark: i64 = field(metadata={"kafka_type": "int64"}) + current_voters: tuple[ReplicaState, ...] + observers: tuple[ReplicaState, ...] + + +@dataclass(frozen=True, slots=True, kw_only=True) +class TopicData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(2) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(55) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_name: TopicName = field(metadata={"kafka_type": "string"}) + """The topic name.""" + partitions: tuple[PartitionData, ...] + + +@dataclass(frozen=True, slots=True, kw_only=True) +class Listener: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(2) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(55) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + name: str = field(metadata={"kafka_type": "string"}) + """The name of the endpoint""" + host: str = field(metadata={"kafka_type": "string"}) + """The hostname""" + port: u16 = field(metadata={"kafka_type": "uint16"}) + """The port""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class Node: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(2) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(55) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + node_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The ID of the associated node""" + listeners: tuple[Listener, ...] + """The listeners of this controller""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class DescribeQuorumResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(2) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(55) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The top level error code.""" + error_message: str | None = field(metadata={"kafka_type": "string"}) + """The error message, or null if there was no error.""" + topics: tuple[TopicData, ...] + nodes: tuple[Node, ...] diff --git a/src/kio/schema/end_quorum_epoch/v1/__init__.py b/src/kio/schema/end_quorum_epoch/v1/__init__.py new file mode 100644 index 00000000..c495d53d --- /dev/null +++ b/src/kio/schema/end_quorum_epoch/v1/__init__.py @@ -0,0 +1,7 @@ +from .request import EndQuorumEpochRequest +from .response import EndQuorumEpochResponse + +__all__ = ( + "EndQuorumEpochRequest", + "EndQuorumEpochResponse", +) diff --git a/src/kio/schema/end_quorum_epoch/v1/request.py b/src/kio/schema/end_quorum_epoch/v1/request.py new file mode 100644 index 00000000..03221292 --- /dev/null +++ b/src/kio/schema/end_quorum_epoch/v1/request.py @@ -0,0 +1,85 @@ +""" +Generated from ``clients/src/main/resources/common/message/EndQuorumEpochRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.schema.types import BrokerId +from kio.schema.types import TopicName +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import u16 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ReplicaInfo: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(54) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + candidate_id: BrokerId = field(metadata={"kafka_type": "int32"}) + candidate_directory_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(54) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + partition_index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + leader_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The current leader ID that is resigning""" + leader_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The current epoch""" + preferred_candidates: tuple[ReplicaInfo, ...] + """A sorted list of preferred candidates to start the election""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class TopicData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(54) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + topic_name: TopicName = field(metadata={"kafka_type": "string"}) + """The topic name.""" + partitions: tuple[PartitionData, ...] + + +@dataclass(frozen=True, slots=True, kw_only=True) +class LeaderEndpoint: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(54) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + name: str = field(metadata={"kafka_type": "string"}) + """The name of the endpoint""" + host: str = field(metadata={"kafka_type": "string"}) + """The node's hostname""" + port: u16 = field(metadata={"kafka_type": "uint16"}) + """The node's port""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class EndQuorumEpochRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(54) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + cluster_id: str | None = field(metadata={"kafka_type": "string"}, default=None) + topics: tuple[TopicData, ...] + leader_endpoints: tuple[LeaderEndpoint, ...] + """Endpoints for the leader""" diff --git a/src/kio/schema/end_quorum_epoch/v1/response.py b/src/kio/schema/end_quorum_epoch/v1/response.py new file mode 100644 index 00000000..bb512288 --- /dev/null +++ b/src/kio/schema/end_quorum_epoch/v1/response.py @@ -0,0 +1,73 @@ +""" +Generated from ``clients/src/main/resources/common/message/EndQuorumEpochResponse.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.schema.types import BrokerId +from kio.schema.types import TopicName +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import u16 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(54) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + partition_index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + leader_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The ID of the current leader or -1 if the leader is unknown.""" + leader_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The latest known leader epoch""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class TopicData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(54) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_name: TopicName = field(metadata={"kafka_type": "string"}) + """The topic name.""" + partitions: tuple[PartitionData, ...] + + +@dataclass(frozen=True, slots=True, kw_only=True) +class NodeEndpoint: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(54) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + node_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The ID of the associated node""" + host: str = field(metadata={"kafka_type": "string"}) + """The node's hostname""" + port: u16 = field(metadata={"kafka_type": "uint16"}) + """The node's port""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class EndQuorumEpochResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(54) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The top level error code.""" + topics: tuple[TopicData, ...] + node_endpoints: tuple[NodeEndpoint, ...] = field(metadata={"tag": 0}, default=()) + """Endpoints for all leaders enumerated in PartitionData""" diff --git a/src/kio/schema/errors.py b/src/kio/schema/errors.py index 50197887..b69feb2e 100644 --- a/src/kio/schema/errors.py +++ b/src/kio/schema/errors.py @@ -265,3 +265,17 @@ def __new__(cls, value: int, retriable: bool) -> ErrorCode: """The controller has considered the broker registration to be invalid.""" transaction_abortable = 120, False """The server encountered an error with the transaction. The client can abort the transaction to continue using this transactional ID.""" + invalid_record_state = 121, False + """The record state is invalid. The acknowledgement of delivery could not be completed.""" + share_session_not_found = 122, True + """The share session was not found.""" + invalid_share_session_epoch = 123, True + """The share session epoch is invalid.""" + fenced_state_epoch = 124, False + """The share coordinator rejected the request because the share-group state epoch did not match.""" + invalid_voter_key = 125, False + """The voter key doesn't match the receiving replica's key.""" + duplicate_voter = 126, False + """The voter is already part of the set of voters.""" + voter_not_found = 127, False + """The voter is not part of the set of voters.""" diff --git a/src/kio/schema/fetch/v17/__init__.py b/src/kio/schema/fetch/v17/__init__.py new file mode 100644 index 00000000..38ae8ba0 --- /dev/null +++ b/src/kio/schema/fetch/v17/__init__.py @@ -0,0 +1,7 @@ +from .request import FetchRequest +from .response import FetchResponse + +__all__ = ( + "FetchRequest", + "FetchResponse", +) diff --git a/src/kio/schema/fetch/v17/request.py b/src/kio/schema/fetch/v17/request.py new file mode 100644 index 00000000..c345acd6 --- /dev/null +++ b/src/kio/schema/fetch/v17/request.py @@ -0,0 +1,114 @@ +""" +Generated from ``clients/src/main/resources/common/message/FetchRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.schema.types import BrokerId +from kio.static.constants import EntityType +from kio.static.primitive import i8 +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i32Timedelta +from kio.static.primitive import i64 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ReplicaState: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(17) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(1) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + replica_id: BrokerId = field(metadata={"kafka_type": "int32"}, default=BrokerId(-1)) + """The replica ID of the follower, or -1 if this request is from a consumer.""" + replica_epoch: i64 = field(metadata={"kafka_type": "int64"}, default=i64(-1)) + """The epoch of this follower, or -1 if not available.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class FetchPartition: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(17) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(1) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + partition: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + current_leader_epoch: i32 = field(metadata={"kafka_type": "int32"}, default=i32(-1)) + """The current leader epoch of the partition.""" + fetch_offset: i64 = field(metadata={"kafka_type": "int64"}) + """The message offset.""" + last_fetched_epoch: i32 = field(metadata={"kafka_type": "int32"}, default=i32(-1)) + """The epoch of the last fetched record or -1 if there is none""" + log_start_offset: i64 = field(metadata={"kafka_type": "int64"}, default=i64(-1)) + """The earliest available offset of the follower replica. The field is only used when the request is sent by the follower.""" + partition_max_bytes: i32 = field(metadata={"kafka_type": "int32"}) + """The maximum bytes to fetch from this partition. See KIP-74 for cases where this limit may not be honored.""" + replica_directory_id: uuid.UUID | None = field( + metadata={"kafka_type": "uuid", "tag": 0}, default=None + ) + """The directory id of the follower fetching""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class FetchTopic: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(17) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(1) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The unique topic ID""" + partitions: tuple[FetchPartition, ...] + """The partitions to fetch.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ForgottenTopic: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(17) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(1) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The unique topic ID""" + partitions: tuple[i32, ...] = field(metadata={"kafka_type": "int32"}, default=()) + """The partitions indexes to forget.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class FetchRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(17) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(1) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + cluster_id: str | None = field( + metadata={"kafka_type": "string", "tag": 0}, default=None + ) + """The clusterId if known. This is used to validate metadata fetches prior to broker registration.""" + replica_state: ReplicaState = field(metadata={"tag": 1}, default=ReplicaState()) + max_wait: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """The maximum time in milliseconds to wait for the response.""" + min_bytes: i32 = field(metadata={"kafka_type": "int32"}) + """The minimum bytes to accumulate in the response.""" + max_bytes: i32 = field(metadata={"kafka_type": "int32"}, default=i32(2147483647)) + """The maximum bytes to fetch. See KIP-74 for cases where this limit may not be honored.""" + isolation_level: i8 = field(metadata={"kafka_type": "int8"}, default=i8(0)) + """This setting controls the visibility of transactional records. Using READ_UNCOMMITTED (isolation_level = 0) makes all records visible. With READ_COMMITTED (isolation_level = 1), non-transactional and COMMITTED transactional records are visible. To be more concrete, READ_COMMITTED returns all data from offsets smaller than the current LSO (last stable offset), and enables the inclusion of the list of aborted transactions in the result, which allows consumers to discard ABORTED transactional records""" + session_id: i32 = field(metadata={"kafka_type": "int32"}, default=i32(0)) + """The fetch session ID.""" + session_epoch: i32 = field(metadata={"kafka_type": "int32"}, default=i32(-1)) + """The fetch session epoch, which is used for ordering requests in a session.""" + topics: tuple[FetchTopic, ...] + """The topics to fetch.""" + forgotten_topics_data: tuple[ForgottenTopic, ...] + """In an incremental fetch request, the partitions to remove.""" + rack_id: str = field(metadata={"kafka_type": "string"}, default="") + """Rack ID of the consumer making this request""" diff --git a/src/kio/schema/fetch/v17/response.py b/src/kio/schema/fetch/v17/response.py new file mode 100644 index 00000000..b5923080 --- /dev/null +++ b/src/kio/schema/fetch/v17/response.py @@ -0,0 +1,153 @@ +""" +Generated from ``clients/src/main/resources/common/message/FetchResponse.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.schema.types import BrokerId +from kio.schema.types import ProducerId +from kio.static.constants import EntityType +from kio.static.primitive import Records +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i32Timedelta +from kio.static.primitive import i64 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class EpochEndOffset: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(17) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(1) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + epoch: i32 = field(metadata={"kafka_type": "int32"}, default=i32(-1)) + end_offset: i64 = field(metadata={"kafka_type": "int64"}, default=i64(-1)) + + +@dataclass(frozen=True, slots=True, kw_only=True) +class LeaderIdAndEpoch: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(17) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(1) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + leader_id: BrokerId = field(metadata={"kafka_type": "int32"}, default=BrokerId(-1)) + """The ID of the current leader or -1 if the leader is unknown.""" + leader_epoch: i32 = field(metadata={"kafka_type": "int32"}, default=i32(-1)) + """The latest known leader epoch""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class SnapshotId: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(17) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(1) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + end_offset: i64 = field(metadata={"kafka_type": "int64"}, default=i64(-1)) + epoch: i32 = field(metadata={"kafka_type": "int32"}, default=i32(-1)) + + +@dataclass(frozen=True, slots=True, kw_only=True) +class AbortedTransaction: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(17) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(1) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + producer_id: ProducerId = field(metadata={"kafka_type": "int64"}) + """The producer id associated with the aborted transaction.""" + first_offset: i64 = field(metadata={"kafka_type": "int64"}) + """The first offset in the aborted transaction.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(17) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(1) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + partition_index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The error code, or 0 if there was no fetch error.""" + high_watermark: i64 = field(metadata={"kafka_type": "int64"}) + """The current high water mark.""" + last_stable_offset: i64 = field(metadata={"kafka_type": "int64"}, default=i64(-1)) + """The last stable offset (or LSO) of the partition. This is the last offset such that the state of all transactional records prior to this offset have been decided (ABORTED or COMMITTED)""" + log_start_offset: i64 = field(metadata={"kafka_type": "int64"}, default=i64(-1)) + """The current log start offset.""" + diverging_epoch: EpochEndOffset = field( + metadata={"tag": 0}, default=EpochEndOffset() + ) + """In case divergence is detected based on the `LastFetchedEpoch` and `FetchOffset` in the request, this field indicates the largest epoch and its end offset such that subsequent records are known to diverge""" + current_leader: LeaderIdAndEpoch = field( + metadata={"tag": 1}, default=LeaderIdAndEpoch() + ) + snapshot_id: SnapshotId = field(metadata={"tag": 2}, default=SnapshotId()) + """In the case of fetching an offset less than the LogStartOffset, this is the end offset and epoch that should be used in the FetchSnapshot request.""" + aborted_transactions: tuple[AbortedTransaction, ...] | None + """The aborted transactions.""" + preferred_read_replica: BrokerId = field( + metadata={"kafka_type": "int32"}, default=BrokerId(-1) + ) + """The preferred read replica for the consumer to use on its next fetch request""" + records: Records | None = field(metadata={"kafka_type": "records"}) + """The record data.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class FetchableTopicResponse: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(17) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(1) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The unique topic ID""" + partitions: tuple[PartitionData, ...] + """The topic partitions.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class NodeEndpoint: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(17) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(1) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + node_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The ID of the associated node.""" + host: str = field(metadata={"kafka_type": "string"}) + """The node's hostname.""" + port: i32 = field(metadata={"kafka_type": "int32"}) + """The node's port.""" + rack: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The rack of the node, or null if it has not been assigned to a rack.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class FetchResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(17) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(1) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + throttle_time: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The top level response error code.""" + session_id: i32 = field(metadata={"kafka_type": "int32"}, default=i32(0)) + """The fetch session ID, or 0 if this is not part of a fetch session.""" + responses: tuple[FetchableTopicResponse, ...] + """The response topics.""" + node_endpoints: tuple[NodeEndpoint, ...] = field(metadata={"tag": 0}, default=()) + """Endpoints for all current-leaders enumerated in PartitionData, with errors NOT_LEADER_OR_FOLLOWER & FENCED_LEADER_EPOCH.""" diff --git a/src/kio/schema/fetch_snapshot/v1/__init__.py b/src/kio/schema/fetch_snapshot/v1/__init__.py new file mode 100644 index 00000000..c6a7e09a --- /dev/null +++ b/src/kio/schema/fetch_snapshot/v1/__init__.py @@ -0,0 +1,7 @@ +from .request import FetchSnapshotRequest +from .response import FetchSnapshotResponse + +__all__ = ( + "FetchSnapshotRequest", + "FetchSnapshotResponse", +) diff --git a/src/kio/schema/fetch_snapshot/v1/request.py b/src/kio/schema/fetch_snapshot/v1/request.py new file mode 100644 index 00000000..4ac54a1b --- /dev/null +++ b/src/kio/schema/fetch_snapshot/v1/request.py @@ -0,0 +1,81 @@ +""" +Generated from ``clients/src/main/resources/common/message/FetchSnapshotRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.schema.types import BrokerId +from kio.schema.types import TopicName +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i64 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class SnapshotId: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(59) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + end_offset: i64 = field(metadata={"kafka_type": "int64"}) + epoch: i32 = field(metadata={"kafka_type": "int32"}) + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionSnapshot: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(59) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + partition: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index""" + current_leader_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The current leader epoch of the partition, -1 for unknown leader epoch""" + snapshot_id: SnapshotId + """The snapshot endOffset and epoch to fetch""" + position: i64 = field(metadata={"kafka_type": "int64"}) + """The byte position within the snapshot to start fetching from""" + replica_directory_id: uuid.UUID | None = field( + metadata={"kafka_type": "uuid", "tag": 0}, default=None + ) + """The directory id of the follower fetching""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class TopicSnapshot: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(59) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + name: TopicName = field(metadata={"kafka_type": "string"}) + """The name of the topic to fetch""" + partitions: tuple[PartitionSnapshot, ...] + """The partitions to fetch""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class FetchSnapshotRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(59) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + cluster_id: str | None = field( + metadata={"kafka_type": "string", "tag": 0}, default=None + ) + """The clusterId if known, this is used to validate metadata fetches prior to broker registration""" + replica_id: BrokerId = field(metadata={"kafka_type": "int32"}, default=BrokerId(-1)) + """The broker ID of the follower""" + max_bytes: i32 = field(metadata={"kafka_type": "int32"}, default=i32(2147483647)) + """The maximum bytes to fetch from all of the snapshots""" + topics: tuple[TopicSnapshot, ...] + """The topics to fetch""" diff --git a/src/kio/schema/fetch_snapshot/v1/response.py b/src/kio/schema/fetch_snapshot/v1/response.py new file mode 100644 index 00000000..5550bd90 --- /dev/null +++ b/src/kio/schema/fetch_snapshot/v1/response.py @@ -0,0 +1,110 @@ +""" +Generated from ``clients/src/main/resources/common/message/FetchSnapshotResponse.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.schema.types import BrokerId +from kio.schema.types import TopicName +from kio.static.constants import EntityType +from kio.static.primitive import Records +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i32Timedelta +from kio.static.primitive import i64 +from kio.static.primitive import u16 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class SnapshotId: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(59) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + end_offset: i64 = field(metadata={"kafka_type": "int64"}) + epoch: i32 = field(metadata={"kafka_type": "int32"}) + + +@dataclass(frozen=True, slots=True, kw_only=True) +class LeaderIdAndEpoch: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(59) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + leader_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The ID of the current leader or -1 if the leader is unknown.""" + leader_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The latest known leader epoch""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionSnapshot: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(59) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The error code, or 0 if there was no fetch error.""" + snapshot_id: SnapshotId + """The snapshot endOffset and epoch fetched""" + current_leader: LeaderIdAndEpoch = field(metadata={"tag": 0}) + size: i64 = field(metadata={"kafka_type": "int64"}) + """The total size of the snapshot.""" + position: i64 = field(metadata={"kafka_type": "int64"}) + """The starting byte position within the snapshot included in the Bytes field.""" + unaligned_records: Records = field(metadata={"kafka_type": "records"}) + """Snapshot data in records format which may not be aligned on an offset boundary""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class TopicSnapshot: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(59) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + name: TopicName = field(metadata={"kafka_type": "string"}) + """The name of the topic to fetch.""" + partitions: tuple[PartitionSnapshot, ...] + """The partitions to fetch.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class NodeEndpoint: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(59) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + node_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The ID of the associated node""" + host: str = field(metadata={"kafka_type": "string"}) + """The node's hostname""" + port: u16 = field(metadata={"kafka_type": "uint16"}) + """The node's port""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class FetchSnapshotResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(59) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + throttle_time: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The top level response error code.""" + topics: tuple[TopicSnapshot, ...] + """The topics to fetch.""" + node_endpoints: tuple[NodeEndpoint, ...] = field(metadata={"tag": 0}, default=()) + """Endpoints for all current-leaders enumerated in PartitionSnapshot""" diff --git a/src/kio/schema/find_coordinator/v6/__init__.py b/src/kio/schema/find_coordinator/v6/__init__.py new file mode 100644 index 00000000..ecac31b6 --- /dev/null +++ b/src/kio/schema/find_coordinator/v6/__init__.py @@ -0,0 +1,7 @@ +from .request import FindCoordinatorRequest +from .response import FindCoordinatorResponse + +__all__ = ( + "FindCoordinatorRequest", + "FindCoordinatorResponse", +) diff --git a/src/kio/schema/find_coordinator/v6/request.py b/src/kio/schema/find_coordinator/v6/request.py new file mode 100644 index 00000000..dcb6593f --- /dev/null +++ b/src/kio/schema/find_coordinator/v6/request.py @@ -0,0 +1,27 @@ +""" +Generated from ``clients/src/main/resources/common/message/FindCoordinatorRequest.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.static.constants import EntityType +from kio.static.primitive import i8 +from kio.static.primitive import i16 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class FindCoordinatorRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(6) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(10) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + key_type: i8 = field(metadata={"kafka_type": "int8"}, default=i8(0)) + """The coordinator key type. (Group, transaction, etc.)""" + coordinator_keys: tuple[str, ...] = field( + metadata={"kafka_type": "string"}, default=() + ) + """The coordinator keys.""" diff --git a/src/kio/schema/find_coordinator/v6/response.py b/src/kio/schema/find_coordinator/v6/response.py new file mode 100644 index 00000000..49b02167 --- /dev/null +++ b/src/kio/schema/find_coordinator/v6/response.py @@ -0,0 +1,49 @@ +""" +Generated from ``clients/src/main/resources/common/message/FindCoordinatorResponse.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.schema.types import BrokerId +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i32Timedelta + + +@dataclass(frozen=True, slots=True, kw_only=True) +class Coordinator: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(6) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(10) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + key: str = field(metadata={"kafka_type": "string"}) + """The coordinator key.""" + node_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The node id.""" + host: str = field(metadata={"kafka_type": "string"}) + """The host name.""" + port: i32 = field(metadata={"kafka_type": "int32"}) + """The port.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The error code, or 0 if there was no error.""" + error_message: str | None = field(metadata={"kafka_type": "string"}) + """The error message, or null if there was no error.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class FindCoordinatorResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(6) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(10) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + throttle_time: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota.""" + coordinators: tuple[Coordinator, ...] + """Each coordinator result in the response""" diff --git a/src/kio/schema/index.py b/src/kio/schema/index.py index 2c84074c..43862d6c 100644 --- a/src/kio/schema/index.py +++ b/src/kio/schema/index.py @@ -101,6 +101,18 @@ 73: "assign_replicas_to_dirs", 74: "list_client_metrics_resources", 75: "describe_topic_partitions", + 76: "share_group_heartbeat", + 77: "share_group_describe", + 78: "share_fetch", + 79: "share_acknowledge", + 80: "add_raft_voter", + 81: "remove_raft_voter", + 82: "update_raft_voter", + 83: "initialize_share_group_state", + 84: "read_share_group_state", + 85: "write_share_group_state", + 86: "delete_share_group_state", + 87: "read_share_group_state_summary", } ) @@ -224,6 +236,20 @@ ), } ), + "add_raft_voter": MappingProxyType( + { + 0: MappingProxyType( + { + EntityType.request: ( + "kio.schema.add_raft_voter.v0.request:AddRaftVoterRequest" + ), + EntityType.response: ( + "kio.schema.add_raft_voter.v0.response:AddRaftVoterResponse" + ), + } + ), + } + ), "allocate_producer_ids": MappingProxyType( { 0: MappingProxyType( @@ -444,6 +470,16 @@ ), } ), + 4: MappingProxyType( + { + EntityType.request: ( + "kio.schema.api_versions.v4.request:ApiVersionsRequest" + ), + EntityType.response: ( + "kio.schema.api_versions.v4.response:ApiVersionsResponse" + ), + } + ), } ), "assign_replicas_to_dirs": MappingProxyType( @@ -472,6 +508,16 @@ ), } ), + 1: MappingProxyType( + { + EntityType.request: ( + "kio.schema.begin_quorum_epoch.v1.request:BeginQuorumEpochRequest" + ), + EntityType.response: ( + "kio.schema.begin_quorum_epoch.v1.response:BeginQuorumEpochResponse" + ), + } + ), } ), "broker_heartbeat": MappingProxyType( @@ -540,6 +586,16 @@ ), } ), + 4: MappingProxyType( + { + EntityType.request: ( + "kio.schema.broker_registration.v4.request:BrokerRegistrationRequest" + ), + EntityType.response: ( + "kio.schema.broker_registration.v4.response:BrokerRegistrationResponse" + ), + } + ), } ), "consumer_group_describe": MappingProxyType( @@ -1031,6 +1087,20 @@ ), } ), + "delete_share_group_state": MappingProxyType( + { + 0: MappingProxyType( + { + EntityType.request: ( + "kio.schema.delete_share_group_state.v0.request:DeleteShareGroupStateRequest" + ), + EntityType.response: ( + "kio.schema.delete_share_group_state.v0.response:DeleteShareGroupStateResponse" + ), + } + ), + } + ), "delete_topics": MappingProxyType( { 0: MappingProxyType( @@ -1449,6 +1519,16 @@ ), } ), + 2: MappingProxyType( + { + EntityType.request: ( + "kio.schema.describe_quorum.v2.request:DescribeQuorumRequest" + ), + EntityType.response: ( + "kio.schema.describe_quorum.v2.response:DescribeQuorumResponse" + ), + } + ), } ), "describe_topic_partitions": MappingProxyType( @@ -1539,6 +1619,16 @@ ), } ), + 1: MappingProxyType( + { + EntityType.request: ( + "kio.schema.end_quorum_epoch.v1.request:EndQuorumEpochRequest" + ), + EntityType.response: ( + "kio.schema.end_quorum_epoch.v1.response:EndQuorumEpochResponse" + ), + } + ), } ), "end_txn": MappingProxyType( @@ -1735,6 +1825,16 @@ ), } ), + 17: MappingProxyType( + { + EntityType.request: ( + "kio.schema.fetch.v17.request:FetchRequest" + ), + EntityType.response: ( + "kio.schema.fetch.v17.response:FetchResponse" + ), + } + ), 2: MappingProxyType( { EntityType.request: ( @@ -1829,6 +1929,16 @@ ), } ), + 1: MappingProxyType( + { + EntityType.request: ( + "kio.schema.fetch_snapshot.v1.request:FetchSnapshotRequest" + ), + EntityType.response: ( + "kio.schema.fetch_snapshot.v1.response:FetchSnapshotResponse" + ), + } + ), } ), "find_coordinator": MappingProxyType( @@ -1893,6 +2003,16 @@ ), } ), + 6: MappingProxyType( + { + EntityType.request: ( + "kio.schema.find_coordinator.v6.request:FindCoordinatorRequest" + ), + EntityType.response: ( + "kio.schema.find_coordinator.v6.response:FindCoordinatorResponse" + ), + } + ), } ), "get_telemetry_subscriptions": MappingProxyType( @@ -2051,6 +2171,20 @@ ), } ), + "initialize_share_group_state": MappingProxyType( + { + 0: MappingProxyType( + { + EntityType.request: ( + "kio.schema.initialize_share_group_state.v0.request:InitializeShareGroupStateRequest" + ), + EntityType.response: ( + "kio.schema.initialize_share_group_state.v0.response:InitializeShareGroupStateResponse" + ), + } + ), + } + ), "join_group": MappingProxyType( { 0: MappingProxyType( @@ -2259,6 +2393,13 @@ ), } ), + 1: MappingProxyType( + { + EntityType.data: ( + "kio.schema.leader_change_message.v1.data:LeaderChangeMessage" + ), + } + ), } ), "leave_group": MappingProxyType( @@ -2495,6 +2636,16 @@ ), } ), + 9: MappingProxyType( + { + EntityType.request: ( + "kio.schema.list_offsets.v9.request:ListOffsetsRequest" + ), + EntityType.response: ( + "kio.schema.list_offsets.v9.response:ListOffsetsResponse" + ), + } + ), } ), "list_partition_reassignments": MappingProxyType( @@ -3083,6 +3234,48 @@ ), } ), + "read_share_group_state": MappingProxyType( + { + 0: MappingProxyType( + { + EntityType.request: ( + "kio.schema.read_share_group_state.v0.request:ReadShareGroupStateRequest" + ), + EntityType.response: ( + "kio.schema.read_share_group_state.v0.response:ReadShareGroupStateResponse" + ), + } + ), + } + ), + "read_share_group_state_summary": MappingProxyType( + { + 0: MappingProxyType( + { + EntityType.request: ( + "kio.schema.read_share_group_state_summary.v0.request:ReadShareGroupStateSummaryRequest" + ), + EntityType.response: ( + "kio.schema.read_share_group_state_summary.v0.response:ReadShareGroupStateSummaryResponse" + ), + } + ), + } + ), + "remove_raft_voter": MappingProxyType( + { + 0: MappingProxyType( + { + EntityType.request: ( + "kio.schema.remove_raft_voter.v0.request:RemoveRaftVoterRequest" + ), + EntityType.response: ( + "kio.schema.remove_raft_voter.v0.response:RemoveRaftVoterResponse" + ), + } + ), + } + ), "renew_delegation_token": MappingProxyType( { 0: MappingProxyType( @@ -3218,6 +3411,62 @@ ), } ), + "share_acknowledge": MappingProxyType( + { + 0: MappingProxyType( + { + EntityType.request: ( + "kio.schema.share_acknowledge.v0.request:ShareAcknowledgeRequest" + ), + EntityType.response: ( + "kio.schema.share_acknowledge.v0.response:ShareAcknowledgeResponse" + ), + } + ), + } + ), + "share_fetch": MappingProxyType( + { + 0: MappingProxyType( + { + EntityType.request: ( + "kio.schema.share_fetch.v0.request:ShareFetchRequest" + ), + EntityType.response: ( + "kio.schema.share_fetch.v0.response:ShareFetchResponse" + ), + } + ), + } + ), + "share_group_describe": MappingProxyType( + { + 0: MappingProxyType( + { + EntityType.request: ( + "kio.schema.share_group_describe.v0.request:ShareGroupDescribeRequest" + ), + EntityType.response: ( + "kio.schema.share_group_describe.v0.response:ShareGroupDescribeResponse" + ), + } + ), + } + ), + "share_group_heartbeat": MappingProxyType( + { + 0: MappingProxyType( + { + EntityType.request: ( + "kio.schema.share_group_heartbeat.v0.request:ShareGroupHeartbeatRequest" + ), + EntityType.response: ( + "kio.schema.share_group_heartbeat.v0.response:ShareGroupHeartbeatResponse" + ), + } + ), + } + ), "snapshot_footer_record": MappingProxyType( { 0: MappingProxyType( @@ -3544,6 +3793,20 @@ ), } ), + "update_raft_voter": MappingProxyType( + { + 0: MappingProxyType( + { + EntityType.request: ( + "kio.schema.update_raft_voter.v0.request:UpdateRaftVoterRequest" + ), + EntityType.response: ( + "kio.schema.update_raft_voter.v0.response:UpdateRaftVoterResponse" + ), + } + ), + } + ), "vote": MappingProxyType( { 0: MappingProxyType( @@ -3554,6 +3817,14 @@ ), } ), + 1: MappingProxyType( + { + EntityType.request: ("kio.schema.vote.v1.request:VoteRequest"), + EntityType.response: ( + "kio.schema.vote.v1.response:VoteResponse" + ), + } + ), } ), "voters_record": MappingProxyType( @@ -3567,6 +3838,20 @@ ), } ), + "write_share_group_state": MappingProxyType( + { + 0: MappingProxyType( + { + EntityType.request: ( + "kio.schema.write_share_group_state.v0.request:WriteShareGroupStateRequest" + ), + EntityType.response: ( + "kio.schema.write_share_group_state.v0.response:WriteShareGroupStateResponse" + ), + } + ), + } + ), "write_txn_markers": MappingProxyType( { 0: MappingProxyType( diff --git a/src/kio/schema/initialize_share_group_state/__init__.py b/src/kio/schema/initialize_share_group_state/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/kio/schema/initialize_share_group_state/v0/__init__.py b/src/kio/schema/initialize_share_group_state/v0/__init__.py new file mode 100644 index 00000000..10c9a218 --- /dev/null +++ b/src/kio/schema/initialize_share_group_state/v0/__init__.py @@ -0,0 +1,7 @@ +from .request import InitializeShareGroupStateRequest +from .response import InitializeShareGroupStateResponse + +__all__ = ( + "InitializeShareGroupStateRequest", + "InitializeShareGroupStateResponse", +) diff --git a/src/kio/schema/initialize_share_group_state/v0/request.py b/src/kio/schema/initialize_share_group_state/v0/request.py new file mode 100644 index 00000000..77bba38e --- /dev/null +++ b/src/kio/schema/initialize_share_group_state/v0/request.py @@ -0,0 +1,56 @@ +""" +Generated from ``clients/src/main/resources/common/message/InitializeShareGroupStateRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i64 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(83) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + partition: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + state_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The state epoch for this share-partition.""" + start_offset: i64 = field(metadata={"kafka_type": "int64"}) + """The share-partition start offset, or -1 if the start offset is not being initialized.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class InitializeStateData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(83) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The topic identifier.""" + partitions: tuple[PartitionData, ...] + """The data for the partitions.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class InitializeShareGroupStateRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(83) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + group_id: str = field(metadata={"kafka_type": "string"}) + """The group identifier.""" + topics: tuple[InitializeStateData, ...] + """The data for the topics.""" diff --git a/src/kio/schema/initialize_share_group_state/v0/response.py b/src/kio/schema/initialize_share_group_state/v0/response.py new file mode 100644 index 00000000..ba8871db --- /dev/null +++ b/src/kio/schema/initialize_share_group_state/v0/response.py @@ -0,0 +1,54 @@ +""" +Generated from ``clients/src/main/resources/common/message/InitializeShareGroupStateResponse.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionResult: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(83) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + partition: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The error code, or 0 if there was no error.""" + error_message: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The error message, or null if there was no error.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class InitializeStateResult: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(83) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The topic identifier""" + partitions: tuple[PartitionResult, ...] + """The results for the partitions.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class InitializeShareGroupStateResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(83) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + results: tuple[InitializeStateResult, ...] + """The initialization results""" diff --git a/src/kio/schema/leader_change_message/v1/__init__.py b/src/kio/schema/leader_change_message/v1/__init__.py new file mode 100644 index 00000000..b560c2fb --- /dev/null +++ b/src/kio/schema/leader_change_message/v1/__init__.py @@ -0,0 +1,3 @@ +from .data import LeaderChangeMessage + +__all__ = ("LeaderChangeMessage",) diff --git a/src/kio/schema/leader_change_message/v1/data.py b/src/kio/schema/leader_change_message/v1/data.py new file mode 100644 index 00000000..6e5b20b9 --- /dev/null +++ b/src/kio/schema/leader_change_message/v1/data.py @@ -0,0 +1,39 @@ +""" +Generated from ``clients/src/main/resources/common/message/LeaderChangeMessage.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.types import BrokerId +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class Voter: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + voter_id: i32 = field(metadata={"kafka_type": "int32"}) + voter_directory_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The directory id of the voter""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class LeaderChangeMessage: + __type__: ClassVar = EntityType.data + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + version: i16 = field(metadata={"kafka_type": "int16"}) + """The version of the leader change message""" + leader_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The ID of the newly elected leader""" + voters: tuple[Voter, ...] + """The set of voters in the quorum for this epoch""" + granting_voters: tuple[Voter, ...] + """The voters who voted for the leader at the time of election""" diff --git a/src/kio/schema/list_offsets/v9/__init__.py b/src/kio/schema/list_offsets/v9/__init__.py new file mode 100644 index 00000000..03ae1dff --- /dev/null +++ b/src/kio/schema/list_offsets/v9/__init__.py @@ -0,0 +1,7 @@ +from .request import ListOffsetsRequest +from .response import ListOffsetsResponse + +__all__ = ( + "ListOffsetsRequest", + "ListOffsetsResponse", +) diff --git a/src/kio/schema/list_offsets/v9/request.py b/src/kio/schema/list_offsets/v9/request.py new file mode 100644 index 00000000..bb133fe3 --- /dev/null +++ b/src/kio/schema/list_offsets/v9/request.py @@ -0,0 +1,59 @@ +""" +Generated from ``clients/src/main/resources/common/message/ListOffsetsRequest.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.schema.types import BrokerId +from kio.schema.types import TopicName +from kio.static.constants import EntityType +from kio.static.primitive import i8 +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i64 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ListOffsetsPartition: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(9) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(2) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + partition_index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + current_leader_epoch: i32 = field(metadata={"kafka_type": "int32"}, default=i32(-1)) + """The current leader epoch.""" + timestamp: i64 = field(metadata={"kafka_type": "int64"}) + """The current timestamp.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ListOffsetsTopic: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(9) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(2) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + name: TopicName = field(metadata={"kafka_type": "string"}) + """The topic name.""" + partitions: tuple[ListOffsetsPartition, ...] + """Each partition in the request.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ListOffsetsRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(9) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(2) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + replica_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The broker ID of the requester, or -1 if this request is being made by a normal consumer.""" + isolation_level: i8 = field(metadata={"kafka_type": "int8"}) + """This setting controls the visibility of transactional records. Using READ_UNCOMMITTED (isolation_level = 0) makes all records visible. With READ_COMMITTED (isolation_level = 1), non-transactional and COMMITTED transactional records are visible. To be more concrete, READ_COMMITTED returns all data from offsets smaller than the current LSO (last stable offset), and enables the inclusion of the list of aborted transactions in the result, which allows consumers to discard ABORTED transactional records""" + topics: tuple[ListOffsetsTopic, ...] + """Each topic in the request.""" diff --git a/src/kio/schema/list_offsets/v9/response.py b/src/kio/schema/list_offsets/v9/response.py new file mode 100644 index 00000000..8e238bcc --- /dev/null +++ b/src/kio/schema/list_offsets/v9/response.py @@ -0,0 +1,60 @@ +""" +Generated from ``clients/src/main/resources/common/message/ListOffsetsResponse.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.schema.types import TopicName +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i32Timedelta +from kio.static.primitive import i64 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ListOffsetsPartitionResponse: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(9) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(2) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + partition_index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The partition error code, or 0 if there was no error.""" + timestamp: i64 = field(metadata={"kafka_type": "int64"}, default=i64(-1)) + """The timestamp associated with the returned offset.""" + offset: i64 = field(metadata={"kafka_type": "int64"}, default=i64(-1)) + """The returned offset.""" + leader_epoch: i32 = field(metadata={"kafka_type": "int32"}, default=i32(-1)) + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ListOffsetsTopicResponse: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(9) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(2) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + name: TopicName = field(metadata={"kafka_type": "string"}) + """The topic name""" + partitions: tuple[ListOffsetsPartitionResponse, ...] + """Each partition in the response.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ListOffsetsResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(9) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(2) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + throttle_time: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota.""" + topics: tuple[ListOffsetsTopicResponse, ...] + """Each topic in the response.""" diff --git a/src/kio/schema/read_share_group_state/__init__.py b/src/kio/schema/read_share_group_state/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/kio/schema/read_share_group_state/v0/__init__.py b/src/kio/schema/read_share_group_state/v0/__init__.py new file mode 100644 index 00000000..e46fac94 --- /dev/null +++ b/src/kio/schema/read_share_group_state/v0/__init__.py @@ -0,0 +1,7 @@ +from .request import ReadShareGroupStateRequest +from .response import ReadShareGroupStateResponse + +__all__ = ( + "ReadShareGroupStateRequest", + "ReadShareGroupStateResponse", +) diff --git a/src/kio/schema/read_share_group_state/v0/request.py b/src/kio/schema/read_share_group_state/v0/request.py new file mode 100644 index 00000000..ee16f95e --- /dev/null +++ b/src/kio/schema/read_share_group_state/v0/request.py @@ -0,0 +1,53 @@ +""" +Generated from ``clients/src/main/resources/common/message/ReadShareGroupStateRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(84) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + partition: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + leader_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The leader epoch of the share-partition.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ReadStateData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(84) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The topic identifier.""" + partitions: tuple[PartitionData, ...] + """The data for the partitions.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ReadShareGroupStateRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(84) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + group_id: str = field(metadata={"kafka_type": "string"}) + """The group identifier.""" + topics: tuple[ReadStateData, ...] + """The data for the topics.""" diff --git a/src/kio/schema/read_share_group_state/v0/response.py b/src/kio/schema/read_share_group_state/v0/response.py new file mode 100644 index 00000000..8adda5fd --- /dev/null +++ b/src/kio/schema/read_share_group_state/v0/response.py @@ -0,0 +1,78 @@ +""" +Generated from ``clients/src/main/resources/common/message/ReadShareGroupStateResponse.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.static.constants import EntityType +from kio.static.primitive import i8 +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i64 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class StateBatch: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(84) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + first_offset: i64 = field(metadata={"kafka_type": "int64"}) + """The base offset of this state batch.""" + last_offset: i64 = field(metadata={"kafka_type": "int64"}) + """The last offset of this state batch.""" + delivery_state: i8 = field(metadata={"kafka_type": "int8"}) + """The state - 0:Available,2:Acked,4:Archived.""" + delivery_count: i16 = field(metadata={"kafka_type": "int16"}) + """The delivery count.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionResult: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(84) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + partition: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The error code, or 0 if there was no error.""" + error_message: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The error message, or null if there was no error.""" + state_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The state epoch for this share-partition.""" + start_offset: i64 = field(metadata={"kafka_type": "int64"}) + """The share-partition start offset, which can be -1 if it is not yet initialized.""" + state_batches: tuple[StateBatch, ...] + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ReadStateResult: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(84) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The topic identifier""" + partitions: tuple[PartitionResult, ...] + """The results for the partitions.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ReadShareGroupStateResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(84) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + results: tuple[ReadStateResult, ...] + """The read results""" diff --git a/src/kio/schema/read_share_group_state_summary/__init__.py b/src/kio/schema/read_share_group_state_summary/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/kio/schema/read_share_group_state_summary/v0/__init__.py b/src/kio/schema/read_share_group_state_summary/v0/__init__.py new file mode 100644 index 00000000..8d0724de --- /dev/null +++ b/src/kio/schema/read_share_group_state_summary/v0/__init__.py @@ -0,0 +1,7 @@ +from .request import ReadShareGroupStateSummaryRequest +from .response import ReadShareGroupStateSummaryResponse + +__all__ = ( + "ReadShareGroupStateSummaryRequest", + "ReadShareGroupStateSummaryResponse", +) diff --git a/src/kio/schema/read_share_group_state_summary/v0/request.py b/src/kio/schema/read_share_group_state_summary/v0/request.py new file mode 100644 index 00000000..e8ef77da --- /dev/null +++ b/src/kio/schema/read_share_group_state_summary/v0/request.py @@ -0,0 +1,53 @@ +""" +Generated from ``clients/src/main/resources/common/message/ReadShareGroupStateSummaryRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(87) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + partition: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + leader_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The leader epoch of the share-partition.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ReadStateSummaryData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(87) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The topic identifier.""" + partitions: tuple[PartitionData, ...] + """The data for the partitions.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ReadShareGroupStateSummaryRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(87) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + group_id: str = field(metadata={"kafka_type": "string"}) + """The group identifier.""" + topics: tuple[ReadStateSummaryData, ...] + """The data for the topics.""" diff --git a/src/kio/schema/read_share_group_state_summary/v0/response.py b/src/kio/schema/read_share_group_state_summary/v0/response.py new file mode 100644 index 00000000..154b2434 --- /dev/null +++ b/src/kio/schema/read_share_group_state_summary/v0/response.py @@ -0,0 +1,59 @@ +""" +Generated from ``clients/src/main/resources/common/message/ReadShareGroupStateSummaryResponse.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i64 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionResult: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(87) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + partition: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The error code, or 0 if there was no error.""" + error_message: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The error message, or null if there was no error.""" + state_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The state epoch of the share-partition.""" + start_offset: i64 = field(metadata={"kafka_type": "int64"}) + """The share-partition start offset.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ReadStateSummaryResult: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(87) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The topic identifier""" + partitions: tuple[PartitionResult, ...] + """The results for the partitions.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ReadShareGroupStateSummaryResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(87) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + results: tuple[ReadStateSummaryResult, ...] + """The read results""" diff --git a/src/kio/schema/remove_raft_voter/__init__.py b/src/kio/schema/remove_raft_voter/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/kio/schema/remove_raft_voter/v0/__init__.py b/src/kio/schema/remove_raft_voter/v0/__init__.py new file mode 100644 index 00000000..73972298 --- /dev/null +++ b/src/kio/schema/remove_raft_voter/v0/__init__.py @@ -0,0 +1,7 @@ +from .request import RemoveRaftVoterRequest +from .response import RemoveRaftVoterResponse + +__all__ = ( + "RemoveRaftVoterRequest", + "RemoveRaftVoterResponse", +) diff --git a/src/kio/schema/remove_raft_voter/v0/request.py b/src/kio/schema/remove_raft_voter/v0/request.py new file mode 100644 index 00000000..06ba9de2 --- /dev/null +++ b/src/kio/schema/remove_raft_voter/v0/request.py @@ -0,0 +1,28 @@ +""" +Generated from ``clients/src/main/resources/common/message/RemoveRaftVoterRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class RemoveRaftVoterRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(81) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + cluster_id: str | None = field(metadata={"kafka_type": "string"}) + voter_id: i32 = field(metadata={"kafka_type": "int32"}) + """The replica id of the voter getting removed from the topic partition""" + voter_directory_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The directory id of the voter getting removed from the topic partition""" diff --git a/src/kio/schema/remove_raft_voter/v0/response.py b/src/kio/schema/remove_raft_voter/v0/response.py new file mode 100644 index 00000000..bee47f46 --- /dev/null +++ b/src/kio/schema/remove_raft_voter/v0/response.py @@ -0,0 +1,28 @@ +""" +Generated from ``clients/src/main/resources/common/message/RemoveRaftVoterResponse.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32Timedelta + + +@dataclass(frozen=True, slots=True, kw_only=True) +class RemoveRaftVoterResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(81) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + throttle_time: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The error code, or 0 if there was no error""" + error_message: str | None = field(metadata={"kafka_type": "string"}) + """The error message, or null if there was no error.""" diff --git a/src/kio/schema/share_acknowledge/__init__.py b/src/kio/schema/share_acknowledge/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/kio/schema/share_acknowledge/v0/__init__.py b/src/kio/schema/share_acknowledge/v0/__init__.py new file mode 100644 index 00000000..ae8d5670 --- /dev/null +++ b/src/kio/schema/share_acknowledge/v0/__init__.py @@ -0,0 +1,7 @@ +from .request import ShareAcknowledgeRequest +from .response import ShareAcknowledgeResponse + +__all__ = ( + "ShareAcknowledgeRequest", + "ShareAcknowledgeResponse", +) diff --git a/src/kio/schema/share_acknowledge/v0/request.py b/src/kio/schema/share_acknowledge/v0/request.py new file mode 100644 index 00000000..2cf3ac8b --- /dev/null +++ b/src/kio/schema/share_acknowledge/v0/request.py @@ -0,0 +1,77 @@ +""" +Generated from ``clients/src/main/resources/common/message/ShareAcknowledgeRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.schema.types import GroupId +from kio.static.constants import EntityType +from kio.static.primitive import i8 +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i64 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class AcknowledgementBatch: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(79) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + first_offset: i64 = field(metadata={"kafka_type": "int64"}) + """First offset of batch of records to acknowledge.""" + last_offset: i64 = field(metadata={"kafka_type": "int64"}) + """Last offset (inclusive) of batch of records to acknowledge.""" + acknowledge_types: tuple[i8, ...] = field( + metadata={"kafka_type": "int8"}, default=() + ) + """Array of acknowledge types - 0:Gap,1:Accept,2:Release,3:Reject.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class AcknowledgePartition: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(79) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + partition_index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + acknowledgement_batches: tuple[AcknowledgementBatch, ...] + """Record batches to acknowledge.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class AcknowledgeTopic: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(79) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The unique topic ID.""" + partitions: tuple[AcknowledgePartition, ...] + """The partitions containing records to acknowledge.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ShareAcknowledgeRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(79) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + group_id: GroupId | None = field(metadata={"kafka_type": "string"}, default=None) + """The group identifier.""" + member_id: str | None = field(metadata={"kafka_type": "string"}) + """The member ID.""" + share_session_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The current share session epoch: 0 to open a share session; -1 to close it; otherwise increments for consecutive requests.""" + topics: tuple[AcknowledgeTopic, ...] + """The topics containing records to acknowledge.""" diff --git a/src/kio/schema/share_acknowledge/v0/response.py b/src/kio/schema/share_acknowledge/v0/response.py new file mode 100644 index 00000000..14da4204 --- /dev/null +++ b/src/kio/schema/share_acknowledge/v0/response.py @@ -0,0 +1,95 @@ +""" +Generated from ``clients/src/main/resources/common/message/ShareAcknowledgeResponse.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.schema.types import BrokerId +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i32Timedelta + + +@dataclass(frozen=True, slots=True, kw_only=True) +class LeaderIdAndEpoch: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(79) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + leader_id: i32 = field(metadata={"kafka_type": "int32"}) + """The ID of the current leader or -1 if the leader is unknown.""" + leader_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The latest known leader epoch.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(79) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + partition_index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The error code, or 0 if there was no error.""" + error_message: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The error message, or null if there was no error.""" + current_leader: LeaderIdAndEpoch + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ShareAcknowledgeTopicResponse: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(79) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The unique topic ID.""" + partitions: tuple[PartitionData, ...] + """The topic partitions.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class NodeEndpoint: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(79) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + node_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The ID of the associated node.""" + host: str = field(metadata={"kafka_type": "string"}) + """The node's hostname.""" + port: i32 = field(metadata={"kafka_type": "int32"}) + """The node's port.""" + rack: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The rack of the node, or null if it has not been assigned to a rack.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ShareAcknowledgeResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(79) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + throttle_time: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The top level response error code.""" + error_message: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The top-level error message, or null if there was no error.""" + responses: tuple[ShareAcknowledgeTopicResponse, ...] + """The response topics.""" + node_endpoints: tuple[NodeEndpoint, ...] + """Endpoints for all current leaders enumerated in PartitionData with error NOT_LEADER_OR_FOLLOWER.""" diff --git a/src/kio/schema/share_fetch/__init__.py b/src/kio/schema/share_fetch/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/kio/schema/share_fetch/v0/__init__.py b/src/kio/schema/share_fetch/v0/__init__.py new file mode 100644 index 00000000..e69852a1 --- /dev/null +++ b/src/kio/schema/share_fetch/v0/__init__.py @@ -0,0 +1,7 @@ +from .request import ShareFetchRequest +from .response import ShareFetchResponse + +__all__ = ( + "ShareFetchRequest", + "ShareFetchResponse", +) diff --git a/src/kio/schema/share_fetch/v0/request.py b/src/kio/schema/share_fetch/v0/request.py new file mode 100644 index 00000000..1bba0ad3 --- /dev/null +++ b/src/kio/schema/share_fetch/v0/request.py @@ -0,0 +1,101 @@ +""" +Generated from ``clients/src/main/resources/common/message/ShareFetchRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.schema.types import GroupId +from kio.static.constants import EntityType +from kio.static.primitive import i8 +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i32Timedelta +from kio.static.primitive import i64 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class AcknowledgementBatch: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(78) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + first_offset: i64 = field(metadata={"kafka_type": "int64"}) + """First offset of batch of records to acknowledge.""" + last_offset: i64 = field(metadata={"kafka_type": "int64"}) + """Last offset (inclusive) of batch of records to acknowledge.""" + acknowledge_types: tuple[i8, ...] = field( + metadata={"kafka_type": "int8"}, default=() + ) + """Array of acknowledge types - 0:Gap,1:Accept,2:Release,3:Reject.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class FetchPartition: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(78) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + partition_index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + partition_max_bytes: i32 = field(metadata={"kafka_type": "int32"}) + """The maximum bytes to fetch from this partition. 0 when only acknowledgement with no fetching is required. See KIP-74 for cases where this limit may not be honored.""" + acknowledgement_batches: tuple[AcknowledgementBatch, ...] + """Record batches to acknowledge.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class FetchTopic: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(78) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The unique topic ID.""" + partitions: tuple[FetchPartition, ...] + """The partitions to fetch.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ForgottenTopic: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(78) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The unique topic ID.""" + partitions: tuple[i32, ...] = field(metadata={"kafka_type": "int32"}, default=()) + """The partitions indexes to forget.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ShareFetchRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(78) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + group_id: GroupId | None = field(metadata={"kafka_type": "string"}, default=None) + """The group identifier.""" + member_id: str | None = field(metadata={"kafka_type": "string"}) + """The member ID.""" + share_session_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The current share session epoch: 0 to open a share session; -1 to close it; otherwise increments for consecutive requests.""" + max_wait: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """The maximum time in milliseconds to wait for the response.""" + min_bytes: i32 = field(metadata={"kafka_type": "int32"}) + """The minimum bytes to accumulate in the response.""" + max_bytes: i32 = field(metadata={"kafka_type": "int32"}, default=i32(2147483647)) + """The maximum bytes to fetch. See KIP-74 for cases where this limit may not be honored.""" + topics: tuple[FetchTopic, ...] + """The topics to fetch.""" + forgotten_topics_data: tuple[ForgottenTopic, ...] + """The partitions to remove from this share session.""" diff --git a/src/kio/schema/share_fetch/v0/response.py b/src/kio/schema/share_fetch/v0/response.py new file mode 100644 index 00000000..4f468918 --- /dev/null +++ b/src/kio/schema/share_fetch/v0/response.py @@ -0,0 +1,122 @@ +""" +Generated from ``clients/src/main/resources/common/message/ShareFetchResponse.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.schema.types import BrokerId +from kio.static.constants import EntityType +from kio.static.primitive import Records +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i32Timedelta +from kio.static.primitive import i64 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class LeaderIdAndEpoch: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(78) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + leader_id: i32 = field(metadata={"kafka_type": "int32"}) + """The ID of the current leader or -1 if the leader is unknown.""" + leader_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The latest known leader epoch.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class AcquiredRecords: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(78) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + first_offset: i64 = field(metadata={"kafka_type": "int64"}) + """The earliest offset in this batch of acquired records.""" + last_offset: i64 = field(metadata={"kafka_type": "int64"}) + """The last offset of this batch of acquired records.""" + delivery_count: i16 = field(metadata={"kafka_type": "int16"}) + """The delivery count of this batch of acquired records.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(78) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + partition_index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The fetch error code, or 0 if there was no fetch error.""" + error_message: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The fetch error message, or null if there was no fetch error.""" + acknowledge_error_code: i16 = field(metadata={"kafka_type": "int16"}) + """The acknowledge error code, or 0 if there was no acknowledge error.""" + acknowledge_error_message: str | None = field( + metadata={"kafka_type": "string"}, default=None + ) + """The acknowledge error message, or null if there was no acknowledge error.""" + current_leader: LeaderIdAndEpoch + records: Records | None = field(metadata={"kafka_type": "records"}) + """The record data.""" + acquired_records: tuple[AcquiredRecords, ...] + """The acquired records.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ShareFetchableTopicResponse: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(78) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The unique topic ID.""" + partitions: tuple[PartitionData, ...] + """The topic partitions.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class NodeEndpoint: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(78) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + node_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The ID of the associated node.""" + host: str = field(metadata={"kafka_type": "string"}) + """The node's hostname.""" + port: i32 = field(metadata={"kafka_type": "int32"}) + """The node's port.""" + rack: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The rack of the node, or null if it has not been assigned to a rack.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ShareFetchResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(78) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + throttle_time: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The top-level response error code.""" + error_message: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The top-level error message, or null if there was no error.""" + responses: tuple[ShareFetchableTopicResponse, ...] + """The response topics.""" + node_endpoints: tuple[NodeEndpoint, ...] + """Endpoints for all current leaders enumerated in PartitionData with error NOT_LEADER_OR_FOLLOWER.""" diff --git a/src/kio/schema/share_group_describe/__init__.py b/src/kio/schema/share_group_describe/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/kio/schema/share_group_describe/v0/__init__.py b/src/kio/schema/share_group_describe/v0/__init__.py new file mode 100644 index 00000000..b96c7f6e --- /dev/null +++ b/src/kio/schema/share_group_describe/v0/__init__.py @@ -0,0 +1,7 @@ +from .request import ShareGroupDescribeRequest +from .response import ShareGroupDescribeResponse + +__all__ = ( + "ShareGroupDescribeRequest", + "ShareGroupDescribeResponse", +) diff --git a/src/kio/schema/share_group_describe/v0/request.py b/src/kio/schema/share_group_describe/v0/request.py new file mode 100644 index 00000000..f1691790 --- /dev/null +++ b/src/kio/schema/share_group_describe/v0/request.py @@ -0,0 +1,27 @@ +""" +Generated from ``clients/src/main/resources/common/message/ShareGroupDescribeRequest.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.schema.types import GroupId +from kio.static.constants import EntityType +from kio.static.primitive import i16 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ShareGroupDescribeRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(77) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + group_ids: tuple[GroupId, ...] = field( + metadata={"kafka_type": "string"}, default=() + ) + """The ids of the groups to describe""" + include_authorized_operations: bool = field(metadata={"kafka_type": "bool"}) + """Whether to include authorized operations.""" diff --git a/src/kio/schema/share_group_describe/v0/response.py b/src/kio/schema/share_group_describe/v0/response.py new file mode 100644 index 00000000..541e8c37 --- /dev/null +++ b/src/kio/schema/share_group_describe/v0/response.py @@ -0,0 +1,111 @@ +""" +Generated from ``clients/src/main/resources/common/message/ShareGroupDescribeResponse.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.schema.types import GroupId +from kio.schema.types import TopicName +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i32Timedelta + + +@dataclass(frozen=True, slots=True, kw_only=True) +class TopicPartitions: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(77) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The topic ID.""" + topic_name: TopicName = field(metadata={"kafka_type": "string"}) + """The topic name.""" + partitions: tuple[i32, ...] = field(metadata={"kafka_type": "int32"}, default=()) + """The partitions.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class Assignment: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(77) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_partitions: tuple[TopicPartitions, ...] + """The assigned topic-partitions to the member.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class Member: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(77) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + member_id: str = field(metadata={"kafka_type": "string"}) + """The member ID.""" + rack_id: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The member rack ID.""" + member_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The current member epoch.""" + client_id: str = field(metadata={"kafka_type": "string"}) + """The client ID.""" + client_host: str = field(metadata={"kafka_type": "string"}) + """The client host.""" + subscribed_topic_names: tuple[TopicName, ...] = field( + metadata={"kafka_type": "string"}, default=() + ) + """The subscribed topic names.""" + assignment: Assignment + """The current assignment.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class DescribedGroup: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(77) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The describe error, or 0 if there was no error.""" + error_message: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The top-level error message, or null if there was no error.""" + group_id: GroupId = field(metadata={"kafka_type": "string"}) + """The group ID string.""" + group_state: str = field(metadata={"kafka_type": "string"}) + """The group state string, or the empty string.""" + group_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The group epoch.""" + assignment_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The assignment epoch.""" + assignor_name: str = field(metadata={"kafka_type": "string"}) + """The selected assignor.""" + members: tuple[Member, ...] + """The members.""" + authorized_operations: i32 = field( + metadata={"kafka_type": "int32"}, default=i32(-2147483648) + ) + """32-bit bitfield to represent authorized operations for this group.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ShareGroupDescribeResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(77) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + throttle_time: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota.""" + groups: tuple[DescribedGroup, ...] + """Each described group.""" diff --git a/src/kio/schema/share_group_heartbeat/__init__.py b/src/kio/schema/share_group_heartbeat/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/kio/schema/share_group_heartbeat/v0/__init__.py b/src/kio/schema/share_group_heartbeat/v0/__init__.py new file mode 100644 index 00000000..d1e8c5b9 --- /dev/null +++ b/src/kio/schema/share_group_heartbeat/v0/__init__.py @@ -0,0 +1,7 @@ +from .request import ShareGroupHeartbeatRequest +from .response import ShareGroupHeartbeatResponse + +__all__ = ( + "ShareGroupHeartbeatRequest", + "ShareGroupHeartbeatResponse", +) diff --git a/src/kio/schema/share_group_heartbeat/v0/request.py b/src/kio/schema/share_group_heartbeat/v0/request.py new file mode 100644 index 00000000..a9f63f43 --- /dev/null +++ b/src/kio/schema/share_group_heartbeat/v0/request.py @@ -0,0 +1,34 @@ +""" +Generated from ``clients/src/main/resources/common/message/ShareGroupHeartbeatRequest.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.schema.types import GroupId +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ShareGroupHeartbeatRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(76) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + group_id: GroupId = field(metadata={"kafka_type": "string"}) + """The group identifier.""" + member_id: str = field(metadata={"kafka_type": "string"}) + """The member ID generated by the coordinator. The member ID must be kept during the entire lifetime of the member.""" + member_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The current member epoch; 0 to join the group; -1 to leave the group.""" + rack_id: str | None = field(metadata={"kafka_type": "string"}, default=None) + """null if not provided or if it didn't change since the last heartbeat; the rack ID of consumer otherwise.""" + subscribed_topic_names: tuple[str, ...] = field( + metadata={"kafka_type": "string"}, default=() + ) + """null if it didn't change since the last heartbeat; the subscribed topic names otherwise.""" diff --git a/src/kio/schema/share_group_heartbeat/v0/response.py b/src/kio/schema/share_group_heartbeat/v0/response.py new file mode 100644 index 00000000..33af72d2 --- /dev/null +++ b/src/kio/schema/share_group_heartbeat/v0/response.py @@ -0,0 +1,63 @@ +""" +Generated from ``clients/src/main/resources/common/message/ShareGroupHeartbeatResponse.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i32Timedelta + + +@dataclass(frozen=True, slots=True, kw_only=True) +class TopicPartitions: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(76) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The topic ID.""" + partitions: tuple[i32, ...] = field(metadata={"kafka_type": "int32"}, default=()) + """The partitions.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class Assignment: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(76) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_partitions: tuple[TopicPartitions, ...] + """The partitions assigned to the member.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class ShareGroupHeartbeatResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(76) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + throttle_time: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The top-level error code, or 0 if there was no error""" + error_message: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The top-level error message, or null if there was no error.""" + member_id: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The member ID generated by the coordinator. Only provided when the member joins with MemberEpoch == 0.""" + member_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The member epoch.""" + heartbeat_interval: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """The heartbeat interval in milliseconds.""" + assignment: Assignment | None = field(default=None) + """null if not provided; the assignment otherwise.""" diff --git a/src/kio/schema/update_raft_voter/__init__.py b/src/kio/schema/update_raft_voter/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/kio/schema/update_raft_voter/v0/__init__.py b/src/kio/schema/update_raft_voter/v0/__init__.py new file mode 100644 index 00000000..83324d71 --- /dev/null +++ b/src/kio/schema/update_raft_voter/v0/__init__.py @@ -0,0 +1,7 @@ +from .request import UpdateRaftVoterRequest +from .response import UpdateRaftVoterResponse + +__all__ = ( + "UpdateRaftVoterRequest", + "UpdateRaftVoterResponse", +) diff --git a/src/kio/schema/update_raft_voter/v0/request.py b/src/kio/schema/update_raft_voter/v0/request.py new file mode 100644 index 00000000..a032c20e --- /dev/null +++ b/src/kio/schema/update_raft_voter/v0/request.py @@ -0,0 +1,63 @@ +""" +Generated from ``clients/src/main/resources/common/message/UpdateRaftVoterRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import u16 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class Listener: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(82) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + name: str = field(metadata={"kafka_type": "string"}) + """The name of the endpoint""" + host: str = field(metadata={"kafka_type": "string"}) + """The hostname""" + port: u16 = field(metadata={"kafka_type": "uint16"}) + """The port""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class KRaftVersionFeature: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(82) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + min_supported_version: i16 = field(metadata={"kafka_type": "int16"}) + """The minimum supported KRaft protocol version""" + max_supported_version: i16 = field(metadata={"kafka_type": "int16"}) + """The maximum supported KRaft protocol version""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class UpdateRaftVoterRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(82) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + cluster_id: str | None = field(metadata={"kafka_type": "string"}) + current_leader_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The current leader epoch of the partition, -1 for unknown leader epoch""" + voter_id: i32 = field(metadata={"kafka_type": "int32"}) + """The replica id of the voter getting updated in the topic partition""" + voter_directory_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The directory id of the voter getting updated in the topic partition""" + listeners: tuple[Listener, ...] + """The endpoint that can be used to communicate with the leader""" + k_raft_version_feature: KRaftVersionFeature + """The range of versions of the protocol that the replica supports""" diff --git a/src/kio/schema/update_raft_voter/v0/response.py b/src/kio/schema/update_raft_voter/v0/response.py new file mode 100644 index 00000000..336a1ce4 --- /dev/null +++ b/src/kio/schema/update_raft_voter/v0/response.py @@ -0,0 +1,46 @@ +""" +Generated from ``clients/src/main/resources/common/message/UpdateRaftVoterResponse.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.schema.types import BrokerId +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i32Timedelta + + +@dataclass(frozen=True, slots=True, kw_only=True) +class CurrentLeader: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(82) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + leader_id: BrokerId = field(metadata={"kafka_type": "int32"}, default=BrokerId(-1)) + """The replica id of the current leader or -1 if the leader is unknown""" + leader_epoch: i32 = field(metadata={"kafka_type": "int32"}, default=i32(-1)) + """The latest known leader epoch""" + host: str = field(metadata={"kafka_type": "string"}) + """The node's hostname""" + port: i32 = field(metadata={"kafka_type": "int32"}) + """The node's port""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class UpdateRaftVoterResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(82) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + throttle_time: i32Timedelta = field(metadata={"kafka_type": "timedelta_i32"}) + """The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The error code, or 0 if there was no error""" + current_leader: CurrentLeader = field(metadata={"tag": 0}) diff --git a/src/kio/schema/vote/v0/request.py b/src/kio/schema/vote/v0/request.py index a514edbf..abf7f494 100644 --- a/src/kio/schema/vote/v0/request.py +++ b/src/kio/schema/vote/v0/request.py @@ -27,7 +27,7 @@ class PartitionData: candidate_epoch: i32 = field(metadata={"kafka_type": "int32"}) """The bumped epoch of the candidate sending the request""" candidate_id: BrokerId = field(metadata={"kafka_type": "int32"}) - """The ID of the voter sending the request""" + """The replica id of the voter sending the request""" last_offset_epoch: i32 = field(metadata={"kafka_type": "int32"}) """The epoch of the last record written to the metadata log""" last_offset: i64 = field(metadata={"kafka_type": "int64"}) diff --git a/src/kio/schema/vote/v1/__init__.py b/src/kio/schema/vote/v1/__init__.py new file mode 100644 index 00000000..068c87f6 --- /dev/null +++ b/src/kio/schema/vote/v1/__init__.py @@ -0,0 +1,7 @@ +from .request import VoteRequest +from .response import VoteResponse + +__all__ = ( + "VoteRequest", + "VoteResponse", +) diff --git a/src/kio/schema/vote/v1/request.py b/src/kio/schema/vote/v1/request.py new file mode 100644 index 00000000..1d988506 --- /dev/null +++ b/src/kio/schema/vote/v1/request.py @@ -0,0 +1,65 @@ +""" +Generated from ``clients/src/main/resources/common/message/VoteRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.schema.types import BrokerId +from kio.schema.types import TopicName +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i64 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(52) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + partition_index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + candidate_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The bumped epoch of the candidate sending the request""" + candidate_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The replica id of the voter sending the request""" + candidate_directory_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The directory id of the voter sending the request""" + voter_directory_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The ID of the voter sending the request""" + last_offset_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The epoch of the last record written to the metadata log""" + last_offset: i64 = field(metadata={"kafka_type": "int64"}) + """The offset of the last record written to the metadata log""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class TopicData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(52) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + topic_name: TopicName = field(metadata={"kafka_type": "string"}) + """The topic name.""" + partitions: tuple[PartitionData, ...] + + +@dataclass(frozen=True, slots=True, kw_only=True) +class VoteRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(52) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + cluster_id: str | None = field(metadata={"kafka_type": "string"}, default=None) + voter_id: BrokerId = field(metadata={"kafka_type": "int32"}, default=BrokerId(-1)) + """The replica id of the voter receiving the request""" + topics: tuple[TopicData, ...] diff --git a/src/kio/schema/vote/v1/response.py b/src/kio/schema/vote/v1/response.py new file mode 100644 index 00000000..91157560 --- /dev/null +++ b/src/kio/schema/vote/v1/response.py @@ -0,0 +1,75 @@ +""" +Generated from ``clients/src/main/resources/common/message/VoteResponse.json``. +""" + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.schema.types import BrokerId +from kio.schema.types import TopicName +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import u16 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(52) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + partition_index: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + leader_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The ID of the current leader or -1 if the leader is unknown.""" + leader_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The latest known leader epoch""" + vote_granted: bool = field(metadata={"kafka_type": "bool"}) + """True if the vote was granted and false otherwise""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class TopicData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(52) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_name: TopicName = field(metadata={"kafka_type": "string"}) + """The topic name.""" + partitions: tuple[PartitionData, ...] + + +@dataclass(frozen=True, slots=True, kw_only=True) +class NodeEndpoint: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(52) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + node_id: BrokerId = field(metadata={"kafka_type": "int32"}) + """The ID of the associated node""" + host: str = field(metadata={"kafka_type": "string"}) + """The node's hostname""" + port: u16 = field(metadata={"kafka_type": "uint16"}) + """The node's port""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class VoteResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(1) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(52) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The top level error code.""" + topics: tuple[TopicData, ...] + node_endpoints: tuple[NodeEndpoint, ...] = field(metadata={"tag": 0}, default=()) + """Endpoints for all current-leaders enumerated in PartitionData""" diff --git a/src/kio/schema/write_share_group_state/__init__.py b/src/kio/schema/write_share_group_state/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/kio/schema/write_share_group_state/v0/__init__.py b/src/kio/schema/write_share_group_state/v0/__init__.py new file mode 100644 index 00000000..524674c0 --- /dev/null +++ b/src/kio/schema/write_share_group_state/v0/__init__.py @@ -0,0 +1,7 @@ +from .request import WriteShareGroupStateRequest +from .response import WriteShareGroupStateResponse + +__all__ = ( + "WriteShareGroupStateRequest", + "WriteShareGroupStateResponse", +) diff --git a/src/kio/schema/write_share_group_state/v0/request.py b/src/kio/schema/write_share_group_state/v0/request.py new file mode 100644 index 00000000..8890e631 --- /dev/null +++ b/src/kio/schema/write_share_group_state/v0/request.py @@ -0,0 +1,77 @@ +""" +Generated from ``clients/src/main/resources/common/message/WriteShareGroupStateRequest.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.request_header.v2.header import RequestHeader +from kio.static.constants import EntityType +from kio.static.primitive import i8 +from kio.static.primitive import i16 +from kio.static.primitive import i32 +from kio.static.primitive import i64 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class StateBatch: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(85) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + first_offset: i64 = field(metadata={"kafka_type": "int64"}) + """The base offset of this state batch.""" + last_offset: i64 = field(metadata={"kafka_type": "int64"}) + """The last offset of this state batch.""" + delivery_state: i8 = field(metadata={"kafka_type": "int8"}) + """The state - 0:Available,2:Acked,4:Archived""" + delivery_count: i16 = field(metadata={"kafka_type": "int16"}) + """The delivery count.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(85) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + partition: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + state_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The state epoch for this share-partition.""" + leader_epoch: i32 = field(metadata={"kafka_type": "int32"}) + """The leader epoch of the share-partition.""" + start_offset: i64 = field(metadata={"kafka_type": "int64"}) + """The share-partition start offset, or -1 if the start offset is not being written.""" + state_batches: tuple[StateBatch, ...] + + +@dataclass(frozen=True, slots=True, kw_only=True) +class WriteStateData: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(85) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The topic identifier.""" + partitions: tuple[PartitionData, ...] + """The data for the partitions.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class WriteShareGroupStateRequest: + __type__: ClassVar = EntityType.request + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(85) + __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader + group_id: str = field(metadata={"kafka_type": "string"}) + """The group identifier.""" + topics: tuple[WriteStateData, ...] + """The data for the topics.""" diff --git a/src/kio/schema/write_share_group_state/v0/response.py b/src/kio/schema/write_share_group_state/v0/response.py new file mode 100644 index 00000000..099ccf66 --- /dev/null +++ b/src/kio/schema/write_share_group_state/v0/response.py @@ -0,0 +1,54 @@ +""" +Generated from ``clients/src/main/resources/common/message/WriteShareGroupStateResponse.json``. +""" + +import uuid + +from dataclasses import dataclass +from dataclasses import field +from typing import ClassVar + +from kio.schema.errors import ErrorCode +from kio.schema.response_header.v1.header import ResponseHeader +from kio.static.constants import EntityType +from kio.static.primitive import i16 +from kio.static.primitive import i32 + + +@dataclass(frozen=True, slots=True, kw_only=True) +class PartitionResult: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(85) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + partition: i32 = field(metadata={"kafka_type": "int32"}) + """The partition index.""" + error_code: ErrorCode = field(metadata={"kafka_type": "error_code"}) + """The error code, or 0 if there was no error.""" + error_message: str | None = field(metadata={"kafka_type": "string"}, default=None) + """The error message, or null if there was no error.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class WriteStateResult: + __type__: ClassVar = EntityType.nested + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(85) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + topic_id: uuid.UUID | None = field(metadata={"kafka_type": "uuid"}) + """The topic identifier""" + partitions: tuple[PartitionResult, ...] + """The results for the partitions.""" + + +@dataclass(frozen=True, slots=True, kw_only=True) +class WriteShareGroupStateResponse: + __type__: ClassVar = EntityType.response + __version__: ClassVar[i16] = i16(0) + __flexible__: ClassVar[bool] = True + __api_key__: ClassVar[i16] = i16(85) + __header_schema__: ClassVar[type[ResponseHeader]] = ResponseHeader + results: tuple[WriteStateResult, ...] + """The write results""" diff --git a/tests/generated/test_add_raft_voter_v0_request.py b/tests/generated/test_add_raft_voter_v0_request.py new file mode 100644 index 00000000..43537dd2 --- /dev/null +++ b/tests/generated/test_add_raft_voter_v0_request.py @@ -0,0 +1,50 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.add_raft_voter.v0.request import AddRaftVoterRequest +from kio.schema.add_raft_voter.v0.request import Listener +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_listener: Final = entity_reader(Listener) + + +@pytest.mark.roundtrip +@given(from_type(Listener)) +def test_listener_roundtrip(instance: Listener) -> None: + writer = entity_writer(Listener) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_listener(buffer) + assert instance == result + + +read_add_raft_voter_request: Final = entity_reader(AddRaftVoterRequest) + + +@pytest.mark.roundtrip +@given(from_type(AddRaftVoterRequest)) +def test_add_raft_voter_request_roundtrip(instance: AddRaftVoterRequest) -> None: + writer = entity_writer(AddRaftVoterRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_add_raft_voter_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(AddRaftVoterRequest)) +def test_add_raft_voter_request_java( + instance: AddRaftVoterRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_add_raft_voter_v0_response.py b/tests/generated/test_add_raft_voter_v0_response.py new file mode 100644 index 00000000..0c593466 --- /dev/null +++ b/tests/generated/test_add_raft_voter_v0_response.py @@ -0,0 +1,35 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.add_raft_voter.v0.response import AddRaftVoterResponse +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_add_raft_voter_response: Final = entity_reader(AddRaftVoterResponse) + + +@pytest.mark.roundtrip +@given(from_type(AddRaftVoterResponse)) +def test_add_raft_voter_response_roundtrip(instance: AddRaftVoterResponse) -> None: + writer = entity_writer(AddRaftVoterResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_add_raft_voter_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(AddRaftVoterResponse)) +def test_add_raft_voter_response_java( + instance: AddRaftVoterResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_api_versions_v4_request.py b/tests/generated/test_api_versions_v4_request.py new file mode 100644 index 00000000..3befde91 --- /dev/null +++ b/tests/generated/test_api_versions_v4_request.py @@ -0,0 +1,35 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.api_versions.v4.request import ApiVersionsRequest +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_api_versions_request: Final = entity_reader(ApiVersionsRequest) + + +@pytest.mark.roundtrip +@given(from_type(ApiVersionsRequest)) +def test_api_versions_request_roundtrip(instance: ApiVersionsRequest) -> None: + writer = entity_writer(ApiVersionsRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_api_versions_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ApiVersionsRequest)) +def test_api_versions_request_java( + instance: ApiVersionsRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_api_versions_v4_response.py b/tests/generated/test_api_versions_v4_response.py new file mode 100644 index 00000000..468f3c94 --- /dev/null +++ b/tests/generated/test_api_versions_v4_response.py @@ -0,0 +1,80 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.api_versions.v4.response import ApiVersion +from kio.schema.api_versions.v4.response import ApiVersionsResponse +from kio.schema.api_versions.v4.response import FinalizedFeatureKey +from kio.schema.api_versions.v4.response import SupportedFeatureKey +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_api_version: Final = entity_reader(ApiVersion) + + +@pytest.mark.roundtrip +@given(from_type(ApiVersion)) +def test_api_version_roundtrip(instance: ApiVersion) -> None: + writer = entity_writer(ApiVersion) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_api_version(buffer) + assert instance == result + + +read_supported_feature_key: Final = entity_reader(SupportedFeatureKey) + + +@pytest.mark.roundtrip +@given(from_type(SupportedFeatureKey)) +def test_supported_feature_key_roundtrip(instance: SupportedFeatureKey) -> None: + writer = entity_writer(SupportedFeatureKey) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_supported_feature_key(buffer) + assert instance == result + + +read_finalized_feature_key: Final = entity_reader(FinalizedFeatureKey) + + +@pytest.mark.roundtrip +@given(from_type(FinalizedFeatureKey)) +def test_finalized_feature_key_roundtrip(instance: FinalizedFeatureKey) -> None: + writer = entity_writer(FinalizedFeatureKey) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_finalized_feature_key(buffer) + assert instance == result + + +read_api_versions_response: Final = entity_reader(ApiVersionsResponse) + + +@pytest.mark.roundtrip +@given(from_type(ApiVersionsResponse)) +def test_api_versions_response_roundtrip(instance: ApiVersionsResponse) -> None: + writer = entity_writer(ApiVersionsResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_api_versions_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ApiVersionsResponse)) +def test_api_versions_response_java( + instance: ApiVersionsResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_begin_quorum_epoch_v1_request.py b/tests/generated/test_begin_quorum_epoch_v1_request.py new file mode 100644 index 00000000..b5520ed7 --- /dev/null +++ b/tests/generated/test_begin_quorum_epoch_v1_request.py @@ -0,0 +1,82 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.begin_quorum_epoch.v1.request import BeginQuorumEpochRequest +from kio.schema.begin_quorum_epoch.v1.request import LeaderEndpoint +from kio.schema.begin_quorum_epoch.v1.request import PartitionData +from kio.schema.begin_quorum_epoch.v1.request import TopicData +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_topic_data: Final = entity_reader(TopicData) + + +@pytest.mark.roundtrip +@given(from_type(TopicData)) +def test_topic_data_roundtrip(instance: TopicData) -> None: + writer = entity_writer(TopicData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_topic_data(buffer) + assert instance == result + + +read_leader_endpoint: Final = entity_reader(LeaderEndpoint) + + +@pytest.mark.roundtrip +@given(from_type(LeaderEndpoint)) +def test_leader_endpoint_roundtrip(instance: LeaderEndpoint) -> None: + writer = entity_writer(LeaderEndpoint) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_leader_endpoint(buffer) + assert instance == result + + +read_begin_quorum_epoch_request: Final = entity_reader(BeginQuorumEpochRequest) + + +@pytest.mark.roundtrip +@given(from_type(BeginQuorumEpochRequest)) +def test_begin_quorum_epoch_request_roundtrip( + instance: BeginQuorumEpochRequest, +) -> None: + writer = entity_writer(BeginQuorumEpochRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_begin_quorum_epoch_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(BeginQuorumEpochRequest)) +def test_begin_quorum_epoch_request_java( + instance: BeginQuorumEpochRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_begin_quorum_epoch_v1_response.py b/tests/generated/test_begin_quorum_epoch_v1_response.py new file mode 100644 index 00000000..28a2ad9a --- /dev/null +++ b/tests/generated/test_begin_quorum_epoch_v1_response.py @@ -0,0 +1,82 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.begin_quorum_epoch.v1.response import BeginQuorumEpochResponse +from kio.schema.begin_quorum_epoch.v1.response import NodeEndpoint +from kio.schema.begin_quorum_epoch.v1.response import PartitionData +from kio.schema.begin_quorum_epoch.v1.response import TopicData +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_topic_data: Final = entity_reader(TopicData) + + +@pytest.mark.roundtrip +@given(from_type(TopicData)) +def test_topic_data_roundtrip(instance: TopicData) -> None: + writer = entity_writer(TopicData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_topic_data(buffer) + assert instance == result + + +read_node_endpoint: Final = entity_reader(NodeEndpoint) + + +@pytest.mark.roundtrip +@given(from_type(NodeEndpoint)) +def test_node_endpoint_roundtrip(instance: NodeEndpoint) -> None: + writer = entity_writer(NodeEndpoint) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_node_endpoint(buffer) + assert instance == result + + +read_begin_quorum_epoch_response: Final = entity_reader(BeginQuorumEpochResponse) + + +@pytest.mark.roundtrip +@given(from_type(BeginQuorumEpochResponse)) +def test_begin_quorum_epoch_response_roundtrip( + instance: BeginQuorumEpochResponse, +) -> None: + writer = entity_writer(BeginQuorumEpochResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_begin_quorum_epoch_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(BeginQuorumEpochResponse)) +def test_begin_quorum_epoch_response_java( + instance: BeginQuorumEpochResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_broker_registration_v4_request.py b/tests/generated/test_broker_registration_v4_request.py new file mode 100644 index 00000000..938bdef1 --- /dev/null +++ b/tests/generated/test_broker_registration_v4_request.py @@ -0,0 +1,67 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.broker_registration.v4.request import BrokerRegistrationRequest +from kio.schema.broker_registration.v4.request import Feature +from kio.schema.broker_registration.v4.request import Listener +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_listener: Final = entity_reader(Listener) + + +@pytest.mark.roundtrip +@given(from_type(Listener)) +def test_listener_roundtrip(instance: Listener) -> None: + writer = entity_writer(Listener) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_listener(buffer) + assert instance == result + + +read_feature: Final = entity_reader(Feature) + + +@pytest.mark.roundtrip +@given(from_type(Feature)) +def test_feature_roundtrip(instance: Feature) -> None: + writer = entity_writer(Feature) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_feature(buffer) + assert instance == result + + +read_broker_registration_request: Final = entity_reader(BrokerRegistrationRequest) + + +@pytest.mark.roundtrip +@given(from_type(BrokerRegistrationRequest)) +def test_broker_registration_request_roundtrip( + instance: BrokerRegistrationRequest, +) -> None: + writer = entity_writer(BrokerRegistrationRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_broker_registration_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(BrokerRegistrationRequest)) +def test_broker_registration_request_java( + instance: BrokerRegistrationRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_broker_registration_v4_response.py b/tests/generated/test_broker_registration_v4_response.py new file mode 100644 index 00000000..b902483e --- /dev/null +++ b/tests/generated/test_broker_registration_v4_response.py @@ -0,0 +1,37 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.broker_registration.v4.response import BrokerRegistrationResponse +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_broker_registration_response: Final = entity_reader(BrokerRegistrationResponse) + + +@pytest.mark.roundtrip +@given(from_type(BrokerRegistrationResponse)) +def test_broker_registration_response_roundtrip( + instance: BrokerRegistrationResponse, +) -> None: + writer = entity_writer(BrokerRegistrationResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_broker_registration_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(BrokerRegistrationResponse)) +def test_broker_registration_response_java( + instance: BrokerRegistrationResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_create_topics_v0_request.py b/tests/generated/test_create_topics_v0_request.py index fbbfc5af..8eabffd0 100644 --- a/tests/generated/test_create_topics_v0_request.py +++ b/tests/generated/test_create_topics_v0_request.py @@ -9,7 +9,7 @@ from kio.schema.create_topics.v0.request import CreatableReplicaAssignment from kio.schema.create_topics.v0.request import CreatableTopic -from kio.schema.create_topics.v0.request import CreateableTopicConfig +from kio.schema.create_topics.v0.request import CreatableTopicConfig from kio.schema.create_topics.v0.request import CreateTopicsRequest from kio.serial import entity_reader from kio.serial import entity_writer @@ -32,17 +32,17 @@ def test_creatable_replica_assignment_roundtrip( assert instance == result -read_createable_topic_config: Final = entity_reader(CreateableTopicConfig) +read_creatable_topic_config: Final = entity_reader(CreatableTopicConfig) @pytest.mark.roundtrip -@given(from_type(CreateableTopicConfig)) -def test_createable_topic_config_roundtrip(instance: CreateableTopicConfig) -> None: - writer = entity_writer(CreateableTopicConfig) +@given(from_type(CreatableTopicConfig)) +def test_creatable_topic_config_roundtrip(instance: CreatableTopicConfig) -> None: + writer = entity_writer(CreatableTopicConfig) with setup_buffer() as buffer: writer(buffer, instance) buffer.seek(0) - result = read_createable_topic_config(buffer) + result = read_creatable_topic_config(buffer) assert instance == result diff --git a/tests/generated/test_create_topics_v1_request.py b/tests/generated/test_create_topics_v1_request.py index a0f287e3..e5eacb22 100644 --- a/tests/generated/test_create_topics_v1_request.py +++ b/tests/generated/test_create_topics_v1_request.py @@ -9,7 +9,7 @@ from kio.schema.create_topics.v1.request import CreatableReplicaAssignment from kio.schema.create_topics.v1.request import CreatableTopic -from kio.schema.create_topics.v1.request import CreateableTopicConfig +from kio.schema.create_topics.v1.request import CreatableTopicConfig from kio.schema.create_topics.v1.request import CreateTopicsRequest from kio.serial import entity_reader from kio.serial import entity_writer @@ -32,17 +32,17 @@ def test_creatable_replica_assignment_roundtrip( assert instance == result -read_createable_topic_config: Final = entity_reader(CreateableTopicConfig) +read_creatable_topic_config: Final = entity_reader(CreatableTopicConfig) @pytest.mark.roundtrip -@given(from_type(CreateableTopicConfig)) -def test_createable_topic_config_roundtrip(instance: CreateableTopicConfig) -> None: - writer = entity_writer(CreateableTopicConfig) +@given(from_type(CreatableTopicConfig)) +def test_creatable_topic_config_roundtrip(instance: CreatableTopicConfig) -> None: + writer = entity_writer(CreatableTopicConfig) with setup_buffer() as buffer: writer(buffer, instance) buffer.seek(0) - result = read_createable_topic_config(buffer) + result = read_creatable_topic_config(buffer) assert instance == result diff --git a/tests/generated/test_create_topics_v2_request.py b/tests/generated/test_create_topics_v2_request.py index 0be8d304..76236505 100644 --- a/tests/generated/test_create_topics_v2_request.py +++ b/tests/generated/test_create_topics_v2_request.py @@ -9,7 +9,7 @@ from kio.schema.create_topics.v2.request import CreatableReplicaAssignment from kio.schema.create_topics.v2.request import CreatableTopic -from kio.schema.create_topics.v2.request import CreateableTopicConfig +from kio.schema.create_topics.v2.request import CreatableTopicConfig from kio.schema.create_topics.v2.request import CreateTopicsRequest from kio.serial import entity_reader from kio.serial import entity_writer @@ -32,17 +32,17 @@ def test_creatable_replica_assignment_roundtrip( assert instance == result -read_createable_topic_config: Final = entity_reader(CreateableTopicConfig) +read_creatable_topic_config: Final = entity_reader(CreatableTopicConfig) @pytest.mark.roundtrip -@given(from_type(CreateableTopicConfig)) -def test_createable_topic_config_roundtrip(instance: CreateableTopicConfig) -> None: - writer = entity_writer(CreateableTopicConfig) +@given(from_type(CreatableTopicConfig)) +def test_creatable_topic_config_roundtrip(instance: CreatableTopicConfig) -> None: + writer = entity_writer(CreatableTopicConfig) with setup_buffer() as buffer: writer(buffer, instance) buffer.seek(0) - result = read_createable_topic_config(buffer) + result = read_creatable_topic_config(buffer) assert instance == result diff --git a/tests/generated/test_create_topics_v3_request.py b/tests/generated/test_create_topics_v3_request.py index 2be54e79..2ffd2133 100644 --- a/tests/generated/test_create_topics_v3_request.py +++ b/tests/generated/test_create_topics_v3_request.py @@ -9,7 +9,7 @@ from kio.schema.create_topics.v3.request import CreatableReplicaAssignment from kio.schema.create_topics.v3.request import CreatableTopic -from kio.schema.create_topics.v3.request import CreateableTopicConfig +from kio.schema.create_topics.v3.request import CreatableTopicConfig from kio.schema.create_topics.v3.request import CreateTopicsRequest from kio.serial import entity_reader from kio.serial import entity_writer @@ -32,17 +32,17 @@ def test_creatable_replica_assignment_roundtrip( assert instance == result -read_createable_topic_config: Final = entity_reader(CreateableTopicConfig) +read_creatable_topic_config: Final = entity_reader(CreatableTopicConfig) @pytest.mark.roundtrip -@given(from_type(CreateableTopicConfig)) -def test_createable_topic_config_roundtrip(instance: CreateableTopicConfig) -> None: - writer = entity_writer(CreateableTopicConfig) +@given(from_type(CreatableTopicConfig)) +def test_creatable_topic_config_roundtrip(instance: CreatableTopicConfig) -> None: + writer = entity_writer(CreatableTopicConfig) with setup_buffer() as buffer: writer(buffer, instance) buffer.seek(0) - result = read_createable_topic_config(buffer) + result = read_creatable_topic_config(buffer) assert instance == result diff --git a/tests/generated/test_create_topics_v4_request.py b/tests/generated/test_create_topics_v4_request.py index 664e7748..5ad42246 100644 --- a/tests/generated/test_create_topics_v4_request.py +++ b/tests/generated/test_create_topics_v4_request.py @@ -9,7 +9,7 @@ from kio.schema.create_topics.v4.request import CreatableReplicaAssignment from kio.schema.create_topics.v4.request import CreatableTopic -from kio.schema.create_topics.v4.request import CreateableTopicConfig +from kio.schema.create_topics.v4.request import CreatableTopicConfig from kio.schema.create_topics.v4.request import CreateTopicsRequest from kio.serial import entity_reader from kio.serial import entity_writer @@ -32,17 +32,17 @@ def test_creatable_replica_assignment_roundtrip( assert instance == result -read_createable_topic_config: Final = entity_reader(CreateableTopicConfig) +read_creatable_topic_config: Final = entity_reader(CreatableTopicConfig) @pytest.mark.roundtrip -@given(from_type(CreateableTopicConfig)) -def test_createable_topic_config_roundtrip(instance: CreateableTopicConfig) -> None: - writer = entity_writer(CreateableTopicConfig) +@given(from_type(CreatableTopicConfig)) +def test_creatable_topic_config_roundtrip(instance: CreatableTopicConfig) -> None: + writer = entity_writer(CreatableTopicConfig) with setup_buffer() as buffer: writer(buffer, instance) buffer.seek(0) - result = read_createable_topic_config(buffer) + result = read_creatable_topic_config(buffer) assert instance == result diff --git a/tests/generated/test_create_topics_v5_request.py b/tests/generated/test_create_topics_v5_request.py index 0d594210..2c82368b 100644 --- a/tests/generated/test_create_topics_v5_request.py +++ b/tests/generated/test_create_topics_v5_request.py @@ -9,7 +9,7 @@ from kio.schema.create_topics.v5.request import CreatableReplicaAssignment from kio.schema.create_topics.v5.request import CreatableTopic -from kio.schema.create_topics.v5.request import CreateableTopicConfig +from kio.schema.create_topics.v5.request import CreatableTopicConfig from kio.schema.create_topics.v5.request import CreateTopicsRequest from kio.serial import entity_reader from kio.serial import entity_writer @@ -32,17 +32,17 @@ def test_creatable_replica_assignment_roundtrip( assert instance == result -read_createable_topic_config: Final = entity_reader(CreateableTopicConfig) +read_creatable_topic_config: Final = entity_reader(CreatableTopicConfig) @pytest.mark.roundtrip -@given(from_type(CreateableTopicConfig)) -def test_createable_topic_config_roundtrip(instance: CreateableTopicConfig) -> None: - writer = entity_writer(CreateableTopicConfig) +@given(from_type(CreatableTopicConfig)) +def test_creatable_topic_config_roundtrip(instance: CreatableTopicConfig) -> None: + writer = entity_writer(CreatableTopicConfig) with setup_buffer() as buffer: writer(buffer, instance) buffer.seek(0) - result = read_createable_topic_config(buffer) + result = read_creatable_topic_config(buffer) assert instance == result diff --git a/tests/generated/test_create_topics_v6_request.py b/tests/generated/test_create_topics_v6_request.py index 711c8367..9d195e79 100644 --- a/tests/generated/test_create_topics_v6_request.py +++ b/tests/generated/test_create_topics_v6_request.py @@ -9,7 +9,7 @@ from kio.schema.create_topics.v6.request import CreatableReplicaAssignment from kio.schema.create_topics.v6.request import CreatableTopic -from kio.schema.create_topics.v6.request import CreateableTopicConfig +from kio.schema.create_topics.v6.request import CreatableTopicConfig from kio.schema.create_topics.v6.request import CreateTopicsRequest from kio.serial import entity_reader from kio.serial import entity_writer @@ -32,17 +32,17 @@ def test_creatable_replica_assignment_roundtrip( assert instance == result -read_createable_topic_config: Final = entity_reader(CreateableTopicConfig) +read_creatable_topic_config: Final = entity_reader(CreatableTopicConfig) @pytest.mark.roundtrip -@given(from_type(CreateableTopicConfig)) -def test_createable_topic_config_roundtrip(instance: CreateableTopicConfig) -> None: - writer = entity_writer(CreateableTopicConfig) +@given(from_type(CreatableTopicConfig)) +def test_creatable_topic_config_roundtrip(instance: CreatableTopicConfig) -> None: + writer = entity_writer(CreatableTopicConfig) with setup_buffer() as buffer: writer(buffer, instance) buffer.seek(0) - result = read_createable_topic_config(buffer) + result = read_creatable_topic_config(buffer) assert instance == result diff --git a/tests/generated/test_create_topics_v7_request.py b/tests/generated/test_create_topics_v7_request.py index 0f5b7ef9..d1501159 100644 --- a/tests/generated/test_create_topics_v7_request.py +++ b/tests/generated/test_create_topics_v7_request.py @@ -9,7 +9,7 @@ from kio.schema.create_topics.v7.request import CreatableReplicaAssignment from kio.schema.create_topics.v7.request import CreatableTopic -from kio.schema.create_topics.v7.request import CreateableTopicConfig +from kio.schema.create_topics.v7.request import CreatableTopicConfig from kio.schema.create_topics.v7.request import CreateTopicsRequest from kio.serial import entity_reader from kio.serial import entity_writer @@ -32,17 +32,17 @@ def test_creatable_replica_assignment_roundtrip( assert instance == result -read_createable_topic_config: Final = entity_reader(CreateableTopicConfig) +read_creatable_topic_config: Final = entity_reader(CreatableTopicConfig) @pytest.mark.roundtrip -@given(from_type(CreateableTopicConfig)) -def test_createable_topic_config_roundtrip(instance: CreateableTopicConfig) -> None: - writer = entity_writer(CreateableTopicConfig) +@given(from_type(CreatableTopicConfig)) +def test_creatable_topic_config_roundtrip(instance: CreatableTopicConfig) -> None: + writer = entity_writer(CreatableTopicConfig) with setup_buffer() as buffer: writer(buffer, instance) buffer.seek(0) - result = read_createable_topic_config(buffer) + result = read_creatable_topic_config(buffer) assert instance == result diff --git a/tests/generated/test_delete_share_group_state_v0_request.py b/tests/generated/test_delete_share_group_state_v0_request.py new file mode 100644 index 00000000..219be7bd --- /dev/null +++ b/tests/generated/test_delete_share_group_state_v0_request.py @@ -0,0 +1,69 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.delete_share_group_state.v0.request import DeleteShareGroupStateRequest +from kio.schema.delete_share_group_state.v0.request import DeleteStateData +from kio.schema.delete_share_group_state.v0.request import PartitionData +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_delete_state_data: Final = entity_reader(DeleteStateData) + + +@pytest.mark.roundtrip +@given(from_type(DeleteStateData)) +def test_delete_state_data_roundtrip(instance: DeleteStateData) -> None: + writer = entity_writer(DeleteStateData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_delete_state_data(buffer) + assert instance == result + + +read_delete_share_group_state_request: Final = entity_reader( + DeleteShareGroupStateRequest +) + + +@pytest.mark.roundtrip +@given(from_type(DeleteShareGroupStateRequest)) +def test_delete_share_group_state_request_roundtrip( + instance: DeleteShareGroupStateRequest, +) -> None: + writer = entity_writer(DeleteShareGroupStateRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_delete_share_group_state_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(DeleteShareGroupStateRequest)) +def test_delete_share_group_state_request_java( + instance: DeleteShareGroupStateRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_delete_share_group_state_v0_response.py b/tests/generated/test_delete_share_group_state_v0_response.py new file mode 100644 index 00000000..2a4f0454 --- /dev/null +++ b/tests/generated/test_delete_share_group_state_v0_response.py @@ -0,0 +1,71 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.delete_share_group_state.v0.response import ( + DeleteShareGroupStateResponse, +) +from kio.schema.delete_share_group_state.v0.response import DeleteStateResult +from kio.schema.delete_share_group_state.v0.response import PartitionResult +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_partition_result: Final = entity_reader(PartitionResult) + + +@pytest.mark.roundtrip +@given(from_type(PartitionResult)) +def test_partition_result_roundtrip(instance: PartitionResult) -> None: + writer = entity_writer(PartitionResult) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_result(buffer) + assert instance == result + + +read_delete_state_result: Final = entity_reader(DeleteStateResult) + + +@pytest.mark.roundtrip +@given(from_type(DeleteStateResult)) +def test_delete_state_result_roundtrip(instance: DeleteStateResult) -> None: + writer = entity_writer(DeleteStateResult) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_delete_state_result(buffer) + assert instance == result + + +read_delete_share_group_state_response: Final = entity_reader( + DeleteShareGroupStateResponse +) + + +@pytest.mark.roundtrip +@given(from_type(DeleteShareGroupStateResponse)) +def test_delete_share_group_state_response_roundtrip( + instance: DeleteShareGroupStateResponse, +) -> None: + writer = entity_writer(DeleteShareGroupStateResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_delete_share_group_state_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(DeleteShareGroupStateResponse)) +def test_delete_share_group_state_response_java( + instance: DeleteShareGroupStateResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_describe_quorum_v2_request.py b/tests/generated/test_describe_quorum_v2_request.py new file mode 100644 index 00000000..51100028 --- /dev/null +++ b/tests/generated/test_describe_quorum_v2_request.py @@ -0,0 +1,65 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.describe_quorum.v2.request import DescribeQuorumRequest +from kio.schema.describe_quorum.v2.request import PartitionData +from kio.schema.describe_quorum.v2.request import TopicData +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_topic_data: Final = entity_reader(TopicData) + + +@pytest.mark.roundtrip +@given(from_type(TopicData)) +def test_topic_data_roundtrip(instance: TopicData) -> None: + writer = entity_writer(TopicData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_topic_data(buffer) + assert instance == result + + +read_describe_quorum_request: Final = entity_reader(DescribeQuorumRequest) + + +@pytest.mark.roundtrip +@given(from_type(DescribeQuorumRequest)) +def test_describe_quorum_request_roundtrip(instance: DescribeQuorumRequest) -> None: + writer = entity_writer(DescribeQuorumRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_describe_quorum_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(DescribeQuorumRequest)) +def test_describe_quorum_request_java( + instance: DescribeQuorumRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_describe_quorum_v2_response.py b/tests/generated/test_describe_quorum_v2_response.py new file mode 100644 index 00000000..fbb0f07c --- /dev/null +++ b/tests/generated/test_describe_quorum_v2_response.py @@ -0,0 +1,110 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.describe_quorum.v2.response import DescribeQuorumResponse +from kio.schema.describe_quorum.v2.response import Listener +from kio.schema.describe_quorum.v2.response import Node +from kio.schema.describe_quorum.v2.response import PartitionData +from kio.schema.describe_quorum.v2.response import ReplicaState +from kio.schema.describe_quorum.v2.response import TopicData +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_replica_state: Final = entity_reader(ReplicaState) + + +@pytest.mark.roundtrip +@given(from_type(ReplicaState)) +def test_replica_state_roundtrip(instance: ReplicaState) -> None: + writer = entity_writer(ReplicaState) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_replica_state(buffer) + assert instance == result + + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_topic_data: Final = entity_reader(TopicData) + + +@pytest.mark.roundtrip +@given(from_type(TopicData)) +def test_topic_data_roundtrip(instance: TopicData) -> None: + writer = entity_writer(TopicData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_topic_data(buffer) + assert instance == result + + +read_listener: Final = entity_reader(Listener) + + +@pytest.mark.roundtrip +@given(from_type(Listener)) +def test_listener_roundtrip(instance: Listener) -> None: + writer = entity_writer(Listener) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_listener(buffer) + assert instance == result + + +read_node: Final = entity_reader(Node) + + +@pytest.mark.roundtrip +@given(from_type(Node)) +def test_node_roundtrip(instance: Node) -> None: + writer = entity_writer(Node) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_node(buffer) + assert instance == result + + +read_describe_quorum_response: Final = entity_reader(DescribeQuorumResponse) + + +@pytest.mark.roundtrip +@given(from_type(DescribeQuorumResponse)) +def test_describe_quorum_response_roundtrip(instance: DescribeQuorumResponse) -> None: + writer = entity_writer(DescribeQuorumResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_describe_quorum_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(DescribeQuorumResponse)) +def test_describe_quorum_response_java( + instance: DescribeQuorumResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_end_quorum_epoch_v1_request.py b/tests/generated/test_end_quorum_epoch_v1_request.py new file mode 100644 index 00000000..53077f00 --- /dev/null +++ b/tests/generated/test_end_quorum_epoch_v1_request.py @@ -0,0 +1,95 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.end_quorum_epoch.v1.request import EndQuorumEpochRequest +from kio.schema.end_quorum_epoch.v1.request import LeaderEndpoint +from kio.schema.end_quorum_epoch.v1.request import PartitionData +from kio.schema.end_quorum_epoch.v1.request import ReplicaInfo +from kio.schema.end_quorum_epoch.v1.request import TopicData +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_replica_info: Final = entity_reader(ReplicaInfo) + + +@pytest.mark.roundtrip +@given(from_type(ReplicaInfo)) +def test_replica_info_roundtrip(instance: ReplicaInfo) -> None: + writer = entity_writer(ReplicaInfo) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_replica_info(buffer) + assert instance == result + + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_topic_data: Final = entity_reader(TopicData) + + +@pytest.mark.roundtrip +@given(from_type(TopicData)) +def test_topic_data_roundtrip(instance: TopicData) -> None: + writer = entity_writer(TopicData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_topic_data(buffer) + assert instance == result + + +read_leader_endpoint: Final = entity_reader(LeaderEndpoint) + + +@pytest.mark.roundtrip +@given(from_type(LeaderEndpoint)) +def test_leader_endpoint_roundtrip(instance: LeaderEndpoint) -> None: + writer = entity_writer(LeaderEndpoint) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_leader_endpoint(buffer) + assert instance == result + + +read_end_quorum_epoch_request: Final = entity_reader(EndQuorumEpochRequest) + + +@pytest.mark.roundtrip +@given(from_type(EndQuorumEpochRequest)) +def test_end_quorum_epoch_request_roundtrip(instance: EndQuorumEpochRequest) -> None: + writer = entity_writer(EndQuorumEpochRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_end_quorum_epoch_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(EndQuorumEpochRequest)) +def test_end_quorum_epoch_request_java( + instance: EndQuorumEpochRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_end_quorum_epoch_v1_response.py b/tests/generated/test_end_quorum_epoch_v1_response.py new file mode 100644 index 00000000..fa1e9670 --- /dev/null +++ b/tests/generated/test_end_quorum_epoch_v1_response.py @@ -0,0 +1,80 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.end_quorum_epoch.v1.response import EndQuorumEpochResponse +from kio.schema.end_quorum_epoch.v1.response import NodeEndpoint +from kio.schema.end_quorum_epoch.v1.response import PartitionData +from kio.schema.end_quorum_epoch.v1.response import TopicData +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_topic_data: Final = entity_reader(TopicData) + + +@pytest.mark.roundtrip +@given(from_type(TopicData)) +def test_topic_data_roundtrip(instance: TopicData) -> None: + writer = entity_writer(TopicData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_topic_data(buffer) + assert instance == result + + +read_node_endpoint: Final = entity_reader(NodeEndpoint) + + +@pytest.mark.roundtrip +@given(from_type(NodeEndpoint)) +def test_node_endpoint_roundtrip(instance: NodeEndpoint) -> None: + writer = entity_writer(NodeEndpoint) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_node_endpoint(buffer) + assert instance == result + + +read_end_quorum_epoch_response: Final = entity_reader(EndQuorumEpochResponse) + + +@pytest.mark.roundtrip +@given(from_type(EndQuorumEpochResponse)) +def test_end_quorum_epoch_response_roundtrip(instance: EndQuorumEpochResponse) -> None: + writer = entity_writer(EndQuorumEpochResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_end_quorum_epoch_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(EndQuorumEpochResponse)) +def test_end_quorum_epoch_response_java( + instance: EndQuorumEpochResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_fetch_snapshot_v1_request.py b/tests/generated/test_fetch_snapshot_v1_request.py new file mode 100644 index 00000000..77c93e80 --- /dev/null +++ b/tests/generated/test_fetch_snapshot_v1_request.py @@ -0,0 +1,80 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.fetch_snapshot.v1.request import FetchSnapshotRequest +from kio.schema.fetch_snapshot.v1.request import PartitionSnapshot +from kio.schema.fetch_snapshot.v1.request import SnapshotId +from kio.schema.fetch_snapshot.v1.request import TopicSnapshot +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_snapshot_id: Final = entity_reader(SnapshotId) + + +@pytest.mark.roundtrip +@given(from_type(SnapshotId)) +def test_snapshot_id_roundtrip(instance: SnapshotId) -> None: + writer = entity_writer(SnapshotId) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_snapshot_id(buffer) + assert instance == result + + +read_partition_snapshot: Final = entity_reader(PartitionSnapshot) + + +@pytest.mark.roundtrip +@given(from_type(PartitionSnapshot)) +def test_partition_snapshot_roundtrip(instance: PartitionSnapshot) -> None: + writer = entity_writer(PartitionSnapshot) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_snapshot(buffer) + assert instance == result + + +read_topic_snapshot: Final = entity_reader(TopicSnapshot) + + +@pytest.mark.roundtrip +@given(from_type(TopicSnapshot)) +def test_topic_snapshot_roundtrip(instance: TopicSnapshot) -> None: + writer = entity_writer(TopicSnapshot) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_topic_snapshot(buffer) + assert instance == result + + +read_fetch_snapshot_request: Final = entity_reader(FetchSnapshotRequest) + + +@pytest.mark.roundtrip +@given(from_type(FetchSnapshotRequest)) +def test_fetch_snapshot_request_roundtrip(instance: FetchSnapshotRequest) -> None: + writer = entity_writer(FetchSnapshotRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_fetch_snapshot_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(FetchSnapshotRequest)) +def test_fetch_snapshot_request_java( + instance: FetchSnapshotRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_fetch_snapshot_v1_response.py b/tests/generated/test_fetch_snapshot_v1_response.py new file mode 100644 index 00000000..d63b2f4c --- /dev/null +++ b/tests/generated/test_fetch_snapshot_v1_response.py @@ -0,0 +1,110 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.fetch_snapshot.v1.response import FetchSnapshotResponse +from kio.schema.fetch_snapshot.v1.response import LeaderIdAndEpoch +from kio.schema.fetch_snapshot.v1.response import NodeEndpoint +from kio.schema.fetch_snapshot.v1.response import PartitionSnapshot +from kio.schema.fetch_snapshot.v1.response import SnapshotId +from kio.schema.fetch_snapshot.v1.response import TopicSnapshot +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_snapshot_id: Final = entity_reader(SnapshotId) + + +@pytest.mark.roundtrip +@given(from_type(SnapshotId)) +def test_snapshot_id_roundtrip(instance: SnapshotId) -> None: + writer = entity_writer(SnapshotId) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_snapshot_id(buffer) + assert instance == result + + +read_leader_id_and_epoch: Final = entity_reader(LeaderIdAndEpoch) + + +@pytest.mark.roundtrip +@given(from_type(LeaderIdAndEpoch)) +def test_leader_id_and_epoch_roundtrip(instance: LeaderIdAndEpoch) -> None: + writer = entity_writer(LeaderIdAndEpoch) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_leader_id_and_epoch(buffer) + assert instance == result + + +read_partition_snapshot: Final = entity_reader(PartitionSnapshot) + + +@pytest.mark.roundtrip +@given(from_type(PartitionSnapshot)) +def test_partition_snapshot_roundtrip(instance: PartitionSnapshot) -> None: + writer = entity_writer(PartitionSnapshot) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_snapshot(buffer) + assert instance == result + + +read_topic_snapshot: Final = entity_reader(TopicSnapshot) + + +@pytest.mark.roundtrip +@given(from_type(TopicSnapshot)) +def test_topic_snapshot_roundtrip(instance: TopicSnapshot) -> None: + writer = entity_writer(TopicSnapshot) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_topic_snapshot(buffer) + assert instance == result + + +read_node_endpoint: Final = entity_reader(NodeEndpoint) + + +@pytest.mark.roundtrip +@given(from_type(NodeEndpoint)) +def test_node_endpoint_roundtrip(instance: NodeEndpoint) -> None: + writer = entity_writer(NodeEndpoint) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_node_endpoint(buffer) + assert instance == result + + +read_fetch_snapshot_response: Final = entity_reader(FetchSnapshotResponse) + + +@pytest.mark.roundtrip +@given(from_type(FetchSnapshotResponse)) +def test_fetch_snapshot_response_roundtrip(instance: FetchSnapshotResponse) -> None: + writer = entity_writer(FetchSnapshotResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_fetch_snapshot_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(FetchSnapshotResponse)) +def test_fetch_snapshot_response_java( + instance: FetchSnapshotResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_fetch_v17_request.py b/tests/generated/test_fetch_v17_request.py new file mode 100644 index 00000000..59bf158c --- /dev/null +++ b/tests/generated/test_fetch_v17_request.py @@ -0,0 +1,93 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.fetch.v17.request import FetchPartition +from kio.schema.fetch.v17.request import FetchRequest +from kio.schema.fetch.v17.request import FetchTopic +from kio.schema.fetch.v17.request import ForgottenTopic +from kio.schema.fetch.v17.request import ReplicaState +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_replica_state: Final = entity_reader(ReplicaState) + + +@pytest.mark.roundtrip +@given(from_type(ReplicaState)) +def test_replica_state_roundtrip(instance: ReplicaState) -> None: + writer = entity_writer(ReplicaState) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_replica_state(buffer) + assert instance == result + + +read_fetch_partition: Final = entity_reader(FetchPartition) + + +@pytest.mark.roundtrip +@given(from_type(FetchPartition)) +def test_fetch_partition_roundtrip(instance: FetchPartition) -> None: + writer = entity_writer(FetchPartition) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_fetch_partition(buffer) + assert instance == result + + +read_fetch_topic: Final = entity_reader(FetchTopic) + + +@pytest.mark.roundtrip +@given(from_type(FetchTopic)) +def test_fetch_topic_roundtrip(instance: FetchTopic) -> None: + writer = entity_writer(FetchTopic) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_fetch_topic(buffer) + assert instance == result + + +read_forgotten_topic: Final = entity_reader(ForgottenTopic) + + +@pytest.mark.roundtrip +@given(from_type(ForgottenTopic)) +def test_forgotten_topic_roundtrip(instance: ForgottenTopic) -> None: + writer = entity_writer(ForgottenTopic) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_forgotten_topic(buffer) + assert instance == result + + +read_fetch_request: Final = entity_reader(FetchRequest) + + +@pytest.mark.roundtrip +@given(from_type(FetchRequest)) +def test_fetch_request_roundtrip(instance: FetchRequest) -> None: + writer = entity_writer(FetchRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_fetch_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(FetchRequest)) +def test_fetch_request_java(instance: FetchRequest, java_tester: JavaTester) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_fetch_v17_response.py b/tests/generated/test_fetch_v17_response.py new file mode 100644 index 00000000..08287db3 --- /dev/null +++ b/tests/generated/test_fetch_v17_response.py @@ -0,0 +1,138 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.fetch.v17.response import AbortedTransaction +from kio.schema.fetch.v17.response import EpochEndOffset +from kio.schema.fetch.v17.response import FetchableTopicResponse +from kio.schema.fetch.v17.response import FetchResponse +from kio.schema.fetch.v17.response import LeaderIdAndEpoch +from kio.schema.fetch.v17.response import NodeEndpoint +from kio.schema.fetch.v17.response import PartitionData +from kio.schema.fetch.v17.response import SnapshotId +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_epoch_end_offset: Final = entity_reader(EpochEndOffset) + + +@pytest.mark.roundtrip +@given(from_type(EpochEndOffset)) +def test_epoch_end_offset_roundtrip(instance: EpochEndOffset) -> None: + writer = entity_writer(EpochEndOffset) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_epoch_end_offset(buffer) + assert instance == result + + +read_leader_id_and_epoch: Final = entity_reader(LeaderIdAndEpoch) + + +@pytest.mark.roundtrip +@given(from_type(LeaderIdAndEpoch)) +def test_leader_id_and_epoch_roundtrip(instance: LeaderIdAndEpoch) -> None: + writer = entity_writer(LeaderIdAndEpoch) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_leader_id_and_epoch(buffer) + assert instance == result + + +read_snapshot_id: Final = entity_reader(SnapshotId) + + +@pytest.mark.roundtrip +@given(from_type(SnapshotId)) +def test_snapshot_id_roundtrip(instance: SnapshotId) -> None: + writer = entity_writer(SnapshotId) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_snapshot_id(buffer) + assert instance == result + + +read_aborted_transaction: Final = entity_reader(AbortedTransaction) + + +@pytest.mark.roundtrip +@given(from_type(AbortedTransaction)) +def test_aborted_transaction_roundtrip(instance: AbortedTransaction) -> None: + writer = entity_writer(AbortedTransaction) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_aborted_transaction(buffer) + assert instance == result + + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_fetchable_topic_response: Final = entity_reader(FetchableTopicResponse) + + +@pytest.mark.roundtrip +@given(from_type(FetchableTopicResponse)) +def test_fetchable_topic_response_roundtrip(instance: FetchableTopicResponse) -> None: + writer = entity_writer(FetchableTopicResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_fetchable_topic_response(buffer) + assert instance == result + + +read_node_endpoint: Final = entity_reader(NodeEndpoint) + + +@pytest.mark.roundtrip +@given(from_type(NodeEndpoint)) +def test_node_endpoint_roundtrip(instance: NodeEndpoint) -> None: + writer = entity_writer(NodeEndpoint) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_node_endpoint(buffer) + assert instance == result + + +read_fetch_response: Final = entity_reader(FetchResponse) + + +@pytest.mark.roundtrip +@given(from_type(FetchResponse)) +def test_fetch_response_roundtrip(instance: FetchResponse) -> None: + writer = entity_writer(FetchResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_fetch_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(FetchResponse)) +def test_fetch_response_java(instance: FetchResponse, java_tester: JavaTester) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_find_coordinator_v6_request.py b/tests/generated/test_find_coordinator_v6_request.py new file mode 100644 index 00000000..68dcaebb --- /dev/null +++ b/tests/generated/test_find_coordinator_v6_request.py @@ -0,0 +1,35 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.find_coordinator.v6.request import FindCoordinatorRequest +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_find_coordinator_request: Final = entity_reader(FindCoordinatorRequest) + + +@pytest.mark.roundtrip +@given(from_type(FindCoordinatorRequest)) +def test_find_coordinator_request_roundtrip(instance: FindCoordinatorRequest) -> None: + writer = entity_writer(FindCoordinatorRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_find_coordinator_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(FindCoordinatorRequest)) +def test_find_coordinator_request_java( + instance: FindCoordinatorRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_find_coordinator_v6_response.py b/tests/generated/test_find_coordinator_v6_response.py new file mode 100644 index 00000000..3863f473 --- /dev/null +++ b/tests/generated/test_find_coordinator_v6_response.py @@ -0,0 +1,50 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.find_coordinator.v6.response import Coordinator +from kio.schema.find_coordinator.v6.response import FindCoordinatorResponse +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_coordinator: Final = entity_reader(Coordinator) + + +@pytest.mark.roundtrip +@given(from_type(Coordinator)) +def test_coordinator_roundtrip(instance: Coordinator) -> None: + writer = entity_writer(Coordinator) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_coordinator(buffer) + assert instance == result + + +read_find_coordinator_response: Final = entity_reader(FindCoordinatorResponse) + + +@pytest.mark.roundtrip +@given(from_type(FindCoordinatorResponse)) +def test_find_coordinator_response_roundtrip(instance: FindCoordinatorResponse) -> None: + writer = entity_writer(FindCoordinatorResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_find_coordinator_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(FindCoordinatorResponse)) +def test_find_coordinator_response_java( + instance: FindCoordinatorResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_initialize_share_group_state_v0_request.py b/tests/generated/test_initialize_share_group_state_v0_request.py new file mode 100644 index 00000000..833a929c --- /dev/null +++ b/tests/generated/test_initialize_share_group_state_v0_request.py @@ -0,0 +1,71 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.initialize_share_group_state.v0.request import ( + InitializeShareGroupStateRequest, +) +from kio.schema.initialize_share_group_state.v0.request import InitializeStateData +from kio.schema.initialize_share_group_state.v0.request import PartitionData +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_initialize_state_data: Final = entity_reader(InitializeStateData) + + +@pytest.mark.roundtrip +@given(from_type(InitializeStateData)) +def test_initialize_state_data_roundtrip(instance: InitializeStateData) -> None: + writer = entity_writer(InitializeStateData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_initialize_state_data(buffer) + assert instance == result + + +read_initialize_share_group_state_request: Final = entity_reader( + InitializeShareGroupStateRequest +) + + +@pytest.mark.roundtrip +@given(from_type(InitializeShareGroupStateRequest)) +def test_initialize_share_group_state_request_roundtrip( + instance: InitializeShareGroupStateRequest, +) -> None: + writer = entity_writer(InitializeShareGroupStateRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_initialize_share_group_state_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(InitializeShareGroupStateRequest)) +def test_initialize_share_group_state_request_java( + instance: InitializeShareGroupStateRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_initialize_share_group_state_v0_response.py b/tests/generated/test_initialize_share_group_state_v0_response.py new file mode 100644 index 00000000..82d0504b --- /dev/null +++ b/tests/generated/test_initialize_share_group_state_v0_response.py @@ -0,0 +1,71 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.initialize_share_group_state.v0.response import ( + InitializeShareGroupStateResponse, +) +from kio.schema.initialize_share_group_state.v0.response import InitializeStateResult +from kio.schema.initialize_share_group_state.v0.response import PartitionResult +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_partition_result: Final = entity_reader(PartitionResult) + + +@pytest.mark.roundtrip +@given(from_type(PartitionResult)) +def test_partition_result_roundtrip(instance: PartitionResult) -> None: + writer = entity_writer(PartitionResult) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_result(buffer) + assert instance == result + + +read_initialize_state_result: Final = entity_reader(InitializeStateResult) + + +@pytest.mark.roundtrip +@given(from_type(InitializeStateResult)) +def test_initialize_state_result_roundtrip(instance: InitializeStateResult) -> None: + writer = entity_writer(InitializeStateResult) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_initialize_state_result(buffer) + assert instance == result + + +read_initialize_share_group_state_response: Final = entity_reader( + InitializeShareGroupStateResponse +) + + +@pytest.mark.roundtrip +@given(from_type(InitializeShareGroupStateResponse)) +def test_initialize_share_group_state_response_roundtrip( + instance: InitializeShareGroupStateResponse, +) -> None: + writer = entity_writer(InitializeShareGroupStateResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_initialize_share_group_state_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(InitializeShareGroupStateResponse)) +def test_initialize_share_group_state_response_java( + instance: InitializeShareGroupStateResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_leader_change_message_v1_data.py b/tests/generated/test_leader_change_message_v1_data.py new file mode 100644 index 00000000..78de5317 --- /dev/null +++ b/tests/generated/test_leader_change_message_v1_data.py @@ -0,0 +1,50 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.leader_change_message.v1.data import LeaderChangeMessage +from kio.schema.leader_change_message.v1.data import Voter +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_voter: Final = entity_reader(Voter) + + +@pytest.mark.roundtrip +@given(from_type(Voter)) +def test_voter_roundtrip(instance: Voter) -> None: + writer = entity_writer(Voter) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_voter(buffer) + assert instance == result + + +read_leader_change_message: Final = entity_reader(LeaderChangeMessage) + + +@pytest.mark.roundtrip +@given(from_type(LeaderChangeMessage)) +def test_leader_change_message_roundtrip(instance: LeaderChangeMessage) -> None: + writer = entity_writer(LeaderChangeMessage) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_leader_change_message(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(LeaderChangeMessage)) +def test_leader_change_message_java( + instance: LeaderChangeMessage, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_list_offsets_v9_request.py b/tests/generated/test_list_offsets_v9_request.py new file mode 100644 index 00000000..da8d3b58 --- /dev/null +++ b/tests/generated/test_list_offsets_v9_request.py @@ -0,0 +1,65 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.list_offsets.v9.request import ListOffsetsPartition +from kio.schema.list_offsets.v9.request import ListOffsetsRequest +from kio.schema.list_offsets.v9.request import ListOffsetsTopic +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_list_offsets_partition: Final = entity_reader(ListOffsetsPartition) + + +@pytest.mark.roundtrip +@given(from_type(ListOffsetsPartition)) +def test_list_offsets_partition_roundtrip(instance: ListOffsetsPartition) -> None: + writer = entity_writer(ListOffsetsPartition) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_list_offsets_partition(buffer) + assert instance == result + + +read_list_offsets_topic: Final = entity_reader(ListOffsetsTopic) + + +@pytest.mark.roundtrip +@given(from_type(ListOffsetsTopic)) +def test_list_offsets_topic_roundtrip(instance: ListOffsetsTopic) -> None: + writer = entity_writer(ListOffsetsTopic) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_list_offsets_topic(buffer) + assert instance == result + + +read_list_offsets_request: Final = entity_reader(ListOffsetsRequest) + + +@pytest.mark.roundtrip +@given(from_type(ListOffsetsRequest)) +def test_list_offsets_request_roundtrip(instance: ListOffsetsRequest) -> None: + writer = entity_writer(ListOffsetsRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_list_offsets_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ListOffsetsRequest)) +def test_list_offsets_request_java( + instance: ListOffsetsRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_list_offsets_v9_response.py b/tests/generated/test_list_offsets_v9_response.py new file mode 100644 index 00000000..bd818591 --- /dev/null +++ b/tests/generated/test_list_offsets_v9_response.py @@ -0,0 +1,71 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.list_offsets.v9.response import ListOffsetsPartitionResponse +from kio.schema.list_offsets.v9.response import ListOffsetsResponse +from kio.schema.list_offsets.v9.response import ListOffsetsTopicResponse +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_list_offsets_partition_response: Final = entity_reader( + ListOffsetsPartitionResponse +) + + +@pytest.mark.roundtrip +@given(from_type(ListOffsetsPartitionResponse)) +def test_list_offsets_partition_response_roundtrip( + instance: ListOffsetsPartitionResponse, +) -> None: + writer = entity_writer(ListOffsetsPartitionResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_list_offsets_partition_response(buffer) + assert instance == result + + +read_list_offsets_topic_response: Final = entity_reader(ListOffsetsTopicResponse) + + +@pytest.mark.roundtrip +@given(from_type(ListOffsetsTopicResponse)) +def test_list_offsets_topic_response_roundtrip( + instance: ListOffsetsTopicResponse, +) -> None: + writer = entity_writer(ListOffsetsTopicResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_list_offsets_topic_response(buffer) + assert instance == result + + +read_list_offsets_response: Final = entity_reader(ListOffsetsResponse) + + +@pytest.mark.roundtrip +@given(from_type(ListOffsetsResponse)) +def test_list_offsets_response_roundtrip(instance: ListOffsetsResponse) -> None: + writer = entity_writer(ListOffsetsResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_list_offsets_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ListOffsetsResponse)) +def test_list_offsets_response_java( + instance: ListOffsetsResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_read_share_group_state_summary_v0_request.py b/tests/generated/test_read_share_group_state_summary_v0_request.py new file mode 100644 index 00000000..a3460387 --- /dev/null +++ b/tests/generated/test_read_share_group_state_summary_v0_request.py @@ -0,0 +1,71 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.read_share_group_state_summary.v0.request import PartitionData +from kio.schema.read_share_group_state_summary.v0.request import ( + ReadShareGroupStateSummaryRequest, +) +from kio.schema.read_share_group_state_summary.v0.request import ReadStateSummaryData +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_read_state_summary_data: Final = entity_reader(ReadStateSummaryData) + + +@pytest.mark.roundtrip +@given(from_type(ReadStateSummaryData)) +def test_read_state_summary_data_roundtrip(instance: ReadStateSummaryData) -> None: + writer = entity_writer(ReadStateSummaryData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_read_state_summary_data(buffer) + assert instance == result + + +read_read_share_group_state_summary_request: Final = entity_reader( + ReadShareGroupStateSummaryRequest +) + + +@pytest.mark.roundtrip +@given(from_type(ReadShareGroupStateSummaryRequest)) +def test_read_share_group_state_summary_request_roundtrip( + instance: ReadShareGroupStateSummaryRequest, +) -> None: + writer = entity_writer(ReadShareGroupStateSummaryRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_read_share_group_state_summary_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ReadShareGroupStateSummaryRequest)) +def test_read_share_group_state_summary_request_java( + instance: ReadShareGroupStateSummaryRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_read_share_group_state_summary_v0_response.py b/tests/generated/test_read_share_group_state_summary_v0_response.py new file mode 100644 index 00000000..f66953f6 --- /dev/null +++ b/tests/generated/test_read_share_group_state_summary_v0_response.py @@ -0,0 +1,71 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.read_share_group_state_summary.v0.response import PartitionResult +from kio.schema.read_share_group_state_summary.v0.response import ( + ReadShareGroupStateSummaryResponse, +) +from kio.schema.read_share_group_state_summary.v0.response import ReadStateSummaryResult +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_partition_result: Final = entity_reader(PartitionResult) + + +@pytest.mark.roundtrip +@given(from_type(PartitionResult)) +def test_partition_result_roundtrip(instance: PartitionResult) -> None: + writer = entity_writer(PartitionResult) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_result(buffer) + assert instance == result + + +read_read_state_summary_result: Final = entity_reader(ReadStateSummaryResult) + + +@pytest.mark.roundtrip +@given(from_type(ReadStateSummaryResult)) +def test_read_state_summary_result_roundtrip(instance: ReadStateSummaryResult) -> None: + writer = entity_writer(ReadStateSummaryResult) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_read_state_summary_result(buffer) + assert instance == result + + +read_read_share_group_state_summary_response: Final = entity_reader( + ReadShareGroupStateSummaryResponse +) + + +@pytest.mark.roundtrip +@given(from_type(ReadShareGroupStateSummaryResponse)) +def test_read_share_group_state_summary_response_roundtrip( + instance: ReadShareGroupStateSummaryResponse, +) -> None: + writer = entity_writer(ReadShareGroupStateSummaryResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_read_share_group_state_summary_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ReadShareGroupStateSummaryResponse)) +def test_read_share_group_state_summary_response_java( + instance: ReadShareGroupStateSummaryResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_read_share_group_state_v0_request.py b/tests/generated/test_read_share_group_state_v0_request.py new file mode 100644 index 00000000..40d4c0cc --- /dev/null +++ b/tests/generated/test_read_share_group_state_v0_request.py @@ -0,0 +1,67 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.read_share_group_state.v0.request import PartitionData +from kio.schema.read_share_group_state.v0.request import ReadShareGroupStateRequest +from kio.schema.read_share_group_state.v0.request import ReadStateData +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_read_state_data: Final = entity_reader(ReadStateData) + + +@pytest.mark.roundtrip +@given(from_type(ReadStateData)) +def test_read_state_data_roundtrip(instance: ReadStateData) -> None: + writer = entity_writer(ReadStateData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_read_state_data(buffer) + assert instance == result + + +read_read_share_group_state_request: Final = entity_reader(ReadShareGroupStateRequest) + + +@pytest.mark.roundtrip +@given(from_type(ReadShareGroupStateRequest)) +def test_read_share_group_state_request_roundtrip( + instance: ReadShareGroupStateRequest, +) -> None: + writer = entity_writer(ReadShareGroupStateRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_read_share_group_state_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ReadShareGroupStateRequest)) +def test_read_share_group_state_request_java( + instance: ReadShareGroupStateRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_read_share_group_state_v0_response.py b/tests/generated/test_read_share_group_state_v0_response.py new file mode 100644 index 00000000..89e136dc --- /dev/null +++ b/tests/generated/test_read_share_group_state_v0_response.py @@ -0,0 +1,82 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.read_share_group_state.v0.response import PartitionResult +from kio.schema.read_share_group_state.v0.response import ReadShareGroupStateResponse +from kio.schema.read_share_group_state.v0.response import ReadStateResult +from kio.schema.read_share_group_state.v0.response import StateBatch +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_state_batch: Final = entity_reader(StateBatch) + + +@pytest.mark.roundtrip +@given(from_type(StateBatch)) +def test_state_batch_roundtrip(instance: StateBatch) -> None: + writer = entity_writer(StateBatch) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_state_batch(buffer) + assert instance == result + + +read_partition_result: Final = entity_reader(PartitionResult) + + +@pytest.mark.roundtrip +@given(from_type(PartitionResult)) +def test_partition_result_roundtrip(instance: PartitionResult) -> None: + writer = entity_writer(PartitionResult) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_result(buffer) + assert instance == result + + +read_read_state_result: Final = entity_reader(ReadStateResult) + + +@pytest.mark.roundtrip +@given(from_type(ReadStateResult)) +def test_read_state_result_roundtrip(instance: ReadStateResult) -> None: + writer = entity_writer(ReadStateResult) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_read_state_result(buffer) + assert instance == result + + +read_read_share_group_state_response: Final = entity_reader(ReadShareGroupStateResponse) + + +@pytest.mark.roundtrip +@given(from_type(ReadShareGroupStateResponse)) +def test_read_share_group_state_response_roundtrip( + instance: ReadShareGroupStateResponse, +) -> None: + writer = entity_writer(ReadShareGroupStateResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_read_share_group_state_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ReadShareGroupStateResponse)) +def test_read_share_group_state_response_java( + instance: ReadShareGroupStateResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_remove_raft_voter_v0_request.py b/tests/generated/test_remove_raft_voter_v0_request.py new file mode 100644 index 00000000..1208ac8f --- /dev/null +++ b/tests/generated/test_remove_raft_voter_v0_request.py @@ -0,0 +1,35 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.remove_raft_voter.v0.request import RemoveRaftVoterRequest +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_remove_raft_voter_request: Final = entity_reader(RemoveRaftVoterRequest) + + +@pytest.mark.roundtrip +@given(from_type(RemoveRaftVoterRequest)) +def test_remove_raft_voter_request_roundtrip(instance: RemoveRaftVoterRequest) -> None: + writer = entity_writer(RemoveRaftVoterRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_remove_raft_voter_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(RemoveRaftVoterRequest)) +def test_remove_raft_voter_request_java( + instance: RemoveRaftVoterRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_remove_raft_voter_v0_response.py b/tests/generated/test_remove_raft_voter_v0_response.py new file mode 100644 index 00000000..44f0f698 --- /dev/null +++ b/tests/generated/test_remove_raft_voter_v0_response.py @@ -0,0 +1,37 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.remove_raft_voter.v0.response import RemoveRaftVoterResponse +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_remove_raft_voter_response: Final = entity_reader(RemoveRaftVoterResponse) + + +@pytest.mark.roundtrip +@given(from_type(RemoveRaftVoterResponse)) +def test_remove_raft_voter_response_roundtrip( + instance: RemoveRaftVoterResponse, +) -> None: + writer = entity_writer(RemoveRaftVoterResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_remove_raft_voter_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(RemoveRaftVoterResponse)) +def test_remove_raft_voter_response_java( + instance: RemoveRaftVoterResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_share_acknowledge_v0_request.py b/tests/generated/test_share_acknowledge_v0_request.py new file mode 100644 index 00000000..ad454a02 --- /dev/null +++ b/tests/generated/test_share_acknowledge_v0_request.py @@ -0,0 +1,80 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.share_acknowledge.v0.request import AcknowledgementBatch +from kio.schema.share_acknowledge.v0.request import AcknowledgePartition +from kio.schema.share_acknowledge.v0.request import AcknowledgeTopic +from kio.schema.share_acknowledge.v0.request import ShareAcknowledgeRequest +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_acknowledgement_batch: Final = entity_reader(AcknowledgementBatch) + + +@pytest.mark.roundtrip +@given(from_type(AcknowledgementBatch)) +def test_acknowledgement_batch_roundtrip(instance: AcknowledgementBatch) -> None: + writer = entity_writer(AcknowledgementBatch) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_acknowledgement_batch(buffer) + assert instance == result + + +read_acknowledge_partition: Final = entity_reader(AcknowledgePartition) + + +@pytest.mark.roundtrip +@given(from_type(AcknowledgePartition)) +def test_acknowledge_partition_roundtrip(instance: AcknowledgePartition) -> None: + writer = entity_writer(AcknowledgePartition) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_acknowledge_partition(buffer) + assert instance == result + + +read_acknowledge_topic: Final = entity_reader(AcknowledgeTopic) + + +@pytest.mark.roundtrip +@given(from_type(AcknowledgeTopic)) +def test_acknowledge_topic_roundtrip(instance: AcknowledgeTopic) -> None: + writer = entity_writer(AcknowledgeTopic) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_acknowledge_topic(buffer) + assert instance == result + + +read_share_acknowledge_request: Final = entity_reader(ShareAcknowledgeRequest) + + +@pytest.mark.roundtrip +@given(from_type(ShareAcknowledgeRequest)) +def test_share_acknowledge_request_roundtrip(instance: ShareAcknowledgeRequest) -> None: + writer = entity_writer(ShareAcknowledgeRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_share_acknowledge_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ShareAcknowledgeRequest)) +def test_share_acknowledge_request_java( + instance: ShareAcknowledgeRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_share_acknowledge_v0_response.py b/tests/generated/test_share_acknowledge_v0_response.py new file mode 100644 index 00000000..1243e785 --- /dev/null +++ b/tests/generated/test_share_acknowledge_v0_response.py @@ -0,0 +1,101 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.share_acknowledge.v0.response import LeaderIdAndEpoch +from kio.schema.share_acknowledge.v0.response import NodeEndpoint +from kio.schema.share_acknowledge.v0.response import PartitionData +from kio.schema.share_acknowledge.v0.response import ShareAcknowledgeResponse +from kio.schema.share_acknowledge.v0.response import ShareAcknowledgeTopicResponse +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_leader_id_and_epoch: Final = entity_reader(LeaderIdAndEpoch) + + +@pytest.mark.roundtrip +@given(from_type(LeaderIdAndEpoch)) +def test_leader_id_and_epoch_roundtrip(instance: LeaderIdAndEpoch) -> None: + writer = entity_writer(LeaderIdAndEpoch) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_leader_id_and_epoch(buffer) + assert instance == result + + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_share_acknowledge_topic_response: Final = entity_reader( + ShareAcknowledgeTopicResponse +) + + +@pytest.mark.roundtrip +@given(from_type(ShareAcknowledgeTopicResponse)) +def test_share_acknowledge_topic_response_roundtrip( + instance: ShareAcknowledgeTopicResponse, +) -> None: + writer = entity_writer(ShareAcknowledgeTopicResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_share_acknowledge_topic_response(buffer) + assert instance == result + + +read_node_endpoint: Final = entity_reader(NodeEndpoint) + + +@pytest.mark.roundtrip +@given(from_type(NodeEndpoint)) +def test_node_endpoint_roundtrip(instance: NodeEndpoint) -> None: + writer = entity_writer(NodeEndpoint) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_node_endpoint(buffer) + assert instance == result + + +read_share_acknowledge_response: Final = entity_reader(ShareAcknowledgeResponse) + + +@pytest.mark.roundtrip +@given(from_type(ShareAcknowledgeResponse)) +def test_share_acknowledge_response_roundtrip( + instance: ShareAcknowledgeResponse, +) -> None: + writer = entity_writer(ShareAcknowledgeResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_share_acknowledge_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ShareAcknowledgeResponse)) +def test_share_acknowledge_response_java( + instance: ShareAcknowledgeResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_share_fetch_v0_request.py b/tests/generated/test_share_fetch_v0_request.py new file mode 100644 index 00000000..c18630aa --- /dev/null +++ b/tests/generated/test_share_fetch_v0_request.py @@ -0,0 +1,95 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.share_fetch.v0.request import AcknowledgementBatch +from kio.schema.share_fetch.v0.request import FetchPartition +from kio.schema.share_fetch.v0.request import FetchTopic +from kio.schema.share_fetch.v0.request import ForgottenTopic +from kio.schema.share_fetch.v0.request import ShareFetchRequest +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_acknowledgement_batch: Final = entity_reader(AcknowledgementBatch) + + +@pytest.mark.roundtrip +@given(from_type(AcknowledgementBatch)) +def test_acknowledgement_batch_roundtrip(instance: AcknowledgementBatch) -> None: + writer = entity_writer(AcknowledgementBatch) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_acknowledgement_batch(buffer) + assert instance == result + + +read_fetch_partition: Final = entity_reader(FetchPartition) + + +@pytest.mark.roundtrip +@given(from_type(FetchPartition)) +def test_fetch_partition_roundtrip(instance: FetchPartition) -> None: + writer = entity_writer(FetchPartition) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_fetch_partition(buffer) + assert instance == result + + +read_fetch_topic: Final = entity_reader(FetchTopic) + + +@pytest.mark.roundtrip +@given(from_type(FetchTopic)) +def test_fetch_topic_roundtrip(instance: FetchTopic) -> None: + writer = entity_writer(FetchTopic) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_fetch_topic(buffer) + assert instance == result + + +read_forgotten_topic: Final = entity_reader(ForgottenTopic) + + +@pytest.mark.roundtrip +@given(from_type(ForgottenTopic)) +def test_forgotten_topic_roundtrip(instance: ForgottenTopic) -> None: + writer = entity_writer(ForgottenTopic) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_forgotten_topic(buffer) + assert instance == result + + +read_share_fetch_request: Final = entity_reader(ShareFetchRequest) + + +@pytest.mark.roundtrip +@given(from_type(ShareFetchRequest)) +def test_share_fetch_request_roundtrip(instance: ShareFetchRequest) -> None: + writer = entity_writer(ShareFetchRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_share_fetch_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ShareFetchRequest)) +def test_share_fetch_request_java( + instance: ShareFetchRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_share_fetch_v0_response.py b/tests/generated/test_share_fetch_v0_response.py new file mode 100644 index 00000000..19685a82 --- /dev/null +++ b/tests/generated/test_share_fetch_v0_response.py @@ -0,0 +1,112 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.share_fetch.v0.response import AcquiredRecords +from kio.schema.share_fetch.v0.response import LeaderIdAndEpoch +from kio.schema.share_fetch.v0.response import NodeEndpoint +from kio.schema.share_fetch.v0.response import PartitionData +from kio.schema.share_fetch.v0.response import ShareFetchableTopicResponse +from kio.schema.share_fetch.v0.response import ShareFetchResponse +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_leader_id_and_epoch: Final = entity_reader(LeaderIdAndEpoch) + + +@pytest.mark.roundtrip +@given(from_type(LeaderIdAndEpoch)) +def test_leader_id_and_epoch_roundtrip(instance: LeaderIdAndEpoch) -> None: + writer = entity_writer(LeaderIdAndEpoch) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_leader_id_and_epoch(buffer) + assert instance == result + + +read_acquired_records: Final = entity_reader(AcquiredRecords) + + +@pytest.mark.roundtrip +@given(from_type(AcquiredRecords)) +def test_acquired_records_roundtrip(instance: AcquiredRecords) -> None: + writer = entity_writer(AcquiredRecords) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_acquired_records(buffer) + assert instance == result + + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_share_fetchable_topic_response: Final = entity_reader(ShareFetchableTopicResponse) + + +@pytest.mark.roundtrip +@given(from_type(ShareFetchableTopicResponse)) +def test_share_fetchable_topic_response_roundtrip( + instance: ShareFetchableTopicResponse, +) -> None: + writer = entity_writer(ShareFetchableTopicResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_share_fetchable_topic_response(buffer) + assert instance == result + + +read_node_endpoint: Final = entity_reader(NodeEndpoint) + + +@pytest.mark.roundtrip +@given(from_type(NodeEndpoint)) +def test_node_endpoint_roundtrip(instance: NodeEndpoint) -> None: + writer = entity_writer(NodeEndpoint) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_node_endpoint(buffer) + assert instance == result + + +read_share_fetch_response: Final = entity_reader(ShareFetchResponse) + + +@pytest.mark.roundtrip +@given(from_type(ShareFetchResponse)) +def test_share_fetch_response_roundtrip(instance: ShareFetchResponse) -> None: + writer = entity_writer(ShareFetchResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_share_fetch_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ShareFetchResponse)) +def test_share_fetch_response_java( + instance: ShareFetchResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_share_group_describe_v0_request.py b/tests/generated/test_share_group_describe_v0_request.py new file mode 100644 index 00000000..b830d911 --- /dev/null +++ b/tests/generated/test_share_group_describe_v0_request.py @@ -0,0 +1,37 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.share_group_describe.v0.request import ShareGroupDescribeRequest +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_share_group_describe_request: Final = entity_reader(ShareGroupDescribeRequest) + + +@pytest.mark.roundtrip +@given(from_type(ShareGroupDescribeRequest)) +def test_share_group_describe_request_roundtrip( + instance: ShareGroupDescribeRequest, +) -> None: + writer = entity_writer(ShareGroupDescribeRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_share_group_describe_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ShareGroupDescribeRequest)) +def test_share_group_describe_request_java( + instance: ShareGroupDescribeRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_share_group_describe_v0_response.py b/tests/generated/test_share_group_describe_v0_response.py new file mode 100644 index 00000000..36a60a6d --- /dev/null +++ b/tests/generated/test_share_group_describe_v0_response.py @@ -0,0 +1,97 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.share_group_describe.v0.response import Assignment +from kio.schema.share_group_describe.v0.response import DescribedGroup +from kio.schema.share_group_describe.v0.response import Member +from kio.schema.share_group_describe.v0.response import ShareGroupDescribeResponse +from kio.schema.share_group_describe.v0.response import TopicPartitions +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_topic_partitions: Final = entity_reader(TopicPartitions) + + +@pytest.mark.roundtrip +@given(from_type(TopicPartitions)) +def test_topic_partitions_roundtrip(instance: TopicPartitions) -> None: + writer = entity_writer(TopicPartitions) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_topic_partitions(buffer) + assert instance == result + + +read_assignment: Final = entity_reader(Assignment) + + +@pytest.mark.roundtrip +@given(from_type(Assignment)) +def test_assignment_roundtrip(instance: Assignment) -> None: + writer = entity_writer(Assignment) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_assignment(buffer) + assert instance == result + + +read_member: Final = entity_reader(Member) + + +@pytest.mark.roundtrip +@given(from_type(Member)) +def test_member_roundtrip(instance: Member) -> None: + writer = entity_writer(Member) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_member(buffer) + assert instance == result + + +read_described_group: Final = entity_reader(DescribedGroup) + + +@pytest.mark.roundtrip +@given(from_type(DescribedGroup)) +def test_described_group_roundtrip(instance: DescribedGroup) -> None: + writer = entity_writer(DescribedGroup) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_described_group(buffer) + assert instance == result + + +read_share_group_describe_response: Final = entity_reader(ShareGroupDescribeResponse) + + +@pytest.mark.roundtrip +@given(from_type(ShareGroupDescribeResponse)) +def test_share_group_describe_response_roundtrip( + instance: ShareGroupDescribeResponse, +) -> None: + writer = entity_writer(ShareGroupDescribeResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_share_group_describe_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ShareGroupDescribeResponse)) +def test_share_group_describe_response_java( + instance: ShareGroupDescribeResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_share_group_heartbeat_v0_request.py b/tests/generated/test_share_group_heartbeat_v0_request.py new file mode 100644 index 00000000..319235f2 --- /dev/null +++ b/tests/generated/test_share_group_heartbeat_v0_request.py @@ -0,0 +1,37 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.share_group_heartbeat.v0.request import ShareGroupHeartbeatRequest +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_share_group_heartbeat_request: Final = entity_reader(ShareGroupHeartbeatRequest) + + +@pytest.mark.roundtrip +@given(from_type(ShareGroupHeartbeatRequest)) +def test_share_group_heartbeat_request_roundtrip( + instance: ShareGroupHeartbeatRequest, +) -> None: + writer = entity_writer(ShareGroupHeartbeatRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_share_group_heartbeat_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ShareGroupHeartbeatRequest)) +def test_share_group_heartbeat_request_java( + instance: ShareGroupHeartbeatRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_share_group_heartbeat_v0_response.py b/tests/generated/test_share_group_heartbeat_v0_response.py new file mode 100644 index 00000000..b6b23169 --- /dev/null +++ b/tests/generated/test_share_group_heartbeat_v0_response.py @@ -0,0 +1,67 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.share_group_heartbeat.v0.response import Assignment +from kio.schema.share_group_heartbeat.v0.response import ShareGroupHeartbeatResponse +from kio.schema.share_group_heartbeat.v0.response import TopicPartitions +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_topic_partitions: Final = entity_reader(TopicPartitions) + + +@pytest.mark.roundtrip +@given(from_type(TopicPartitions)) +def test_topic_partitions_roundtrip(instance: TopicPartitions) -> None: + writer = entity_writer(TopicPartitions) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_topic_partitions(buffer) + assert instance == result + + +read_assignment: Final = entity_reader(Assignment) + + +@pytest.mark.roundtrip +@given(from_type(Assignment)) +def test_assignment_roundtrip(instance: Assignment) -> None: + writer = entity_writer(Assignment) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_assignment(buffer) + assert instance == result + + +read_share_group_heartbeat_response: Final = entity_reader(ShareGroupHeartbeatResponse) + + +@pytest.mark.roundtrip +@given(from_type(ShareGroupHeartbeatResponse)) +def test_share_group_heartbeat_response_roundtrip( + instance: ShareGroupHeartbeatResponse, +) -> None: + writer = entity_writer(ShareGroupHeartbeatResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_share_group_heartbeat_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(ShareGroupHeartbeatResponse)) +def test_share_group_heartbeat_response_java( + instance: ShareGroupHeartbeatResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_update_raft_voter_v0_request.py b/tests/generated/test_update_raft_voter_v0_request.py new file mode 100644 index 00000000..f4a6367c --- /dev/null +++ b/tests/generated/test_update_raft_voter_v0_request.py @@ -0,0 +1,65 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.update_raft_voter.v0.request import KRaftVersionFeature +from kio.schema.update_raft_voter.v0.request import Listener +from kio.schema.update_raft_voter.v0.request import UpdateRaftVoterRequest +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_listener: Final = entity_reader(Listener) + + +@pytest.mark.roundtrip +@given(from_type(Listener)) +def test_listener_roundtrip(instance: Listener) -> None: + writer = entity_writer(Listener) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_listener(buffer) + assert instance == result + + +read_k_raft_version_feature: Final = entity_reader(KRaftVersionFeature) + + +@pytest.mark.roundtrip +@given(from_type(KRaftVersionFeature)) +def test_k_raft_version_feature_roundtrip(instance: KRaftVersionFeature) -> None: + writer = entity_writer(KRaftVersionFeature) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_k_raft_version_feature(buffer) + assert instance == result + + +read_update_raft_voter_request: Final = entity_reader(UpdateRaftVoterRequest) + + +@pytest.mark.roundtrip +@given(from_type(UpdateRaftVoterRequest)) +def test_update_raft_voter_request_roundtrip(instance: UpdateRaftVoterRequest) -> None: + writer = entity_writer(UpdateRaftVoterRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_update_raft_voter_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(UpdateRaftVoterRequest)) +def test_update_raft_voter_request_java( + instance: UpdateRaftVoterRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_update_raft_voter_v0_response.py b/tests/generated/test_update_raft_voter_v0_response.py new file mode 100644 index 00000000..dedc2d12 --- /dev/null +++ b/tests/generated/test_update_raft_voter_v0_response.py @@ -0,0 +1,52 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.update_raft_voter.v0.response import CurrentLeader +from kio.schema.update_raft_voter.v0.response import UpdateRaftVoterResponse +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_current_leader: Final = entity_reader(CurrentLeader) + + +@pytest.mark.roundtrip +@given(from_type(CurrentLeader)) +def test_current_leader_roundtrip(instance: CurrentLeader) -> None: + writer = entity_writer(CurrentLeader) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_current_leader(buffer) + assert instance == result + + +read_update_raft_voter_response: Final = entity_reader(UpdateRaftVoterResponse) + + +@pytest.mark.roundtrip +@given(from_type(UpdateRaftVoterResponse)) +def test_update_raft_voter_response_roundtrip( + instance: UpdateRaftVoterResponse, +) -> None: + writer = entity_writer(UpdateRaftVoterResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_update_raft_voter_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(UpdateRaftVoterResponse)) +def test_update_raft_voter_response_java( + instance: UpdateRaftVoterResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_vote_v1_request.py b/tests/generated/test_vote_v1_request.py new file mode 100644 index 00000000..bfaa09ce --- /dev/null +++ b/tests/generated/test_vote_v1_request.py @@ -0,0 +1,63 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.vote.v1.request import PartitionData +from kio.schema.vote.v1.request import TopicData +from kio.schema.vote.v1.request import VoteRequest +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_topic_data: Final = entity_reader(TopicData) + + +@pytest.mark.roundtrip +@given(from_type(TopicData)) +def test_topic_data_roundtrip(instance: TopicData) -> None: + writer = entity_writer(TopicData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_topic_data(buffer) + assert instance == result + + +read_vote_request: Final = entity_reader(VoteRequest) + + +@pytest.mark.roundtrip +@given(from_type(VoteRequest)) +def test_vote_request_roundtrip(instance: VoteRequest) -> None: + writer = entity_writer(VoteRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_vote_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(VoteRequest)) +def test_vote_request_java(instance: VoteRequest, java_tester: JavaTester) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_vote_v1_response.py b/tests/generated/test_vote_v1_response.py new file mode 100644 index 00000000..138abe45 --- /dev/null +++ b/tests/generated/test_vote_v1_response.py @@ -0,0 +1,78 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.vote.v1.response import NodeEndpoint +from kio.schema.vote.v1.response import PartitionData +from kio.schema.vote.v1.response import TopicData +from kio.schema.vote.v1.response import VoteResponse +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_topic_data: Final = entity_reader(TopicData) + + +@pytest.mark.roundtrip +@given(from_type(TopicData)) +def test_topic_data_roundtrip(instance: TopicData) -> None: + writer = entity_writer(TopicData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_topic_data(buffer) + assert instance == result + + +read_node_endpoint: Final = entity_reader(NodeEndpoint) + + +@pytest.mark.roundtrip +@given(from_type(NodeEndpoint)) +def test_node_endpoint_roundtrip(instance: NodeEndpoint) -> None: + writer = entity_writer(NodeEndpoint) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_node_endpoint(buffer) + assert instance == result + + +read_vote_response: Final = entity_reader(VoteResponse) + + +@pytest.mark.roundtrip +@given(from_type(VoteResponse)) +def test_vote_response_roundtrip(instance: VoteResponse) -> None: + writer = entity_writer(VoteResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_vote_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(VoteResponse)) +def test_vote_response_java(instance: VoteResponse, java_tester: JavaTester) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_write_share_group_state_v0_request.py b/tests/generated/test_write_share_group_state_v0_request.py new file mode 100644 index 00000000..f1eb6dd7 --- /dev/null +++ b/tests/generated/test_write_share_group_state_v0_request.py @@ -0,0 +1,82 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.write_share_group_state.v0.request import PartitionData +from kio.schema.write_share_group_state.v0.request import StateBatch +from kio.schema.write_share_group_state.v0.request import WriteShareGroupStateRequest +from kio.schema.write_share_group_state.v0.request import WriteStateData +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_state_batch: Final = entity_reader(StateBatch) + + +@pytest.mark.roundtrip +@given(from_type(StateBatch)) +def test_state_batch_roundtrip(instance: StateBatch) -> None: + writer = entity_writer(StateBatch) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_state_batch(buffer) + assert instance == result + + +read_partition_data: Final = entity_reader(PartitionData) + + +@pytest.mark.roundtrip +@given(from_type(PartitionData)) +def test_partition_data_roundtrip(instance: PartitionData) -> None: + writer = entity_writer(PartitionData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_data(buffer) + assert instance == result + + +read_write_state_data: Final = entity_reader(WriteStateData) + + +@pytest.mark.roundtrip +@given(from_type(WriteStateData)) +def test_write_state_data_roundtrip(instance: WriteStateData) -> None: + writer = entity_writer(WriteStateData) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_write_state_data(buffer) + assert instance == result + + +read_write_share_group_state_request: Final = entity_reader(WriteShareGroupStateRequest) + + +@pytest.mark.roundtrip +@given(from_type(WriteShareGroupStateRequest)) +def test_write_share_group_state_request_roundtrip( + instance: WriteShareGroupStateRequest, +) -> None: + writer = entity_writer(WriteShareGroupStateRequest) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_write_share_group_state_request(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(WriteShareGroupStateRequest)) +def test_write_share_group_state_request_java( + instance: WriteShareGroupStateRequest, java_tester: JavaTester +) -> None: + java_tester.test(instance) diff --git a/tests/generated/test_write_share_group_state_v0_response.py b/tests/generated/test_write_share_group_state_v0_response.py new file mode 100644 index 00000000..7ce91365 --- /dev/null +++ b/tests/generated/test_write_share_group_state_v0_response.py @@ -0,0 +1,69 @@ +from __future__ import annotations + +from typing import Final + +import pytest + +from hypothesis import given +from hypothesis.strategies import from_type + +from kio.schema.write_share_group_state.v0.response import PartitionResult +from kio.schema.write_share_group_state.v0.response import WriteShareGroupStateResponse +from kio.schema.write_share_group_state.v0.response import WriteStateResult +from kio.serial import entity_reader +from kio.serial import entity_writer +from tests.conftest import JavaTester +from tests.conftest import setup_buffer + +read_partition_result: Final = entity_reader(PartitionResult) + + +@pytest.mark.roundtrip +@given(from_type(PartitionResult)) +def test_partition_result_roundtrip(instance: PartitionResult) -> None: + writer = entity_writer(PartitionResult) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_partition_result(buffer) + assert instance == result + + +read_write_state_result: Final = entity_reader(WriteStateResult) + + +@pytest.mark.roundtrip +@given(from_type(WriteStateResult)) +def test_write_state_result_roundtrip(instance: WriteStateResult) -> None: + writer = entity_writer(WriteStateResult) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_write_state_result(buffer) + assert instance == result + + +read_write_share_group_state_response: Final = entity_reader( + WriteShareGroupStateResponse +) + + +@pytest.mark.roundtrip +@given(from_type(WriteShareGroupStateResponse)) +def test_write_share_group_state_response_roundtrip( + instance: WriteShareGroupStateResponse, +) -> None: + writer = entity_writer(WriteShareGroupStateResponse) + with setup_buffer() as buffer: + writer(buffer, instance) + buffer.seek(0) + result = read_write_share_group_state_response(buffer) + assert instance == result + + +@pytest.mark.java +@given(instance=from_type(WriteShareGroupStateResponse)) +def test_write_share_group_state_response_java( + instance: WriteShareGroupStateResponse, java_tester: JavaTester +) -> None: + java_tester.test(instance)