示例#1
0
 internal DiskPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, StoragePoolSku sku, string managedBy, IReadOnlyList <string> managedByExtended, ProvisioningStates provisioningState, IList <string> availabilityZones, OperationalStatus status, IList <WritableSubResource> disks, string subnetId, IList <string> additionalCapabilities) : base(id, name, resourceType, systemData, tags, location)
 {
     Sku                    = sku;
     ManagedBy              = managedBy;
     ManagedByExtended      = managedByExtended;
     ProvisioningState      = provisioningState;
     AvailabilityZones      = availabilityZones;
     Status                 = status;
     Disks                  = disks;
     SubnetId               = subnetId;
     AdditionalCapabilities = additionalCapabilities;
 }
 internal IscsiTargetData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, string managedBy, IReadOnlyList <string> managedByExtended, IscsiTargetAclMode aclMode, IList <Acl> staticAcls, IList <IscsiLun> luns, string targetIqn, ProvisioningStates provisioningState, OperationalStatus status, IList <string> endpoints, int?port, IReadOnlyList <string> sessions) : base(id, name, type, systemData)
 {
     ManagedBy         = managedBy;
     ManagedByExtended = managedByExtended;
     AclMode           = aclMode;
     StaticAcls        = staticAcls;
     Luns              = luns;
     TargetIqn         = targetIqn;
     ProvisioningState = provisioningState;
     Status            = status;
     Endpoints         = endpoints;
     Port              = port;
     Sessions          = sessions;
 }
        public IscsiTargetData(IscsiTargetAclMode aclMode, string targetIqn, ProvisioningStates provisioningState, OperationalStatus status)
        {
            if (targetIqn == null)
            {
                throw new ArgumentNullException(nameof(targetIqn));
            }

            ManagedByExtended = new ChangeTrackingList <string>();
            AclMode           = aclMode;
            StaticAcls        = new ChangeTrackingList <Acl>();
            Luns              = new ChangeTrackingList <IscsiLun>();
            TargetIqn         = targetIqn;
            ProvisioningState = provisioningState;
            Status            = status;
            Endpoints         = new ChangeTrackingList <string>();
            Sessions          = new ChangeTrackingList <string>();
        }
示例#4
0
        public DiskPoolData(AzureLocation location, ProvisioningStates provisioningState, IEnumerable <string> availabilityZones, OperationalStatus status, string subnetId) : base(location)
        {
            if (availabilityZones == null)
            {
                throw new ArgumentNullException(nameof(availabilityZones));
            }
            if (subnetId == null)
            {
                throw new ArgumentNullException(nameof(subnetId));
            }

            ManagedByExtended      = new ChangeTrackingList <string>();
            ProvisioningState      = provisioningState;
            AvailabilityZones      = availabilityZones.ToList();
            Status                 = status;
            Disks                  = new ChangeTrackingList <WritableSubResource>();
            SubnetId               = subnetId;
            AdditionalCapabilities = new ChangeTrackingList <string>();
        }
示例#5
0
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param>
 /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param>
 /// <param name="formatProvider">not used by this TypeConverter.</param>
 /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param>
 /// <returns>
 /// an instance of <see cref="ProvisioningStates" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ProvisioningStates.CreateFrom(sourceValue);
