Пример #1
0
        public AsmNetworkInterface(AzureContext azureContext, AsmVirtualMachine asmVirtualMachine, ISettingsProvider settingsProvider, XmlNode xmlNode)
        {
            _AzureContext      = azureContext;
            _AsmVirtualMachine = asmVirtualMachine;
            _XmlNode           = xmlNode;

            this.TargetName = _AsmVirtualMachine.RoleName;
        }
Пример #2
0
        public async Task LoadChildrenAsync()
        {
            if (this.VirtualNetworkName != String.Empty)
            {
                _AsmVirtualNetwork = await this._AzureContext.AzureRetriever.GetAzureAsmVirtualNetwork(this.VirtualNetworkName);
            }

            if (this.AffinityGroupName == String.Empty)
            {
                _AsmAffinityGroup = null;
            }
            else
            {
                _AsmAffinityGroup = await this._AzureContext.AzureRetriever.GetAzureAsmAffinityGroup(this.AffinityGroupName);
            }

            _VirtualMachines = new List <AsmVirtualMachine>();
            if (_XmlNode.SelectNodes("//Deployments/Deployment").Count > 0)
            {
                if (_XmlNode.SelectNodes("//Deployments/Deployment")[0].SelectNodes("RoleList/Role")[0].SelectNodes("RoleType").Count > 0)
                {
                    if (_XmlNode.SelectNodes("//Deployments/Deployment")[0].SelectNodes("RoleList/Role")[0].SelectSingleNode("RoleType").InnerText == "PersistentVMRole")
                    {
                        XmlNodeList roles = _XmlNode.SelectNodes("//Deployments/Deployment")[0].SelectNodes("RoleList/Role");

                        foreach (XmlNode role in roles)
                        {
                            string virtualmachinename = role.SelectSingleNode("RoleName").InnerText;

                            AsmVirtualMachine asmVirtualMachine = await _AzureContext.AzureRetriever.GetAzureAsmVirtualMachine(this, virtualmachinename);

                            _VirtualMachines.Add(asmVirtualMachine);
                        }
                    }
                }
            }

            List <AsmReservedIP> asmReservedIPs = await _AzureContext.AzureRetriever.GetAzureAsmReservedIPs();

            foreach (AsmReservedIP asmReservedIP in asmReservedIPs)
            {
                if (asmReservedIP.ServiceName == this.ServiceName)
                {
                    _AsmReservedIP = asmReservedIP;
                }
            }

            XmlNodeList loadBalancersXml = _XmlNode.SelectNodes("//Deployments/Deployment/LoadBalancers/LoadBalancer");

            foreach (XmlNode loadBalancerXml in loadBalancersXml)
            {
                AsmLoadBalancer asmLoadBalancer = new AsmLoadBalancer(_AzureContext, _AsmVirtualNetwork, loadBalancerXml);
                _LoadBalancers.Add(asmLoadBalancer);
            }
        }