Azure catalog item with subnet choice

Hello,

I’m still on my “azure catalog item subject”, and i wan’t to choose subnetwork in an option list. I did the option list using a REST call toward the morpheus api and it’s fine, but i don’t understand how to integrate it onto the catalog json.
the code inside the catalog item json for network definition looks like that :

 "networkInterfaces": [
  {
   "primaryInterface": true,
   "network": {
    "id": "subnet-17",
    "hasPool": "",
    "subnet": "subnet-17",
    "idName": "snet-bel-d-fr-office-poc",
    "displayName": "vnet-bel-d-fr-office - snet-bel-d-fr-office-poc"
   },

my option does a call on https://morpheus/api/subnets?max=100&sort=name

with that script :

for(var x=0;x < data.subnets.length;x++) {
          results.push({name: data.subnets[x].name, value: data.subnets[x].id});
        }

did you ever tried that kind of thing ?

regards,

Matthieu

Hi Matthieu,
I have already had a catalog for Azure built using the Morpheus API option list where I have used the “instance Network” option list.
My translation script is as follows

for (var x = 0; x < data.length; x++) {
if(data[x].group == "subnet"){
    results.push({name:data[x].name,value:data[x].id});
  }
}

Please find the catalog config for networkInterfaces section

 "networkInterfaces": [
  {
   "primaryInterface": true,
   "network": {
    "id": "<%=customOptions.vsInstanceNetwork%>",
    "hasPool": "",
    "subnet": "<%=customOptions.vsInstanceNetwork%>",
   },
   "ipMode": "",
   "showNetworkPoolLabel": false,
   "showNetworkDhcpLabel": true
  }
 ],

Thanks
Velan

2 Likes

Hello,
I’ve just managed to try this out.
using the morpheus api option list “Instance Network”, I achieved to have the list of subnet, but only when “cloud” is fixed. If i set the cloud with “customoptions”, even when linking the fields with “dependent field”, it doesn’t work anymore.
As the “group” field of this api call is undocumented in Option Lists — Morpheus Docs documentation (morpheusdata.com), can you tell me if I have to modify something else ?

regards,

matthieu