blob: 69aa958d4f218fa800841f2a92984afa35cd806c [file] [log] [blame]
#ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_REDFISH_VERB_H_
#define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_REDFISH_VERB_H_
#include <cstddef>
#include <cstdint>
#include <iostream> //NOLINT, include so that boost::beast can build.
#include <optional>
#include <string_view>
#include "boost/beast/http/verb.hpp" //NOLINT
namespace milotic_tlbmc {
enum class HttpVerb : uint8_t {
kDelete = 0,
kGet,
kHead,
kOptions,
kPatch,
kPost,
kPut,
kMax,
};
static constexpr size_t kMaxVerbIndex =
static_cast<size_t>(HttpVerb::kMax) - 1U;
// `kMaxVerbIndex` + 1 is designated as the "not found" verb. It is done this
// way to keep the BaseRule as a single bitfield (thus keeping the struct small)
// while still having a way to declare a route a "not found" route.
static constexpr const size_t kNotFoundIndex = kMaxVerbIndex + 1;
static constexpr const size_t kMethodNotAllowedIndex = kNotFoundIndex + 1;
std::optional<HttpVerb> HttpVerbFromBoost(boost::beast::http::verb verb);
std::string_view HttpVerbToString(HttpVerb verb);
std::string_view BoostVerbToString(boost::beast::http::verb verb);
} // namespace milotic_tlbmc
#endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_REDFISH_VERB_H_