internal static OperationInformation DeserializeOperationInformation(JsonElement element)
        {
            Optional <string>          id     = default;
            Optional <string>          name   = default;
            Optional <OperationStatus> status = default;
            Optional <IReadOnlyList <ErrorEntity> > errors = default;
            Optional <DateTimeOffset> createdTime          = default;
            Optional <DateTimeOffset> modifiedTime         = default;
            Optional <DateTimeOffset> expirationTime       = default;
            Optional <Guid>           geoMasterOperationId = 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("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    status = property.Value.GetString().ToOperationStatus();
                    continue;
                }
                if (property.NameEquals("errors"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ErrorEntity> array = new List <ErrorEntity>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ErrorEntity.DeserializeErrorEntity(item));
                    }
                    errors = array;
                    continue;
                }
                if (property.NameEquals("createdTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    createdTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("modifiedTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    modifiedTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("expirationTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    expirationTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("geoMasterOperationId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    geoMasterOperationId = property.Value.GetGuid();
                    continue;
                }
            }
            return(new OperationInformation(id.Value, name.Value, Optional.ToNullable(status), Optional.ToList(errors), Optional.ToNullable(createdTime), Optional.ToNullable(modifiedTime), Optional.ToNullable(expirationTime), Optional.ToNullable(geoMasterOperationId)));
        }
Пример #2
0
        internal static CustomHostnameAnalysisResult DeserializeCustomHostnameAnalysisResult(JsonElement element)
        {
            Optional <string>  kind       = default;
            ResourceIdentifier id         = default;
            string             name       = default;
            ResourceType       type       = default;
            SystemData         systemData = default;
            Optional <bool>    isHostnameAlreadyVerified = default;
            Optional <DnsVerificationTestResult> customDomainVerificationTest = default;
            Optional <ErrorEntity>     customDomainVerificationFailureInfo    = default;
            Optional <bool>            hasConflictOnScaleUnit        = default;
            Optional <bool>            hasConflictAcrossSubscription = default;
            Optional <string>          conflictingAppResourceId      = default;
            Optional <IList <string> > cNameRecords          = default;
            Optional <IList <string> > txtRecords            = default;
            Optional <IList <string> > aRecords              = default;
            Optional <IList <string> > alternateCNameRecords = default;
            Optional <IList <string> > alternateTxtRecords   = 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("isHostnameAlreadyVerified"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isHostnameAlreadyVerified = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("customDomainVerificationTest"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            customDomainVerificationTest = property0.Value.GetString().ToDnsVerificationTestResult();
                            continue;
                        }
                        if (property0.NameEquals("customDomainVerificationFailureInfo"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            customDomainVerificationFailureInfo = ErrorEntity.DeserializeErrorEntity(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("hasConflictOnScaleUnit"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hasConflictOnScaleUnit = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("hasConflictAcrossSubscription"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hasConflictAcrossSubscription = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("conflictingAppResourceId"))
                        {
                            conflictingAppResourceId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("cNameRecords"))
                        {
                            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());
                            }
                            cNameRecords = array;
                            continue;
                        }
                        if (property0.NameEquals("txtRecords"))
                        {
                            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());
                            }
                            txtRecords = array;
                            continue;
                        }
                        if (property0.NameEquals("aRecords"))
                        {
                            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());
                            }
                            aRecords = array;
                            continue;
                        }
                        if (property0.NameEquals("alternateCNameRecords"))
                        {
                            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());
                            }
                            alternateCNameRecords = array;
                            continue;
                        }
                        if (property0.NameEquals("alternateTxtRecords"))
                        {
                            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());
                            }
                            alternateTxtRecords = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new CustomHostnameAnalysisResult(id, name, type, systemData, kind.Value, Optional.ToNullable(isHostnameAlreadyVerified), Optional.ToNullable(customDomainVerificationTest), customDomainVerificationFailureInfo.Value, Optional.ToNullable(hasConflictOnScaleUnit), Optional.ToNullable(hasConflictAcrossSubscription), conflictingAppResourceId.Value, Optional.ToList(cNameRecords), Optional.ToList(txtRecords), Optional.ToList(aRecords), Optional.ToList(alternateCNameRecords), Optional.ToList(alternateTxtRecords)));
        }