示例#6
0
        internal static DiskPoolData DeserializeDiskPoolData(JsonElement element)
        {
            Optional <StoragePoolSku>          sku               = default;
            Optional <string>                  managedBy         = default;
            Optional <IReadOnlyList <string> > managedByExtended = default;
            IDictionary <string, string>       tags              = default;
            AzureLocation      location                   = default;
            ResourceIdentifier id                         = default;
            string             name                       = default;
            ResourceType       type                       = default;
            SystemData         systemData                 = default;
            ProvisioningStates provisioningState          = default;
            IList <string>     availabilityZones          = default;
            OperationalStatus  status                     = default;
            Optional <IList <WritableSubResource> > disks = default;
            string subnetId = default;
            Optional <IList <string> > additionalCapabilities = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = StoragePoolSku.DeserializeStoragePoolSku(property.Value);
                    continue;
                }
                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("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("provisioningState"))
                        {
                            provisioningState = new ProvisioningStates(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("availabilityZones"))
                        {
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            availabilityZones = array;
                            continue;
                        }
                        if (property0.NameEquals("status"))
                        {
                            status = new OperationalStatus(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("disks"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <WritableSubResource> array = new List <WritableSubResource>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(JsonSerializer.Deserialize <WritableSubResource>(item.ToString()));
                            }
                            disks = array;
                            continue;
                        }
                        if (property0.NameEquals("subnetId"))
                        {
                            subnetId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("additionalCapabilities"))
                        {
                            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());
                            }
                            additionalCapabilities = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new DiskPoolData(id, name, type, systemData, tags, location, sku.Value, managedBy.Value, Optional.ToList(managedByExtended), provisioningState, availabilityZones, status, Optional.ToList(disks), subnetId, Optional.ToList(additionalCapabilities)));
        }
        internal static ElasticSanVolumeGroupData DeserializeElasticSanVolumeGroupData(JsonElement element)
        {
            IDictionary <string, string> tags               = default;
            AzureLocation                 location          = default;
            ResourceIdentifier            id                = default;
            string                        name              = default;
            ResourceType                  type              = default;
            SystemData                    systemData        = default;
            Optional <ProvisioningStates> provisioningState = default;
            Optional <StorageTargetType>  protocolType      = default;
            Optional <EncryptionType>     encryption        = default;
            Optional <NetworkRuleSet>     networkAcls       = 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 = 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("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningStates(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("protocolType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            protocolType = new StorageTargetType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("encryption"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            encryption = new EncryptionType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("networkAcls"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            networkAcls = NetworkRuleSet.DeserializeNetworkRuleSet(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ElasticSanVolumeGroupData(id, name, type, systemData, tags, location, Optional.ToNullable(provisioningState), Optional.ToNullable(protocolType), Optional.ToNullable(encryption), networkAcls.Value));
        }
示例#8
0
        internal static ElasticSanData DeserializeElasticSanData(JsonElement element)
        {
            IDictionary <string, string> tags                     = default;
            AzureLocation                 location                = default;
            ResourceIdentifier            id                      = default;
            string                        name                    = default;
            ResourceType                  type                    = default;
            SystemData                    systemData              = default;
            Optional <ElasticSanSku>      sku                     = default;
            Optional <IList <string> >    availabilityZones       = default;
            Optional <ProvisioningStates> provisioningState       = default;
            Optional <long>               baseSizeTiB             = default;
            Optional <long>               extendedCapacitySizeTiB = default;
            Optional <long>               totalVolumeSizeGiB      = default;
            Optional <long>               volumeGroupCount        = default;
            Optional <long>               totalIops               = default;
            Optional <long>               totalMBps               = default;
            Optional <long>               provisionedMBps         = 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 = 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("sku"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            sku = ElasticSanSku.DeserializeElasticSanSku(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("availabilityZones"))
                        {
                            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());
                            }
                            availabilityZones = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningStates(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("baseSizeTiB"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            baseSizeTiB = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("extendedCapacitySizeTiB"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            extendedCapacitySizeTiB = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("totalVolumeSizeGiB"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            totalVolumeSizeGiB = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("volumeGroupCount"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            volumeGroupCount = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("totalIops"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            totalIops = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("totalMBps"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            totalMBps = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("provisionedMBps"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisionedMBps = property0.Value.GetInt64();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ElasticSanData(id, name, type, systemData, tags, location, sku.Value, Optional.ToList(availabilityZones), Optional.ToNullable(provisioningState), Optional.ToNullable(baseSizeTiB), Optional.ToNullable(extendedCapacitySizeTiB), Optional.ToNullable(totalVolumeSizeGiB), Optional.ToNullable(volumeGroupCount), Optional.ToNullable(totalIops), Optional.ToNullable(totalMBps), Optional.ToNullable(provisionedMBps)));
        }
示例#9
0
        internal static IscsiTargetData DeserializeIscsiTargetData(JsonElement element)
        {
            Optional <string> managedBy = default;
            Optional <IReadOnlyList <string> > managedByExtended = default;
            ResourceIdentifier                 id                = default;
            string                             name              = default;
            ResourceType                       type              = default;
            SystemData                         systemData        = default;
            IscsiTargetAclMode                 aclMode           = default;
            Optional <IList <Acl> >            staticAcls        = default;
            Optional <IList <IscsiLun> >       luns              = default;
            string                             targetIqn         = default;
            ProvisioningStates                 provisioningState = default;
            OperationalStatus                  status            = default;
            Optional <IList <string> >         endpoints         = default;
            Optional <int>                     port              = default;
            Optional <IReadOnlyList <string> > sessions          = 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("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;
                        }
                        if (property0.NameEquals("targetIqn"))
                        {
                            targetIqn = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = new ProvisioningStates(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("status"))
                        {
                            status = new OperationalStatus(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("endpoints"))
                        {
                            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());
                            }
                            endpoints = array;
                            continue;
                        }
                        if (property0.NameEquals("port"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            port = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("sessions"))
                        {
                            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());
                            }
                            sessions = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new IscsiTargetData(id, name, type, systemData, managedBy.Value, Optional.ToList(managedByExtended), aclMode, Optional.ToList(staticAcls), Optional.ToList(luns), targetIqn, provisioningState, status, Optional.ToList(endpoints), Optional.ToNullable(port), Optional.ToList(sessions)));
        }