コード例 #1
0
ファイル: Program.cs プロジェクト: timothycoy/mongo-azure
        /// <summary>
        /// Creates a backup of the blob with the given URI; returns whether successful.
        /// </summary>
        private static bool Backup(Uri snapshotUri)
        {
            if (!RoleEnvironment.IsAvailable)
            {
                Console.Write("To run a backup, the tool must be run from with an Azure deployed environment.");
                return false;
            }

            if (snapshotUri == null)
            {
                Console.WriteLine("Snapshot URI cannot be null.");
                return false;
            }

            Console.WriteLine("Starting backup on " + snapshotUri + "...");
            var job = new BackupJob(snapshotUri, RoleSettings.StorageCredentials, true);

            job.StartBlocking(); // Runs for a while...

            return true;
        }
コード例 #2
0
ファイル: BackupController.cs プロジェクト: robertogg/Demos
 //=========================================================================
 //
 //  AJAX ACTIONS
 //
 //=========================================================================
 /// <summary>
 /// Starts a backup job on the contents of the blob with the given URI.
 /// </summary>
 public JsonResult Start(string uri)
 {
     var job = new BackupJob(new Uri(uri), RoleSettings.StorageCredentials);
     lock (BackupJobs.Jobs)
     {
         BackupJobs.Jobs.Add(job.Id, job);
     }
     job.Start();
     return Json(new { success = true, jobId = job.Id });
 }