Exemple #1
0
 internal AppServiceDomainPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kind, ContactInformation contactAdmin, ContactInformation contactBilling, ContactInformation contactRegistrant, ContactInformation contactTech, DomainStatus?registrationStatus, ProvisioningState?provisioningState, IReadOnlyList <string> nameServers, bool?privacy, DateTimeOffset?createdOn, DateTimeOffset?expirationOn, DateTimeOffset?lastRenewedOn, bool?autoRenew, bool?readyForDnsRecordManagement, IReadOnlyList <HostName> managedHostNames, DomainPurchaseConsent consent, IReadOnlyList <DomainNotRenewableReasons> domainNotRenewableReasons, DnsType?dnsType, string dnsZoneId, DnsType?targetDnsType, string authCode) : base(id, name, resourceType, systemData, kind)
 {
     ContactAdmin                = contactAdmin;
     ContactBilling              = contactBilling;
     ContactRegistrant           = contactRegistrant;
     ContactTech                 = contactTech;
     RegistrationStatus          = registrationStatus;
     ProvisioningState           = provisioningState;
     NameServers                 = nameServers;
     Privacy                     = privacy;
     CreatedOn                   = createdOn;
     ExpirationOn                = expirationOn;
     LastRenewedOn               = lastRenewedOn;
     AutoRenew                   = autoRenew;
     ReadyForDnsRecordManagement = readyForDnsRecordManagement;
     ManagedHostNames            = managedHostNames;
     Consent                     = consent;
     DomainNotRenewableReasons   = domainNotRenewableReasons;
     DnsType                     = dnsType;
     DnsZoneId                   = dnsZoneId;
     TargetDnsType               = targetDnsType;
     AuthCode                    = authCode;
 }
        internal static AppServiceDomainPatch DeserializeAppServiceDomainPatch(JsonElement element)
        {
            Optional <string>                    kind                        = 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 <DomainNotRenewableReasons> > 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("id"))
                {
                    id = new ResourceIdentifier(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("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 <DomainNotRenewableReasons> array = new List <DomainNotRenewableReasons>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(new DomainNotRenewableReasons(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 AppServiceDomainPatch(id, name, type, systemData, 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));
        }