Change details field encoding to match cloudstack expectations
authorCezar Sa Espinola <cezarsa@gmail.com>
Sat, 31 Aug 2019 13:45:42 +0000 (10:45 -0300)
committerCezar Sa Espinola <cezarsa@gmail.com>
Sat, 31 Aug 2019 13:45:48 +0000 (10:45 -0300)
commit1c5b46e88293ecfbf3a740dd4d84fc1959ff181b
treeed5970ae693fdfbe08bd231652b2888b50efae59
parent47f3e6c8e562a7f3f6ddf4e34b5b515dd558db7b
Change details field encoding to match cloudstack expectations

How the details field must be encoded changes depending on the command
implementation. Some commands allow arbitrary keys and some other
commands require only 2 keys to exist ('key' and 'value') and allow a
list of such key value pairs as the details field.

I wasn't able to find anything in the documentation that would make it
clear which encoding was required for each command and had to look at
cloudstack's code to figure this out.

Here is a list of the commands singled out in this commit and references
to the required encoding in cloudstack's code:

addGuestOs
https://github.com/apache/cloudstack/blob/87c43501608a1df72a2f01ed17a522233e6617b0/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCmd.java#L88-L89

updateGuestOs
https://github.com/apache/cloudstack/blob/87c43501608a1df72a2f01ed17a522233e6617b0/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmd.java#L80-L81

addImageStore
https://github.com/apache/cloudstack/blob/87c43501608a1df72a2f01ed17a522233e6617b0/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java#L90-L91

createSecondaryStagingStore
https://github.com/apache/cloudstack/blob/87c43501608a1df72a2f01ed17a522233e6617b0/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java#L80

updateCloudToUseObjectStore
https://github.com/apache/cloudstack/blob/87c43501608a1df72a2f01ed17a522233e6617b0/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java#L84-L85

addResourceDetail
https://github.com/apache/cloudstack/blob/87c43501608a1df72a2f01ed17a522233e6617b0/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java#L68-L69

updateZone
https://github.com/apache/cloudstack/blob/87c43501608a1df72a2f01ed17a522233e6617b0/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java#L1866-L1867
cloudstack/GuestOSService.go
cloudstack/ImageStoreService.go
cloudstack/ResourcemetadataService.go
cloudstack/ZoneService.go
generate/generate.go