Elastacloud.AzureManagement.Fluent.Types.VirtualMachines.StatefulVirtualMachineSerialiser.GetNetworkConfigurationSet C# (CSharp) Method

GetNetworkConfigurationSet() private method

private GetNetworkConfigurationSet ( System.Xml.Linq.XElement configurationSet ) : NetworkConfigurationSet
configurationSet System.Xml.Linq.XElement
return NetworkConfigurationSet
        private NetworkConfigurationSet GetNetworkConfigurationSet(XElement configurationSet)
        {
            NetworkConfigurationSet networkConfigurationSet = null;
            if (configurationSet.Element(Namespace + "ConfigurationSetType").Value == "NetworkConfiguration")
            {
                networkConfigurationSet = new NetworkConfigurationSet();
                var subnets = configurationSet.Element(Namespace + "SubnetNames");
                if (subnets != null)
                {
                    var subnet = subnets.Element(Namespace + "SubnetName");
                    if (subnet != null)
                    {
                        networkConfigurationSet.SubnetName = (string) subnet;
                    }
                }
                networkConfigurationSet.InputEndpoints= new InputEndpoints();
                var endpoints = configurationSet.Descendants(Namespace + "InputEndpoint");
                foreach (var endpoint in endpoints)
                {
                    var inputEndpoint = new InputEndpoint
                    {
                        EndpointName = GetStringValue(endpoint.Element(Namespace + "Name")),
                        Port = GetIntValue(endpoint.Element(Namespace + "Port")),
                        LocalPort = GetIntValue(endpoint.Element(Namespace + "LocalPort")),
                        Protocol = GetEnumValue<Protocol>(endpoint.Element(Namespace + "Protocol")),
                        Vip = GetStringValue(endpoint.Element(Namespace + "Vip"))
                    };
                    networkConfigurationSet.InputEndpoints.AddEndpoint(inputEndpoint);
                }
            }
            return networkConfigurationSet;
        }