X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frest%2Fmodel%2FSubscriptionParams_ClientEndpoint.h;fp=src%2Frest%2Fmodel%2FSubscriptionParams_ClientEndpoint.h;h=3d439974899c824b7f142ec41f5f923c4dfeb1f8;hb=a0bada6bf7af92d281c381092e7d6881c67d905f;hp=0000000000000000000000000000000000000000;hpb=488447aed60cc52b06d71d50bee4ecf10025f7e1;p=ric-plt%2Fxapp-frame-cpp.git diff --git a/src/rest/model/SubscriptionParams_ClientEndpoint.h b/src/rest/model/SubscriptionParams_ClientEndpoint.h new file mode 100644 index 0000000..3d43997 --- /dev/null +++ b/src/rest/model/SubscriptionParams_ClientEndpoint.h @@ -0,0 +1,65 @@ +#ifndef XAPP_MODEL_SubscriptionParams_ClientEndpoint_H +#define XAPP_MODEL_SubscriptionParams_ClientEndpoint_H +#include "ModelBase.h" + +namespace xapp { +namespace model { + +struct SubscriptionParams_ClientEndpoint: ModelBase { + int HTTPPort; + std::string Host; + int RMRPort; + json validator_schema = R"( + { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SubscriptionParams_ClientEndpoint", + "description": "xApp service address and port", + "properties": { + "HTTPPort": { + "description": "xApp HTTP service address port", + "type": "integer", + "minimum": 0, + "maximum": 65535 + }, + "Host": { + "description": "xApp service address name like service-ricxapp-xappname-http.ricxapp", + "type": "string" + }, + "RMRPort": { + "description": "xApp RMR service address port", + "type": "integer", + "minimum": 0, + "maximum": 65535 + } + }, + "required": [ + "HTTPPort", + "Host", + "RMRPort" + ], + "type": "object" + })"_json; + + virtual json get_validator_schema() const { return validator_schema; } +}; + +void from_json(const json& j, SubscriptionParams_ClientEndpoint& ref) { + + std::cout << __PRETTY_FUNCTION__ << std::endl; + ref.validate_json(j); + j.at("HTTPPort").get_to(ref.HTTPPort); + j.at("Host").get_to(ref.Host); + j.at("RMRPort").get_to(ref.RMRPort); +} + +void to_json(json& j, const SubscriptionParams_ClientEndpoint& ref) { + j = json { + {"HTTPPort", ref.HTTPPort}, + {"Host", ref.Host}, + {"RMRPort", ref.RMRPort}, + }; +} + +} /*namespace model*/ +} /*namespace xapp*/ +#endif /*XAPP_MODEL_SubscriptionParams_ClientEndpoint_H*/