defmodule Kayrock.DeleteAcls do @api :delete_acls @moduledoc "Kayrock-generated module for the Kafka `#{@api}` API " _ = " THIS CODE IS GENERATED BY KAYROCK" ( @vmin 0 @vmax 1 ) defmodule V0.Request do @vsn 0 @api :delete_acls @schema filters: {:array, resource_type: :int8, resource_name: :nullable_string, principal: :nullable_string, host: :nullable_string, operation: :int8, permission_type: :int8} @moduledoc "Kayrock-generated request struct for Kafka `#{@api}` v#{@vsn} API messages The schema of this API is ``` #{inspect(@schema, pretty: true)} ``` " _ = " THIS CODE IS GENERATED BY KAYROCK" defstruct filters: [], correlation_id: nil, client_id: nil import Elixir.Kayrock.Serialize @typedoc "Request struct for the Kafka `#{@api}` API v#{@vsn} " @type t :: %__MODULE__{ filters: [ %{ resource_type: nil | integer(), resource_name: nil | binary(), principal: nil | binary(), host: nil | binary(), operation: nil | integer(), permission_type: nil | integer() } ], correlation_id: nil | integer(), client_id: nil | binary() } @doc "Returns the Kafka API key for this API" @spec api_key :: integer def api_key do Kayrock.KafkaSchemaMetadata.api_key(:delete_acls) end @doc "Returns the API version (#{@vsn}) implemented by this module" @spec api_vsn :: integer def api_vsn do 0 end @doc "Returns a function that can be used to deserialize the wire response from the\nbroker for this message type\n" @spec response_deserializer :: (binary -> {V0.Response.t(), binary}) def response_deserializer do &V0.Response.deserialize/1 end @doc "Returns the schema of this message\n\nSee [above](#).\n" @spec schema :: term def schema do [ filters: {:array, resource_type: :int8, resource_name: :nullable_string, principal: :nullable_string, host: :nullable_string, operation: :int8, permission_type: :int8} ] end @doc "Serialize a message to binary data for transfer to a Kafka broker" @spec serialize(t()) :: iodata def serialize(%V0.Request{} = struct) do [ <>, case struct.client_id do nil -> <<-1::16-signed>> id -> <> end, [ case Map.fetch!(struct, :filters) do nil -> <<-1::32-signed>> [] -> <<0::32-signed>> vals when is_list(vals) -> [ <>, for v <- vals do [ serialize(:int8, Map.fetch!(v, :resource_type)), serialize(:nullable_string, Map.fetch!(v, :resource_name)), serialize(:nullable_string, Map.fetch!(v, :principal)), serialize(:nullable_string, Map.fetch!(v, :host)), serialize(:int8, Map.fetch!(v, :operation)), serialize(:int8, Map.fetch!(v, :permission_type)) ] end ] end ] ] end end defimpl(Elixir.Kayrock.Request, for: V0.Request) do def serialize(%V0.Request{} = struct) do try do V0.Request.serialize(struct) rescue e -> reraise Kayrock.InvalidRequestError, {e, struct}, __STACKTRACE__ end end def api_vsn(%V0.Request{}) do V0.Request.api_vsn() end def response_deserializer(%V0.Request{}) do V0.Request.response_deserializer() end end defmodule V1.Request do @vsn 1 @api :delete_acls @schema filters: {:array, resource_type: :int8, resource_name: :nullable_string, resource_pattern_type_filter: :int8, principal: :nullable_string, host: :nullable_string, operation: :int8, permission_type: :int8} @moduledoc "Kayrock-generated request struct for Kafka `#{@api}` v#{@vsn} API messages The schema of this API is ``` #{inspect(@schema, pretty: true)} ``` " _ = " THIS CODE IS GENERATED BY KAYROCK" defstruct filters: [], correlation_id: nil, client_id: nil import Elixir.Kayrock.Serialize @typedoc "Request struct for the Kafka `#{@api}` API v#{@vsn} " @type t :: %__MODULE__{ filters: [ %{ resource_type: nil | integer(), resource_name: nil | binary(), resource_pattern_type_filter: nil | integer(), principal: nil | binary(), host: nil | binary(), operation: nil | integer(), permission_type: nil | integer() } ], correlation_id: nil | integer(), client_id: nil | binary() } @doc "Returns the Kafka API key for this API" @spec api_key :: integer def api_key do Kayrock.KafkaSchemaMetadata.api_key(:delete_acls) end @doc "Returns the API version (#{@vsn}) implemented by this module" @spec api_vsn :: integer def api_vsn do 1 end @doc "Returns a function that can be used to deserialize the wire response from the\nbroker for this message type\n" @spec response_deserializer :: (binary -> {V1.Response.t(), binary}) def response_deserializer do &V1.Response.deserialize/1 end @doc "Returns the schema of this message\n\nSee [above](#).\n" @spec schema :: term def schema do [ filters: {:array, resource_type: :int8, resource_name: :nullable_string, resource_pattern_type_filter: :int8, principal: :nullable_string, host: :nullable_string, operation: :int8, permission_type: :int8} ] end @doc "Serialize a message to binary data for transfer to a Kafka broker" @spec serialize(t()) :: iodata def serialize(%V1.Request{} = struct) do [ <>, case struct.client_id do nil -> <<-1::16-signed>> id -> <> end, [ case Map.fetch!(struct, :filters) do nil -> <<-1::32-signed>> [] -> <<0::32-signed>> vals when is_list(vals) -> [ <>, for v <- vals do [ serialize(:int8, Map.fetch!(v, :resource_type)), serialize(:nullable_string, Map.fetch!(v, :resource_name)), serialize(:int8, Map.fetch!(v, :resource_pattern_type_filter)), serialize(:nullable_string, Map.fetch!(v, :principal)), serialize(:nullable_string, Map.fetch!(v, :host)), serialize(:int8, Map.fetch!(v, :operation)), serialize(:int8, Map.fetch!(v, :permission_type)) ] end ] end ] ] end end defimpl(Elixir.Kayrock.Request, for: V1.Request) do def serialize(%V1.Request{} = struct) do try do V1.Request.serialize(struct) rescue e -> reraise Kayrock.InvalidRequestError, {e, struct}, __STACKTRACE__ end end def api_vsn(%V1.Request{}) do V1.Request.api_vsn() end def response_deserializer(%V1.Request{}) do V1.Request.response_deserializer() end end ( @doc "Returns a request struct for this API with the given version" @spec get_request_struct(integer) :: request_t ) def get_request_struct(0) do %V0.Request{} end def get_request_struct(1) do %V1.Request{} end defmodule V0.Response do @vsn 0 @api :delete_acls @schema throttle_time_ms: :int32, filter_responses: {:array, error_code: :int16, error_message: :nullable_string, matching_acls: {:array, error_code: :int16, error_message: :nullable_string, resource_type: :int8, resource_name: :string, principal: :string, host: :string, operation: :int8, permission_type: :int8}} @moduledoc "Kayrock-generated response struct for Kafka `#{@api}` v#{@vsn} API messages The schema of this API is ``` #{inspect(@schema, pretty: true)} ``` " _ = " THIS CODE IS GENERATED BY KAYROCK" defstruct throttle_time_ms: nil, filter_responses: [], correlation_id: nil @typedoc "Response struct for the Kafka `#{@api}` API v#{@vsn} " @type t :: %__MODULE__{ throttle_time_ms: nil | integer(), filter_responses: [ %{ error_code: nil | integer(), error_message: nil | binary(), matching_acls: [ %{ error_code: nil | integer(), error_message: nil | binary(), resource_type: nil | integer(), resource_name: nil | binary(), principal: nil | binary(), host: nil | binary(), operation: nil | integer(), permission_type: nil | integer() } ] } ], correlation_id: integer() } import Elixir.Kayrock.Deserialize @doc "Returns the Kafka API key for this API" @spec api_key :: integer def api_key do Kayrock.KafkaSchemaMetadata.api_key(:delete_acls) end @doc "Returns the API version (#{@vsn}) implemented by this module" @spec api_vsn :: integer def api_vsn do 0 end @doc "Returns the schema of this message\n\nSee [above](#).\n" @spec schema :: term def schema do [ throttle_time_ms: :int32, filter_responses: {:array, error_code: :int16, error_message: :nullable_string, matching_acls: {:array, error_code: :int16, error_message: :nullable_string, resource_type: :int8, resource_name: :string, principal: :string, host: :string, operation: :int8, permission_type: :int8}} ] end @doc "Deserialize data for this version of this API\n" @spec deserialize(binary) :: {t(), binary} def deserialize(data) do <> = data deserialize_field( :root, :throttle_time_ms, %__MODULE__{correlation_id: correlation_id}, rest ) end defp deserialize_field(:root, :throttle_time_ms, acc, data) do {val, rest} = deserialize(:int32, data) deserialize_field(:root, :filter_responses, Map.put(acc, :throttle_time_ms, val), rest) end defp deserialize_field(:filter_responses, :error_code, acc, data) do {val, rest} = deserialize(:int16, data) deserialize_field(:filter_responses, :error_message, Map.put(acc, :error_code, val), rest) end defp deserialize_field(:filter_responses, :error_message, acc, data) do {val, rest} = deserialize(:nullable_string, data) deserialize_field( :filter_responses, :matching_acls, Map.put(acc, :error_message, val), rest ) end defp deserialize_field(:matching_acls, :error_code, acc, data) do {val, rest} = deserialize(:int16, data) deserialize_field(:matching_acls, :error_message, Map.put(acc, :error_code, val), rest) end defp deserialize_field(:matching_acls, :error_message, acc, data) do {val, rest} = deserialize(:nullable_string, data) deserialize_field(:matching_acls, :resource_type, Map.put(acc, :error_message, val), rest) end defp deserialize_field(:matching_acls, :resource_type, acc, data) do {val, rest} = deserialize(:int8, data) deserialize_field(:matching_acls, :resource_name, Map.put(acc, :resource_type, val), rest) end defp deserialize_field(:matching_acls, :resource_name, acc, data) do {val, rest} = deserialize(:string, data) deserialize_field(:matching_acls, :principal, Map.put(acc, :resource_name, val), rest) end defp deserialize_field(:matching_acls, :principal, acc, data) do {val, rest} = deserialize(:string, data) deserialize_field(:matching_acls, :host, Map.put(acc, :principal, val), rest) end defp deserialize_field(:matching_acls, :host, acc, data) do {val, rest} = deserialize(:string, data) deserialize_field(:matching_acls, :operation, Map.put(acc, :host, val), rest) end defp deserialize_field(:matching_acls, :operation, acc, data) do {val, rest} = deserialize(:int8, data) deserialize_field(:matching_acls, :permission_type, Map.put(acc, :operation, val), rest) end defp deserialize_field(:matching_acls, :permission_type, acc, data) do {val, rest} = deserialize(:int8, data) deserialize_field(:matching_acls, nil, Map.put(acc, :permission_type, val), rest) end defp deserialize_field(:filter_responses, :matching_acls, acc, data) do <> = data {vals, rest} = if num_elements > 0 do Enum.reduce(1..num_elements, {[], rest}, fn _ix, {acc, d} -> {val, r} = deserialize_field(:matching_acls, :error_code, %{}, d) {[val | acc], r} end) else {[], rest} end deserialize_field( :filter_responses, nil, Map.put(acc, :matching_acls, Enum.reverse(vals)), rest ) end defp deserialize_field(:root, :filter_responses, acc, data) do <> = data {vals, rest} = if num_elements > 0 do Enum.reduce(1..num_elements, {[], rest}, fn _ix, {acc, d} -> {val, r} = deserialize_field(:filter_responses, :error_code, %{}, d) {[val | acc], r} end) else {[], rest} end deserialize_field(:root, nil, Map.put(acc, :filter_responses, Enum.reverse(vals)), rest) end defp deserialize_field(_, nil, acc, rest) do {acc, rest} end end defmodule V1.Response do @vsn 1 @api :delete_acls @schema throttle_time_ms: :int32, filter_responses: {:array, error_code: :int16, error_message: :nullable_string, matching_acls: {:array, error_code: :int16, error_message: :nullable_string, resource_type: :int8, resource_name: :string, resource_pattern_type: :int8, principal: :string, host: :string, operation: :int8, permission_type: :int8}} @moduledoc "Kayrock-generated response struct for Kafka `#{@api}` v#{@vsn} API messages The schema of this API is ``` #{inspect(@schema, pretty: true)} ``` " _ = " THIS CODE IS GENERATED BY KAYROCK" defstruct throttle_time_ms: nil, filter_responses: [], correlation_id: nil @typedoc "Response struct for the Kafka `#{@api}` API v#{@vsn} " @type t :: %__MODULE__{ throttle_time_ms: nil | integer(), filter_responses: [ %{ error_code: nil | integer(), error_message: nil | binary(), matching_acls: [ %{ error_code: nil | integer(), error_message: nil | binary(), resource_type: nil | integer(), resource_name: nil | binary(), resource_pattern_type: nil | integer(), principal: nil | binary(), host: nil | binary(), operation: nil | integer(), permission_type: nil | integer() } ] } ], correlation_id: integer() } import Elixir.Kayrock.Deserialize @doc "Returns the Kafka API key for this API" @spec api_key :: integer def api_key do Kayrock.KafkaSchemaMetadata.api_key(:delete_acls) end @doc "Returns the API version (#{@vsn}) implemented by this module" @spec api_vsn :: integer def api_vsn do 1 end @doc "Returns the schema of this message\n\nSee [above](#).\n" @spec schema :: term def schema do [ throttle_time_ms: :int32, filter_responses: {:array, error_code: :int16, error_message: :nullable_string, matching_acls: {:array, error_code: :int16, error_message: :nullable_string, resource_type: :int8, resource_name: :string, resource_pattern_type: :int8, principal: :string, host: :string, operation: :int8, permission_type: :int8}} ] end @doc "Deserialize data for this version of this API\n" @spec deserialize(binary) :: {t(), binary} def deserialize(data) do <> = data deserialize_field( :root, :throttle_time_ms, %__MODULE__{correlation_id: correlation_id}, rest ) end defp deserialize_field(:root, :throttle_time_ms, acc, data) do {val, rest} = deserialize(:int32, data) deserialize_field(:root, :filter_responses, Map.put(acc, :throttle_time_ms, val), rest) end defp deserialize_field(:filter_responses, :error_code, acc, data) do {val, rest} = deserialize(:int16, data) deserialize_field(:filter_responses, :error_message, Map.put(acc, :error_code, val), rest) end defp deserialize_field(:filter_responses, :error_message, acc, data) do {val, rest} = deserialize(:nullable_string, data) deserialize_field( :filter_responses, :matching_acls, Map.put(acc, :error_message, val), rest ) end defp deserialize_field(:matching_acls, :error_code, acc, data) do {val, rest} = deserialize(:int16, data) deserialize_field(:matching_acls, :error_message, Map.put(acc, :error_code, val), rest) end defp deserialize_field(:matching_acls, :error_message, acc, data) do {val, rest} = deserialize(:nullable_string, data) deserialize_field(:matching_acls, :resource_type, Map.put(acc, :error_message, val), rest) end defp deserialize_field(:matching_acls, :resource_type, acc, data) do {val, rest} = deserialize(:int8, data) deserialize_field(:matching_acls, :resource_name, Map.put(acc, :resource_type, val), rest) end defp deserialize_field(:matching_acls, :resource_name, acc, data) do {val, rest} = deserialize(:string, data) deserialize_field( :matching_acls, :resource_pattern_type, Map.put(acc, :resource_name, val), rest ) end defp deserialize_field(:matching_acls, :resource_pattern_type, acc, data) do {val, rest} = deserialize(:int8, data) deserialize_field( :matching_acls, :principal, Map.put(acc, :resource_pattern_type, val), rest ) end defp deserialize_field(:matching_acls, :principal, acc, data) do {val, rest} = deserialize(:string, data) deserialize_field(:matching_acls, :host, Map.put(acc, :principal, val), rest) end defp deserialize_field(:matching_acls, :host, acc, data) do {val, rest} = deserialize(:string, data) deserialize_field(:matching_acls, :operation, Map.put(acc, :host, val), rest) end defp deserialize_field(:matching_acls, :operation, acc, data) do {val, rest} = deserialize(:int8, data) deserialize_field(:matching_acls, :permission_type, Map.put(acc, :operation, val), rest) end defp deserialize_field(:matching_acls, :permission_type, acc, data) do {val, rest} = deserialize(:int8, data) deserialize_field(:matching_acls, nil, Map.put(acc, :permission_type, val), rest) end defp deserialize_field(:filter_responses, :matching_acls, acc, data) do <> = data {vals, rest} = if num_elements > 0 do Enum.reduce(1..num_elements, {[], rest}, fn _ix, {acc, d} -> {val, r} = deserialize_field(:matching_acls, :error_code, %{}, d) {[val | acc], r} end) else {[], rest} end deserialize_field( :filter_responses, nil, Map.put(acc, :matching_acls, Enum.reverse(vals)), rest ) end defp deserialize_field(:root, :filter_responses, acc, data) do <> = data {vals, rest} = if num_elements > 0 do Enum.reduce(1..num_elements, {[], rest}, fn _ix, {acc, d} -> {val, r} = deserialize_field(:filter_responses, :error_code, %{}, d) {[val | acc], r} end) else {[], rest} end deserialize_field(:root, nil, Map.put(acc, :filter_responses, Enum.reverse(vals)), rest) end defp deserialize_field(_, nil, acc, rest) do {acc, rest} end end ( @doc "Deserializes raw wire data for this API with the given version" @spec deserialize(integer, binary) :: {response_t, binary} ) def deserialize(0, data) do V0.Response.deserialize(data) end def deserialize(1, data) do V1.Response.deserialize(data) end ( @typedoc "Union type for all request structs for this API" @type request_t :: Kayrock.DeleteAcls.V1.Request.t() | Kayrock.DeleteAcls.V0.Request.t() ) ( @typedoc "Union type for all response structs for this API" @type response_t :: Kayrock.DeleteAcls.V1.Response.t() | Kayrock.DeleteAcls.V0.Response.t() ) ( @doc "Returns the minimum version of this API supported by Kayrock (#{@vmin})" @spec min_vsn :: integer def min_vsn do 0 end ) ( @doc "Returns the maximum version of this API supported by Kayrock (#{@vmax})" @spec max_vsn :: integer def max_vsn do 1 end ) end