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;
 }

On Monday, 7 August, 2023 at 2:14:29 pm UTC+5:30 Sumit Patil wrote:

>
> I am receiving a WatchEvent message and the value stored in this 
> kubernetes proto is -
>
>    1. Type - for ex. event such as modified or added or deleted
>    2. 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; }
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/59f6ac9f-1299-41ba-a9e5-2768aa28a2c8n%40googlegroups.com.

Reply via email to