コード例 #1
0
 internal ElasticSanVolumeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string elasticSanVolumeId, SourceCreationData creationData, long?sizeGiB, IscsiTargetInfo storageTarget) : base(id, name, resourceType, systemData, tags, location)
 {
     ElasticSanVolumeId = elasticSanVolumeId;
     CreationData       = creationData;
     SizeGiB            = sizeGiB;
     StorageTarget      = storageTarget;
 }
コード例 #2
0
        internal static ElasticSanVolumeData DeserializeElasticSanVolumeData(JsonElement element)
        {
            IDictionary <string, string> tags           = default;
            AzureLocation                 location      = default;
            ResourceIdentifier            id            = default;
            string                        name          = default;
            ResourceType                  type          = default;
            SystemData                    systemData    = default;
            Optional <string>             volumeId      = default;
            Optional <SourceCreationData> creationData  = default;
            Optional <long>               sizeGiB       = default;
            Optional <IscsiTargetInfo>    storageTarget = 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("volumeId"))
                        {
                            volumeId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("creationData"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            creationData = SourceCreationData.DeserializeSourceCreationData(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("sizeGiB"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            sizeGiB = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("storageTarget"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            storageTarget = IscsiTargetInfo.DeserializeIscsiTargetInfo(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ElasticSanVolumeData(id, name, type, systemData, tags, location, volumeId.Value, creationData.Value, Optional.ToNullable(sizeGiB), storageTarget.Value));
        }