
Le 6 avr. 2017 =C3=A0 15:32, Yaniv Kaul <ykaul@redhat.com> a =C3=A9crit = : =20 =20 =20 On Thu, Apr 6, 2017 at 3:58 PM, Fabrice Bacchella = <fabrice.bacchella@orange.fr <mailto:fabrice.bacchella@orange.fr>> = wrote: Yes I'm starting to understand that thinking about migrating code is =
=20 The old skd3 code is just good to be thrown away. There is no hope =
--Apple-Mail=_E9D80E67-7974-4602-8A67-05FD8FEC3A98 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 pointless. thinking about "migrating code". And as it's just a thin layer around = REST calls, it's up to us to try to make something usable around that. = So I expect a lot of sweat and tears to adapt my existing code.
=20 Well, yes and no. Yes, it's not smooth, but once you 'get' the idea = behind the v4 API philosophy, it's quite easy to write to (at least in = Python).
An example of code that I'm unhappy to write and that a good sdk should = have provided: searchfilter =3D "%s=3D%s" % (type, value) vm =3D vms_service.list(search=3D searchfilter)[0] instead of : vms_service.list(search=3D {type: value})[0] or even better: vms_service.get(**{type: value}) --Apple-Mail=_E9D80E67-7974-4602-8A67-05FD8FEC3A98 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html = charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" = class=3D""><br class=3D""><div><blockquote type=3D"cite" class=3D""><div = class=3D"">Le 6 avr. 2017 =C3=A0 15:32, Yaniv Kaul <<a = href=3D"mailto:ykaul@redhat.com" class=3D"">ykaul@redhat.com</a>> a = =C3=A9crit :</div><br class=3D"Apple-interchange-newline"><div = class=3D""><div dir=3D"ltr" class=3D""><br class=3D""><div = class=3D"gmail_extra"><br class=3D""><div class=3D"gmail_quote">On Thu, = Apr 6, 2017 at 3:58 PM, Fabrice Bacchella <span dir=3D"ltr" = class=3D""><<a href=3D"mailto:fabrice.bacchella@orange.fr" = target=3D"_blank" class=3D"">fabrice.bacchella@orange.fr</a>></span> = wrote:<br class=3D""><blockquote class=3D"gmail_quote" style=3D"margin:0px= 0px 0px 0.8ex;border-left:1px solid = rgb(204,204,204);padding-left:1ex"><div style=3D"word-wrap:break-word" = class=3D"">Yes I'm starting to understand that thinking about migrating = code is pointless.<div class=3D""><br class=3D""></div><div class=3D"">The= old skd3 code is just good to be thrown away. There is no hope thinking = about "migrating code". And as it's just a thin layer around REST calls, = it's up to us to try to make something usable around that. So I expect a = lot of sweat and tears to adapt my existing = code.</div></div></blockquote><div class=3D""><br class=3D""></div><div = class=3D"">Well, yes and no. Yes, it's not smooth, but once you 'get' = the idea behind the v4 API philosophy, it's quite easy to write to (at = least in Python).</div></div></div></div></div></blockquote><br = class=3D""></div><div>An example of code that I'm unhappy to write and = that a good sdk should have provided:</div><div><br = class=3D""></div><div>searchfilter =3D "%s=3D%s" % (type, = value)</div><div><span style=3D"color: rgb(36, 41, 46); font-family: = SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; = white-space: pre; background-color: rgb(255, 255, 255);" class=3D"">vm = </span><span class=3D"pl-k" style=3D"box-sizing: border-box; color: = rgb(167, 29, 93); font-family: SFMono-Regular, Consolas, 'Liberation = Mono', Menlo, Courier, monospace; white-space: pre;">=3D</span><span = style=3D"color: rgb(36, 41, 46); font-family: SFMono-Regular, Consolas, = 'Liberation Mono', Menlo, Courier, monospace; white-space: pre; = background-color: rgb(255, 255, 255);" class=3D""> = vms_service.list(</span><span class=3D"pl-v" style=3D"box-sizing: = border-box; color: rgb(237, 106, 67); font-family: SFMono-Regular, = Consolas, 'Liberation Mono', Menlo, Courier, monospace; white-space: = pre;">search</span><span class=3D"pl-k" style=3D"box-sizing: border-box; = color: rgb(167, 29, 93); font-family: SFMono-Regular, Consolas, = 'Liberation Mono', Menlo, Courier, monospace; white-space: = pre;">=3D</span> searchfilter<span style=3D"color: rgb(36, 41, 46); = font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, = Courier, monospace; white-space: pre; background-color: rgb(255, 255, = 255);" class=3D"">)[</span><span class=3D"pl-c1" style=3D"box-sizing: = border-box; color: rgb(0, 134, 179); font-family: SFMono-Regular, = Consolas, 'Liberation Mono', Menlo, Courier, monospace; white-space: = pre;">0</span><span style=3D"color: rgb(36, 41, 46); font-family: = SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; = white-space: pre; background-color: rgb(255, 255, 255);" = class=3D"">]</span></div><div><span style=3D"color: rgb(36, 41, 46); = font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, = Courier, monospace; white-space: pre; background-color: rgb(255, 255, = 255);" class=3D""><br class=3D""></span></div><div><span style=3D"color: = rgb(36, 41, 46); font-family: SFMono-Regular, Consolas, 'Liberation = Mono', Menlo, Courier, monospace; white-space: pre; background-color: = rgb(255, 255, 255);" class=3D"">instead of :</span></div><div><span = style=3D"color: rgb(36, 41, 46); font-family: SFMono-Regular, Consolas, = 'Liberation Mono', Menlo, Courier, monospace; white-space: pre; = background-color: rgb(255, 255, 255);" = class=3D"">vms_service.list(</span><span class=3D"pl-v" = style=3D"box-sizing: border-box; color: rgb(237, 106, 67); font-family: = SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; = white-space: pre;">search</span><span class=3D"pl-k" style=3D"box-sizing: = border-box; color: rgb(167, 29, 93); font-family: SFMono-Regular, = Consolas, 'Liberation Mono', Menlo, Courier, monospace; white-space: = pre;">=3D</span> {type: value}<span style=3D"color: rgb(36, 41, = 46); font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, = Courier, monospace; white-space: pre; background-color: rgb(255, 255, = 255);" class=3D"">)[</span><span class=3D"pl-c1" style=3D"box-sizing: = border-box; color: rgb(0, 134, 179); font-family: SFMono-Regular, = Consolas, 'Liberation Mono', Menlo, Courier, monospace; white-space: = pre;">0</span><span style=3D"color: rgb(36, 41, 46); font-family: = SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; = white-space: pre; background-color: rgb(255, 255, 255);" = class=3D"">]</span></div><div><span style=3D"color: rgb(36, 41, 46); = font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, = Courier, monospace; white-space: pre; background-color: rgb(255, 255, = 255);" class=3D""><br class=3D""></span></div><div><span style=3D"color: = rgb(36, 41, 46); font-family: SFMono-Regular, Consolas, 'Liberation = Mono', Menlo, Courier, monospace; white-space: pre; background-color: = rgb(255, 255, 255);" class=3D"">or even better:</span></div><div><span = style=3D"color: rgb(36, 41, 46); font-family: SFMono-Regular, Consolas, = 'Liberation Mono', Menlo, Courier, monospace; white-space: pre; = background-color: rgb(255, 255, 255);" class=3D"">vms_service.get(**{type:= value})</span></div><div><span style=3D"color: rgb(36, 41, 46); = font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, = Courier, monospace; white-space: pre; background-color: rgb(255, 255, = 255);" class=3D""><br class=3D""></span></div><div><span style=3D"color: = rgb(36, 41, 46); font-family: SFMono-Regular, Consolas, 'Liberation = Mono', Menlo, Courier, monospace; white-space: pre; background-color: = rgb(255, 255, 255);" class=3D""><br class=3D""></span></div><br = class=3D""></body></html>= --Apple-Mail=_E9D80E67-7974-4602-8A67-05FD8FEC3A98--