kf_protocol_message/kf_code_gen/
api_versions.rs

1/// WARNING: CODE GENERATED FILE
2/// * This file is generated by kfspec2code.
3/// * Any changes applied to this file will be lost when a new spec is generated.
4use serde::{Deserialize, Serialize};
5
6use kf_protocol_api::ErrorCode;
7use kf_protocol_api::Request;
8
9use kf_protocol_derive::Decode;
10use kf_protocol_derive::Encode;
11use kf_protocol_derive::KfDefault;
12
13// -----------------------------------
14// KfApiVersionsRequest
15// -----------------------------------
16
17#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
18pub struct KfApiVersionsRequest {}
19
20// -----------------------------------
21// KfApiVersionsResponse
22// -----------------------------------
23
24#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
25pub struct KfApiVersionsResponse {
26    /// The top-level error code.
27    pub error_code: ErrorCode,
28
29    /// The APIs supported by the broker.
30    pub api_keys: Vec<ApiVersionsResponseKey>,
31
32    /// The duration in milliseconds for which the request was throttled due to a quota violation,
33    /// or zero if the request did not violate any quota.
34    #[fluvio_kf(min_version = 1, ignorable)]
35    pub throttle_time_ms: i32,
36}
37
38#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
39pub struct ApiVersionsResponseKey {
40    /// The API index.
41    pub index: i16,
42
43    /// The minimum supported version, inclusive.
44    pub min_version: i16,
45
46    /// The maximum supported version, inclusive.
47    pub max_version: i16,
48}
49
50// -----------------------------------
51// Implementation - KfApiVersionsRequest
52// -----------------------------------
53
54impl Request for KfApiVersionsRequest {
55    const API_KEY: u16 = 18;
56
57    const MIN_API_VERSION: i16 = 0;
58    const MAX_API_VERSION: i16 = 2;
59    const DEFAULT_API_VERSION: i16 = 2;
60
61    type Response = KfApiVersionsResponse;
62}