At the vCenter level, there are multiple datastores. So, I am trying to achieve like when user define the virtual disk size less than 50GB then datastore Id will be 123 (example value), if user define the size above 100GB then datastore Id will be 456 etc…
Note the ‘toLong()’ is to convert a string to an integer. Overall, the variables are groovy and you can use standard groovy language to create more complex decisions.
Another query for the load balancer. Let’s say if I says enable load balancer " Yes/No" using radio list or selection list. Can I replace {123} block with below load balancer json block.
Unfortunately I have not found a way to null or input an object into the JSON. The config validates JSON on submit, and since the input is missing the catalog won’t render correctly.
Sometimes we’re able to have the objects already within the config and have an invalid value that would result in it not being created. Then if you say ‘yes’ to a loadbalancer you input the correct value.
Check out this example @rboyd created about disk adds. Uses the same concept: