Example #1
0
        internal static PrivateDnsZoneGroup DeserializePrivateDnsZoneGroup(JsonElement element)
        {
            Optional <string>                        name = default;
            Optional <string>                        etag = default;
            Optional <string>                        id   = default;
            Optional <ProvisioningState>             provisioningState     = default;
            Optional <IList <PrivateDnsZoneConfig> > privateDnsZoneConfigs = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = 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("provisioningState"))
                        {
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("privateDnsZoneConfigs"))
                        {
                            List <PrivateDnsZoneConfig> array = new List <PrivateDnsZoneConfig>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PrivateDnsZoneConfig.DeserializePrivateDnsZoneConfig(item));
                            }
                            privateDnsZoneConfigs = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new PrivateDnsZoneGroup(id.Value, name.Value, etag.Value, Optional.ToNullable(provisioningState), Optional.ToList(privateDnsZoneConfigs)));
        }
        internal static PrivateDnsZoneGroup DeserializePrivateDnsZoneGroup(JsonElement element)
        {
            string                       name = default;
            string                       etag = default;
            string                       id   = default;
            ProvisioningState?           provisioningState     = default;
            IList <PrivateDnsZoneConfig> privateDnsZoneConfigs = 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("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("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("privateDnsZoneConfigs"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <PrivateDnsZoneConfig> array = new List <PrivateDnsZoneConfig>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(PrivateDnsZoneConfig.DeserializePrivateDnsZoneConfig(item));
                                }
                            }
                            privateDnsZoneConfigs = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new PrivateDnsZoneGroup(id, name, etag, provisioningState, privateDnsZoneConfigs));
        }