示例#1
0
 internal ScVmmCloudData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, ExtendedLocation extendedLocation, string inventoryItemId, string uuid, string vmmServerId, string cloudName, CloudCapacity cloudCapacity, IReadOnlyList <StorageQoSPolicy> storageQoSPolicies, string provisioningState) : base(id, name, resourceType, systemData, tags, location)
 {
     ExtendedLocation   = extendedLocation;
     InventoryItemId    = inventoryItemId;
     Uuid               = uuid;
     VmmServerId        = vmmServerId;
     CloudName          = cloudName;
     CloudCapacity      = cloudCapacity;
     StorageQoSPolicies = storageQoSPolicies;
     ProvisioningState  = provisioningState;
 }
示例#2
0
        internal static ScVmmCloudData DeserializeScVmmCloudData(JsonElement element)
        {
            ExtendedLocation             extendedLocation = default;
            IDictionary <string, string> tags             = default;
            AzureLocation            location             = default;
            ResourceIdentifier       id              = default;
            string                   name            = default;
            ResourceType             type            = default;
            SystemData               systemData      = default;
            Optional <string>        inventoryItemId = default;
            Optional <string>        uuid            = default;
            Optional <string>        vmmServerId     = default;
            Optional <string>        cloudName       = default;
            Optional <CloudCapacity> cloudCapacity   = default;
            Optional <IReadOnlyList <StorageQoSPolicy> > storageQoSPolicies = default;
            Optional <string> provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("extendedLocation"))
                {
                    extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value);
                    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("inventoryItemId"))
                        {
                            inventoryItemId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("uuid"))
                        {
                            uuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("vmmServerId"))
                        {
                            vmmServerId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("cloudName"))
                        {
                            cloudName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("cloudCapacity"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            cloudCapacity = CloudCapacity.DeserializeCloudCapacity(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("storageQoSPolicies"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <StorageQoSPolicy> array = new List <StorageQoSPolicy>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(StorageQoSPolicy.DeserializeStorageQoSPolicy(item));
                            }
                            storageQoSPolicies = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ScVmmCloudData(id, name, type, systemData, tags, location, extendedLocation, inventoryItemId.Value, uuid.Value, vmmServerId.Value, cloudName.Value, cloudCapacity.Value, Optional.ToList(storageQoSPolicies), provisioningState.Value));
        }
示例#3
0
 public static CloudCapacity CreateCloudCapacity(global::System.Guid stampId, global::System.Guid cloudId)
 {
     CloudCapacity cloudCapacity = new CloudCapacity();
     cloudCapacity.StampId = stampId;
     cloudCapacity.CloudId = cloudId;
     return cloudCapacity;
 }