diff --git a/libs/rest/src/ecflow/http/ApiV1Impl.cpp b/libs/rest/src/ecflow/http/ApiV1Impl.cpp index e39e7f721..9a4bcfbbb 100644 --- a/libs/rest/src/ecflow/http/ApiV1Impl.cpp +++ b/libs/rest/src/ecflow/http/ApiV1Impl.cpp @@ -256,6 +256,8 @@ ojson get_node_attributes(const std::string& path) { j["autocancel"] = node->get_autocancel(); j["autoarchive"] = node->get_autoarchive(); j["autorestore"] = node->get_autorestore(); + j["avisos"] = node->avisos(); + j["mirrors"] = node->mirrors(); { // Collect 'normal' variables @@ -612,6 +614,14 @@ ojson add_node_attribute(const httplib::Request& request) { std::string value_ = (value == "true" || value == "set") ? "set" : "clear"; client->alter(path, "change", "event", name, value_); } + else if (type == "aviso") { + const std::string name = payload.at("name"); + client->alter(path, "add", "aviso", name, value); + } + else if (type == "mirror") { + const std::string name = payload.at("name"); + client->alter(path, "add", "mirror", name, value); + } else if (type == "cron") { add_attribute_to_path(ecf::CronAttr::create(value), request); } @@ -729,6 +739,10 @@ ojson update_node_attribute_by_user(const httplib::Request& request) { client->alter(path, "delete", type, old_value); client->alter(path, "add", type, value); } + else if (type == "aviso" || type == "mirror") { + const std::string value = json_type_to_string(payload.at("value")); + client->alter(path, "change", type, value); + } else if (type == "autocancel") { const std::string value = json_type_to_string(payload.at("value")); update_attribute_in_path(create_from_text(value), type, request); diff --git a/libs/rest/src/ecflow/http/TreeGeneration.hpp b/libs/rest/src/ecflow/http/TreeGeneration.hpp index d1c8cb086..8d224b54f 100644 --- a/libs/rest/src/ecflow/http/TreeGeneration.hpp +++ b/libs/rest/src/ecflow/http/TreeGeneration.hpp @@ -239,6 +239,13 @@ struct FullTree if (auto flag = node.get_flag(); flag.flag()) { array.emplace_back(publish_atribute(flag, "flag")); } + + for (const auto& aviso : node.avisos()) { + array.emplace_back(publish_atribute(aviso, "aviso")); + } + for (const auto& mirror : node.mirrors()) { + array.emplace_back(publish_atribute(mirror, "mirror")); + } } private: diff --git a/libs/rest/src/ecflow/http/TypeToJson.cpp b/libs/rest/src/ecflow/http/TypeToJson.cpp index 7f3135fee..ffcc9604c 100644 --- a/libs/rest/src/ecflow/http/TypeToJson.cpp +++ b/libs/rest/src/ecflow/http/TypeToJson.cpp @@ -352,4 +352,21 @@ void to_json(ojson& j, const ecf::AutoArchiveAttr& a) { j["value"] = value; } +void to_json(ojson& j, const ecf::AvisoAttr& a) { + j["name"] = a.name(); + j["listener"] = a.listener(); + j["url"] = a.url(); + j["schema"] = a.schema(); + j["polling"] = a.polling(); +} + +void to_json(ojson& j, const ecf::MirrorAttr& a) { + j["name"] = a.name(); + j["remote_path"] = a.remote_path(); + j["remote_host"] = a.remote_host(); + j["remote_port"] = a.remote_port(); + j["polling"] = a.polling(); + j["ssl"] = a.ssl(); +} + } // namespace ecf diff --git a/libs/rest/src/ecflow/http/TypeToJson.hpp b/libs/rest/src/ecflow/http/TypeToJson.hpp index b39d4665e..09160abd2 100644 --- a/libs/rest/src/ecflow/http/TypeToJson.hpp +++ b/libs/rest/src/ecflow/http/TypeToJson.hpp @@ -30,11 +30,13 @@ #include "ecflow/core/TimeSlot.hpp" #include "ecflow/http/JSON.hpp" #include "ecflow/node/AutoRestoreAttr.hpp" +#include "ecflow/node/AvisoAttr.hpp" #include "ecflow/node/Expression.hpp" #include "ecflow/node/Flag.hpp" #include "ecflow/node/InLimit.hpp" #include "ecflow/node/Limit.hpp" #include "ecflow/node/LimitFwd.hpp" +#include "ecflow/node/MirrorAttr.hpp" /** * IMPORTANT @@ -82,6 +84,8 @@ void to_json(ecf::http::ojson&, const ecf::AutoArchiveAttr*); void to_json(ecf::http::ojson&, const ecf::AutoArchiveAttr&); void to_json(ecf::http::ojson&, const ecf::AutoRestoreAttr*); void to_json(ecf::http::ojson&, const ecf::AutoRestoreAttr&); +void to_json(ecf::http::ojson&, const ecf::AvisoAttr&); +void to_json(ecf::http::ojson&, const ecf::MirrorAttr&); } // namespace ecf #endif /* ecflow_http_TypeToJson_HPP */