apache / cloudstack-go

CloudStack Go SDK

Home Page:https://cloudstack.apache.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding multiple details to registerTemplate, updateTemplate doesn't work

mlsorensen opened this issue · comments

When making a registerTemplate or updateTemplate API call, the accepted API format for the map is to always use details[0]. Otherwise, the other fields don't work. Currently we increment an iterator in the client and it causes the API to ignore all but the first detail.

e.g.

(localhost) 🐱 > register template name=test displaytext=test hypervisor=Simulator url=http://foo.com/image.vhd format=vhd zoneid=-1 ostypeid=da13519b-5491-11ed-820c-0242ac120002 details[0].uefi=legacy details[1].other=foo
{
  "count": 1,
  "template": [
    {
      "account": "admin",
      "bits": 0,
      "created": "2022-11-08T20:13:59+0000",
      "crossZones": true,
      "deployasis": false,
      "details": {
        "uefi": "legacy"
      },

The above is missing the "other" detail. Compare with:

(localhost) 🐱 > register template name=test displaytext=test hypervisor=Simulator url=http://foo.com/image.vhd format=vhd zoneid=-1 ostypeid=da13519b-5491-11ed-820c-0242ac120002 details[0].uefi=legacy details[0].other=foo
{
 "count": 1,
 "template": [
   {
     "account": "admin",
     "bits": 0,
     "created": "2022-11-08T20:14:27+0000",
     "crossZones": true,
     "deployasis": false,
     "details": {
       "other": "foo",
       "uefi": "legacy"
     },

That's a known historic limitation, all details use the zero key in the API call. Thanks for the PR @mlsorensen