internal static ContainerService DeserializeContainerService(JsonElement element)
        {
            string id       = default;
            string name     = default;
            string type     = default;
            string location = default;
            IDictionary <string, string> tags = default;
            string provisioningState          = default;
            ContainerServiceOrchestratorProfile      orchestratorProfile     = default;
            ContainerServiceCustomProfile            customProfile           = default;
            ContainerServicePrincipalProfile         servicePrincipalProfile = default;
            ContainerServiceMasterProfile            masterProfile           = default;
            IList <ContainerServiceAgentPoolProfile> agentPoolProfiles       = default;
            ContainerServiceWindowsProfile           windowsProfile          = default;
            ContainerServiceLinuxProfile             linuxProfile            = default;
            ContainerServiceDiagnosticsProfile       diagnosticsProfile      = default;

            foreach (var property in element.EnumerateObject())
            {
                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"))
                {
                    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("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("orchestratorProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            orchestratorProfile = ContainerServiceOrchestratorProfile.DeserializeContainerServiceOrchestratorProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("customProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            customProfile = ContainerServiceCustomProfile.DeserializeContainerServiceCustomProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("servicePrincipalProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            servicePrincipalProfile = ContainerServicePrincipalProfile.DeserializeContainerServicePrincipalProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("masterProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            masterProfile = ContainerServiceMasterProfile.DeserializeContainerServiceMasterProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("agentPoolProfiles"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <ContainerServiceAgentPoolProfile> array = new List <ContainerServiceAgentPoolProfile>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(ContainerServiceAgentPoolProfile.DeserializeContainerServiceAgentPoolProfile(item));
                                }
                            }
                            agentPoolProfiles = array;
                            continue;
                        }
                        if (property0.NameEquals("windowsProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            windowsProfile = ContainerServiceWindowsProfile.DeserializeContainerServiceWindowsProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("linuxProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            linuxProfile = ContainerServiceLinuxProfile.DeserializeContainerServiceLinuxProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("diagnosticsProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            diagnosticsProfile = ContainerServiceDiagnosticsProfile.DeserializeContainerServiceDiagnosticsProfile(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ContainerService(id, name, type, location, tags, provisioningState, orchestratorProfile, customProfile, servicePrincipalProfile, masterProfile, agentPoolProfiles, windowsProfile, linuxProfile, diagnosticsProfile));
        }
Beispiel #2
0
        internal static ContainerService DeserializeContainerService(JsonElement element)
        {
            Optional <string> id       = default;
            Optional <string> name     = default;
            Optional <string> type     = default;
            string            location = default;
            Optional <IDictionary <string, string> > tags = default;
            Optional <string> provisioningState           = default;
            Optional <ContainerServiceOrchestratorProfile>       orchestratorProfile     = default;
            Optional <ContainerServiceCustomProfile>             customProfile           = default;
            Optional <ContainerServicePrincipalProfile>          servicePrincipalProfile = default;
            Optional <ContainerServiceMasterProfile>             masterProfile           = default;
            Optional <IList <ContainerServiceAgentPoolProfile> > agentPoolProfiles       = default;
            Optional <ContainerServiceWindowsProfile>            windowsProfile          = default;
            Optional <ContainerServiceLinuxProfile>       linuxProfile       = default;
            Optional <ContainerServiceDiagnosticsProfile> diagnosticsProfile = default;

            foreach (var property in element.EnumerateObject())
            {
                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("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("orchestratorProfile"))
                        {
                            orchestratorProfile = ContainerServiceOrchestratorProfile.DeserializeContainerServiceOrchestratorProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("customProfile"))
                        {
                            customProfile = ContainerServiceCustomProfile.DeserializeContainerServiceCustomProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("servicePrincipalProfile"))
                        {
                            servicePrincipalProfile = ContainerServicePrincipalProfile.DeserializeContainerServicePrincipalProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("masterProfile"))
                        {
                            masterProfile = ContainerServiceMasterProfile.DeserializeContainerServiceMasterProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("agentPoolProfiles"))
                        {
                            List <ContainerServiceAgentPoolProfile> array = new List <ContainerServiceAgentPoolProfile>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ContainerServiceAgentPoolProfile.DeserializeContainerServiceAgentPoolProfile(item));
                            }
                            agentPoolProfiles = array;
                            continue;
                        }
                        if (property0.NameEquals("windowsProfile"))
                        {
                            windowsProfile = ContainerServiceWindowsProfile.DeserializeContainerServiceWindowsProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("linuxProfile"))
                        {
                            linuxProfile = ContainerServiceLinuxProfile.DeserializeContainerServiceLinuxProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("diagnosticsProfile"))
                        {
                            diagnosticsProfile = ContainerServiceDiagnosticsProfile.DeserializeContainerServiceDiagnosticsProfile(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ContainerService(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), provisioningState.Value, orchestratorProfile.Value, customProfile.Value, servicePrincipalProfile.Value, masterProfile.Value, Optional.ToList(agentPoolProfiles), windowsProfile.Value, linuxProfile.Value, diagnosticsProfile.Value));
        }