internal ContainerNetworkInterface(string id, string name, string type, string etag, ContainerNetworkInterfaceConfiguration containerNetworkInterfaceConfiguration, SubResource container, IReadOnlyList <ContainerNetworkInterfaceIpConfiguration> ipConfigurations, ProvisioningState?provisioningState) : base(id)
 {
     Name = name;
     Type = type;
     Etag = etag;
     ContainerNetworkInterfaceConfiguration = containerNetworkInterfaceConfiguration;
     Container         = container;
     IpConfigurations  = ipConfigurations;
     ProvisioningState = provisioningState;
 }
Ejemplo n.º 2
0
        internal static ContainerNetworkInterface DeserializeContainerNetworkInterface(JsonElement element)
        {
            string name = default;
            string type = default;
            string etag = default;
            string id   = default;
            ContainerNetworkInterfaceConfiguration containerNetworkInterfaceConfiguration = default;
            SubResource container = default;
            IList <ContainerNetworkInterfaceIpConfiguration> ipConfigurations = default;
            ProvisioningState?provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("containerNetworkInterfaceConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            containerNetworkInterfaceConfiguration = ContainerNetworkInterfaceConfiguration.DeserializeContainerNetworkInterfaceConfiguration(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("container"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            container = DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("ipConfigurations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <ContainerNetworkInterfaceIpConfiguration> array = new List <ContainerNetworkInterfaceIpConfiguration>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(ContainerNetworkInterfaceIpConfiguration.DeserializeContainerNetworkInterfaceIpConfiguration(item));
                                }
                            }
                            ipConfigurations = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ContainerNetworkInterface(id, name, type, etag, containerNetworkInterfaceConfiguration, container, ipConfigurations, provisioningState));
        }
        internal static NetworkProfile DeserializeNetworkProfile(JsonElement element)
        {
            string etag     = default;
            string id       = default;
            string name     = default;
            string type     = default;
            string location = default;
            IDictionary <string, string>      tags = default;
            IList <ContainerNetworkInterface> containerNetworkInterfaces = default;
            IList <ContainerNetworkInterfaceConfiguration> containerNetworkInterfaceConfigurations = default;
            string            resourceGuid      = default;
            ProvisioningState?provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.Value.ValueKind == JsonValueKind.Null)
                        {
                            dictionary.Add(property0.Name, null);
                        }
                        else
                        {
                            dictionary.Add(property0.Name, property0.Value.GetString());
                        }
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("containerNetworkInterfaces"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <ContainerNetworkInterface> array = new List <ContainerNetworkInterface>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(ContainerNetworkInterface.DeserializeContainerNetworkInterface(item));
                                }
                            }
                            containerNetworkInterfaces = array;
                            continue;
                        }
                        if (property0.NameEquals("containerNetworkInterfaceConfigurations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <ContainerNetworkInterfaceConfiguration> array = new List <ContainerNetworkInterfaceConfiguration>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(ContainerNetworkInterfaceConfiguration.DeserializeContainerNetworkInterfaceConfiguration(item));
                                }
                            }
                            containerNetworkInterfaceConfigurations = array;
                            continue;
                        }
                        if (property0.NameEquals("resourceGuid"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            resourceGuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new NetworkProfile(id, name, type, location, tags, etag, containerNetworkInterfaces, containerNetworkInterfaceConfigurations, resourceGuid, provisioningState));
        }
