/// <summary>
        /// Initializes a new instance of the <see cref="DatabaseInstanceConfiguration"/> class
        /// with a restore point for restoring a database instance from a backup.
        /// </summary>
        /// <param name="flavorRef">A <see cref="FlavorRef"/> object describing the flavor of the database instance.</param>
        /// <param name="volumeConfiguration">A <see cref="DatabaseVolumeConfiguration"/> object containing additional information about
        /// the database instance storage volume.</param>
        /// <param name="name">The name of the database instance, or <see langword="null"/> if the database instance is not named.</param>
        /// <param name="restorePoint">A <see cref="RestorePoint"/> object describing the backup from which this database instance was restored, or null if the restore point is not available.</param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="flavorRef"/> is <see langword="null"/>.
        /// <para>-or-</para>
        /// <para>If <paramref name="volumeConfiguration"/> is <see langword="null"/>.</para>
        /// </exception>
        public DatabaseInstanceConfiguration(FlavorRef flavorRef, DatabaseVolumeConfiguration volumeConfiguration, string name, RestorePoint restorePoint)
        {
            if (flavorRef == null)
                throw new ArgumentNullException("flavorRef");
            if (volumeConfiguration == null)
                throw new ArgumentNullException("volumeConfiguration");

            _flavorRef = flavorRef;
            _volume = volumeConfiguration;
            _name = name;
            _restorePoint = restorePoint;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DatabaseInstanceConfiguration"/> class
 /// with the specified values.
 /// </summary>
 /// <param name="flavorRef">A <see cref="FlavorRef"/> object describing the flavor of the database instance.</param>
 /// <param name="volumeConfiguration">A <see cref="DatabaseVolumeConfiguration"/> object containing additional information about
 /// the database instance storage volume.</param>
 /// <param name="name">The name of the database instance, or <see langword="null"/> if the database instance is not named.</param>
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="flavorRef"/> is <see langword="null"/>.
 /// <para>-or-</para>
 /// <para>If <paramref name="volumeConfiguration"/> is <see langword="null"/>.</para>
 /// </exception>
 public DatabaseInstanceConfiguration(FlavorRef flavorRef, DatabaseVolumeConfiguration volumeConfiguration, string name)
     : this(flavorRef, volumeConfiguration, name, null)
 {
 }
        /// <summary>
        /// Resize the memory of the database instance.
        /// </summary>
        /// <param name="service">The database service instance.</param>
        /// <param name="instanceId">The database instance ID. This is obtained from <see cref="DatabaseInstance.Id">DatabaseInstance.Id</see>.</param>
        /// <param name="flavorRef">The new flavor to use for the database instance. This is obtained from <see cref="DatabaseFlavor.Href">DatabaseFlavor.Href</see>.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="instanceId"/> is <see langword="null"/>.
        /// <para>-or-</para>
        /// <para>If <paramref name="flavorRef"/> is <see langword="null"/>.</para>
        /// </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/POST_resizeInstance__version___accountId__instances__instanceId__action_.html">Resize the Instance (Rackspace Cloud Databases Developer Guide - API v1.0)</seealso>
        public static void ResizeDatabaseInstance(this IDatabaseService service, DatabaseInstanceId instanceId, FlavorRef flavorRef)
        {
            if (service == null)
                throw new ArgumentNullException("service");

            try
            {
                service.ResizeDatabaseInstanceAsync(instanceId, flavorRef, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Wait();
            }
            catch (AggregateException ex)
            {
                ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
                if (innerExceptions.Count == 1)
                    throw innerExceptions[0];

                throw;
            }
        }