]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/jaeger-client-cpp/src/jaegertracing/baggage/RemoteRestrictionJSON.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / jaegertracing / jaeger-client-cpp / src / jaegertracing / baggage / RemoteRestrictionJSON.h
CommitLineData
f67539c2
TL
1/*
2 * Copyright (c) 2017 Uber Technologies, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef JAEGERTRACING_BAGGAGE_REMOTERESTRICTIONJSON_H
18#define JAEGERTRACING_BAGGAGE_REMOTERESTRICTIONJSON_H
19
20#include <cstdint>
21#include <nlohmann/json.hpp>
22#include <string>
23#include <vector>
24
25#include "jaegertracing/Compilers.h"
26#include "jaegertracing/thrift-gen/BaggageRestrictionManager.h"
27#include "jaegertracing/thrift-gen/baggage_types.h"
28
29namespace jaegertracing {
30namespace thrift {
31
32inline void to_json(nlohmann::json& json, const BaggageRestriction& restriction)
33{
34 json["baggageKey"] = restriction.baggageKey;
35 json["maxValueLength"] = restriction.maxValueLength;
36}
37
38inline void from_json(const nlohmann::json& json,
39 BaggageRestriction& restriction)
40{
41 restriction.__set_baggageKey(json.at("baggageKey"));
42 restriction.__set_maxValueLength(json.at("maxValueLength"));
43}
44
45using BaggageRestrictionList =
46 BaggageRestrictionManager_getBaggageRestrictions_result;
47
48inline void to_json(nlohmann::json& json, const BaggageRestrictionList& list)
49{
50 json = list.success;
51}
52
53inline void from_json(const nlohmann::json& json, BaggageRestrictionList& list)
54{
55 list.success = json.get<std::vector<BaggageRestriction>>();
56 list.__isset.success = true;
57}
58
59} // namespace thrift
60} // namespace jaegertracing
61
62#endif // JAEGERTRACING_BAGGAGE_REMOTERESTRICTIONJSON_H