I am creating a linux vm using a custom image from an shared image gallery using java sdk.
virtualMachine = azure.virtualMachines()
.define(linuxVMName)
.withRegion(location)
.withExistingResourceGroup(resourceGroup)
.withExistingPrimaryNetworkInterface(networkInterface)
.withLinuxCustomImage(customImageUrl)
.withRootUsername(username)
.withRootPassword(password)
.withCustomData(custDatastring)
.withComputerName(linuxVMName)
.withExistingStorageAccount(storageAccount)
.withSize(vmSize())
.create();
this also supports creating linux instances from generic public images also like
.withLatestLinuxImage(publisher, offer, sku)
What I want to know is
whether it is possible to use conditional statements in this pattern like whether Azure has implemented that part.
Another scenario is instead of root password, i can also use root SSH, so many conditions here
I had no luck with the documentation part also.
Yes I can write an whole if else and copy paste the code also, I just want to know is there a better way to implement this.
Thanks in advance