Пример #1
0
 internal ManagementLockData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagementLockLevel level, string notes, IList <ManagementLockOwner> owners) : base(id, name, resourceType, systemData)
 {
     Level  = level;
     Notes  = notes;
     Owners = owners;
 }
Пример #2
0
        internal static ManagementLockData DeserializeManagementLockData(JsonElement element)
        {
            ResourceIdentifier  id         = default;
            string              name       = default;
            ResourceType        type       = default;
            SystemData          systemData = default;
            ManagementLockLevel level      = default;
            Optional <string>   notes      = default;
            Optional <IList <ManagementLockOwner> > owners = default;

            foreach (var property in element.EnumerateObject())
            {
                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("level"))
                        {
                            level = new ManagementLockLevel(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("notes"))
                        {
                            notes = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("owners"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ManagementLockOwner> array = new List <ManagementLockOwner>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ManagementLockOwner.DeserializeManagementLockOwner(item));
                            }
                            owners = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ManagementLockData(id, name, type, systemData, level, notes.Value, Optional.ToList(owners)));
        }
Пример #3
0
 public ManagementLockData(ManagementLockLevel level)
 {
     Level  = level;
     Owners = new ChangeTrackingList <ManagementLockOwner>();
 }