private static void CreateDatabaseFromRestorePoint(IAzure azure) { ISqlServer sqlServer = azure.SqlServers.GetById(sqlSubscriptionId); ISqlDatabase database = sqlServer.Databases.Get(sourceDatabase); // Let the user know something is happening Console.WriteLine("Starting creation of new database from restore point of existing item"); Console.WriteLine("This can take a long time..."); // There only ever seems to be one come back...? IRestorePoint restorePoint = database.ListRestorePoints()[0]; // Select the Elastic Pool to deploy too ISqlElasticPool elasticPool = sqlServer.ElasticPools.Get(sqlElasticPoolName); // Restore the database from 5 minutes ago to a random name prefixed with Example_ string dbName = SdkContext.RandomResourceName("Example_", 20); ISqlDatabase newDatabase = sqlServer.Databases .Define(dbName) .WithExistingElasticPool(elasticPool) .FromRestorePoint(restorePoint, DateTime.UtcNow.AddMinutes(-5)) .Create(); // The process is finished... Console.WriteLine($"Database {newDatabase.Name} deployed to pool {elasticPool.Name}"); }
///GENMHASH:3BDABC5AAC07959FD1C78BEA74FD8712:BA30DB47040BBC492DFC164A6C968F85 public SqlDatabaseImpl WithExistingElasticPool(ISqlElasticPool sqlElasticPool) { if (sqlElasticPool == null) { throw new ArgumentNullException("sqlElasticPool"); } return(this.WithExistingElasticPool(sqlElasticPool.Name)); }
private static void ValidateSqlElasticPool(ISqlElasticPool sqlElasticPool, string elasticPoolName) { Assert.NotNull(sqlElasticPool); Assert.Equal(GroupName, sqlElasticPool.ResourceGroupName); Assert.Equal(elasticPoolName, sqlElasticPool.Name); Assert.Equal(SqlServerName, sqlElasticPool.SqlServerName); Assert.Equal(ElasticPoolEditions.Standard, sqlElasticPool.Edition); Assert.NotEqual(0, sqlElasticPool.DatabaseDtuMax); Assert.NotEqual(0, sqlElasticPool.Dtu); }
private static void ValidateSqlElasticPool(ISqlElasticPool sqlElasticPool) { ValidateSqlElasticPool(sqlElasticPool, SqlElasticPoolName); }
/// <summary> /// Sets the existing elastic pool for the SQLDatabase. /// </summary> /// <param name="sqlElasticPool">For the SQL Database.</param> /// <return>The next stage of the update.</return> SqlDatabase.Update.IUpdate SqlDatabase.Update.IWithElasticPoolName.WithExistingElasticPool(ISqlElasticPool sqlElasticPool) { return(this.WithExistingElasticPool(sqlElasticPool) as SqlDatabase.Update.IUpdate); }
/// <summary> /// Sets the existing elastic pool for the SQLDatabase. /// </summary> /// <param name="sqlElasticPool">For the SQL Database.</param> /// <return>The next stage of the definition.</return> SqlDatabase.Definition.IWithExistingDatabase SqlDatabase.Definition.IWithElasticPoolName.WithExistingElasticPool(ISqlElasticPool sqlElasticPool) { return(this.WithExistingElasticPool(sqlElasticPool) as SqlDatabase.Definition.IWithExistingDatabase); }
///GENMHASH:3BDABC5AAC07959FD1C78BEA74FD8712:D95E9FC81AB4F602112544DEF8D56410 public SqlDatabaseImpl WithExistingElasticPool(ISqlElasticPool sqlElasticPool) { return(this.WithExistingElasticPool(sqlElasticPool.Name)); }