Example #1
0
 internal AppServiceCertificateOrderPatch(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, string kind, IDictionary <string, AppServiceCertificate> certificates, string distinguishedName, string domainVerificationToken, int?validityInYears, int?keySize, CertificateProductType?productType, bool?autoRenew, ProvisioningState?provisioningState, CertificateOrderStatus?status, CertificateDetails signedCertificate, string csr, CertificateDetails intermediate, CertificateDetails root, string serialNumber, DateTimeOffset?lastCertificateIssuanceTime, DateTimeOffset?expirationTime, bool?isPrivateKeyExternal, IReadOnlyList <AppServiceCertificateNotRenewableReason> appServiceCertificateNotRenewableReasons, DateTimeOffset?nextAutoRenewalTimeStamp, CertificateOrderContact contact) : base(id, name, type, systemData, kind)
 {
     Certificates            = certificates;
     DistinguishedName       = distinguishedName;
     DomainVerificationToken = domainVerificationToken;
     ValidityInYears         = validityInYears;
     KeySize           = keySize;
     ProductType       = productType;
     AutoRenew         = autoRenew;
     ProvisioningState = provisioningState;
     Status            = status;
     SignedCertificate = signedCertificate;
     Csr          = csr;
     Intermediate = intermediate;
     Root         = root;
     SerialNumber = serialNumber;
     LastCertificateIssuanceTime = lastCertificateIssuanceTime;
     ExpirationTime       = expirationTime;
     IsPrivateKeyExternal = isPrivateKeyExternal;
     AppServiceCertificateNotRenewableReasons = appServiceCertificateNotRenewableReasons;
     NextAutoRenewalTimeStamp = nextAutoRenewalTimeStamp;
     Contact = contact;
 }
        internal static AppServiceCertificateOrderUpdateOptions DeserializeAppServiceCertificateOrderUpdateOptions(JsonElement element)
        {
            Optional <string>  kind       = default;
            ResourceIdentifier id         = default;
            string             name       = default;
            ResourceType       type       = default;
            SystemData         systemData = default;
            Optional <IDictionary <string, AppServiceCertificate> > certificates = default;
            Optional <string> distinguishedName       = default;
            Optional <string> domainVerificationToken = default;
            Optional <int>    validityInYears         = default;
            Optional <int>    keySize = default;
            Optional <CertificateProductType> productType = default;
            Optional <bool> autoRenew = default;
            Optional <ProvisioningState>      provisioningState = default;
            Optional <CertificateOrderStatus> status            = default;
            Optional <CertificateDetails>     signedCertificate = default;
            Optional <string>             csr          = default;
            Optional <CertificateDetails> intermediate = default;
            Optional <CertificateDetails> root         = default;
            Optional <string>             serialNumber = default;
            Optional <DateTimeOffset>     lastCertificateIssuanceTime = default;
            Optional <DateTimeOffset>     expirationTime = default;
            Optional <bool> isPrivateKeyExternal         = default;
            Optional <IReadOnlyList <AppServiceCertificateNotRenewableReason> > appServiceCertificateNotRenewableReasons = default;
            Optional <DateTimeOffset>          nextAutoRenewalTimeStamp = default;
            Optional <CertificateOrderContact> contact = 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("certificates"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            Dictionary <string, AppServiceCertificate> dictionary = new Dictionary <string, AppServiceCertificate>();
                            foreach (var property1 in property0.Value.EnumerateObject())
                            {
                                dictionary.Add(property1.Name, AppServiceCertificate.DeserializeAppServiceCertificate(property1.Value));
                            }
                            certificates = dictionary;
                            continue;
                        }
                        if (property0.NameEquals("distinguishedName"))
                        {
                            distinguishedName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("domainVerificationToken"))
                        {
                            domainVerificationToken = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("validityInYears"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            validityInYears = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("keySize"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            keySize = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("productType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            productType = property0.Value.GetString().ToCertificateProductType();
                            continue;
                        }
                        if (property0.NameEquals("autoRenew"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            autoRenew = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = property0.Value.GetString().ToProvisioningState();
                            continue;
                        }
                        if (property0.NameEquals("status"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            status = property0.Value.GetString().ToCertificateOrderStatus();
                            continue;
                        }
                        if (property0.NameEquals("signedCertificate"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            signedCertificate = CertificateDetails.DeserializeCertificateDetails(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("csr"))
                        {
                            csr = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("intermediate"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            intermediate = CertificateDetails.DeserializeCertificateDetails(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("root"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            root = CertificateDetails.DeserializeCertificateDetails(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("serialNumber"))
                        {
                            serialNumber = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("lastCertificateIssuanceTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            lastCertificateIssuanceTime = 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("isPrivateKeyExternal"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isPrivateKeyExternal = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("appServiceCertificateNotRenewableReasons"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <AppServiceCertificateNotRenewableReason> array = new List <AppServiceCertificateNotRenewableReason>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(new AppServiceCertificateNotRenewableReason(item.GetString()));
                            }
                            appServiceCertificateNotRenewableReasons = array;
                            continue;
                        }
                        if (property0.NameEquals("nextAutoRenewalTimeStamp"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            nextAutoRenewalTimeStamp = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("contact"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            contact = CertificateOrderContact.DeserializeCertificateOrderContact(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new AppServiceCertificateOrderUpdateOptions(id, name, type, systemData, kind.Value, Optional.ToDictionary(certificates), distinguishedName.Value, domainVerificationToken.Value, Optional.ToNullable(validityInYears), Optional.ToNullable(keySize), Optional.ToNullable(productType), Optional.ToNullable(autoRenew), Optional.ToNullable(provisioningState), Optional.ToNullable(status), signedCertificate.Value, csr.Value, intermediate.Value, root.Value, serialNumber.Value, Optional.ToNullable(lastCertificateIssuanceTime), Optional.ToNullable(expirationTime), Optional.ToNullable(isPrivateKeyExternal), Optional.ToList(appServiceCertificateNotRenewableReasons), Optional.ToNullable(nextAutoRenewalTimeStamp), contact.Value));
        }