I am receiving a WatchEvent message and the value stored in this kubernetes proto is -
- Type - for ex. event such as modified or added or deleted
- Object - raw bytes of actual object. Can be any object.
I want to convert those raw bytes to actual objects such as pod. Note that I know the kind name of that RawExtension runtime object.
Currently I was doing this but result is negative -
if( eventType == "ADDED" || eventType == "MODIFIED" )
{
WatchEvent watch;
watch.set_type( eventType );
string object = responseJson["object"].dump();
watch.mutable_object()->set_raw(object);
cout << "Message" << endl;
cout << watch.DebugString() << endl;
Pod pod;
JsonStringToMessage( watch.object().raw(), &pod );
cout << "Pod" << endl;
cout << pod.DebugString() << endl;
}