public static VolumePropertiesDataProtection ConvertDataProtectionFromPs(PSNetAppFilesVolumeDataProtection psDataProtection) { var dataProtection = new VolumePropertiesDataProtection(); if (psDataProtection.Replication != null) { var replication = new ReplicationObject(); // replication.ReplicationId = psDataProtection.Replication.ReplicationId; replication.EndpointType = psDataProtection.Replication.EndpointType; replication.ReplicationSchedule = psDataProtection.Replication.ReplicationSchedule; replication.RemoteVolumeResourceId = psDataProtection.Replication.RemoteVolumeResourceId; // replication.RemoteVolumeRegion = psDataProtection.Replication.RemoteVolumeRegion; dataProtection.Replication = replication; } if (psDataProtection.Snapshot != null) { var snapshot = new VolumeSnapshotProperties(); snapshot.SnapshotPolicyId = psDataProtection.Snapshot.SnapshotPolicyId; dataProtection.Snapshot = snapshot; } if (psDataProtection.Backup != null) { var backup = new VolumeBackupProperties(); backup.BackupEnabled = psDataProtection.Backup.BackupEnabled; backup.BackupPolicyId = psDataProtection.Backup.BackupPolicyId; backup.PolicyEnforced = psDataProtection.Backup.PolicyEnforced; dataProtection.Backup = backup; } return(dataProtection); }
public static VolumePropertiesDataProtection ConvertDataProtectionFromPs(PSNetAppFilesVolumeDataProtection psDataProtection) { var dataProtection = new VolumePropertiesDataProtection(); var replication = new ReplicationObject(); // replication.ReplicationId = psDataProtection.Replication.ReplicationId; replication.EndpointType = psDataProtection.Replication.EndpointType; replication.ReplicationSchedule = psDataProtection.Replication.ReplicationSchedule; replication.RemoteVolumeResourceId = psDataProtection.Replication.RemoteVolumeResourceId; // replication.RemoteVolumeRegion = psDataProtection.Replication.RemoteVolumeRegion; dataProtection.Replication = replication; return(dataProtection); }
public static Volume CreateDpVolume(AzureNetAppFilesManagementClient netAppMgmtClient, Volume sourceVolume, string volumeName = volumeName1ReplDest, string poolName = remotePoolName1, string accountName = remoteAccountName1, string resourceGroup = remoteResourceGroup, string location = location, List <string> protocolTypes = null, IDictionary <string, string> tags = default(IDictionary <string, string>), VolumePropertiesExportPolicy exportPolicy = null, bool volumeOnly = false, string snapshotId = null) { if (!volumeOnly) { CreatePool(netAppMgmtClient, poolName, accountName, resourceGroup: resourceGroup, location: remoteLocation); } var defaultProtocolType = new List <string>() { "NFSv3" }; var volumeProtocolTypes = protocolTypes == null ? defaultProtocolType : protocolTypes; var replication = new ReplicationObject { EndpointType = "dst", RemoteVolumeResourceId = sourceVolume.Id, ReplicationSchedule = "_10minutely" }; var dataProtection = new VolumePropertiesDataProtection { Replication = replication }; var volume = new Volume { Location = remoteLocation, UsageThreshold = 100 * gibibyte, ProtocolTypes = volumeProtocolTypes, CreationToken = volumeName, //SubnetId = "/subscriptions/" + subsId + "/resourceGroups/" + resourceGroup + "/providers/Microsoft.Network/virtualNetworks/" + remoteVnet + "/subnets/default", SubnetId = "/subscriptions/" + netAppMgmtClient.SubscriptionId + "/resourceGroups/" + resourceGroup + "/providers/Microsoft.Network/virtualNetworks/" + remoteVnet + "/subnets/default", Tags = tags, ExportPolicy = exportPolicy, SnapshotId = snapshotId, VolumeType = "DataProtection", DataProtection = dataProtection }; var resource = netAppMgmtClient.Volumes.CreateOrUpdate(volume, resourceGroup, accountName, poolName, volumeName); Assert.Equal(resource.Name, accountName + '/' + poolName + '/' + volumeName); if (Environment.GetEnvironmentVariable("AZURE_TEST_MODE") == "Record") { Thread.Sleep(delay); // some robustness against ARM caching } return(resource); }