diff options
author | Ed Tanous <ed@tanous.net> | 2024-04-07 02:03:49 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2024-04-11 19:38:16 +0300 |
commit | 4a7fbefdff330f06d5698a1e60ce893225cd389e (patch) | |
tree | 036f2c7795de1d48d06834d6b0ccbe1d0d5c9e79 | |
parent | d9e89dfd49538c54d280dce3750f4af264cfd5fc (diff) | |
download | bmcweb-4a7fbefdff330f06d5698a1e60ce893225cd389e.tar.xz |
Fix large copies with url_view and segments_view
Despite these objects being called "view" they are still relatively
large, as clang-tidy correctly flags, and we ignore.
Change all function uses to capture by:
const boost::urls::url_view_base&
Which is the base class of all boost URL types, and any class (url,
url_view, etc) is convertible to that base.
Change-Id: I8ee2ea3f4cfba38331303a7e4eb520a2b6f8ba92
Signed-off-by: Ed Tanous <ed@tanous.net>
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | http/http_client.hpp | 13 | ||||
-rw-r--r-- | http/logging.hpp | 21 | ||||
-rw-r--r-- | http/utility.hpp | 37 | ||||
-rw-r--r-- | include/event_service_store.hpp | 1 | ||||
-rw-r--r-- | redfish-core/include/error_messages.hpp | 61 | ||||
-rw-r--r-- | redfish-core/include/event_service_manager.hpp | 4 | ||||
-rw-r--r-- | redfish-core/include/redfish_aggregator.hpp | 14 | ||||
-rw-r--r-- | redfish-core/lib/trigger.hpp | 2 | ||||
-rw-r--r-- | redfish-core/lib/virtual_media.hpp | 3 | ||||
-rw-r--r-- | redfish-core/src/error_messages.cpp | 61 |
11 files changed, 108 insertions, 110 deletions
diff --git a/.clang-tidy b/.clang-tidy index 0027ca00b2..41643f5fcd 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -357,6 +357,5 @@ CheckOptions: - { key: readability-identifier-naming.FunctionIgnoredRegexp, value: (BMCWEB_LOG_DEBUG|BMCWEB_LOG_INFO|BMCWEB_LOG_WARNING|BMCWEB_LOG_ERROR|BMCWEB_LOG_CRITICAL) } - { key: readability-identifier-naming.StructIgnoredRegexp, value: (BMCWEB_LOG_DEBUG|BMCWEB_LOG_INFO|BMCWEB_LOG_WARNING|BMCWEB_LOG_ERROR|BMCWEB_LOG_CRITICAL) } - { key: cppcoreguidelines-macro-usage.AllowedRegexp, value: DEBUG*|NLOHMANN_JSON_SERIALIZE_ENUM } - - { key: performance-unnecessary-value-param.AllowedTypes, value: ((segments_view)|(url_view)) } - { key: cppcoreguidelines-rvalue-reference-param-not-moved.IgnoreUnnamedParams, value: true } - { key: misc-include-cleaner.IgnoreHeaders, value: ((nlohmann/json_fwd.hpp)|(boost/.*/src.hpp)|(boost/.*/detail/.*)|(nlohmann/detail/.*)|(stdio.h)|(ranges)|(bits/chrono.h)|(boost/system/error_code.hpp)) } diff --git a/http/http_client.hpp b/http/http_client.hpp index 59804789ee..75304f69a1 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp @@ -41,7 +41,7 @@ #include <boost/system/error_code.hpp> #include <boost/url/format.hpp> #include <boost/url/url.hpp> -#include <boost/url/url_view.hpp> +#include <boost/url/url_view_base.hpp> #include <cstdlib> #include <functional> @@ -637,7 +637,7 @@ class ConnectionInfo : public std::enable_shared_from_this<ConnectionInfo> explicit ConnectionInfo( boost::asio::io_context& iocIn, const std::string& idIn, const std::shared_ptr<ConnectionPolicy>& connPolicyIn, - boost::urls::url_view hostIn, unsigned int connIdIn) : + const boost::urls::url_view_base& hostIn, unsigned int connIdIn) : subId(idIn), connPolicy(connPolicyIn), host(hostIn), connId(connIdIn), ioc(iocIn), resolver(iocIn), conn(iocIn), timer(iocIn) @@ -728,7 +728,7 @@ class ConnectionPool : public std::enable_shared_from_this<ConnectionPool> } } - void sendData(std::string&& data, boost::urls::url_view destUri, + void sendData(std::string&& data, const boost::urls::url_view_base& destUri, const boost::beast::http::fields& httpHeader, const boost::beast::http::verb verb, const std::function<void(Response&)>& resHandler) @@ -836,7 +836,7 @@ class ConnectionPool : public std::enable_shared_from_this<ConnectionPool> explicit ConnectionPool( boost::asio::io_context& iocIn, const std::string& idIn, const std::shared_ptr<ConnectionPolicy>& connPolicyIn, - boost::urls::url_view destIPIn) : + const boost::urls::url_view_base& destIPIn) : ioc(iocIn), id(idIn), connPolicy(connPolicyIn), destIP(destIPIn) { @@ -879,7 +879,7 @@ class HttpClient // Send a request to destIP where additional processing of the // result is not required - void sendData(std::string&& data, boost::urls::url_view destUri, + void sendData(std::string&& data, const boost::urls::url_view_base& destUri, const boost::beast::http::fields& httpHeader, const boost::beast::http::verb verb) { @@ -889,7 +889,8 @@ class HttpClient // Send request to destIP and use the provided callback to // handle the response - void sendDataWithCallback(std::string&& data, boost::urls::url_view destUrl, + void sendDataWithCallback(std::string&& data, + const boost::urls::url_view_base& destUrl, const boost::beast::http::fields& httpHeader, const boost::beast::http::verb verb, const std::function<void(Response&)>& resHandler) diff --git a/http/logging.hpp b/http/logging.hpp index 2f88c90b14..de14d99e8f 100644 --- a/http/logging.hpp +++ b/http/logging.hpp @@ -5,7 +5,7 @@ #include <boost/system/error_code.hpp> #include <boost/url/pct_string_view.hpp> #include <boost/url/string_view.hpp> -#include <boost/url/url.hpp> +#include <boost/url/url_view_base.hpp> #include <nlohmann/json.hpp> #include <bit> @@ -46,27 +46,14 @@ struct std::formatter<boost::urls::pct_string_view> } }; -template <> -struct std::formatter<boost::urls::url_view> -{ - constexpr auto parse(std::format_parse_context& ctx) - { - return ctx.begin(); - } - auto format(const boost::urls::url& msg, auto& ctx) const - { - return std::format_to(ctx.out(), "{}", std::string_view(msg.buffer())); - } -}; - -template <> -struct std::formatter<boost::urls::url> +template <std::derived_from<boost::urls::url_view_base> URL> +struct std::formatter<URL> { constexpr auto parse(std::format_parse_context& ctx) { return ctx.begin(); } - auto format(const boost::urls::url& msg, auto& ctx) const + auto format(const URL& msg, auto& ctx) const { return std::format_to(ctx.out(), "{}", std::string_view(msg.buffer())); } diff --git a/http/utility.hpp b/http/utility.hpp index 7633c395af..5a2dc67d5b 100644 --- a/http/utility.hpp +++ b/http/utility.hpp @@ -8,6 +8,7 @@ #include <boost/url/parse.hpp> #include <boost/url/url.hpp> #include <boost/url/url_view.hpp> +#include <boost/url/url_view_base.hpp> #include <nlohmann/json.hpp> #include <array> @@ -398,18 +399,18 @@ class UrlSegmentMatcherVisitor std::string_view segment; }; -inline bool readUrlSegments(boost::urls::url_view url, +inline bool readUrlSegments(const boost::urls::url_view_base& url, std::initializer_list<UrlSegment> segments) { - boost::urls::segments_view urlSegments = url.segments(); + const boost::urls::segments_view& urlSegments = url.segments(); if (!urlSegments.is_absolute()) { return false; } - boost::urls::segments_view::iterator it = urlSegments.begin(); - boost::urls::segments_view::iterator end = urlSegments.end(); + boost::urls::segments_view::const_iterator it = urlSegments.begin(); + boost::urls::segments_view::const_iterator end = urlSegments.end(); for (const auto& segment : segments) { @@ -442,16 +443,17 @@ inline bool readUrlSegments(boost::urls::url_view url, } // namespace details template <typename... Args> -inline bool readUrlSegments(boost::urls::url_view url, Args&&... args) +inline bool readUrlSegments(const boost::urls::url_view_base& url, + Args&&... args) { return details::readUrlSegments(url, {std::forward<Args>(args)...}); } -inline boost::urls::url replaceUrlSegment(boost::urls::url_view urlView, - const uint replaceLoc, - std::string_view newSegment) +inline boost::urls::url + replaceUrlSegment(const boost::urls::url_view_base& urlView, + const uint replaceLoc, std::string_view newSegment) { - boost::urls::segments_view urlSegments = urlView.segments(); + const boost::urls::segments_view& urlSegments = urlView.segments(); boost::urls::url url("/"); if (!urlSegments.is_absolute()) @@ -533,22 +535,11 @@ inline void setPortDefaults(boost::urls::url& url) namespace nlohmann { -template <> -struct adl_serializer<boost::urls::url> -{ - // nlohmann requires a specific casing to look these up in adl - // NOLINTNEXTLINE(readability-identifier-naming) - static void to_json(json& j, const boost::urls::url& url) - { - j = url.buffer(); - } -}; - -template <> -struct adl_serializer<boost::urls::url_view> +template <std::derived_from<boost::urls::url_view_base> URL> +struct adl_serializer<URL> { // NOLINTNEXTLINE(readability-identifier-naming) - static void to_json(json& j, boost::urls::url_view url) + static void to_json(json& j, const URL& url) { j = url.buffer(); } diff --git a/include/event_service_store.hpp b/include/event_service_store.hpp index 522227b61c..f03bd7908f 100644 --- a/include/event_service_store.hpp +++ b/include/event_service_store.hpp @@ -4,6 +4,7 @@ #include <boost/beast/http/fields.hpp> #include <boost/container/flat_map.hpp> #include <boost/url/parse.hpp> +#include <boost/url/url.hpp> #include <nlohmann/json.hpp> namespace persistent_data diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp index 91edc3c7cb..b692edaa78 100644 --- a/redfish-core/include/error_messages.hpp +++ b/redfish-core/include/error_messages.hpp @@ -17,7 +17,7 @@ #include "http_response.hpp" -#include <boost/url/url_view.hpp> +#include <boost/url/url_view_base.hpp> #include <nlohmann/json.hpp> #include <cstdint> @@ -71,9 +71,10 @@ void malformedJSON(crow::Response& res); * @param[in] arg1 Parameter of message that will replace %1 in its body. * * @returns Message ResourceMissingAtURI formatted to JSON */ -nlohmann::json resourceMissingAtURI(boost::urls::url_view arg1); +nlohmann::json resourceMissingAtURI(const boost::urls::url_view_base& arg1); -void resourceMissingAtURI(crow::Response& res, boost::urls::url_view arg1); +void resourceMissingAtURI(crow::Response& res, + const boost::urls::url_view_base& arg1); /** * @brief Formats ActionParameterValueFormatError message into JSON @@ -144,10 +145,11 @@ void unrecognizedRequestBody(crow::Response& res); * @param[in] arg2 Parameter of message that will replace %2 in its body. * * @returns Message ResourceAtUriUnauthorized formatted to JSON */ -nlohmann::json resourceAtUriUnauthorized(boost::urls::url_view arg1, +nlohmann::json resourceAtUriUnauthorized(const boost::urls::url_view_base& arg1, std::string_view arg2); -void resourceAtUriUnauthorized(crow::Response& res, boost::urls::url_view arg1, +void resourceAtUriUnauthorized(crow::Response& res, + const boost::urls::url_view_base& arg1, std::string_view arg2); /** @@ -292,10 +294,11 @@ void propertyValueOutOfRange(crow::Response& res, const nlohmann::json& arg1, * @param[in] arg1 Parameter of message that will replace %1 in its body. * * @returns Message ResourceAtUriInUnknownFormat formatted to JSON */ -nlohmann::json resourceAtUriInUnknownFormat(boost::urls::url_view arg1); +nlohmann::json + resourceAtUriInUnknownFormat(const boost::urls::url_view_base& arg1); void resourceAtUriInUnknownFormat(crow::Response& res, - boost::urls::url_view arg1); + const boost::urls::url_view_base& arg1); /** * @brief Formats ServiceDisabled message into JSON @@ -402,9 +405,10 @@ void resourceTypeIncompatible(crow::Response& res, std::string_view arg1, * @param[in] arg2 Parameter of message that will replace %2 in its body. * * @returns Message ResetRequired formatted to JSON */ -nlohmann::json resetRequired(boost::urls::url_view arg1, std::string_view arg2); +nlohmann::json resetRequired(const boost::urls::url_view_base& arg1, + std::string_view arg2); -void resetRequired(crow::Response& res, boost::urls::url_view arg1, +void resetRequired(crow::Response& res, const boost::urls::url_view_base& arg1, std::string_view arg2); /** @@ -457,13 +461,14 @@ void propertyValueConflict(crow::Response& res, std::string_view arg1, * @param[in] arg3 Parameter of message that will replace %3 in its body. * * @returns Message PropertyValueResourceConflict to JSON */ -nlohmann::json propertyValueResourceConflict(std::string_view arg1, - const nlohmann::json& arg2, - boost::urls::url_view arg3); +nlohmann::json + propertyValueResourceConflict(std::string_view arg1, + const nlohmann::json& arg2, + const boost::urls::url_view_base& arg3); void propertyValueResourceConflict(crow::Response& res, std::string_view arg1, const nlohmann::json& arg2, - boost::urls::url_view arg3); + const boost::urls::url_view_base& arg3); /** * @brief Formats PropertyValueExternalConflict message into JSON @@ -505,9 +510,10 @@ void propertyValueIncorrect(crow::Response& res, std::string_view arg1, * @param[in] arg1 Parameter of message that will replace %1 in its body. * * @returns Message ResourceCreationConflict formatted to JSON */ -nlohmann::json resourceCreationConflict(boost::urls::url_view arg1); +nlohmann::json resourceCreationConflict(const boost::urls::url_view_base& arg1); -void resourceCreationConflict(crow::Response& res, boost::urls::url_view arg1); +void resourceCreationConflict(crow::Response& res, + const boost::urls::url_view_base& arg1); /** * @brief Formats MaximumErrorsExceeded message into JSON @@ -600,10 +606,11 @@ void resourceNotFound(crow::Response& res, std::string_view arg1, * @param[in] arg1 Parameter of message that will replace %1 in its body. * * @returns Message CouldNotEstablishConnection formatted to JSON */ -nlohmann::json couldNotEstablishConnection(boost::urls::url_view arg1); +nlohmann::json + couldNotEstablishConnection(const boost::urls::url_view_base& arg1); void couldNotEstablishConnection(crow::Response& res, - boost::urls::url_view arg1); + const boost::urls::url_view_base& arg1); /** * @brief Formats PropertyNotWritable message into JSON @@ -683,11 +690,12 @@ void actionParameterNotSupported(crow::Response& res, std::string_view arg1, * @param[in] arg2 Parameter of message that will replace %2 in its body. * * @returns Message SourceDoesNotSupportProtocol formatted to JSON */ -nlohmann::json sourceDoesNotSupportProtocol(boost::urls::url_view arg1, - std::string_view arg2); +nlohmann::json + sourceDoesNotSupportProtocol(const boost::urls::url_view_base& arg1, + std::string_view arg2); void sourceDoesNotSupportProtocol(crow::Response& res, - boost::urls::url_view arg1, + const boost::urls::url_view_base& arg1, std::string_view arg2); /** @@ -719,9 +727,9 @@ void accountRemoved(crow::Response& res); * @param[in] arg1 Parameter of message that will replace %1 in its body. * * @returns Message AccessDenied formatted to JSON */ -nlohmann::json accessDenied(boost::urls::url_view arg1); +nlohmann::json accessDenied(const boost::urls::url_view_base& arg1); -void accessDenied(crow::Response& res, boost::urls::url_view arg1); +void accessDenied(crow::Response& res, const boost::urls::url_view_base& arg1); /** * @brief Formats QueryNotSupported message into JSON @@ -816,9 +824,9 @@ void noValidSession(crow::Response& res); * @param[in] arg1 Parameter of message that will replace %1 in its body. * * @returns Message InvalidObject formatted to JSON */ -nlohmann::json invalidObject(boost::urls::url_view arg1); +nlohmann::json invalidObject(const boost::urls::url_view_base& arg1); -void invalidObject(crow::Response& res, boost::urls::url_view arg1); +void invalidObject(crow::Response& res, const boost::urls::url_view_base& arg1); /** * @brief Formats ResourceInStandby message into JSON @@ -1055,9 +1063,10 @@ void queryParameterOutOfRange(crow::Response& res, std::string_view arg1, * * @returns Message PasswordChangeRequired formatted to JSON */ -nlohmann::json passwordChangeRequired(boost::urls::url_view arg1); +nlohmann::json passwordChangeRequired(const boost::urls::url_view_base& arg1); -void passwordChangeRequired(crow::Response& res, boost::urls::url_view arg1); +void passwordChangeRequired(crow::Response& res, + const boost::urls::url_view_base& arg1); /** * @brief Formats InvalidUpload message into JSON diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp index 679c4f6918..9872bf8410 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -32,6 +32,7 @@ #include <boost/asio/io_context.hpp> #include <boost/container/flat_map.hpp> #include <boost/url/format.hpp> +#include <boost/url/url_view_base.hpp> #include <sdbusplus/bus/match.hpp> #include <algorithm> @@ -355,7 +356,8 @@ class Subscription : public persistent_data::UserSubscription Subscription(Subscription&&) = delete; Subscription& operator=(Subscription&&) = delete; - Subscription(boost::urls::url_view url, boost::asio::io_context& ioc) : + Subscription(const boost::urls::url_view_base& url, + boost::asio::io_context& ioc) : policy(std::make_shared<crow::ConnectionPolicy>()) { destinationUrl = url; diff --git a/redfish-core/include/redfish_aggregator.hpp b/redfish-core/include/redfish_aggregator.hpp index f255b9f0a6..bc0300a1a9 100644 --- a/redfish-core/include/redfish_aggregator.hpp +++ b/redfish-core/include/redfish_aggregator.hpp @@ -202,7 +202,7 @@ static inline void addPrefixToStringItem(std::string& strValue, const boost::urls::segments_view urlSegments = thisUrl.segments(); bool addedPrefix = false; boost::urls::url url("/"); - boost::urls::segments_view::iterator it = urlSegments.begin(); + boost::urls::segments_view::const_iterator it = urlSegments.begin(); const boost::urls::segments_view::const_iterator end = urlSegments.end(); // Skip past the leading "/redfish/v1" @@ -671,9 +671,8 @@ class RedfishAggregator const boost::urls::segments_view urlSegments = thisReq.url().segments(); boost::urls::url currentUrl("/"); - boost::urls::segments_view::iterator it = urlSegments.begin(); - const boost::urls::segments_view::const_iterator end = - urlSegments.end(); + boost::urls::segments_view::const_iterator it = urlSegments.begin(); + boost::urls::segments_view::const_iterator end = urlSegments.end(); // Skip past the leading "/redfish/v1" it++; @@ -1188,7 +1187,7 @@ class RedfishAggregator { using crow::utility::OrMorePaths; using crow::utility::readUrlSegments; - const boost::urls::url_view url = thisReq.url(); + boost::urls::url_view url = thisReq.url(); // We don't need to aggregate JsonSchemas due to potential issues such // as version mismatches between aggregator and satellite BMCs. For @@ -1214,9 +1213,8 @@ class RedfishAggregator // /redfish/v1/UpdateService/FirmwareInventory const boost::urls::segments_view urlSegments = url.segments(); boost::urls::url currentUrl("/"); - boost::urls::segments_view::iterator it = urlSegments.begin(); - const boost::urls::segments_view::const_iterator end = - urlSegments.end(); + boost::urls::segments_view::const_iterator it = urlSegments.begin(); + boost::urls::segments_view::const_iterator end = urlSegments.end(); // Skip past the leading "/redfish/v1" it++; diff --git a/redfish-core/lib/trigger.hpp b/redfish-core/lib/trigger.hpp index 43ec77daf8..9ea886e641 100644 --- a/redfish-core/lib/trigger.hpp +++ b/redfish-core/lib/trigger.hpp @@ -546,7 +546,7 @@ inline bool parseMetricProperties(crow::Response& res, Context& ctx) size_t uriIdx = 0; for (const std::string& uriStr : *ctx.metricProperties) { - boost::system::result<boost::urls::url_view> uri = + boost::system::result<boost::urls::url> uri = boost::urls::parse_relative_ref(uriStr); if (!uri) { diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp index b03f323620..529b9dc5d9 100644 --- a/redfish-core/lib/virtual_media.hpp +++ b/redfish-core/lib/virtual_media.hpp @@ -28,6 +28,7 @@ #include <boost/process/async_pipe.hpp> #include <boost/url/format.hpp> #include <boost/url/url_view.hpp> +#include <boost/url/url_view_base.hpp> #include <array> #include <ranges> @@ -367,7 +368,7 @@ enum class TransferProtocol * */ inline std::optional<TransferProtocol> - getTransferProtocolFromUri(boost::urls::url_view imageUri) + getTransferProtocolFromUri(const boost::urls::url_view_base& imageUri) { std::string_view scheme = imageUri.scheme(); if (scheme == "smb") diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp index 7b0251562d..87293833fc 100644 --- a/redfish-core/src/error_messages.cpp +++ b/redfish-core/src/error_messages.cpp @@ -22,7 +22,7 @@ #include <boost/beast/http/field.hpp> #include <boost/beast/http/status.hpp> -#include <boost/url/url_view.hpp> +#include <boost/url/url_view_base.hpp> #include <nlohmann/json.hpp> #include <array> @@ -206,13 +206,14 @@ void malformedJSON(crow::Response& res) * See header file for more information * @endinternal */ -nlohmann::json resourceMissingAtURI(boost::urls::url_view arg1) +nlohmann::json resourceMissingAtURI(const boost::urls::url_view_base& arg1) { std::array<std::string_view, 1> args{arg1.buffer()}; return getLog(redfish::registries::base::Index::resourceMissingAtURI, args); } -void resourceMissingAtURI(crow::Response& res, boost::urls::url_view arg1) +void resourceMissingAtURI(crow::Response& res, + const boost::urls::url_view_base& arg1) { res.result(boost::beast::http::status::bad_request); addMessageToErrorJson(res.jsonValue, resourceMissingAtURI(arg1)); @@ -317,14 +318,15 @@ void unrecognizedRequestBody(crow::Response& res) * See header file for more information * @endinternal */ -nlohmann::json resourceAtUriUnauthorized(boost::urls::url_view arg1, +nlohmann::json resourceAtUriUnauthorized(const boost::urls::url_view_base& arg1, std::string_view arg2) { return getLog(redfish::registries::base::Index::resourceAtUriUnauthorized, std::to_array<std::string_view>({arg1.buffer(), arg2})); } -void resourceAtUriUnauthorized(crow::Response& res, boost::urls::url_view arg1, +void resourceAtUriUnauthorized(crow::Response& res, + const boost::urls::url_view_base& arg1, std::string_view arg2) { res.result(boost::beast::http::status::unauthorized); @@ -554,7 +556,8 @@ void propertyValueOutOfRange(crow::Response& res, const nlohmann::json& arg1, * See header file for more information * @endinternal */ -nlohmann::json resourceAtUriInUnknownFormat(boost::urls::url_view arg1) +nlohmann::json + resourceAtUriInUnknownFormat(const boost::urls::url_view_base& arg1) { return getLog( redfish::registries::base::Index::resourceAtUriInUnknownFormat, @@ -562,7 +565,7 @@ nlohmann::json resourceAtUriInUnknownFormat(boost::urls::url_view arg1) } void resourceAtUriInUnknownFormat(crow::Response& res, - boost::urls::url_view arg1) + const boost::urls::url_view_base& arg1) { res.result(boost::beast::http::status::bad_request); addMessageToErrorJson(res.jsonValue, resourceAtUriInUnknownFormat(arg1)); @@ -729,13 +732,14 @@ void resourceTypeIncompatible(crow::Response& res, std::string_view arg1, * See header file for more information * @endinternal */ -nlohmann::json resetRequired(boost::urls::url_view arg1, std::string_view arg2) +nlohmann::json resetRequired(const boost::urls::url_view_base& arg1, + std::string_view arg2) { return getLog(redfish::registries::base::Index::resetRequired, std::to_array<std::string_view>({arg1.buffer(), arg2})); } -void resetRequired(crow::Response& res, boost::urls::url_view arg1, +void resetRequired(crow::Response& res, const boost::urls::url_view_base& arg1, std::string_view arg2) { res.result(boost::beast::http::status::bad_request); @@ -809,9 +813,10 @@ void propertyValueConflict(crow::Response& res, std::string_view arg1, * See header file for more information * @endinternal */ -nlohmann::json propertyValueResourceConflict(std::string_view arg1, - const nlohmann::json& arg2, - boost::urls::url_view arg3) +nlohmann::json + propertyValueResourceConflict(std::string_view arg1, + const nlohmann::json& arg2, + const boost::urls::url_view_base& arg3) { std::string arg2Str = arg2.dump(2, ' ', true, nlohmann::json::error_handler_t::replace); @@ -823,7 +828,7 @@ nlohmann::json propertyValueResourceConflict(std::string_view arg1, void propertyValueResourceConflict(crow::Response& res, std::string_view arg1, const nlohmann::json& arg2, - boost::urls::url_view arg3) + const boost::urls::url_view_base& arg3) { res.result(boost::beast::http::status::conflict); addMessageToErrorJson(res.jsonValue, @@ -886,13 +891,14 @@ void propertyValueIncorrect(crow::Response& res, std::string_view arg1, * See header file for more information * @endinternal */ -nlohmann::json resourceCreationConflict(boost::urls::url_view arg1) +nlohmann::json resourceCreationConflict(const boost::urls::url_view_base& arg1) { return getLog(redfish::registries::base::Index::resourceCreationConflict, std::to_array<std::string_view>({arg1.buffer()})); } -void resourceCreationConflict(crow::Response& res, boost::urls::url_view arg1) +void resourceCreationConflict(crow::Response& res, + const boost::urls::url_view_base& arg1) { res.result(boost::beast::http::status::bad_request); addMessageToErrorJson(res.jsonValue, resourceCreationConflict(arg1)); @@ -1039,14 +1045,15 @@ void resourceNotFound(crow::Response& res, std::string_view arg1, * See header file for more information * @endinternal */ -nlohmann::json couldNotEstablishConnection(boost::urls::url_view arg1) +nlohmann::json + couldNotEstablishConnection(const boost::urls::url_view_base& arg1) { return getLog(redfish::registries::base::Index::couldNotEstablishConnection, std::to_array<std::string_view>({arg1.buffer()})); } void couldNotEstablishConnection(crow::Response& res, - boost::urls::url_view arg1) + const boost::urls::url_view_base& arg1) { res.result(boost::beast::http::status::not_found); addMessageToErrorJson(res.jsonValue, couldNotEstablishConnection(arg1)); @@ -1166,8 +1173,9 @@ void actionParameterNotSupported(crow::Response& res, std::string_view arg1, * See header file for more information * @endinternal */ -nlohmann::json sourceDoesNotSupportProtocol(boost::urls::url_view arg1, - std::string_view arg2) +nlohmann::json + sourceDoesNotSupportProtocol(const boost::urls::url_view_base& arg1, + std::string_view arg2) { return getLog( redfish::registries::base::Index::sourceDoesNotSupportProtocol, @@ -1175,7 +1183,7 @@ nlohmann::json sourceDoesNotSupportProtocol(boost::urls::url_view arg1, } void sourceDoesNotSupportProtocol(crow::Response& res, - boost::urls::url_view arg1, + const boost::urls::url_view_base& arg1, std::string_view arg2) { res.result(boost::beast::http::status::bad_request); @@ -1227,13 +1235,13 @@ void accountRemoved(crow::Response& res) * See header file for more information * @endinternal */ -nlohmann::json accessDenied(boost::urls::url_view arg1) +nlohmann::json accessDenied(const boost::urls::url_view_base& arg1) { return getLog(redfish::registries::base::Index::accessDenied, std::to_array<std::string_view>({arg1.buffer()})); } -void accessDenied(crow::Response& res, boost::urls::url_view arg1) +void accessDenied(crow::Response& res, const boost::urls::url_view_base& arg1) { res.result(boost::beast::http::status::forbidden); addMessageToErrorJson(res.jsonValue, accessDenied(arg1)); @@ -1394,13 +1402,13 @@ void noValidSession(crow::Response& res) * See header file for more information * @endinternal */ -nlohmann::json invalidObject(boost::urls::url_view arg1) +nlohmann::json invalidObject(const boost::urls::url_view_base& arg1) { return getLog(redfish::registries::base::Index::invalidObject, std::to_array<std::string_view>({arg1.buffer()})); } -void invalidObject(crow::Response& res, boost::urls::url_view arg1) +void invalidObject(crow::Response& res, const boost::urls::url_view_base& arg1) { res.result(boost::beast::http::status::bad_request); addMessageToErrorJson(res.jsonValue, invalidObject(arg1)); @@ -1771,7 +1779,7 @@ void queryParameterOutOfRange(crow::Response& res, std::string_view arg1, queryParameterOutOfRange(arg1, arg2, arg3)); } -nlohmann::json passwordChangeRequired(boost::urls::url_view arg1) +nlohmann::json passwordChangeRequired(const boost::urls::url_view_base& arg1) { return getLog(redfish::registries::base::Index::passwordChangeRequired, std::to_array<std::string_view>({arg1.buffer()})); @@ -1784,7 +1792,8 @@ nlohmann::json passwordChangeRequired(boost::urls::url_view arg1) * See header file for more information * @endinternal */ -void passwordChangeRequired(crow::Response& res, boost::urls::url_view arg1) +void passwordChangeRequired(crow::Response& res, + const boost::urls::url_view_base& arg1) { messages::addMessageToJsonRoot(res.jsonValue, passwordChangeRequired(arg1)); } |