コード例 #1
0
 public IscsiTargetCreateOrUpdateContent(IscsiTargetAclMode aclMode)
 {
     ManagedByExtended = new ChangeTrackingList <string>();
     AclMode           = aclMode;
     StaticAcls        = new ChangeTrackingList <Acl>();
     Luns = new ChangeTrackingList <IscsiLun>();
 }
コード例 #2
0
 internal IscsiTargetCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string managedBy, IList <string> managedByExtended, IscsiTargetAclMode aclMode, string targetIqn, IList <Acl> staticAcls, IList <IscsiLun> luns) : base(id, name, resourceType, systemData)
 {
     ManagedBy         = managedBy;
     ManagedByExtended = managedByExtended;
     AclMode           = aclMode;
     TargetIqn         = targetIqn;
     StaticAcls        = staticAcls;
     Luns = luns;
 }
        internal static IscsiTargetCreate DeserializeIscsiTargetCreate(JsonElement element)
        {
            Optional <string>          managedBy         = default;
            Optional <IList <string> > managedByExtended = default;
            ResourceIdentifier         id           = default;
            string                       name       = default;
            ResourceType                 type       = default;
            SystemData                   systemData = default;
            IscsiTargetAclMode           aclMode    = default;
            Optional <string>            targetIqn  = default;
            Optional <IList <Acl> >      staticAcls = default;
            Optional <IList <IscsiLun> > luns       = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("managedBy"))
                {
                    managedBy = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("managedByExtended"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    managedByExtended = array;
                    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("aclMode"))
                        {
                            aclMode = new IscsiTargetAclMode(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("targetIqn"))
                        {
                            targetIqn = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("staticAcls"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <Acl> array = new List <Acl>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(Acl.DeserializeAcl(item));
                            }
                            staticAcls = array;
                            continue;
                        }
                        if (property0.NameEquals("luns"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <IscsiLun> array = new List <IscsiLun>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(IscsiLun.DeserializeIscsiLun(item));
                            }
                            luns = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new IscsiTargetCreate(id, name, type, systemData, managedBy.Value, Optional.ToList(managedByExtended), aclMode, targetIqn.Value, Optional.ToList(staticAcls), Optional.ToList(luns)));
        }