Fix wrong commands json docs for CLIENT KILL (#10970)

The docs state that there is a new and an old argument format.
The current state of the arguments allows mixing the old and new format,
thus the need for two additional oneof blocks.
One for differentiating the new from the old format and then one to
allow setting multiple filters using the new format.
This commit is contained in:
Rudi Floren 2022-08-01 14:52:40 +02:00 committed by GitHub
parent e13b681874
commit 4ce3fd51b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 95 additions and 70 deletions

View File

@ -820,8 +820,8 @@ commandHistory CLIENT_KILL_History[] = {
/* CLIENT KILL tips */ /* CLIENT KILL tips */
#define CLIENT_KILL_tips NULL #define CLIENT_KILL_tips NULL
/* CLIENT KILL normal_master_slave_pubsub argument table */ /* CLIENT KILL filter new_format normal_master_slave_pubsub argument table */
struct redisCommandArg CLIENT_KILL_normal_master_slave_pubsub_Subargs[] = { struct redisCommandArg CLIENT_KILL_filter_new_format_normal_master_slave_pubsub_Subargs[] = {
{"normal",ARG_TYPE_PURE_TOKEN,-1,"NORMAL",NULL,NULL,CMD_ARG_NONE}, {"normal",ARG_TYPE_PURE_TOKEN,-1,"NORMAL",NULL,NULL,CMD_ARG_NONE},
{"master",ARG_TYPE_PURE_TOKEN,-1,"MASTER",NULL,"3.2.0",CMD_ARG_NONE}, {"master",ARG_TYPE_PURE_TOKEN,-1,"MASTER",NULL,"3.2.0",CMD_ARG_NONE},
{"slave",ARG_TYPE_PURE_TOKEN,-1,"SLAVE",NULL,NULL,CMD_ARG_NONE}, {"slave",ARG_TYPE_PURE_TOKEN,-1,"SLAVE",NULL,NULL,CMD_ARG_NONE},
@ -830,11 +830,10 @@ struct redisCommandArg CLIENT_KILL_normal_master_slave_pubsub_Subargs[] = {
{0} {0}
}; };
/* CLIENT KILL argument table */ /* CLIENT KILL filter new_format argument table */
struct redisCommandArg CLIENT_KILL_Args[] = { struct redisCommandArg CLIENT_KILL_filter_new_format_Subargs[] = {
{"ip:port",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL},
{"client-id",ARG_TYPE_INTEGER,-1,"ID",NULL,"2.8.12",CMD_ARG_OPTIONAL}, {"client-id",ARG_TYPE_INTEGER,-1,"ID",NULL,"2.8.12",CMD_ARG_OPTIONAL},
{"normal_master_slave_pubsub",ARG_TYPE_ONEOF,-1,"TYPE",NULL,"2.8.12",CMD_ARG_OPTIONAL,.subargs=CLIENT_KILL_normal_master_slave_pubsub_Subargs}, {"normal_master_slave_pubsub",ARG_TYPE_ONEOF,-1,"TYPE",NULL,"2.8.12",CMD_ARG_OPTIONAL,.subargs=CLIENT_KILL_filter_new_format_normal_master_slave_pubsub_Subargs},
{"username",ARG_TYPE_STRING,-1,"USER",NULL,NULL,CMD_ARG_OPTIONAL}, {"username",ARG_TYPE_STRING,-1,"USER",NULL,NULL,CMD_ARG_OPTIONAL},
{"ip:port",ARG_TYPE_STRING,-1,"ADDR",NULL,NULL,CMD_ARG_OPTIONAL}, {"ip:port",ARG_TYPE_STRING,-1,"ADDR",NULL,NULL,CMD_ARG_OPTIONAL},
{"ip:port",ARG_TYPE_STRING,-1,"LADDR",NULL,"6.2.0",CMD_ARG_OPTIONAL}, {"ip:port",ARG_TYPE_STRING,-1,"LADDR",NULL,"6.2.0",CMD_ARG_OPTIONAL},
@ -842,6 +841,19 @@ struct redisCommandArg CLIENT_KILL_Args[] = {
{0} {0}
}; };
/* CLIENT KILL filter argument table */
struct redisCommandArg CLIENT_KILL_filter_Subargs[] = {
{"ip:port",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE,.deprecated_since="2.8.12"},
{"new-format",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_MULTIPLE,.subargs=CLIENT_KILL_filter_new_format_Subargs},
{0}
};
/* CLIENT KILL argument table */
struct redisCommandArg CLIENT_KILL_Args[] = {
{"filter",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_NONE,.subargs=CLIENT_KILL_filter_Subargs},
{0}
};
/********** CLIENT LIST ********************/ /********** CLIENT LIST ********************/
/* CLIENT LIST history */ /* CLIENT LIST history */

View File

@ -39,12 +39,21 @@
"acl_categories": [ "acl_categories": [
"CONNECTION" "CONNECTION"
], ],
"arguments": [
{
"name": "filter",
"type": "oneof",
"arguments": [ "arguments": [
{ {
"name": "ip:port", "name": "ip:port",
"type": "string", "type": "string",
"optional": true "deprecated_since": "2.8.12"
}, },
{
"name": "new-format",
"type": "oneof",
"multiple": true,
"arguments": [
{ {
"token": "ID", "token": "ID",
"name": "client-id", "name": "client-id",
@ -115,4 +124,8 @@
} }
] ]
} }
]
}
]
}
} }