psycofdj opened a new pull request #7:
URL: https://github.com/apache/cloudstack-go/pull/7


   This PR modifies the generator to handle some parameters that are list of 
objects and not list of key/values.
   For instance, when using the `deployVirtualMachines` endpoint while 
configuring multiple network interfaces, we want to pass the following 
`iptonetworklist` in the query string:
   ```
   iptonetworklist[0].ip=10.10.10.11
   iptonetworklist[0].ipv6=fc00:1234:5678::abcd
   iptonetworklist[0].networkid=uuid1
   iptonetworklist[1].ip=10.10.11.11
   iptonetworklist[1].ipv6=fc01:1234:5678::abcd
   iptonetworklist[1].networkid=uuid2
   ```
   
   In the current implementation, the `iptonetworklist` doesn't allow to pass 
multiple networks and a single interface is serialized as:
   ```
   iptonetworklist[0].key=ip
   iptonetworklist[0].value=10.10.10.11
   iptonetworklist[1].key=ipv6
   iptonetworklist[1].value=fc00:1234:5678::abcd
   iptonetworklist[2].key=networkid
   iptonetworklist[2].value=uuid1
   ```
   which is not what is expected on the cloudstack side.
   
   The same goes for other params like `dhcpoptionsnetworklist` and 
`nicnetworklist`.
   
   I don't known where the `listApis.json` is extract from and I assumed that 
it was automatically generated from the 
[apache/cloudstack](https://github.com/apache/cloudstack) repository so I could 
not disambiguate the `map` type from this file. 
   Instead, I took inspiration from `detailsRequireKeyValue` approach and 
implemented a kind of declarative list of parameters that should be serialized 
this way.
   
   The commit in the PR contains both the modification of the generator and the 
new generated golang code. However I had to revert unexpected changes in 
`cloudstack/HostService.go`. It appears that the file has been edited in 
d0a8e7d2a3623d00911b71b5e9ce514487658d6e and 
46b776eaca4936a2f7995b26db779a8dd35b1ede without any modification of the 
generator.
   Q: is the generation part deprecated and should I remove it from my PR ?
   
   I'm currently testing the new client against a real-world cloudstack and 
I'll remvove the WIP flag if everything is ok
   
   Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to