Skip to content

Commit

Permalink
Sqldb serverless (Azure#5961)
Browse files Browse the repository at this point in the history
* Add autoPauseDelay and minCapacity parameters for serverless

* Add tests for serverless parameters

* Bump version
  • Loading branch information
mykolian authored and dsgouda committed Apr 25, 2019
1 parent 4a93c61 commit 5466615
Show file tree
Hide file tree
Showing 9 changed files with 1,214 additions and 1,324 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ public Database()
/// the same region. Possible values include: 'Enabled',
/// 'Disabled'</param>
/// <param name="currentSku">The name and tier of the SKU.</param>
public Database(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), Sku sku = default(Sku), string kind = default(string), string managedBy = default(string), string createMode = default(string), string collation = default(string), long? maxSizeBytes = default(long?), string sampleName = default(string), string elasticPoolId = default(string), string sourceDatabaseId = default(string), string status = default(string), System.Guid? databaseId = default(System.Guid?), System.DateTime? creationDate = default(System.DateTime?), string currentServiceObjectiveName = default(string), string requestedServiceObjectiveName = default(string), string defaultSecondaryLocation = default(string), string failoverGroupId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), System.DateTime? sourceDatabaseDeletionDate = default(System.DateTime?), string recoveryServicesRecoveryPointId = default(string), string longTermRetentionBackupResourceId = default(string), string recoverableDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string catalogCollation = default(string), bool? zoneRedundant = default(bool?), string licenseType = default(string), long? maxLogSizeBytes = default(long?), System.DateTime? earliestRestoreDate = default(System.DateTime?), string readScale = default(string), Sku currentSku = default(Sku))
/// <param name="autoPauseDelay">Time in minutes after which database
/// is automatically paused. A value of -1 means that automatic pause
/// is disabled</param>
/// <param name="minCapacity">Minimal capacity that database will
/// always have allocated, if not paused</param>
public Database(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), Sku sku = default(Sku), string kind = default(string), string managedBy = default(string), string createMode = default(string), string collation = default(string), long? maxSizeBytes = default(long?), string sampleName = default(string), string elasticPoolId = default(string), string sourceDatabaseId = default(string), string status = default(string), System.Guid? databaseId = default(System.Guid?), System.DateTime? creationDate = default(System.DateTime?), string currentServiceObjectiveName = default(string), string requestedServiceObjectiveName = default(string), string defaultSecondaryLocation = default(string), string failoverGroupId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), System.DateTime? sourceDatabaseDeletionDate = default(System.DateTime?), string recoveryServicesRecoveryPointId = default(string), string longTermRetentionBackupResourceId = default(string), string recoverableDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string catalogCollation = default(string), bool? zoneRedundant = default(bool?), string licenseType = default(string), long? maxLogSizeBytes = default(long?), System.DateTime? earliestRestoreDate = default(System.DateTime?), string readScale = default(string), Sku currentSku = default(Sku), int? autoPauseDelay = default(int?), double? minCapacity = default(double?))
: base(location, id, name, type, tags)
{
Sku = sku;
Expand Down Expand Up @@ -181,6 +186,8 @@ public Database()
EarliestRestoreDate = earliestRestoreDate;
ReadScale = readScale;
CurrentSku = currentSku;
AutoPauseDelay = autoPauseDelay;
MinCapacity = minCapacity;
CustomInit();
}

Expand Down Expand Up @@ -425,6 +432,20 @@ public Database()
[JsonProperty(PropertyName = "properties.currentSku")]
public Sku CurrentSku { get; private set; }

/// <summary>
/// Gets or sets time in minutes after which database is automatically
/// paused. A value of -1 means that automatic pause is disabled
/// </summary>
[JsonProperty(PropertyName = "properties.autoPauseDelay")]
public int? AutoPauseDelay { get; set; }

