Skip to content

Commit

Permalink
generate: migrate config describing/altering to enums
Browse files Browse the repository at this point in the history
Besides ErrorCode, there may be one or two enums lurking out there.
Known:
  - Op on incremental alter, but I don't think this is worth switching?
  - Mechanism on the new SCRAM apis.
  • Loading branch information
twmb committed Oct 9, 2020
1 parent afcef94 commit a3d9d62
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 32 deletions.
33 changes: 7 additions & 26 deletions generate/definitions/32_describe_configs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ DescribeConfigsRequest => key 32, max version 3
// Resources is a list of resources to describe.
Resources: [=>]
// ResourceType is an enum corresponding to the type of config to describe.
// Valid values are 2 (topic), 4 (broker), or 8 (broker logger).
ResourceType: int8
ResourceType: enum-ConfigResourceType
// ResourceName is the name of config to describe.
//
// If the requested type is a topic, this corresponds to a topic name.
Expand Down Expand Up @@ -53,7 +52,7 @@ DescribeConfigsResponse =>
// ErrorMessage is an informative message if the describe config failed.
ErrorMessage: nullable-string
// ResourceType is the enum corresponding to the type of described config.
ResourceType: int8
ResourceType: enum-ConfigResourceType
// ResourceName is the name corresponding to the describe config request.
ResourceName: string
// Configs contains information about key/value config pairs for
Expand All @@ -69,24 +68,8 @@ DescribeConfigsResponse =>
// IsDefault is whether this is a default config option. This has been
// replaced in favor of Source.
IsDefault: bool // v0-v0
// Source is where this config entry is from. Note that if there
// are no config synonyms, the source is DEFAULT_CONFIG. The values of
// this enum are as follows.
//
// UNKNOWN (0): unknown; e.g. an altar request was issued with no source set
//
// DYNAMIC_TOPIC_CONFIG (1): dynamic topic config for a specific topic
//
// DYNAMIC_BROKER_CONFIG (2): dynamic broker config for a specific broker
//
// DYNAMIC_DEFAULT_BROKER_CONFIG (3): dynamic broker config used as the default for all brokers in a cluster
//
// STATIC_BROKER_CONFIG (4): static broker config provided at start up
//
// DEFAULT_CONFIG (5): built-in default configuration for those that have defaults
//
// DYNAMIC_BROKER_LOGGER_CONFIG (6): broker logger; see KIP 412.
Source: int8(-1) // v1+
// Source is where this config entry is from.
Source: enum-ConfigSource(-1) // v1+
// IsSensitive signifies whether this is a sensitive config key, which
// is either a password or an unknown type.
IsSensitive: bool
Expand All @@ -95,10 +78,8 @@ DescribeConfigsResponse =>
ConfigSynonyms: [=>] // v1+
Name: string
Value: nullable-string
Source: int8
// ConfigType specifies the configuration data type. The values of this
// enum are as follows: UNKNOWN (0), BOOLEAN (1), STRING (2), INT (3),
// SHORT (4), LONG (5), DOUBLE (6), LIST (7), CLASS (8), PASSWORD (9).
ConfigType: int8 // v3+
Source: enum-ConfigSource
// ConfigType specifies the configuration data type.
ConfigType: enum-ConfigType // v3+
// Documentation is optional documentation for the config entry.
Documentation: nullable-string // v3+
4 changes: 2 additions & 2 deletions generate/definitions/33_alter_configs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ AlterConfigsRequest => key 33, max version 1
Resources: [=>]
// ResourceType is an enum corresponding to the type of config to alter.
// The only two valid values are 2 (for topic) and 4 (for broker).
ResourceType: int8
ResourceType: enum-ConfigResourceType
// ResourceName is the name of config to alter.
//
// If the requested type is a topic, this corresponds to a topic name.
Expand Down Expand Up @@ -67,6 +67,6 @@ AlterConfigsResponse =>
// ErrorMessage is an informative message if the alter config failed.
ErrorMessage: nullable-string
// ResourceType is the enum corresponding to the type of altered config.
ResourceType: int8
ResourceType: enum-ConfigResourceType
// ResourceName is the name corresponding to the alter config request.
ResourceName: string
6 changes: 2 additions & 4 deletions generate/definitions/44_incremental_alter_configs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ IncrementalAlterConfigsRequest => key 44, max version 1, flexible v1+
// Resources is an array of configs to alter.
Resources: [=>]
// ResourceType is an enum corresponding to the type of config to alter.
// The possible valid values are 2 (for topic), 4 (for broker),
// and 8 (for broker logger).
ResourceType: int8
ResourceType: enum-ConfigResourceType
// ResourceName is the name of config to alter.
//
// If the requested type is a topic, this corresponds to a topic name.
Expand Down Expand Up @@ -74,7 +72,7 @@ IncrementalAlterConfigsResponse =>
// ErrorMessage is an informative message if the incremental alter config failed.
ErrorMessage: nullable-string
// ResourceType is the enum corresponding to the type of altered config.
ResourceType: int8
ResourceType: enum-ConfigResourceType
// ResourceName is the name corresponding to the incremental alter config
// request.
ResourceName: string
41 changes: 41 additions & 0 deletions generate/definitions/enums
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
/////////////
// CONFIGS //
/////////////

// A type of config.
ConfigResourceType int8 (
2: TOPIC
4: BROKER
8: BROKER_LOGGER
)

// Where a config entry is from. If there are no config synonyms,
// the source is DEFAULT_CONFIG.
ConfigSource int8 (
// Dynamic topic config for a specific topic.
1: DYNAMIC_TOPIC_CONFIG
// Dynamic broker config for a specific broker.
2: DYNAMIC_BROKER_CONFIG
// Dynamic broker config used as the default for all brokers in a cluster.
3: DYNAMIC_DEFAULT_BROKER_CONFIG
// Static broker config provided at start up.
4: STATIC_BROKER_CONFIG
// Build-in default configuration for those that have defaults.
5: DEFAULT_CONFIG
// Broker logger; see KIP-412.
6: DYNAMIC_BROKER_LOGGER_CONFIG
)

// A configuration data type.
ConfigType int8 (
1: BOOLEAN
2: STRING
3: INT
4: SHORT
5: LONG
6: DOUBLE
7: LIST
8: CLASS
9: PASSWORD
)

//////////
// ACLS //
//////////
Expand Down

0 comments on commit a3d9d62

Please sign in to comment.