internal new async Task InitializeChildrenAsync() { await base.InitializeChildrenAsync(); if (this.AvailabilitySetId != null && this.AvailabilitySetId != String.Empty) { this.AvailabilitySet = this.AzureSubscription.GetAzureARMAvailabilitySet(this.AvailabilitySetId); } if (this.AvailabilitySet != null) { if (this.AvailabilitySet.VirtualMachines != null) { this.AvailabilitySet.VirtualMachines.Add(this); } } if (this.OSVirtualHardDisk != null) { await this.OSVirtualHardDisk.InitializeChildrenAsync(); } if (this.DataDisks != null) { foreach (IArmDisk dataDisk in this.DataDisks) { if (dataDisk.GetType() == typeof(Arm.ClassicDisk)) { ClassicDisk classicDisk = (Arm.ClassicDisk)dataDisk; await classicDisk.InitializeChildrenAsync(); } } } if (ResourceToken["properties"] != null && ResourceToken["properties"]["networkProfile"] != null && ResourceToken["properties"]["networkProfile"]["networkInterfaces"] != null) { foreach (JToken networkInterfaceToken in ResourceToken["properties"]["networkProfile"]["networkInterfaces"]) { if (networkInterfaceToken["id"] != null) { NetworkInterface networkInterface = await this.AzureSubscription.GetAzureARMNetworkInterface((string)networkInterfaceToken["id"]); if (networkInterface != null) { networkInterface.VirtualMachine = this; _NetworkInterfaceCards.Add(networkInterface); } } } } // Seek the VmSize object that corresponds to the VmSize String obtained from the VM Json if (this.ResourceGroup != null && this.ResourceGroup.Location != null) { this.VmSize = this.ResourceGroup.Location.SeekVmSize(this.VmSizeString); } return; }
internal new async Task InitializeChildrenAsync(AzureContext azureContext) { await base.InitializeChildrenAsync(azureContext); if (this.AvailabilitySetId != String.Empty) { this.AvailabilitySet = azureContext.AzureRetriever.GetAzureARMAvailabilitySet(azureContext.AzureSubscription, this.AvailabilitySetId); } if (this.AvailabilitySet != null) { this.AvailabilitySet.VirtualMachines.Add(this); } await this.OSVirtualHardDisk.InitializeChildrenAsync(azureContext); foreach (IArmDisk dataDisk in this.DataDisks) { if (dataDisk.GetType() == typeof(Arm.ClassicDisk)) { ClassicDisk classicDisk = (Arm.ClassicDisk)dataDisk; await classicDisk.InitializeChildrenAsync(azureContext); } } foreach (JToken networkInterfaceToken in ResourceToken["properties"]["networkProfile"]["networkInterfaces"]) { NetworkInterface networkInterface = await azureContext.AzureRetriever.GetAzureARMNetworkInterface((string)networkInterfaceToken["id"]); networkInterface.VirtualMachine = this; _NetworkInterfaceCards.Add(networkInterface); } // Seek the VmSize object that corresponds to the VmSize String obtained from the VM Json if (this.ResourceGroup != null && this.ResourceGroup.Location != null && this.ResourceGroup.Location.VMSizes != null) { this.VmSize = this.ResourceGroup.Location.VMSizes.Where(a => a.Name == this.VmSizeString).FirstOrDefault(); } return; }