/// <summary>
        /// Return BackupScheduleGroup give id
        /// </summary>
        /// <param name="id"></param>
        /// <param name="deviceName"></param>
        /// <param name="client"></param>
        /// <param name="resourceGroupName"></param>
        /// <param name="managerName"></param>
        /// <returns></returns>
        public static BackupScheduleGroup GetBackupScheduleGroupById(
            string id,
            string deviceName,
            StorSimpleManagementClient client,
            string resourceGroupName,
            string managerName)
        {
            var bsgs = client.BackupScheduleGroups.ListByDevice(
                deviceName,
                resourceGroupName,
                managerName);

            BackupScheduleGroup bsg = null;

            if (bsgs != null)
            {
                bsg = bsgs.FirstOrDefault(b =>
                                          b.Id.Equals(id, StringComparison.CurrentCultureIgnoreCase));
            }

            if (bsg != null)
            {
                bsg.SetBaseResourceValues(client, resourceGroupName, managerName);
            }

            return(bsg);
        }
Exemplo n.º 2
0
 public FileShare(
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName,
     string name) : base(client, resourceGroupName, managerName, name)
 {
 }
        /// <summary>
        /// Deletes a given fileserver
        /// </summary>
        /// <param name="client"></param>
        /// <param name="resourceGroupName"></param>
        /// <param name="managerName"></param>
        /// <param name="deviceName"></param>
        /// <param name="fileServerName"></param>
        public static void DeleteAndValidateFileServer(
            StorSimpleManagementClient client,
            string resourceGroupName,
            string managerName,
            string deviceName,
            string fileServerName)
        {
            var fileServerToDelete = client.FileServers.Get(
                deviceName,
                fileServerName,
                resourceGroupName,
                managerName);

            Assert.True(fileServerToDelete != null, "Failed to find FileServer to delete");

            client.FileServers.Delete(deviceName, fileServerToDelete.Name, resourceGroupName, managerName);

            // Get FileServers by Manager and check
            var fileServersByMgrPostDelete = client.FileServers.ListByManager(resourceGroupName, managerName);

            // Get FileServer by Device and check
            var fileServersPostDelete = client.FileServers.ListByDevice(
                deviceName,
                resourceGroupName,
                managerName);

            Assert.True(fileServersByMgrPostDelete.FirstOrDefault(f =>
                                                                  f.Name.Equals(fileServerName, StringComparison.CurrentCultureIgnoreCase)) == null,
                        "Failed to delete the FileServer" + fileServerName);

            Assert.True(fileServersPostDelete.FirstOrDefault(f =>
                                                             f.Name.Equals(fileServerName, StringComparison.CurrentCultureIgnoreCase)) == null,
                        "Failed to delete the FileServer" + fileServerName);
        }
Exemplo n.º 4
0
 public StorageDomain(
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName,
     string name) : base(client, resourceGroupName, managerName, name)
 {
 }
Exemplo n.º 5
0
 public AccessControlRecord(
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName,
     string name) : base(client, resourceGroupName, managerName, name)
 {
 }
 public AlertSettings(
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName,
     string name) : base(client, resourceGroupName, managerName, name)
 {
 }
        /// <summary>
        /// Returns BackupScheduleGroup for a given name
        /// </summary>
        /// <param name="deviceName"></param>
        /// <param name="name"></param>
        /// <param name="client"></param>
        /// <param name="resourceGroupName"></param>
        /// <param name="managerName"></param>
        /// <returns></returns>
        public static BackupScheduleGroup GetBackupScheduleGroup(
            string deviceName,
            string name,
            StorSimpleManagementClient client,
            string resourceGroupName,
            string managerName)
        {
            var bsgs = client.BackupScheduleGroups.ListByDevice(
                deviceName,
                resourceGroupName,
                managerName);

            BackupScheduleGroup bsg = null;

            if (bsgs != null)
            {
                bsg = bsgs.FirstOrDefault(b =>
                                          b.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase));
            }

            if (bsg == null)
            {
                // Create new one for the device
                var bsgNew = new BackupScheduleGroup(
                    client,
                    resourceGroupName,
                    managerName,
                    name);
                bsgNew.Initialize();
                bsg = bsgNew.CreateOrUpdate(deviceName);
            }

            bsg.SetBaseResourceValues(client, resourceGroupName, managerName);
            return(bsg);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Returns managers list for given subscription
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        public static IEnumerable <Manager> ListManagerBySubscription(
            StorSimpleManagementClient client)
        {
            var managers = client.Managers.List();

            return(managers);
        }
 public ISCSIServer(
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName,
     string name) : base(client, resourceGroupName, managerName, name)
 {
 }
