kf-protocol-message 2.0.0

Rust kafka protocol message definition
Documentation
/// WARNING: CODE GENERATED FILE
/// * This file is generated by kfspec2code.
/// * Any changes applied to this file will be lost when a new spec is generated.
use serde::{Deserialize, Serialize};

use kf_protocol_api::ErrorCode;
use kf_protocol_api::Request;

use kf_protocol_derive::Decode;
use kf_protocol_derive::Encode;
use kf_protocol_derive::KfDefault;

// -----------------------------------
// KfDescribeConfigsRequest
// -----------------------------------

#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
pub struct KfDescribeConfigsRequest {
    /// The resources whose configurations we want to describe.
    pub resources: Vec<DescribeConfigsResource>,

    /// True if we should include all synonyms.
    #[fluvio_kf(min_version = 1)]
    pub include_synoyms: bool,
}

#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
pub struct DescribeConfigsResource {
    /// The resource type.
    pub resource_type: i8,

    /// The resource name.
    pub resource_name: String,

    /// The configuration keys to list, or null to list all configuration keys.
    pub configuration_keys: Option<Vec<String>>,
}

// -----------------------------------
// KfDescribeConfigsResponse
// -----------------------------------

#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
pub struct KfDescribeConfigsResponse {
    /// 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.
    pub throttle_time_ms: i32,

    /// The results for each resource.
    pub results: Vec<DescribeConfigsResult>,
}

#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
pub struct DescribeConfigsResult {
    /// The error code, or 0 if we were able to successfully describe the configurations.
    pub error_code: ErrorCode,

    /// The error message, or null if we were able to successfully describe the configurations.
    pub error_message: Option<String>,

    /// The resource type.
    pub resource_type: i8,

    /// The resource name.
    pub resource_name: String,

    /// Each listed configuration.
    pub configs: Vec<DescribeConfigsResourceResult>,
}

#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
pub struct DescribeConfigsResourceResult {
    /// The configuration name.
    pub name: String,

    /// The configuration value.
    pub value: Option<String>,

    /// True if the configuration is read-only.
    pub read_only: bool,

    /// The configuration source.
    #[fluvio_kf(min_version = 1, ignorable)]
    pub config_source: i8,

    /// True if this configuration is sensitive.
    pub is_sensitive: bool,

    /// The synonyms for this configuration key.
    #[fluvio_kf(min_version = 1, ignorable)]
    pub synonyms: Vec<DescribeConfigsSynonym>,
}

#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
pub struct DescribeConfigsSynonym {
    /// The synonym name.
    #[fluvio_kf(min_version = 1)]
    pub name: String,

    /// The synonym value.
    #[fluvio_kf(min_version = 1)]
    pub value: Option<String>,

    /// The synonym source.
    #[fluvio_kf(min_version = 1)]
    pub source: i8,
}

// -----------------------------------
// Implementation - KfDescribeConfigsRequest
// -----------------------------------

impl Request for KfDescribeConfigsRequest {
    const API_KEY: u16 = 32;

    const MIN_API_VERSION: i16 = 0;
    const MAX_API_VERSION: i16 = 2;
    const DEFAULT_API_VERSION: i16 = 2;

    type Response = KfDescribeConfigsResponse;
}