internal static EditionCapability DeserializeEditionCapability(JsonElement element)
        {
            Optional <string> name = default;
            Optional <IReadOnlyList <ServiceObjectiveCapability> > supportedServiceLevelObjectives = default;
            Optional <bool> zoneRedundant            = default;
            Optional <ReadScaleCapability> readScale = default;
            Optional <IReadOnlyList <StorageCapability> > supportedStorageCapabilities = default;
            Optional <CapabilityStatus> status = default;
            Optional <string>           reason = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("supportedServiceLevelObjectives"))
                {
                    List <ServiceObjectiveCapability> array = new List <ServiceObjectiveCapability>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ServiceObjectiveCapability.DeserializeServiceObjectiveCapability(item));
                    }
                    supportedServiceLevelObjectives = array;
                    continue;
                }
                if (property.NameEquals("zoneRedundant"))
                {
                    zoneRedundant = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("readScale"))
                {
                    readScale = ReadScaleCapability.DeserializeReadScaleCapability(property.Value);
                    continue;
                }
                if (property.NameEquals("supportedStorageCapabilities"))
                {
                    List <StorageCapability> array = new List <StorageCapability>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(StorageCapability.DeserializeStorageCapability(item));
                    }
                    supportedStorageCapabilities = array;
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    status = property.Value.GetString().ToCapabilityStatus();
                    continue;
                }
                if (property.NameEquals("reason"))
                {
                    reason = property.Value.GetString();
                    continue;
                }
            }
            return(new EditionCapability(name.Value, Optional.ToList(supportedServiceLevelObjectives), Optional.ToNullable(zoneRedundant), readScale.Value, Optional.ToList(supportedStorageCapabilities), Optional.ToNullable(status), reason.Value));
        }
Example #2
0
 internal EditionCapability(string name, IReadOnlyList <ServiceObjectiveCapability> supportedServiceLevelObjectives, bool?zoneRedundant, ReadScaleCapability readScale, IReadOnlyList <StorageCapability> supportedStorageCapabilities, CapabilityStatus?status, string reason)
 {
     Name = name;
     SupportedServiceLevelObjectives = supportedServiceLevelObjectives;
     ZoneRedundant = zoneRedundant;
     ReadScale     = readScale;
     SupportedStorageCapabilities = supportedStorageCapabilities;
     Status = status;
     Reason = reason;
 }