Exemplo n.º 10
0
        /// <summary>
        /// Deletes a given iscsi disk
        /// </summary>
        /// <param name="client"></param>
        /// <param name="resourceGroupName"></param>
        /// <param name="managerName"></param>
        /// <param name="iscsiDiskName"></param>
        /// <param name="deviceName"></param>
        /// <param name="iscsiServerName"></param>
        public static void DeleteAndValidateIscsiDisk(
            StorSimpleManagementClient client,
            string resourceGroupName,
            string managerName,
            string iscsiDiskName,
            string deviceName,
            string iscsiServerName)
        {
            var iscsiDisk = client.IscsiDisks.Get(
                deviceName,
                iscsiServerName,
                iscsiDiskName,
                resourceGroupName,
                managerName);

            client.IscsiDisks.Delete(
                deviceName,
                iscsiServerName,
                iscsiDiskName,
                resourceGroupName,
                managerName);

            var iscsiDiskPostDelete = client.IscsiDisks.ListByIscsiServer(
                deviceName,
                iscsiServerName,
                resourceGroupName,
                managerName);

            var deletedFileShare = iscsiDiskPostDelete.FirstOrDefault(f =>
                                                                      f.Name.Equals(iscsiDiskName, StringComparison.CurrentCultureIgnoreCase));

            Assert.True(deletedFileShare == null, "Deletion of IscsiDisk failed");
        }
        /// <summary>
        /// Returns StorageAccountCredential given a name
        /// </summary>
        /// <param name="client"></param>
        /// <param name="name"></param>
        /// <param name="resourceGroupName"></param>
        /// <param name="managerName"></param>
        /// <returns></returns>
        public static StorageAccountCredential GetStorageAccountCredential(
            StorSimpleManagementClient client,
            string name,
            string resourceGroupName,
            string managerName)
        {
            StorageAccountCredential sac = null;

            try
            {
                sac = client.StorageAccountCredentials.Get(name, resourceGroupName, managerName);
            }
            catch (Exception)
            {
                // Since it's not present, create
                sac = new StorageAccountCredential(
                    client,
                    resourceGroupName,
                    managerName,
                    TestConstants.DefaultSacName);
                sac.Initialize();
                sac = sac.CreateOrUpdate();
            }

            sac.SetBaseResourceValues(client, resourceGroupName, managerName);
            return(sac);
        }
Exemplo n.º 12
0
 public BackupScheduleGroup(
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName,
     string name) : base(client, resourceGroupName, managerName, name)
 {
 }