/// <summary>
/// Gets or sets minimal capacity that database will always have
/// allocated, if not paused
/// </summary>
[JsonProperty(PropertyName = "properties.minCapacity")]
public double? MinCapacity { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,13 @@ public DatabaseUpdate()
/// the same region. Possible values include: 'Enabled',
/// 'Disabled'</param>
/// <param name="currentSku">The name and tier of the SKU.</param>
/// <param name="autoPauseDelay">Time in minutes after which database
/// is automatically paused. A value of -1 means that automatic pause
/// is disabled</param>
/// <param name="minCapacity">Minimal capacity that database will
/// always have allocated, if not paused</param>
/// <param name="tags">Resource tags.</param>
public DatabaseUpdate(Sku sku = default(Sku), string createMode = default(string), string collation = default(string), long? maxSizeBytes = default(long?), string sampleName = default(string), string elasticPoolId = default(string), string sourceDatabaseId = default(string), string status = default(string), System.Guid? databaseId = default(System.Guid?), System.DateTime? creationDate = default(System.DateTime?), string currentServiceObjectiveName = default(string), string requestedServiceObjectiveName = default(string), string defaultSecondaryLocation = default(string), string failoverGroupId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), System.DateTime? sourceDatabaseDeletionDate = default(System.DateTime?), string recoveryServicesRecoveryPointId = default(string), string longTermRetentionBackupResourceId = default(string), string recoverableDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string catalogCollation = default(string), bool? zoneRedundant = default(bool?), string licenseType = default(string), long? maxLogSizeBytes = default(long?), System.DateTime? earliestRestoreDate = default(System.DateTime?), string readScale = default(string), Sku currentSku = default(Sku), IDictionary<string, string> tags = default(IDictionary<string, string>))
public DatabaseUpdate(Sku sku = default(Sku), string createMode = default(string), string collation = default(string), long? maxSizeBytes = default(long?), string sampleName = default(string), string elasticPoolId = default(string), string sourceDatabaseId = default(string), string status = default(string), System.Guid? databaseId = default(System.Guid?), System.DateTime? creationDate = default(System.DateTime?), string currentServiceObjectiveName = default(string), string requestedServiceObjectiveName = default(string), string defaultSecondaryLocation = default(string), string failoverGroupId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), System.DateTime? sourceDatabaseDeletionDate = default(System.DateTime?), string recoveryServicesRecoveryPointId = default(string), string longTermRetentionBackupResourceId = default(string), string recoverableDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string catalogCollation = default(string), bool? zoneRedundant = default(bool?), string licenseType = default(string), long? maxLogSizeBytes = default(long?), System.DateTime? earliestRestoreDate = default(System.DateTime?), string readScale = default(string), Sku currentSku = default(Sku), int? autoPauseDelay = default(int?), double? minCapacity = default(double?), IDictionary<string, string> tags = default(IDictionary<string, string>))
{
Sku = sku;
CreateMode = createMode;
Expand Down Expand Up @@ -171,6 +176,8 @@ public DatabaseUpdate()
EarliestRestoreDate = earliestRestoreDate;
ReadScale = readScale;
CurrentSku = currentSku;
AutoPauseDelay = autoPauseDelay;
MinCapacity = minCapacity;
Tags = tags;
CustomInit();
}
Expand Down Expand Up @@ -403,6 +410,20 @@ public DatabaseUpdate()
[JsonProperty(PropertyName = "properties.currentSku")]
public Sku CurrentSku { get; private set; }

/// <summary>
/// Gets or sets time in minutes after which database is automatically
/// paused. A value of -1 means that automatic pause is disabled
/// </summary>
[JsonProperty(PropertyName = "properties.autoPauseDelay")]
public int? AutoPauseDelay { get; set; }

/// <summary>
/// Gets or sets minimal capacity that database will always have
/// allocated, if not paused
/// </summary>
[JsonProperty(PropertyName = "properties.minCapacity")]
public double? MinCapacity { get; set; }

/// <summary>
/// Gets or sets resource tags.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public ManagedInstance()
/// <param name="storageSizeInGB">Storage size in GB. Minimum value:
/// 32. Maximum value: 8192. Increments of 32 GB allowed only.</param>
/// <param name="collation">Collation of the managed instance.</param>
/// <param name="dnsZone">The Dns Zone taht the managed instance is
/// <param name="dnsZone">The Dns Zone that the managed instance is
/// in.</param>
/// <param name="dnsZonePartner">The resource id of another managed
/// instance whose DNS zone this managed instance will share after
Expand All @@ -89,7 +89,7 @@ public ManagedInstance()
/// instance.</param>
/// <param name="timezoneId">Id of the timezone. Allowed values are
/// timezones supported by Windows.
/// Winodws keeps details on supported timezones, including the id, in
/// Windows keeps details on supported timezones, including the id, in
/// registry under
/// KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time
/// Zones.
Expand Down Expand Up @@ -222,7 +222,7 @@ public ManagedInstance()
public string Collation { get; set; }

