/// <summary> /// Initializes a new instance of the <see cref="RestorePoint"/> class /// with the specified backup ID. /// </summary> /// <param name="backupId">The backup ID. This is obtained from <see cref="Backup.Id">Backup.Id</see>.</param> /// <exception cref="ArgumentNullException">If <paramref name="backupId"/> is <see langword="null"/>.</exception> public RestorePoint(BackupId backupId) { if (backupId == null) throw new ArgumentNullException("backupId"); _backupId = backupId; }
/// <summary> /// Remove and delete a database instance backup. /// </summary> /// <param name="service">The database service instance.</param> /// <param name="backupId">The backup ID. This is obtained from <see cref="Backup.Id">Backup.Id</see></param> /// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentNullException">If <paramref name="backupId"/> is <see langword="null"/>.</exception> /// <exception cref="WebException">If the REST request does not return successfully.</exception> /// <seealso href="http://docs.rackspace.com/cdb/api/v1.0/cdb-devguide/content/DELETE_deleteBackup__version___accountId__backups__backupId__.html">Delete Backup (Rackspace Cloud Databases Developer Guide - API v1.0)</seealso> public static void RemoveBackup(this IDatabaseService service, BackupId backupId) { if (service == null) throw new ArgumentNullException("service"); try { service.RemoveBackupAsync(backupId, CancellationToken.None).Wait(); } catch (AggregateException ex) { ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions; if (innerExceptions.Count == 1) throw innerExceptions[0]; throw; } }