Exemplo n.º 13
0
        /// <summary>
        /// Gets and updates extended info of a given manager
        /// </summary>
        /// <param name="manager"></param>
        /// <returns></returns>
        public static ManagerExtendedInfo GetAndUpdateExtendedInfo(
            this Manager manager,
            StorSimpleManagementClient client,
            string resourceGroupName)
        {
            var extendedInfo = client.Managers.GetExtendedInfo(
                resourceGroupName,
                manager.Name.GetDoubleEncoded());

            extendedInfo.Algorithm = "SHA256";
            string ifMatchETag = extendedInfo.Etag;

            var updatedExtndedInfo = client.Managers.UpdateExtendedInfo(
                extendedInfo,
                resourceGroupName,
                manager.Name.GetDoubleEncoded(),
                ifMatchETag);

            updatedExtndedInfo.SetBaseResourceValues(
                client,
                resourceGroupName,
                manager.Name.GetDoubleEncoded());

            return(updatedExtndedInfo);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Return storage domain
        /// </summary>
        /// <param name="name"></param>
        /// <param name="sacId"></param>
        /// <param name="client"></param>
        /// <param name="resourceGroupName"></param>
        /// <param name="managerName"></param>
        /// <returns></returns>
        public static StorageDomain GetStorageDomain(
            string name,
            string sacId,
            StorSimpleManagementClient client,
            string resourceGroupName,
            string managerName)
        {
            var           storageDomains = client.StorageDomains.ListByManager(resourceGroupName, managerName);
            StorageDomain storageDomain  = null;

            if (storageDomains != null)
            {
                storageDomain = storageDomains.FirstOrDefault(s =>
                                                              s.Name.Equals(
                                                                  name,
                                                                  StringComparison.CurrentCultureIgnoreCase));
            }

            if (storageDomain == null)
            {
                var sdNew = new StorageDomain(
                    client,
                    resourceGroupName,
                    managerName,
                    name);
                sdNew.Initialize(sacId);
                storageDomain = sdNew.CreateOrUpdate();
            }

            storageDomain.SetBaseResourceValues(client, resourceGroupName, managerName);
            return(storageDomain);
        }
        public static T GetServiceClient <T>() where T : class
        {
            var factory = (TestEnvironmentFactory) new RDFETestEnvironmentFactory();

            var testEnvironment = factory.GetTestEnvironment();

            ServicePointManager.ServerCertificateValidationCallback = IgnoreCertificateErrorHandler;

            StorSimpleManagementClient client;

            if (testEnvironment.UsesCustomUri())
            {
                client = new StorSimpleManagementClient(
                    ConfigurationManager.AppSettings["CloudServiceName"],
                    ConfigurationManager.AppSettings["ResourceName"],
                    ConfigurationManager.AppSettings["ResourceId"],
                    ConfigurationManager.AppSettings["ResourceNamespace"],
                    ConfigurationManager.AppSettings["CisStampId"],
                    testEnvironment.Credentials as SubscriptionCloudCredentials,
                    testEnvironment.BaseUri);
            }

            else
            {
                client = new StorSimpleManagementClient(
                    ConfigurationManager.AppSettings["CloudServiceName"],
                    ConfigurationManager.AppSettings["ResourceName"],
                    ConfigurationManager.AppSettings["ResourceId"],
                    ConfigurationManager.AppSettings["ResourceNamespace"],
                    ConfigurationManager.AppSettings["CisStampId"],
                    testEnvironment.Credentials as SubscriptionCloudCredentials);
            }

            return(GetServiceClient <T>(factory, client));
        }
Exemplo n.º 16
0
 /// <summary>
 /// Returns manager given a manager name
 /// </summary>
 /// <param name="client"></param>
 /// <param name="resourceGroupName"></param>
 /// <param name="managerName"></param>
 /// <returns></returns>
 public static Manager GetManager(
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName)
 {
     return(client.Managers.Get(resourceGroupName, managerName.GetDoubleEncoded()));
 }
Exemplo n.º 17
0
 /// <summary>
 /// Returns alerts given an odata filter
 /// </summary>
 /// <param name="client"></param>
 /// <param name="resourceGroupName"></param>
 /// <param name="managerName"></param>
 /// <param name="filter"></param>
 /// <returns></returns>
 public static IPage <Alert> GetAlerts(
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName,
     ODataQuery <AlertFilter> filter)
 {
     return(client.Alerts.ListByManager(resourceGroupName, managerName, filter));
 }
Exemplo n.º 18
0
 /// <summary>
 /// Deactivates a given device
 /// </summary>
 /// <param name="client"></param>
 /// <param name="resourceGroupName"></param>
 /// <param name="managerName"></param>
 /// <param name="deviceName"></param>
 public static void DeleteDevice(
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName,
     string deviceName)
 {
     client.Devices.Delete(deviceName.GetDoubleEncoded(), resourceGroupName, managerName);
 }
Exemplo n.º 19
0
 /// <summary>
 /// Returns jobs for a given manager
 /// </summary>
 /// <param name="client"></param>
 /// <param name="resourceGroupName"></param>
 /// <param name="managerName"></param>
 /// <param name="filter"></param>
 /// <returns></returns>
 public static IEnumerable <Job> GetJobsByManager(
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName,
     ODataQuery <JobFilter> filter)
 {
     return(client.Jobs.ListByManager(resourceGroupName, managerName, filter));
 }
Exemplo n.º 20
0
        /// <summary>
        /// Returns Managers for a given resourcegroup
        /// </summary>
        /// <param name="client"></param>
        /// <param name="resourceGroupName"></param>
        /// <returns></returns>
        public static IEnumerable <Manager> ListManagerByResourceGroup(
            StorSimpleManagementClient client,
            string resourceGroupName)
        {
            var managers = client.Managers.ListByResourceGroup(resourceGroupName);

            return(managers);
        }
Exemplo n.º 21
0
 /// <summary>
 /// Returns job for a given name
 /// </summary>
 /// <param name="name"></param>
 /// <param name="deviceName"></param>
 /// <param name="client"></param>
 /// <param name="resourceGroupName"></param>
 /// <param name="managerName"></param>
 /// <returns></returns>
 public static Job GetJob(
     string name,
     string deviceName,
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName)
 {
     return(client.Jobs.Get(deviceName, name, resourceGroupName, managerName));
 }
Exemplo n.º 22
0
 /// <summary>
 /// Deletes the manager-extendedInfo for the specified StorSimple Manager.
 /// </summary>
 public static void DeleteExtendedInfo(
     this Manager manager,
     StorSimpleManagementClient client,
     string resourceGroupName)
 {
     client.Managers.DeleteExtendedInfoWithHttpMessagesAsync(
         resourceGroupName,
         manager.Name);
 }
Exemplo n.º 23
0
 /// <summary>
 /// Deleted given chap name
 /// </summary>
 /// <param name="chapUserName"></param>
 /// <param name="deviceName"></param>
 /// <param name="client"></param>
 /// <param name="resourceGroupName"></param>
 /// <param name="managerName"></param>
 public static void DeleteChapSettings(
     string chapUserName,
     string deviceName,
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName)
 {
     client.ChapSettings.Delete(deviceName, chapUserName, resourceGroupName, managerName);
 }
Exemplo n.º 24
0
 /// <summary>
 /// Returns metrics definitions of a given manager
 /// </summary>
 /// <param name="manager"></param>
 /// <returns></returns>
 public static IEnumerable <MetricDefinition> GetMetricDefinitions(
     this Manager manager,
     StorSimpleManagementClient client,
     string resourceGroupName)
 {
     return(client.Managers.ListMetricDefinition(
                resourceGroupName,
                manager.Name.GetDoubleEncoded()));
 }
 /// <summary>
 /// Deletes a given backup
 /// </summary>
 /// <param name="name"></param>
 /// <param name="client"></param>
 /// <param name="resourceGroupName"></param>
 /// <param name="managerName"></param>
 public static void DeleteBackup(
     string name,
     string deviceName,
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName)
 {
     client.Backups.Delete(deviceName, name, resourceGroupName, managerName);
 }
 public BaseModel(
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName)
 {
     this.Client            = client;
     this.ResourceGroupName = resourceGroupName;
     this.ManagerName       = managerName;
 }
Exemplo n.º 27
0
 public Resource(
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName)
 {
     Client            = client;
     ResourceGroupName = resourceGroupName;
     ManagerName       = managerName;
     Name = managerName;
 }
Exemplo n.º 28
0
 private static void SetBaseResourceValues(
     this BaseModel baseModel,
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName)
 {
     baseModel.Client            = client;
     baseModel.ResourceGroupName = resourceGroupName;
     baseModel.ManagerName       = managerName;
 }
 public static void GetBackupsByDevice(
     string deviceName,
     StorSimpleManagementClient client,
     string resourceGroupName,
     string managerName)
 {
     client.Backups.ListByDevice(
         deviceName,
         resourceGroupName,
         managerName);
 }
Exemplo n.º 30
0
 /// <summary>
 /// Returns metrics of a given manager
 /// </summary>
 /// <param name="manager"></param>
 /// <param name="odataQuery"></param>
 /// <returns></returns>
 public static IEnumerable <Metrics> GetMetrics(
     this Manager manager,
     StorSimpleManagementClient client,
     string resourceGroupName,
     ODataQuery <MetricFilter> odataQuery)
 {
     return(client.Managers.ListMetrics(
                resourceGroupName,
                manager.Name.GetDoubleEncoded(),
                odataQuery));
 }