/// <summary>
/// Gets the Dns Zone taht the managed instance is in.
/// Gets the Dns Zone that the managed instance is in.
/// </summary>
[JsonProperty(PropertyName = "properties.dnsZone")]
public string DnsZone { get; private set; }
Expand Down Expand Up @@ -263,7 +263,7 @@ public ManagedInstance()
/// <summary>
/// Gets or sets id of the timezone. Allowed values are timezones
/// supported by Windows.
/// Winodws keeps details on supported timezones, including the id, in
/// Windows keeps details on supported timezones, including the id, in
/// registry under
/// KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time
/// Zones.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public ManagedInstanceUpdate()
/// <param name="storageSizeInGB">Storage size in GB. Minimum value:
/// 32. Maximum value: 8192. Increments of 32 GB allowed only.</param>
/// <param name="collation">Collation of the managed instance.</param>
/// <param name="dnsZone">The Dns Zone taht the managed instance is
/// <param name="dnsZone">The Dns Zone that the managed instance is
/// in.</param>
/// <param name="dnsZonePartner">The resource id of another managed
/// instance whose DNS zone this managed instance will share after
Expand All @@ -81,7 +81,7 @@ public ManagedInstanceUpdate()
/// instance.</param>
/// <param name="timezoneId">Id of the timezone. Allowed values are
/// timezones supported by Windows.
/// Winodws keeps details on supported timezones, including the id, in
/// Windows keeps details on supported timezones, including the id, in
/// registry under
/// KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time
/// Zones.
Expand Down Expand Up @@ -206,7 +206,7 @@ public ManagedInstanceUpdate()
public string Collation { get; set; }

/// <summary>
/// Gets the Dns Zone taht the managed instance is in.
/// Gets the Dns Zone that the managed instance is in.
/// </summary>
[JsonProperty(PropertyName = "properties.dnsZone")]
public string DnsZone { get; private set; }
Expand Down Expand Up @@ -247,7 +247,7 @@ public ManagedInstanceUpdate()
/// <summary>
/// Gets or sets id of the timezone. Allowed values are timezones
/// supported by Windows.
/// Winodws keeps details on supported timezones, including the id, in
/// Windows keeps details on supported timezones, including the id, in
/// registry under
/// KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time
/// Zones.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
<PackageId>Microsoft.Azure.Management.Sql</PackageId>
<Description>Azure SQL Management SDK library</Description>
<AssemblyName>Microsoft.Azure.Management.Sql</AssemblyName>
<Version>1.29.0-preview</Version>
<Version>1.30.0-preview</Version>
<PackageTags>Microsoft Azure SQL Management;SQL;SQL Management;</PackageTags>
<PackageReleaseNotes>
<![CDATA[
New features:
- Added support for Virtual cluster operations.
- Support database sensitivity labels.
- Added two new properties (PublicDataEndpointEnabled and ProxyOverride) to managed instance.
- Added support for serverless databases.
]]>
</PackageReleaseNotes>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
[assembly: AssemblyTitle("Microsoft Azure SQL Management Library")]
[assembly: AssemblyDescription("Provides management functionality for Microsoft Azure SQL.")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.29.0.0")]
[assembly: AssemblyFileVersion("1.30.0.0")]

16 changes: 16 additions & 0 deletions src/SDKs/SqlManagement/Sql.Tests/DatabaseCrudScenarioTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,25 @@ public void TestCreateDropDatabase()
Assert.NotNull(db4);
SqlManagementTestUtilities.ValidateDatabase(db4Input, db4, dbName);

// Create database with Serverless specific parameters
//
dbName = SqlManagementTestUtilities.GenerateName();
var db5Input = new Database()
{
Location = server.Location,
Sku = new Microsoft.Azure.Management.Sql.Models.Sku("GP_S_Gen5_2"),
Tags = tags,
AutoPauseDelay = 360,
MinCapacity = 0.5,
};
var db5 = sqlClient.Databases.CreateOrUpdate(resourceGroup.Name, server.Name, dbName, db5Input);
Assert.NotNull(db5);
SqlManagementTestUtilities.ValidateDatabase(db5Input, db5, dbName);

sqlClient.Databases.Delete(resourceGroup.Name, server.Name, db1.Name);
sqlClient.Databases.Delete(resourceGroup.Name, server.Name, db2.Name);
sqlClient.Databases.Delete(resourceGroup.Name, server.Name, db4.Name);
sqlClient.Databases.Delete(resourceGroup.Name, server.Name, db5.Name);
}
}

Expand Down
Loading

0 comments on commit 5466615

Please sign in to comment.