[Engine-devel] Question about API REST

--_000_EF26FC1776F7FF46BFC072393EFD13A29A40C6SERV070corpeldora_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello everyone, I'm adding the architecture meta-field of VMs, Templates and Clusters in RE= ST API (see change #16700 in gerrit). It's a read-only field (like a "final= " in Java), that the administrator cannot change it, but there are some sit= uations where there might be a value for it, such as when an entity is rece= ived from the API, slightly modified and then its update method is called. = So I would like to ask these questions about how to implement it: 1) Should this attribute be mapped both ways (from the REST API to the engi= ne and vice-versa)? 2) How should this field be declared in the rdsl_metadata? Do I have to exp= licitly put it in the optional arguments or should I omit it? 3) How can I make this field strictly immutable (like the ID field is), giv= en that the architecture is a field of the CPU entity, and the methods used= to check for invalid updates can only operate on fields that belong direct= ly to the main entity? Thanks. --_000_EF26FC1776F7FF46BFC072393EFD13A29A40C6SERV070corpeldora_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr= osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" = xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:= //www.w3.org/TR/REC-html40"> <head> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
<meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered medium)"> <style><!-- /* Font Definitions */ @font-face {font-family:SimSun; panose-1:2 1 6 0 3 1 1 1 1 1;} @font-face {font-family:SimSun; panose-1:2 1 6 0 3 1 1 1 1 1;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face {font-family:"\@SimSun"; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; font-size:11.0pt; font-family:"Calibri","sans-serif";} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {mso-style-priority:99; color:purple; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal-compose; font-family:"Calibri","sans-serif"; color:windowtext;} .MsoChpDefault {mso-style-type:export-only; font-family:"Calibri","sans-serif";} @page WordSection1 {size:612.0pt 792.0pt; margin:70.85pt 3.0cm 70.85pt 3.0cm;} div.WordSection1 {page:WordSection1;} --></style><!--[if gte mso 9]><xml> <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext=3D"edit"> <o:idmap v:ext=3D"edit" data=3D"1" /> </o:shapelayout></xml><![endif]--> </head> <body lang=3D"PT-BR" link=3D"blue" vlink=3D"purple"> <div class=3D"WordSection1"> <p class=3D"MsoNormal"><span lang=3D"EN-US">Hello everyone,<o:p></o:p></spa= n></p> <p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p> </o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US">I'm adding the architecture met= a-field of VMs, Templates and Clusters in REST API (see change #16700 in ge= rrit). It's a read-only field (like a “final” in Java), that th= e administrator cannot change it, but there are some situations where there might be a value for it, such as when an entit= y is received from the API, slightly modified and then its update method is= called. So I would like to ask these questions about how to implement it:<= o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p> </o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US">1) Should this attribute be map= ped both ways (from the REST API to the engine and vice-versa)?<o:p></o:p><= /span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US">2) How should this field be dec= lared in the rdsl_metadata? Do I have to explicitly put it in the optional = arguments or should I omit it?<o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US">3) How can I make this field st= rictly immutable (like the ID field is), given that the architecture is a f= ield of the CPU entity, and the methods used to check for invalid updates c= an only operate on fields that belong directly to the main entity? <o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p> </o:p></span></p> <p class=3D"MsoNormal">Thanks.<o:p></o:p></p> <p class=3D"MsoNormal"><o:p> </o:p></p> </div> </body> </html> --_000_EF26FC1776F7FF46BFC072393EFD13A29A40C6SERV070corpeldora_--

On 09/03/2013 03:14 PM, Gustavo Frederico Temple Pedrosa wrote:
Hello everyone,
I'm adding the architecture meta-field of VMs, Templates and Clusters in REST API (see change #16700 in gerrit). It's a read-only field (like a “final” in Java), that the administrator cannot change it, but there are some situations where there might be a value for it, such as when an entity is received from the API, slightly modified and then its update method is called. So I would like to ask these questions about how to implement it:
not sure i follow, do you want it to be updatable or not?, can you elaborate a bit? do
1) Should this attribute be mapped both ways (from the REST API to the engine and vice-versa)?
if you want it to be updateable, - yes.
2) How should this field be declared in the rdsl_metadata? Do I have to explicitly put it in the optional arguments or should I omit it?
if they're valid for update - "put it in the optional arguments"
3) How can I make this field strictly immutable (like the ID field is),
currently we using immutability constraint in api for id only
given that the architecture is a field of the CPU entity, and the methods used to check for invalid updates can only operate on fields that belong directly to the main entity?
this is not a api logic, consider adding CAN-DO-ACTION check at UPDATE command instead.
Thanks.
_______________________________________________ Engine-devel mailing list Engine-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-devel
-- Michael Pasternak RedHat, ENG-Virtualization R&D

Thank you very much!
-----Original Message----- From: Michael Pasternak [mailto:mpastern@redhat.com] Sent: terça-feira, 3 de setembro de 2013 09:29 To: Gustavo Frederico Temple Pedrosa Cc: engine-devel@ovirt.org Subject: Re: [Engine-devel] Question about API REST
On 09/03/2013 03:14 PM, Gustavo Frederico Temple Pedrosa wrote:
Hello everyone,
I'm adding the architecture meta-field of VMs, Templates and Clusters in REST API (see change #16700 in gerrit). It's a read-only field (like a "final" in Java), that the administrator cannot change it, but there are some situations where there might be a value for it, such as when an entity is received from the API, slightly modified and then its update method is called. So I would like to ask these questions about how to implement it:
not sure i follow, do you want it to be updatable or not?, can you elaborate a bit? do
1) Should this attribute be mapped both ways (from the REST API to the
engine and vice-versa)?
if you want it to be updateable, - yes.
2) How should this field be declared in the rdsl_metadata? Do I have to
explicitly put it in the optional arguments or should I omit it?
if they're valid for update - "put it in the optional arguments"
3) How can I make this field strictly immutable (like the ID field is),
currently we using immutability constraint in api for id only
given that the architecture is a field of the CPU entity, and the methods used to check for invalid updates can only operate on fields that belong directly to the main entity?
this is not a api logic, consider adding CAN-DO-ACTION check at UPDATE command instead.
Thanks.
_______________________________________________ Engine-devel mailing list Engine-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-devel
--
Michael Pasternak RedHat, ENG-Virtualization R&D
participants (2)
-
Gustavo Frederico Temple Pedrosa
-
Michael Pasternak