HPE Morpheus Enterprise
1849034 Members
6575 Online
104041 Solutions
New Discussion

Get vmwarefolderId List

 
SOLVED
Go to solution
Not applicable

Get vmwarefolderId List

Hello team,
How can i create an option list that will gather all the forlderIds of a specific vmware cloud ?

2da1cf5cc4ed09620188389b7f307fc0d92b68f7.png

can’t find any api into the swagger :frowning:
regards,
Matthieu

4 REPLIES 4
Not applicable

Re: Get vmwarefolderId List

The API endpoint for that is documented here: Retrieves all resource folders for Specified Cloud

Not applicable

Re: Get vmwarefolderId List

Hello, thank you for your answer.

I’ve managed to get it work on a specified cloud :
e307e7c5631aba35d67e286c8ea8f4c5f8547fa3.png

with this translation script :

console.log('DEBUG REST OL : '+data['folders'].length)
for (var x = 0; x < data['folders'].length; x++) {
console.log('DEBUG REST OL : value no '+x+' = '+data['folders'][x].name)
  results.push({name:data['folders'][x].name,value:data['folders'][x].id});
  }

do you have an idea to do it with having cloud as an input in a catalog item ?
The final goal is to choose a cloud tighted to a vmware cluster in a catalog item, an then be able to choose the folder in which the VM will be created
regards,

Matthieu

Not applicable
Solution

Re: Get vmwarefolderId List

Hi Matthieu,

For this use case you can use the option source url: /api/options/vmware/vmwareFolders?zoneId=354
To use this in a catalog item, set the option list Source URL to https://morpheus-dev/devops.groupe-bel.net/api/options/vmware/vmwareFolders
Then on the folder input you can specify the zoneId query parameter as the value from your cloud input in the request script, for this example I’ve assumed the cloud input name is morpheusCloud so the request script is:

results.push({name: 'zoneId', value : data.morpheusCloud});

Finally, you also need to change your translation script to match the json response structure from the new url, so the translation script is:

console.log('DEBUG REST OL : '+data['data'].length)
for (var x = 0; x < data['data'].length; x++) {
console.log('DEBUG REST OL : value no '+x+' = '+data['data'][x].name)
  results.push({name:data['data'][x].name,value:data['data'][x].value});
  }

That should do it, just let us know.

Thanks,
James

Not applicable

Re: Get vmwarefolderId List

Hello James,
It works perfectly fine.
Thank you