Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* Defines values for DatabaseEditions.
*/
public final class DatabaseEditions {
public class DatabaseEditions {
/** Static value Web for DatabaseEditions. */
public static final DatabaseEditions WEB = new DatabaseEditions("Web");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ interface Definition extends
DefinitionStages.WithCreate,
DefinitionStages.WithCollation,
DefinitionStages.WithEdition,
DefinitionStages.WithElasticPoolName {
DefinitionStages.WithElasticPoolName,
DefinitionStages.WithSourceDatabaseId,
DefinitionStages.WithCreateMode,
DefinitionStages.WithCreateWithLessOptions,
DefinitionStages.WithExistingDatabase {
}

/**
Expand All @@ -161,13 +165,95 @@ interface DefinitionStages {
/**
* The first stage of the SQL Server definition.
*/
interface Blank extends WithCreate {
interface Blank extends WithElasticPoolName {
}

/**
* The SQL Database definition to set the elastic pool for database.
*/
interface WithElasticPoolName {
/**
* Specifies database to be created without elastic pool.
*
* @return The next stage of definition.
*/
WithExistingDatabase withoutExistingElasticPool();

/**
* Sets the existing elastic pool for the SQLDatabase.
*
* @param elasticPoolName for the SQL Database
* @return The next stage of definition.
*/
WithExistingDatabase withExistingElasticPool(String elasticPoolName);

/**
* Sets the existing elastic pool for the SQLDatabase.
*
* @param sqlElasticPool for the SQL Database
* @return The next stage of definition.
*/
WithExistingDatabase withExistingElasticPool(SqlElasticPool sqlElasticPool);

/**
* Sets the new elastic pool for the SQLDatabase, this will create a new elastic pool while creating database.
*
* @param sqlElasticPool creatable definition for new elastic pool to be created for the SQL Database
* @return The next stage of definition.
*/
WithExistingDatabase withNewElasticPool(Creatable<SqlElasticPool> sqlElasticPool);
}

/**
* The stage to decide whether using existing database or not.
*/
interface WithExistingDatabase extends WithSourceDatabaseId {
/**
* Sets the creation flow to ask relevant question when source database is not specified.
*
* @return The next stage of definition.
*/
WithCreate withoutSourceDatabaseId();
}

/**
* The SQL Database definition to set the source database id for database.
*/
interface WithSourceDatabaseId {
/**
* Sets the resource if of source database for the SQL Database.
* Collation, Edition, and MaxSizeBytes must remain the same while the link is
* active. Values specified for these parameters will be ignored.
*
* @param sourceDatabaseId id of the source database
* @return The next stage of definition.
*/
WithCreateMode withSourceDatabaseId(String sourceDatabaseId);
}

/**
* The SQL Database definition to set the create mode for database.
*/
interface WithCreateMode {
/**
* Sets the create mode for the SQL Database.
*
* @param createMode create mode for the database, should not be default in this flow
* @return The next stage of definition.
*/
WithCreateWithLessOptions withCreateMode(CreateMode createMode);
}

/**
* The SQL Database definition to set the collation for database.
*/
interface WithCollation {
/**
* Sets the collation for the SQL Database.
*
* @param collation collation to be set for database
* @return The next stage of definition
*/
WithCreate withCollation(String collation);
}

Expand All @@ -177,8 +263,9 @@ interface WithCollation {
interface WithEdition {
/**
* Sets the edition for the SQL Database.
* @param edition edition to be set for database.
* @return The next stage of definition.
*
* @param edition edition to be set for database
* @return The next stage of definition
*/
WithCreate withEdition(DatabaseEditions edition);
}
Expand All @@ -189,6 +276,7 @@ interface WithEdition {
interface WithMaxSizeBytes {
/**
* Sets the max size in bytes for SQL Database.
*
* @param maxSizeBytes max size of the Azure SQL Database expressed in bytes. Note: Only
* the following sizes are supported (in addition to limitations being
* placed on each edition): { 100 MB | 500 MB |1 GB | 5 GB | 10 GB | 20
Expand All @@ -204,51 +292,34 @@ interface WithMaxSizeBytes {
interface WithServiceObjective {
/**
* Sets the service level objective for the SQL Database.
*
* @param serviceLevelObjective service level objected for the SQL Database
* @return The next stage of the definition.
*/
WithCreate withServiceObjective(ServiceObjectiveName serviceLevelObjective);
}

/**
* The SQL Database definition to set the elastic pool for database.
* A SQL Database definition with sufficient inputs to create a new
* SQL Server in the cloud, but exposing additional optional inputs to
* specify.
*/
interface WithElasticPoolName {
/**
* Sets the existing elastic pool for the SQLDatabase.
* @param elasticPoolName for the SQL Database.
* @return The next stage of definition.
*/
WithCreate withExistingElasticPool(String elasticPoolName);

/**
* Sets the existing elastic pool for the SQLDatabase.
* @param sqlElasticPool for the SQL Database.
* @return The next stage of definition.
*/
WithCreate withExistingElasticPool(SqlElasticPool sqlElasticPool);

/**
* Sets the new elastic pool for the SQLDatabase, this will create a new elastic pool while creating database.
* @param sqlElasticPool creatable definition for new elastic pool to be created for the SQL Database.
* @return The next stage of definition.
*/
WithCreate withNewElasticPool(Creatable<SqlElasticPool> sqlElasticPool);
interface WithCreate extends
WithMaxSizeBytes,
WithServiceObjective,
WithCollation,
WithEdition,
WithCreateWithLessOptions {
}

/**
* A SQL Database definition with sufficient inputs to create a new
* SQL Server in the cloud, but exposing additional optional inputs to
* specify.
*/
interface WithCreate extends
interface WithCreateWithLessOptions extends
Creatable<SqlDatabase>,
DefinitionWithTags<WithCreate>,
WithMaxSizeBytes,
WithServiceObjective,
WithElasticPoolName,
WithCollation,
WithEdition {
DefinitionWithTags<WithCreate> {
}
}

Expand All @@ -273,10 +344,11 @@ interface UpdateStages {
interface WithEdition {
/**
* Sets the edition for the SQL Database.
* @param edition edition to be set for database.
*
* @param edition edition to be set for database
* @return The next stage of definition.
*/
WithServiceObjective withEdition(DatabaseEditions edition);
Update withEdition(DatabaseEditions edition);
}

/**
Expand All @@ -300,6 +372,7 @@ interface WithMaxSizeBytes {
interface WithServiceObjective {
/**
* Sets the service level objective for the SQL Database.
*
* @param serviceLevelObjective service level objected for the SQL Database
* @return The next stage of the definition.
*/
Expand All @@ -312,27 +385,31 @@ interface WithServiceObjective {
interface WithElasticPoolName {
/**
* Removes database from it's elastic pool.
*
* @return The next stage of definition.
*/
WithEdition withoutExistingElasticPool();

/**
* Sets the existing elastic pool for the SQLDatabase.
* @param elasticPoolName for the SQL Database.
*
* @param elasticPoolName for the SQL Database
* @return The next stage of definition.
*/
Update withExistingElasticPool(String elasticPoolName);

/**
* Sets the existing elastic pool for the SQLDatabase.
* @param sqlElasticPool for the SQL Database.
*
* @param sqlElasticPool for the SQL Database
* @return The next stage of definition.
*/
Update withExistingElasticPool(SqlElasticPool sqlElasticPool);

/**
* Sets the new elastic pool for the SQLDatabase, this will create a new elastic pool while creating database.
* @param sqlElasticPool creatable definition for new elastic pool to be created for the SQL Database.
*
* @param sqlElasticPool creatable definition for new elastic pool to be created for the SQL Database
* @return The next stage of definition.
*/
Update withNewElasticPool(Creatable<SqlElasticPool> sqlElasticPool);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ public interface SqlServer extends
ServerVersion version();

/**
*
* @return the administrator login user name for the SQL Server
*/
String adminLogin();
String administratorLogin();

/**
* @return returns entry point to manage FirewallRules in SqlServer.
Expand Down Expand Up @@ -173,8 +172,8 @@ interface Databases {
interface Definition extends
DefinitionStages.Blank,
DefinitionStages.WithGroup,
DefinitionStages.WithAdminUserName,
DefinitionStages.WithPassword,
DefinitionStages.WithAdministratorLogin,
DefinitionStages.WithAdministratorPassword,
DefinitionStages.WithVersion,
DefinitionStages.WithCreate {
}
Expand All @@ -192,27 +191,45 @@ interface Blank extends DefinitionWithRegion<WithGroup> {
/**
* A SQL Server definition allowing resource group to be set.
*/
interface WithGroup extends GroupableResource.DefinitionStages.WithGroup<WithAdminUserName> {
interface WithGroup extends GroupableResource.DefinitionStages.WithGroup<WithAdministratorLogin> {
}

/**
* A SQL Server definition setting admin user name.
* A SQL Server definition setting administrator user name.
*/
interface WithAdminUserName {
WithPassword withAdminUserName(String adminUserName);
interface WithAdministratorLogin {
/**
* Sets the administrator login user name.
*
* @param administratorLogin administrator login user name
* @return Next stage of the SQL Server creation
*/
WithAdministratorPassword withAdministratorLogin(String administratorLogin);
}

/**
* A SQL Server definition setting admin user password.
*/
interface WithPassword {
WithCreate withPassword(String password);
interface WithAdministratorPassword {
/**
* Sets the administrator login password.
*
* @param administratorLoginPassword password for administrator login
* @return Next stage of the SQL Server creation
*/
WithCreate withAdministratorPassword(String administratorLoginPassword);
}

/**
* A SQL Server definition setting version.
*/
interface WithVersion {
/**
* Sets the version of SQL Server to be created.
*
* @param version Version of SQL server to be created
* @return Next stage of the SQL Server creation
*/
WithCreate withVersion(ServerVersion version);
}

Expand All @@ -232,7 +249,7 @@ interface WithCreate extends
*/
interface Update extends
Appliable<SqlServer>,
UpdateStages.WithAdminPassword {
UpdateStages.WithAdministratorPassword {
}

/**
Expand All @@ -241,10 +258,16 @@ interface Update extends
interface UpdateStages {

/**
* A SQL Server definition setting administrator user password.
* A SQL Server definition setting admin user password.
*/
interface WithAdminPassword {
Update withPassword(String administratorPassword);
interface WithAdministratorPassword {
/**
* Sets the administrator login password.
*
* @param administratorLoginPassword password for administrator login
* @return Next stage of the SQL Server creation.
*/
Update withAdministratorPassword(String administratorLoginPassword);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class DatabasesImpl implements SqlServer.Databases {
@Override
public SqlDatabase get(String databaseName) {
return this.databases.getBySqlServer(this.resourceGroupName, this.sqlServerName, databaseName);
}
}

@Override
public SqlDatabase.DefinitionStages.Blank define(String databaseName) {
Expand Down
Loading