Skip to content

Commit 0604377

Browse files
Styling fixes for Get-AzureSqlDatabaseRestorePoints
1 parent fd1001f commit 0604377

File tree

8 files changed

+30
-35
lines changed

8 files changed

+30
-35
lines changed

src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@
156156
<None Include="ScenarioTests\DatabaseActivationTests.ps1">
157157
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
158158
</None>
159-
<None Include="ScenarioTests\DatabaseBackupTests.ps1" />
159+
<None Include="ScenarioTests\DatabaseBackupTests.ps1">
160+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
161+
</None>
160162
<None Include="ScenarioTests\RecommendedElasticPoolTests.ps1">
161163
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
162164
</None>

src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/DatabaseBackupTests.ps1

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,11 @@ function Test-ListDatabaseRestorePoints
3636
$standarddb = New-AzureSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $databaseName `
3737
-Edition Standard -RequestedServiceObjectiveName S0
3838

39-
# Get restore points from data warehouse database.
39+
# Get restore points from data warehouse database. There should be none.
4040
$restorePoints = Get-AzureSqlDatabaseRestorePoints -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $dwdb.DatabaseName
41-
$restorePoint = $restorePoints[0]
42-
Assert-AreEqual $restorePoint.RestorePointType Discrete
43-
Assert-NotNull $restorePoint.RestorePointCreationDate
44-
Assert-Null $restorePoint.EarliestRestoreDate
45-
Assert-AreEqual $restorePoint.SizeBytes 0
41+
Assert-True $restorePoints.IsEmpty
4642

47-
# Get restore points from standard database.
43+
# Get restore points from standard database.There should be 1.
4844
$restorePoints = Resume-AzureSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $standarddb.DatabaseName
4945
$restorePoint = $restorePoints[0]
5046
Assert-AreEqual $restorePoint.RestorePointType Continuous
@@ -83,12 +79,7 @@ function Test-ListDatabaseRestorePointsPiped
8379
-Edition Standard -RequestedServiceObjectiveName S0
8480

8581
# Get restore points from data warehouse database.
86-
$restorePoints = $dwdb | Get-AzureSqlDatabaseRestorePoints
87-
$restorePoint = $restorePoints[0]
88-
Assert-AreEqual $restorePoint.RestorePointType Discrete
89-
Assert-NotNull $restorePoint.RestorePointCreationDate
90-
Assert-Null $restorePoint.EarliestRestoreDate
91-
Assert-AreEqual $restorePoint.SizeBytes 0
82+
Assert-True $restorePoints.IsEmpty
9283

9384
# Get restore points from standard database.
9485
$restorePoints = $standarddb | Resume-AzureSqlDatabase

src/ResourceManager/Sql/Commands.Sql.Test/UnitTests/AzureSqlDatabaseBackupAttributeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class AzureSqlDatabaseBackupAttributeTests
2626
{
2727
[Fact]
2828
[Trait(Category.Sql, Category.CheckIn)]
29-
public void SuspendAzureSqlDatabaseAttributes()
29+
public void GetAzureSqlDatabaseRestorePointsAttributes()
3030
{
3131
Type type = typeof(GetAzureSqlDatabaseRestorePoints);
3232
UnitTestHelper.CheckCmdletModifiesData(type, supportsShouldProcess: false);

src/ResourceManager/Sql/Commands.Sql/Database Backup/Cmdlet/AzureSqlDatabaseRestorePointCmdletBase.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ public abstract class AzureSqlDatabaseRestorePointCmdletBase
3535
[ValidateNotNullOrEmpty]
3636
public string ServerName { get; set; }
3737

38+
/// <summary>
39+
/// Gets or sets the name of the database to use.
40+
/// </summary>
41+
[Parameter(Mandatory = true,
42+
ValueFromPipelineByPropertyName = true,
43+
Position = 2,
44+
HelpMessage = "The name of the Azure SQL Database to retrieve restore points from.")]
45+
[ValidateNotNullOrEmpty]
46+
public string DatabaseName { get; set; }
47+
3848
/// <summary>
3949
/// Initializes the adapter
4050
/// </summary>

src/ResourceManager/Sql/Commands.Sql/Database Backup/Cmdlet/GetAzureSqlDatabaseRestorePoints.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,13 @@ namespace Microsoft.Azure.Commands.Sql.Backup.Cmdlet
2424
ConfirmImpact = ConfirmImpact.None)]
2525
public class GetAzureSqlDatabaseRestorePoints : AzureSqlDatabaseRestorePointCmdletBase
2626
{
27-
/// <summary>
28-
/// Gets or sets the name of the database to use.
29-
/// </summary>
30-
[Parameter(Mandatory = true,
31-
ValueFromPipelineByPropertyName = true,
32-
Position = 2,
33-
HelpMessage = "The name of the Azure SQL Database to retrieve restore points from.")]
34-
[ValidateNotNullOrEmpty]
35-
public string DatabaseName { get; set; }
36-
3727
/// <summary>
3828
/// Get the entities from the service
3929
/// </summary>
4030
/// <returns>The list of entities</returns>
4131
protected override IEnumerable<AzureSqlDatabaseRestorePointModel> GetEntity()
4232
{
43-
IEnumerable<AzureSqlDatabaseRestorePointModel> results;
44-
results = ModelAdapter.ListRestorePoints(this.ResourceGroupName, this.ServerName, this.DatabaseName);
45-
return results;
33+
return ModelAdapter.ListRestorePoints(this.ResourceGroupName, this.ServerName, this.DatabaseName);
4634
}
4735

4836
/// <summary>

src/ResourceManager/Sql/Commands.Sql/Database Backup/Model/AzureSqlDatabaseRestorePointModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class AzureSqlDatabaseRestorePointModel
5858
public DateTime? EarliestRestoreDate { get; set; }
5959

6060
/// <summary>
61-
/// Backup size in blob storage of the restore point.
61+
/// Size of the backup in blob storage.
6262
/// For discrete restore point, the value is the database snap size; for continuous restore point, the value is the
6363
/// total backup storage usage of the database.
6464
/// </summary>

src/ResourceManager/Sql/Commands.Sql/Database Backup/Services/AzureSqlDatabaseBackupAdapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
namespace Microsoft.Azure.Commands.Sql.Backup.Services
3333
{
3434
/// <summary>
35-
/// Adapter for database activation operations
35+
/// Adapter for database backup operations
3636
/// </summary>
3737
public class AzureSqlDatabaseBackupAdapter
3838
{

src/ResourceManager/Sql/Commands.Sql/Database Backup/Services/AzureSqlDatabaseBackupCommunicator.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
namespace Microsoft.Azure.Commands.Sql.Backup.Services
2727
{
2828
/// <summary>
29-
/// This class is responsible for all the REST communication with the database activation REST endpoints.
29+
/// This class is responsible for all the REST communication with the database backup REST endpoints.
3030
/// </summary>
3131
public class AzureSqlDatabaseBackupCommunicator
3232
{
@@ -46,10 +46,10 @@ public class AzureSqlDatabaseBackupCommunicator
4646
public AzureProfile Profile { get; set; }
4747

4848
/// <summary>
49-
/// Creates a communicator for Azure Sql Databases
49+
/// Creates a communicator for Azure Sql Database backup REST endpoints.
5050
/// </summary>
51-
/// <param name="profile"></param>
52-
/// <param name="subscription"></param>
51+
/// <param name="profile">Azure profile</param>
52+
/// <param name="subscription">Associated subscription</param>
5353
public AzureSqlDatabaseBackupCommunicator(AzureProfile profile, AzureSubscription subscription)
5454
{
5555
Profile = profile;
@@ -61,8 +61,12 @@ public AzureSqlDatabaseBackupCommunicator(AzureProfile profile, AzureSubscriptio
6161
}
6262

6363
/// <summary>
64-
/// Gets all the restore points for a given Azure Sql Database.
64+
/// Lists the restore points for a given Sql Azure Database.
6565
/// </summary>
66+
/// <param name="resourceGroup">The name of the resource group</param>
67+
/// <param name="serverName">The name of the Azure SQL Server</param>
68+
/// <param name="databaseName">The name of the Azure SQL database</param>
69+
/// <returns>List of restore points</returns>
6670
public IList<Management.Sql.Models.RestorePoint> ListRestorePoints(string resourceGroupName, string serverName, string databaseName, string clientRequestId)
6771
{
6872
return GetCurrentSqlClient(clientRequestId).Backup.ListRestorePoints(resourceGroupName, serverName, databaseName).RestorePoints;

0 commit comments

Comments
 (0)