16 #ifndef THIRD_PARTY_TENSORFLOW_SERVING_MODEL_SERVERS_HTTP_REST_API_UTIL_H_
17 #define THIRD_PARTY_TENSORFLOW_SERVING_MODEL_SERVERS_HTTP_REST_API_UTIL_H_
22 #include "absl/strings/string_view.h"
23 #include "absl/types/optional.h"
25 #include "tensorflow/core/lib/core/status.h"
26 #include "tensorflow_serving/apis/get_model_metadata.pb.h"
27 #include "tensorflow_serving/apis/get_model_status.pb.h"
28 #include "tensorflow_serving/apis/model.pb.h"
30 namespace tensorflow {
33 const char*
const kHTTPRestApiHandlerPathRegex =
"(?i)/v1/.*";
35 void AddHeaders(std::vector<std::pair<string, string>>* headers);
37 void AddCORSHeaders(std::vector<std::pair<string, string>>* headers);
39 Status FillModelSpecWithNameVersionAndLabel(
40 const absl::string_view model_name,
41 const absl::optional<int64_t>& model_version,
42 const absl::optional<absl::string_view> model_version_label,
43 ::tensorflow::serving::ModelSpec* model_spec);
46 Status ParseModelInfo(
const absl::string_view http_method,
47 const absl::string_view request_path,
string* model_name,
48 absl::optional<int64_t>* model_version,
49 absl::optional<string>* model_version_label,
50 string* method,
string* model_subresource,
51 bool* parse_successful);
53 Status ToJsonString(
const GetModelStatusResponse& response,
string* output);
55 Status ToJsonString(
const GetModelMetadataResponse& response,
string* output);