Exemple #1
0
        internal static AppServiceDomainData DeserializeAppServiceDomainData(JsonElement element)
        {
            Optional <string>            kind                                = default;
            IDictionary <string, string> tags                                = default;
            AzureLocation                        location                    = default;
            ResourceIdentifier                   id                          = default;
            string                               name                        = default;
            ResourceType                         type                        = default;
            SystemData                           systemData                  = default;
            Optional <ContactInformation>        contactAdmin                = default;
            Optional <ContactInformation>        contactBilling              = default;
            Optional <ContactInformation>        contactRegistrant           = default;
            Optional <ContactInformation>        contactTech                 = default;
            Optional <DomainStatus>              registrationStatus          = default;
            Optional <ProvisioningState>         provisioningState           = default;
            Optional <IReadOnlyList <string> >   nameServers                 = default;
            Optional <bool>                      privacy                     = default;
            Optional <DateTimeOffset>            createdTime                 = default;
            Optional <DateTimeOffset>            expirationTime              = default;
            Optional <DateTimeOffset>            lastRenewedTime             = default;
            Optional <bool>                      autoRenew                   = default;
            Optional <bool>                      readyForDnsRecordManagement = default;
            Optional <IReadOnlyList <HostName> > managedHostNames            = default;
            Optional <DomainPurchaseConsent>     consent                     = default;
            Optional <IReadOnlyList <AppServiceDomainPropertiesDomainNotRenewableReasonsItem> > domainNotRenewableReasons = default;
            Optional <DnsType> dnsType       = default;
            Optional <string>  dnsZoneId     = default;
            Optional <DnsType> targetDnsType = default;
            Optional <string>  authCode      = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    kind = 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("location"))
                {
                    location = new AzureLocation(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("contactAdmin"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            contactAdmin = ContactInformation.DeserializeContactInformation(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("contactBilling"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            contactBilling = ContactInformation.DeserializeContactInformation(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("contactRegistrant"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            contactRegistrant = ContactInformation.DeserializeContactInformation(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("contactTech"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            contactTech = ContactInformation.DeserializeContactInformation(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("registrationStatus"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            registrationStatus = property0.Value.GetString().ToDomainStatus();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = property0.Value.GetString().ToProvisioningState();
                            continue;
                        }
                        if (property0.NameEquals("nameServers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            nameServers = array;
                            continue;
                        }
                        if (property0.NameEquals("privacy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            privacy = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("createdTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            createdTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("expirationTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            expirationTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("lastRenewedTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            lastRenewedTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("autoRenew"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            autoRenew = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("readyForDnsRecordManagement"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            readyForDnsRecordManagement = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("managedHostNames"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <HostName> array = new List <HostName>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(HostName.DeserializeHostName(item));
                            }
                            managedHostNames = array;
                            continue;
                        }
                        if (property0.NameEquals("consent"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            consent = DomainPurchaseConsent.DeserializeDomainPurchaseConsent(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("domainNotRenewableReasons"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <AppServiceDomainPropertiesDomainNotRenewableReasonsItem> array = new List <AppServiceDomainPropertiesDomainNotRenewableReasonsItem>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(new AppServiceDomainPropertiesDomainNotRenewableReasonsItem(item.GetString()));
                            }
                            domainNotRenewableReasons = array;
                            continue;
                        }
                        if (property0.NameEquals("dnsType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            dnsType = property0.Value.GetString().ToDnsType();
                            continue;
                        }
                        if (property0.NameEquals("dnsZoneId"))
                        {
                            dnsZoneId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("targetDnsType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            targetDnsType = property0.Value.GetString().ToDnsType();
                            continue;
                        }
                        if (property0.NameEquals("authCode"))
                        {
                            authCode = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new AppServiceDomainData(id, name, type, systemData, tags, location, kind.Value, contactAdmin.Value, contactBilling.Value, contactRegistrant.Value, contactTech.Value, Optional.ToNullable(registrationStatus), Optional.ToNullable(provisioningState), Optional.ToList(nameServers), Optional.ToNullable(privacy), Optional.ToNullable(createdTime), Optional.ToNullable(expirationTime), Optional.ToNullable(lastRenewedTime), Optional.ToNullable(autoRenew), Optional.ToNullable(readyForDnsRecordManagement), Optional.ToList(managedHostNames), consent.Value, Optional.ToList(domainNotRenewableReasons), Optional.ToNullable(dnsType), dnsZoneId.Value, Optional.ToNullable(targetDnsType), authCode.Value));
        }