Exemple #1
0
 internal RestorePointGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, RestorePointGroupSource source, string provisioningState, string restorePointGroupId, IReadOnlyList <RestorePointData> restorePoints) : base(id, name, resourceType, systemData, tags, location)
 {
     Source              = source;
     ProvisioningState   = provisioningState;
     RestorePointGroupId = restorePointGroupId;
     RestorePoints       = restorePoints;
 }
Exemple #2
0
        internal static RestorePointGroupData DeserializeRestorePointGroupData(JsonElement element)
        {
            IDictionary <string, string> tags          = default;
            AzureLocation      location                = default;
            ResourceIdentifier id                      = default;
            string             name                    = default;
            ResourceType       type                    = default;
            SystemData         systemData              = default;
            Optional <RestorePointGroupSource> source  = default;
            Optional <string> provisioningState        = default;
            Optional <string> restorePointCollectionId = default;
            Optional <IReadOnlyList <RestorePointData> > restorePoints = default;

            foreach (var property in element.EnumerateObject())
            {
                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("source"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            source = RestorePointGroupSource.DeserializeRestorePointGroupSource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("restorePointCollectionId"))
                        {
                            restorePointCollectionId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("restorePoints"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <RestorePointData> array = new List <RestorePointData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(RestorePointData.DeserializeRestorePointData(item));
                            }
                            restorePoints = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new RestorePointGroupData(id, name, type, systemData, tags, location, source.Value, provisioningState.Value, restorePointCollectionId.Value, Optional.ToList(restorePoints)));
        }