コード例 #1
0
        // Create restore point and exercise 'ExcludeDisk' functionality by excluding dataDisk.
        private RestorePoint CreateRestorePoint(string rgName, string rpcName,
                                                string rpName, string diskToExclude, string sourceRestorePointId)
        {
            RestorePoint inputRestorePoint = new RestorePoint();

            if (diskToExclude != null)
            {
                ApiEntityReference diskToExcludeEntityRef = new ApiEntityReference()
                {
                    Id = diskToExclude
                };
                List <ApiEntityReference> disksToExclude = new List <ApiEntityReference> {
                    diskToExcludeEntityRef
                };
                inputRestorePoint.ExcludeDisks = disksToExclude;
            }

            if (sourceRestorePointId != null)
            {
                inputRestorePoint.SourceRestorePoint = new ApiEntityReference()
                {
                    Id = sourceRestorePointId
                };
            }

            return(m_CrpClient.RestorePoints.Create(rgName, rpcName, rpName, inputRestorePoint));
        }
コード例 #2
0
 internal RestorePointSourceVMDataDisk(int?lun, string name, CachingTypes?caching, int?diskSizeGB, ManagedDiskParameters managedDisk, ApiEntityReference diskRestorePoint)
 {
     Lun              = lun;
     Name             = name;
     Caching          = caching;
     DiskSizeGB       = diskSizeGB;
     ManagedDisk      = managedDisk;
     DiskRestorePoint = diskRestorePoint;
 }
コード例 #3
0
 internal RestorePointSourceVmosDisk(OperatingSystemType?osType, DiskEncryptionSettings encryptionSettings, string name, CachingTypes?caching, int?diskSizeGB, ManagedDiskParameters managedDisk, ApiEntityReference diskRestorePoint)
 {
     OsType             = osType;
     EncryptionSettings = encryptionSettings;
     Name             = name;
     Caching          = caching;
     DiskSizeGB       = diskSizeGB;
     ManagedDisk      = managedDisk;
     DiskRestorePoint = diskRestorePoint;
 }
コード例 #4
0
        // Create restore point and exercise 'ExcludeDisk' functionality by excluding dataDisk.
        private RestorePoint CreateRestorePoint(string rgName, string rpcName,
                                                string rpName, OSDisk osDisk, string diskToExclude)
        {
            string             osDiskId               = osDisk.ManagedDisk.Id;
            string             osDiskName             = osDisk.Name;
            ApiEntityReference diskToExcludeEntityRef = new ApiEntityReference()
            {
                Id = diskToExclude
            };
            List <ApiEntityReference> disksToExclude = new List <ApiEntityReference> {
                diskToExcludeEntityRef
            };

            return(m_CrpClient.RestorePoints.Create(rgName, rpcName, rpName, disksToExclude));
        }
コード例 #5
0
        internal static RestorePointData DeserializeRestorePointData(JsonElement element)
        {
            ResourceIdentifier id   = default;
            string             name = default;
            ResourceType       type = default;
            Optional <IList <ApiEntityReference> > excludeDisks   = default;
            Optional <RestorePointSourceMetadata>  sourceMetadata = default;
            Optional <string> provisioningState = default;
            Optional <ConsistencyModeTypes>            consistencyMode     = default;
            Optional <RestorePointProvisioningDetails> provisioningDetails = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = 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("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("excludeDisks"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ApiEntityReference> array = new List <ApiEntityReference>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ApiEntityReference.DeserializeApiEntityReference(item));
                            }
                            excludeDisks = array;
                            continue;
                        }
                        if (property0.NameEquals("sourceMetadata"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            sourceMetadata = RestorePointSourceMetadata.DeserializeRestorePointSourceMetadata(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("consistencyMode"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            consistencyMode = new ConsistencyModeTypes(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("provisioningDetails"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningDetails = RestorePointProvisioningDetails.DeserializeRestorePointProvisioningDetails(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new RestorePointData(id, name, type, Optional.ToList(excludeDisks), sourceMetadata.Value, provisioningState.Value, Optional.ToNullable(consistencyMode), provisioningDetails.Value));
        }