be/src/service/http/action/version_action.cpp
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #include "service/http/action/version_action.h" |
19 | | |
20 | | #include <string> |
21 | | |
22 | | #include "common/version_internal.h" |
23 | | #include "service/http/http_channel.h" |
24 | | #include "service/http/http_headers.h" |
25 | | #include "service/http/http_request.h" |
26 | | #include "service/http/http_status.h" |
27 | | #include "util/easy_json.h" |
28 | | |
29 | | namespace doris { |
30 | | |
31 | | const static std::string HEADER_JSON = "application/json"; |
32 | | |
33 | | VersionAction::VersionAction(ExecEnv* exec_env, TPrivilegeHier::type hier, |
34 | | TPrivilegeType::type type) |
35 | 8 | : HttpHandlerWithAuth(exec_env, hier, type) {} |
36 | | |
37 | 0 | void VersionAction::handle(HttpRequest* req) { |
38 | 0 | EasyJson be_version_info; |
39 | 0 | be_version_info["msg"] = "success"; |
40 | 0 | be_version_info["code"] = 0; |
41 | 0 | EasyJson data = be_version_info.Set("data", EasyJson::kObject); |
42 | 0 | EasyJson version_info = data.Set("beVersionInfo", EasyJson::kObject); |
43 | 0 | version_info["dorisBuildVersionPrefix"] = version::doris_build_version_prefix(); |
44 | 0 | version_info["dorisBuildVersionMajor"] = version::doris_build_version_major(); |
45 | 0 | version_info["dorisBuildVersionMinor"] = version::doris_build_version_minor(); |
46 | 0 | version_info["dorisBuildVersionPatch"] = version::doris_build_version_patch(); |
47 | 0 | version_info["dorisBuildVersionRcVersion"] = version::doris_build_version_rc_version(); |
48 | 0 | version_info["dorisBuildVersion"] = version::doris_build_version(); |
49 | 0 | version_info["dorisBuildHash"] = version::doris_build_hash(); |
50 | 0 | version_info["dorisBuildShortHash"] = version::doris_build_short_hash(); |
51 | 0 | version_info["dorisBuildTime"] = version::doris_build_time(); |
52 | 0 | version_info["dorisBuildInfo"] = version::doris_build_info(); |
53 | 0 | be_version_info["count"] = 0; |
54 | |
|
55 | 0 | req->add_output_header(HttpHeaders::CONTENT_TYPE, HEADER_JSON.c_str()); |
56 | 0 | HttpChannel::send_reply(req, HttpStatus::OK, be_version_info.ToString()); |
57 | 0 | } |
58 | | |
59 | | } // end namespace doris |