Ejemplo n.º 4
0
 internal static NetworkProfile DeserializeNetworkProfile(JsonElement element)
 {
     Optional<string> etag = default;
     Optional<string> id = default;
     Optional<string> name = default;
     Optional<string> type = default;
     Optional<string> location = default;
     Optional<IDictionary<string, string>> tags = default;
     Optional<IReadOnlyList<ContainerNetworkInterface>> containerNetworkInterfaces = default;
     Optional<IList<ContainerNetworkInterfaceConfiguration>> containerNetworkInterfaceConfigurations = default;
     Optional<string> resourceGuid = default;
     Optional<ProvisioningState> provisioningState = default;
     foreach (var property in element.EnumerateObject())
     {
         if (property.NameEquals("etag"))
         {
             etag = property.Value.GetString();
             continue;
         }
         if (property.NameEquals("id"))
         {
             id = property.Value.GetString();
             continue;
         }
         if (property.NameEquals("name"))
         {
             name = property.Value.GetString();
             continue;
         }
         if (property.NameEquals("type"))
         {
             type = property.Value.GetString();
             continue;
         }
         if (property.NameEquals("location"))
         {
             location = property.Value.GetString();
             continue;
         }
         if (property.NameEquals("tags"))
         {
             Dictionary<string, string> dictionary = new Dictionary<string, string>();
             foreach (var property0 in property.Value.EnumerateObject())
             {
                 dictionary.Add(property0.Name, property0.Value.GetString());
             }
             tags = dictionary;
             continue;
         }
         if (property.NameEquals("properties"))
         {
             foreach (var property0 in property.Value.EnumerateObject())
             {
                 if (property0.NameEquals("containerNetworkInterfaces"))
                 {
                     List<ContainerNetworkInterface> array = new List<ContainerNetworkInterface>();
                     foreach (var item in property0.Value.EnumerateArray())
                     {
                         array.Add(ContainerNetworkInterface.DeserializeContainerNetworkInterface(item));
                     }
                     containerNetworkInterfaces = array;
                     continue;
                 }
                 if (property0.NameEquals("containerNetworkInterfaceConfigurations"))
                 {
                     List<ContainerNetworkInterfaceConfiguration> array = new List<ContainerNetworkInterfaceConfiguration>();
                     foreach (var item in property0.Value.EnumerateArray())
                     {
                         array.Add(ContainerNetworkInterfaceConfiguration.DeserializeContainerNetworkInterfaceConfiguration(item));
                     }
                     containerNetworkInterfaceConfigurations = array;
                     continue;
                 }
                 if (property0.NameEquals("resourceGuid"))
                 {
                     resourceGuid = property0.Value.GetString();
                     continue;
                 }
                 if (property0.NameEquals("provisioningState"))
                 {
                     provisioningState = new ProvisioningState(property0.Value.GetString());
                     continue;
                 }
             }
             continue;
         }
     }
     return new NetworkProfile(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(containerNetworkInterfaces), Optional.ToList(containerNetworkInterfaceConfigurations), resourceGuid.Value, Optional.ToNullable(provisioningState));
 }
Ejemplo n.º 5
0
        internal static ContainerNetworkInterface DeserializeContainerNetworkInterface(JsonElement element)
        {
            Optional <string> name = default;
            Optional <string> type = default;
            Optional <string> etag = default;
            Optional <string> id   = default;
            Optional <ContainerNetworkInterfaceConfiguration> containerNetworkInterfaceConfiguration = default;
            Optional <SubResource> container = default;
            Optional <IReadOnlyList <ContainerNetworkInterfaceIpConfiguration> > ipConfigurations = default;
            Optional <ProvisioningState> provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("containerNetworkInterfaceConfiguration"))
                        {
                            containerNetworkInterfaceConfiguration = ContainerNetworkInterfaceConfiguration.DeserializeContainerNetworkInterfaceConfiguration(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("container"))
                        {
                            container = DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("ipConfigurations"))
                        {
                            List <ContainerNetworkInterfaceIpConfiguration> array = new List <ContainerNetworkInterfaceIpConfiguration>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ContainerNetworkInterfaceIpConfiguration.DeserializeContainerNetworkInterfaceIpConfiguration(item));
                            }
                            ipConfigurations = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ContainerNetworkInterface(id.Value, name.Value, type.Value, etag.Value, containerNetworkInterfaceConfiguration.Value, container.Value, Optional.ToList(ipConfigurations), Optional.ToNullable(provisioningState)));
        }