Re: [ovirt-users] Question about the ovirt-engine-sdk-java

------=_Part_258573_264923491.1445347258533 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Salifou, OK, i see now, then you have two options: a) To extend the sdk: 1. extend java-sdk by allowing to inject custom headers in every request=C2= =A0(not trivial as all ovirt SDKs are auto-generated,but if its common case= , you may find yourself getting help from community/maintainers) 2. fork java-sdk customizing it for your needs I'd recommend the former as fork will leave you with no support/maintenance= from community plus you'll haveto implement new=C2=A0features by your own = (what will become a moving target very quickly)=20 b) Proxying the sdk You can implement dynamic proxy wrapping SDK's HttpProxy.java#execute and i= ntercept the context from there,but you've to stay tuned as backward compat= ibility is for interface and not for SDK internals,so "potentially" you can= find your code broken in one of the following upgrades hope it helps.=C2=A0 On Monday, October 19, 2015 6:05 PM, Salifou Sidi M. Malick <ssidimah@= redhat.com> wrote: =20 Hi Micheal, Thanks for replying. Unfortunately the headers are dynamic ... Here is the story: We implemented a custom RHEV-M AAA module for a client in order to allow their custom portal to make RHEV-M API=20 calls.=20 The custom AAA module requires extra dynamic data in the HTTP=20 request (as request headers for now but request parameters=20 should be fine too).=20 Their is no problem if they go with the REST API, I am just=20 trying to anticipate/identify potential integration problem ... It seems like they will have to use the REST API or modify the=20 java sdk ...=C2=A0=20 Thanks a lot, Salifou ----- Original Message ----- From: "Michael Pasternak" <mishka8520@yahoo.com> To: "Salifou Sidi M. Malick" <ssidimah@redhat.com> Cc: "Users" <users@ovirt.org> Sent: Sunday, October 18, 2015 5:45:05 AM Subject: Re: Question about the ovirt-engine-sdk-java Hi=C2=A0Salifou, Actually java sdk is=C2=A0intentionally=C2=A0hiding transport level interna= ls so developers could stay in java domain,if your headers are static, easi= est way would be using reverse proxy in a middle to intercept requests,=C2= =A0 can you tell me why do you need this? =20 =C2=A0 =C2=A0 On Friday, October 16, 2015 1:14 AM, Salifou Sidi M. Malick <= ssidimah@redhat.com> wrote: =C2=A0=20 Hi Micheal, I have a question about the ovirt-engine-sdk-java. Is there a way to add custom request headers to each RHEVM API call? Here is an example of a request that I would like to do: $ curl -v -k \ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -H "ID: user1@ad.xyz.com" \ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -H "PASSWORD: Pwssd" \ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -H "TARGET: kobe" \ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 https://vm0.smalick.com/api/hosts I would like to add ID, PASSWORD and TARGET as HTTP request header.=20 Thanks, Salifou ------=_Part_258573_264923491.1445347258533 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <html><head></head><body><div style=3D"color:#000; background-color:#fff; f= ont-family:HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helve= tica, Arial, Lucida Grande, sans-serif;font-size:13px"><div id=3D"yiv936631= 0362"><div id=3D"yui_3_16_0_1_1445338067930_7276"><div style=3D"color:#000;= background-color:#fff;font-family:HelveticaNeue-Light, Helvetica Neue Light= , Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13p= x;" id=3D"yui_3_16_0_1_1445338067930_7275"><div dir=3D"ltr" id=3D"yiv936631= 0362yui_3_16_0_1_1445338067930_4283"><span class=3D"yiv9366310362" id=3D"yi= v9366310362yui_3_16_0_1_1445338067930_4296" style=3D"font-family:'Helvetica= Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;">Hi Sali= fou,</span><span></span></div><div dir=3D"ltr" id=3D"yiv9366310362yui_3_16_= 0_1_1445338067930_4283"><span class=3D"yiv9366310362" style=3D"font-family:= 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif= ;"><br clear=3D"none"></span></div><div dir=3D"ltr" id=3D"yiv9366310362yui_= 3_16_0_1_1445338067930_4283"><span class=3D"yiv9366310362" id=3D"yiv9366310= 362yui_3_16_0_1_1445338067930_4547" style=3D"font-family:'Helvetica Neue', = 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;">OK, i see now, = then you have two options:</span></div><div dir=3D"ltr" id=3D"yiv9366310362= yui_3_16_0_1_1445338067930_4283"><span class=3D"yiv9366310362" style=3D"fon= t-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', s= ans-serif;"><br clear=3D"none"></span></div><div dir=3D"ltr" id=3D"yiv93663= 10362yui_3_16_0_1_1445338067930_4283"><span class=3D"yiv9366310362" style= =3D"font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Gra= nde', sans-serif;" id=3D"yui_3_16_0_1_1445338067930_7286">a) To extend the = sdk:</span></div><div dir=3D"ltr" id=3D"yiv9366310362yui_3_16_0_1_144533806= 7930_4283"><span class=3D"yiv9366310362" style=3D"font-family:'Helvetica Ne= ue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;"><br clear= =3D"none"></span></div><div dir=3D"ltr" id=3D"yiv9366310362yui_3_16_0_1_144= 5338067930_4283"><span class=3D"yiv9366310362" id=3D"yiv9366310362yui_3_16_= 0_1_1445338067930_4800" style=3D"font-family:'Helvetica Neue', 'Segoe UI', = Helvetica, Arial, 'Lucida Grande', sans-serif;">1. extend java-sdk by allow= ing to inject custom headers in every request</span><span class=3D"yiv93663= 10362" style=3D"font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial= , 'Lucida Grande', sans-serif;"> </span><span id=3D"yui_3_16_0_1_14453= 38067930_8082" class=3D"" style=3D"font-family: 'Helvetica Neue', 'Segoe UI= ', Helvetica, Arial, 'Lucida Grande', sans-serif;">(not trivial as all ovir= t SDKs are auto-generated</span><span style=3D"font-family: 'Helvetica Neue= ', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;">,</span></di= v><div dir=3D"ltr" id=3D"yiv9366310362yui_3_16_0_1_1445338067930_4283"><spa= n style=3D"font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lu= cida Grande', sans-serif;" class=3D"" id=3D"yui_3_16_0_1_1445338067930_9090= ">but if its common case, you may find yourself getting help from community= /maintainers)</span></div><div dir=3D"ltr" id=3D"yiv9366310362yui_3_16_0_1_= 1445338067930_4283"><span style=3D"font-family: 'Helvetica Neue', 'Segoe UI= ', Helvetica, Arial, 'Lucida Grande', sans-serif;" class=3D""><br></span></= div><div dir=3D"ltr" id=3D"yiv9366310362yui_3_16_0_1_1445338067930_4283"><s= pan class=3D"yiv9366310362" id=3D"yiv9366310362yui_3_16_0_1_1445338067930_4= 801" style=3D"font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, '= Lucida Grande', sans-serif;">2. fork java-sdk customizing it for your needs= </span></div><div dir=3D"ltr" id=3D"yiv9366310362yui_3_16_0_1_1445338067930= _4283"><span class=3D"yiv9366310362" style=3D"font-family:'Helvetica Neue',= 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;"><br clear=3D"n= one"></span></div><div dir=3D"ltr" id=3D"yiv9366310362yui_3_16_0_1_14453380= 67930_4283"><span class=3D"yiv9366310362" id=3D"yiv9366310362yui_3_16_0_1_1= 445338067930_4974" style=3D"font-family:'Helvetica Neue', 'Segoe UI', Helve= tica, Arial, 'Lucida Grande', sans-serif;">I'd recommend the former as fork= will leave you with no support/maintenance from community plus you'll have= </span></div><div dir=3D"ltr" id=3D"yiv9366310362yui_3_16_0_1_1445338067930= _4283"><span class=3D"yiv9366310362" style=3D"font-family:'Helvetica Neue',= 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;" id=3D"yui_3_16= _0_1_1445338067930_7285">to implement new </span><span id=3D"yiv936631= 0362yui_3_16_0_1_1445338067930_5162" style=3D"font-family:'Helvetica Neue',= 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;">features by yo= ur own (what will become a moving target very quickly)</span></div> <br cl= ear=3D"none"><div class=3D"yiv9366310362qtdSeparateBR" id=3D"yui_3_16_0_1_1= 445338067930_7274" dir=3D"ltr">b) Proxying the sdk</div><div class=3D"yiv93= 66310362qtdSeparateBR" id=3D"yui_3_16_0_1_1445338067930_7274" dir=3D"ltr"><= br></div><div class=3D"yiv9366310362qtdSeparateBR" id=3D"yui_3_16_0_1_14453= 38067930_7274" dir=3D"ltr">You can implement dynamic proxy wrapping SDK's H= ttpProxy.java#execute and intercept the context from there,</div><div class= =3D"yiv9366310362qtdSeparateBR" id=3D"yui_3_16_0_1_1445338067930_7274" dir= =3D"ltr">but you've to stay tuned as backward compatibility is for interfac= e and not for SDK internals,</div><div class=3D"yiv9366310362qtdSeparateBR"= id=3D"yui_3_16_0_1_1445338067930_7274" dir=3D"ltr">so "potentially" you ca= n find your code broken in one of the following upgrades</div><div class=3D= "yiv9366310362qtdSeparateBR" id=3D"yui_3_16_0_1_1445338067930_7274" dir=3D"= ltr"><br></div><div class=3D"yiv9366310362qtdSeparateBR" id=3D"yui_3_16_0_1= _1445338067930_7274" dir=3D"ltr">hope it helps. <br clear=3D"none"><br= clear=3D"none"></div><div class=3D"yiv9366310362yqt0562777282" id=3D"yiv93= 66310362yqt81591"></div></div></div></div><div class=3D".yiv9366310362yahoo= _quoted" id=3D"yui_3_16_0_1_1445338067930_8533"> <div style=3D"font-family:= HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial= , Lucida Grande, sans-serif;font-size:13px;" id=3D"yui_3_16_0_1_14453380679= 30_8532"> <div style=3D"font-family:HelveticaNeue, Helvetica Neue, Helvetic= a, Arial, Lucida Grande, sans-serif;font-size:16px;" id=3D"yui_3_16_0_1_144= 5338067930_8531"> <div dir=3D"ltr" id=3D"yui_3_16_0_1_1445338067930_8554"> = <font size=3D"2" face=3D"Arial" id=3D"yui_3_16_0_1_1445338067930_8559"> On = Monday, October 19, 2015 6:05 PM, Salifou Sidi M. Malick <ssidimah@redha= t.com> wrote:<br clear=3D"none"> </font> </div> <br clear=3D"none"><br = clear=3D"none"> <div class=3D"yiv9366310362y_msg_container" id=3D"yui_3_16_= 0_1_1445338067930_8712">Hi Micheal,<br clear=3D"none"><br clear=3D"none">Th= anks for replying. Unfortunately the headers are dynamic ...<br clear=3D"no= ne"><br clear=3D"none">Here is the story:<br clear=3D"none"><br clear=3D"no= ne">We implemented a custom RHEV-M AAA module for a client<br clear=3D"none= ">in order to allow their custom portal to make RHEV-M API <br clear=3D"non= e">calls. <br clear=3D"none"><br clear=3D"none">The custom AAA module requi= res extra dynamic data in the HTTP <br clear=3D"none">request (as request h= eaders for now but request parameters <br clear=3D"none">should be fine too= ). <br clear=3D"none"><br clear=3D"none">Their is no problem if they go wit= h the REST API, I am just <br clear=3D"none">trying to anticipate/identify = potential integration problem ...<br clear=3D"none"><br clear=3D"none">It s= eems like they will have to use the REST API or modify the <br clear=3D"non= e">java sdk ... <br clear=3D"none"><br clear=3D"none">Thanks a lot,<b= r clear=3D"none">Salifou<br clear=3D"none"><br clear=3D"none"><div class=3D= "yiv9366310362yqt8023103542" id=3D"yiv9366310362yqtfd83808"><br clear=3D"no= ne">----- Original Message -----<br clear=3D"none">From: "Michael Pasternak= " <<a rel=3D"nofollow" shape=3D"rect" ymailto=3D"mailto:mishka8520@yahoo= .com" target=3D"_blank" href=3D"mailto:mishka8520@yahoo.com">mishka8520@yah= oo.com</a>><br clear=3D"none">To: "Salifou Sidi M. Malick" <<a rel=3D= "nofollow" shape=3D"rect" ymailto=3D"mailto:ssidimah@redhat.com" target=3D"= _blank" href=3D"mailto:ssidimah@redhat.com">ssidimah@redhat.com</a>><br = clear=3D"none">Cc: "Users" <<a rel=3D"nofollow" shape=3D"rect" ymailto= =3D"mailto:users@ovirt.org" target=3D"_blank" href=3D"mailto:users@ovirt.or= g">users@ovirt.org</a>><br clear=3D"none">Sent: Sunday, October 18, 2015= 5:45:05 AM<br clear=3D"none">Subject: Re: Question about the ovirt-engine-= sdk-java<br clear=3D"none"><br clear=3D"none">Hi Salifou,<br clear=3D"= none">Actually java sdk is intentionally hiding transport level i= nternals so developers could stay in java domain,if your headers are static= , easiest way would be using reverse proxy in a middle to intercept request= s, <br clear=3D"none"><br clear=3D"none">can you tell me why do you ne= ed this?<br clear=3D"none"> <br clear=3D"none"><br clear=3D"none"><br clear= =3D"none"> On Friday, October 16, 2015 1:14 AM, Salifou Sidi = M. Malick <<a rel=3D"nofollow" shape=3D"rect" ymailto=3D"mailto:ssidimah= @redhat.com" target=3D"_blank" href=3D"mailto:ssidimah@redhat.com">ssidimah= @redhat.com</a>> wrote:<br clear=3D"none"> <br clear=3D"none"><br= clear=3D"none"> Hi Micheal,<br clear=3D"none"><br clear=3D"none">I have a = question about the ovirt-engine-sdk-java.<br clear=3D"none"><br clear=3D"no= ne">Is there a way to add custom request headers to each RHEVM API call?<br= clear=3D"none"><br clear=3D"none">Here is an example of a request that I w= ould like to do:<br clear=3D"none"><br clear=3D"none">$ curl -v -k \<br cle= ar=3D"none"> -H "ID: <a rel=3D"nofollow" = shape=3D"rect" ymailto=3D"mailto:user1@ad.xyz.com" target=3D"_blank" href= =3D"mailto:user1@ad.xyz.com">user1@ad.xyz.com</a>" \<br clear=3D"none">&nbs= p; -H "PASSWORD: Pwssd" \<br clear=3D"none">&nb= sp; -H "TARGET: kobe" \<br clear=3D"none"> = ; <a rel=3D"nofollow" shape=3D"rect" target=3D"= _blank" href=3D"https://vm0.smalick.com/api/hosts">https://vm0.smalick.com/= api/hosts</a><br clear=3D"none"><br clear=3D"none"><br clear=3D"none">I wou= ld like to add ID, PASSWORD and TARGET as HTTP request header. <br clear=3D= "none"><br clear=3D"none">Thanks,<br clear=3D"none">Salifou<br clear=3D"non= e"><br clear=3D"none"><br clear=3D"none"></div><br clear=3D"none"><br clear= =3D"none"></div> </div> </div> </div></div></body></html> ------=_Part_258573_264923491.1445347258533--
participants (1)
-
Michael Pasternak