mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
ARI: Deleting log channels
An http request can be sent to delete a log channel in Asterisk. The command "curl -v -u user:pass -X DELETE 'http://localhost:8088 /ari/asterisk/logging/mylog'" can be run in the terminal to access the newly implemented functionally for ARI. * Able to delete log channels using ARI ASTERISK-25252 Change-Id: Id6eeb54ebcc511595f0418d586ff55914bc3aae6
This commit is contained in:
@@ -366,18 +366,19 @@ int ast_ari_validate_log_channel(struct ast_json *json)
|
||||
{
|
||||
int res = 1;
|
||||
struct ast_json_iter *iter;
|
||||
int has_logging_levels = 0;
|
||||
int has_configuration = 0;
|
||||
int has_name = 0;
|
||||
int has_status = 0;
|
||||
int has_type = 0;
|
||||
|
||||
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
|
||||
if (strcmp("logging_levels", ast_json_object_iter_key(iter)) == 0) {
|
||||
if (strcmp("configuration", ast_json_object_iter_key(iter)) == 0) {
|
||||
int prop_is_valid;
|
||||
has_logging_levels = 1;
|
||||
prop_is_valid = ast_ari_validate_list(
|
||||
ast_json_object_iter_value(iter),
|
||||
ast_ari_validate_string);
|
||||
has_configuration = 1;
|
||||
prop_is_valid = ast_ari_validate_string(
|
||||
ast_json_object_iter_value(iter));
|
||||
if (!prop_is_valid) {
|
||||
ast_log(LOG_ERROR, "ARI LogChannel field logging_levels failed validation\n");
|
||||
ast_log(LOG_ERROR, "ARI LogChannel field configuration failed validation\n");
|
||||
res = 0;
|
||||
}
|
||||
} else
|
||||
@@ -391,6 +392,26 @@ int ast_ari_validate_log_channel(struct ast_json *json)
|
||||
res = 0;
|
||||
}
|
||||
} else
|
||||
if (strcmp("status", ast_json_object_iter_key(iter)) == 0) {
|
||||
int prop_is_valid;
|
||||
has_status = 1;
|
||||
prop_is_valid = ast_ari_validate_string(
|
||||
ast_json_object_iter_value(iter));
|
||||
if (!prop_is_valid) {
|
||||
ast_log(LOG_ERROR, "ARI LogChannel field status failed validation\n");
|
||||
res = 0;
|
||||
}
|
||||
} else
|
||||
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
|
||||
int prop_is_valid;
|
||||
has_type = 1;
|
||||
prop_is_valid = ast_ari_validate_string(
|
||||
ast_json_object_iter_value(iter));
|
||||
if (!prop_is_valid) {
|
||||
ast_log(LOG_ERROR, "ARI LogChannel field type failed validation\n");
|
||||
res = 0;
|
||||
}
|
||||
} else
|
||||
{
|
||||
ast_log(LOG_ERROR,
|
||||
"ARI LogChannel has undocumented field %s\n",
|
||||
@@ -399,8 +420,8 @@ int ast_ari_validate_log_channel(struct ast_json *json)
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_logging_levels) {
|
||||
ast_log(LOG_ERROR, "ARI LogChannel missing required field logging_levels\n");
|
||||
if (!has_configuration) {
|
||||
ast_log(LOG_ERROR, "ARI LogChannel missing required field configuration\n");
|
||||
res = 0;
|
||||
}
|
||||
|
||||
@@ -409,6 +430,16 @@ int ast_ari_validate_log_channel(struct ast_json *json)
|
||||
res = 0;
|
||||
}
|
||||
|
||||
if (!has_status) {
|
||||
ast_log(LOG_ERROR, "ARI LogChannel missing required field status\n");
|
||||
res = 0;
|
||||
}
|
||||
|
||||
if (!has_type) {
|
||||
ast_log(LOG_ERROR, "ARI LogChannel missing required field type\n");
|
||||
res = 0;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user