Skip to content

Commit d877f3b

Browse files
committed
Remove StorageContainer Parameter from Import/Export Commands
Remove StorageContainer Parameter from Import/Export Commands
1 parent c109109 commit d877f3b

File tree

4 files changed

+7
-70
lines changed

4 files changed

+7
-70
lines changed

src/ServiceManagement/Sql/Commands.SqlDatabase.Test/TestScripts/Database/ExportTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function TestExportWithRequestObject
2424
$BlobName = $DatabaseName1 + ".bacpac"
2525
Write-Output "Exporting to Blob: $BlobName"
2626

27-
$Request = Start-AzureSqlDatabaseExport -SqlConnectionContext $context -StorageContainer $container `
27+
$Request = Start-AzureSqlDatabaseExport -SqlConnectionContext $context -StorageContainerName $container.Name -StorageContext $StgCtx `
2828
-DatabaseName $DatabaseName1 -BlobName $BlobName
2929
Assert {$Request} "Failed to initiate the first export operation"
3030
$id = ($Request.RequestGuid)

src/ServiceManagement/Sql/Commands.SqlDatabase.Test/TestScripts/Database/ImportTests.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function TestImportWithRequestObject
2525
$dbName = $DatabaseName1 + "-import1"
2626
Write-Output "Importing from Blob: $BlobName"
2727

28-
$Request = Start-AzureSqlDatabaseImport -SqlConnectionContext $context -StorageContainer $container `
28+
$Request = Start-AzureSqlDatabaseImport -SqlConnectionContext $context -StorageContainerName $container.Name -StorageContext $StgCtx `
2929
-DatabaseName $dbName -BlobName $BlobName
3030
Assert {$Request} "Failed to initiate the first import opertaion"
3131
$id = ($Request.RequestGuid)
@@ -79,21 +79,21 @@ function TestImportWithRequestObjectAndOptionalParameters
7979
$dbName = $DatabaseName1 + "Options-edition"
8080
Write-Output "Database name: $dbName"
8181
TestImportCommandHelper `
82-
{ Start-AzureSqlDatabaseImport -SqlConnectionContext $context -StorageContainer $container `
82+
{ Start-AzureSqlDatabaseImport -SqlConnectionContext $context -StorageContainerName $container.Name -StorageContext $StgCtx `
8383
-DatabaseName $dbName -BlobName $BlobName -Edition "Business" }
8484

8585
Write-Output "Running test for import with optional size parameter"
8686
$dbName = $DatabaseName1 + "Options-size"
8787
Write-Output "Database name: $dbName"
8888
TestImportCommandHelper `
89-
{ Start-AzureSqlDatabaseImport -SqlConnectionContext $context -StorageContainer $container `
89+
{ Start-AzureSqlDatabaseImport -SqlConnectionContext $context -StorageContainerName $container.Name -StorageContext $StgCtx `
9090
-DatabaseName $dbName -BlobName $BlobName -DatabaseMaxSize 5 }
9191

9292
Write-Output "Running test for import with optional edition and size parameter"
9393
$dbName = $DatabaseName1 + "Options-edition"
9494
Write-Output "Database name: $dbName"
9595
TestImportCommandHelper `
96-
{ Start-AzureSqlDatabaseImport -SqlConnectionContext $context -StorageContainer $container `
96+
{ Start-AzureSqlDatabaseImport -SqlConnectionContext $context -StorageContainerName $container.Name -StorageContext $StgCtx `
9797
-DatabaseName $dbName -BlobName $BlobName -Edition "Business" -DatabaseMaxSize 20 }
9898
}
9999

src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseExport.cs

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,7 @@ namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet
3131
public class StartAzureSqlDatabaseExport : SqlDatabaseCmdletBase
3232
{
3333
#region Parameter Set names
34-
35-
/// <summary>
36-
/// The name of the parameter set that uses the Azure Storage Container object
37-
/// </summary>
38-
internal const string ByContainerObjectParameterSet =
39-
"ByContainerObject";
40-
34+
4135
/// <summary>
4236
/// The name of the parameter set that uses the storage container name
4337
/// </summary>
@@ -57,15 +51,6 @@ public class StartAzureSqlDatabaseExport : SqlDatabaseCmdletBase
5751
[ValidateNotNullOrEmpty]
5852
public ISqlServerConnectionInformation SqlConnectionContext { get; set; }
5953

60-
/// <summary>
61-
/// Gets or sets the destination storage container for the blob
62-
/// </summary>
63-
[Parameter(Mandatory = true, Position = 1,
64-
ParameterSetName = ByContainerObjectParameterSet,
65-
HelpMessage = "The Azure Storage Container to place the blob in.")]
66-
[ValidateNotNull]
67-
public AzureStorageContainer StorageContainer { get; set; }
68-
6954
/// <summary>
7055
/// Gets or sets the storage context
7156
/// </summary>
@@ -87,9 +72,6 @@ public class StartAzureSqlDatabaseExport : SqlDatabaseCmdletBase
8772
/// <summary>
8873
/// Gets or sets the name of the database to export
8974
/// </summary>
90-
[Parameter(Mandatory = true, Position = 2,
91-
ParameterSetName = ByContainerObjectParameterSet,
92-
HelpMessage = "The name of the database to export")]
9375
[Parameter(Mandatory = true, Position = 3,
9476
ParameterSetName = ByContainerNameParameterSet,
9577
HelpMessage = "The name of the database to export")]
@@ -99,9 +81,6 @@ public class StartAzureSqlDatabaseExport : SqlDatabaseCmdletBase
9981
/// <summary>
10082
/// Gets or sets name of the blob to use for the export
10183
/// </summary>
102-
[Parameter(Mandatory = true, Position = 3,
103-
ParameterSetName = ByContainerObjectParameterSet,
104-
HelpMessage = "The name of the blob to use for the export")]
10584
[Parameter(Mandatory = true, Position = 4,
10685
ParameterSetName = ByContainerNameParameterSet,
10786
HelpMessage = "The name of the blob to use for the export")]
@@ -193,16 +172,6 @@ public override void ExecuteCmdlet()
193172
this.BlobName;
194173
break;
195174

196-
case ByContainerObjectParameterSet:
197-
accessKey = Convert.ToBase64String(
198-
this.StorageContainer.CloudBlobContainer.ServiceClient.Credentials.ExportKey());
199-
200-
blobUri =
201-
this.StorageContainer.Context.BlobEndPoint +
202-
this.StorageContainer.Name + "/" +
203-
this.BlobName;
204-
break;
205-
206175
default:
207176
throw new NotSupportedException("ParameterSet");
208177
}

src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseImport.cs

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,7 @@ namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet
3333
public class StartAzureSqlDatabaseImport : SqlDatabaseCmdletBase
3434
{
3535
#region Parameter Set names
36-
37-
/// <summary>
38-
/// The name of the parameter set that uses the Azure Storage Container object
39-
/// </summary>
40-
internal const string ByContainerObjectParameterSet =
41-
"ByContainerObject";
42-
36+
4337
/// <summary>
4438
/// The name of the parameter set that uses the storage container name
4539
/// </summary>
@@ -59,15 +53,6 @@ public class StartAzureSqlDatabaseImport : SqlDatabaseCmdletBase
5953
[ValidateNotNullOrEmpty]
6054
public ISqlServerConnectionInformation SqlConnectionContext { get; set; }
6155

62-
/// <summary>
63-
/// Gets or sets the storage container object containing the blob
64-
/// </summary>
65-
[Parameter(Mandatory = true, Position = 1,
66-
ParameterSetName = ByContainerObjectParameterSet,
67-
HelpMessage = "The Azure Storage Container to place the blob in.")]
68-
[ValidateNotNull]
69-
public AzureStorageContainer StorageContainer { get; set; }
70-
7156
/// <summary>
7257
/// Gets or sets the storage context
7358
/// </summary>
@@ -89,9 +74,6 @@ public class StartAzureSqlDatabaseImport : SqlDatabaseCmdletBase
8974
/// <summary>
9075
/// Gets or sets the name for the imported database
9176
/// </summary>
92-
[Parameter(Mandatory = true, Position = 2,
93-
ParameterSetName = ByContainerObjectParameterSet,
94-
HelpMessage = "The name for the imported database")]
9577
[Parameter(Mandatory = true, Position = 3,
9678
ParameterSetName = ByContainerNameParameterSet,
9779
HelpMessage = "The name for the imported database")]
@@ -101,9 +83,6 @@ public class StartAzureSqlDatabaseImport : SqlDatabaseCmdletBase
10183
/// <summary>
10284
/// Gets or sets name of the blob to use for the import
10385
/// </summary>
104-
[Parameter(Mandatory = true, Position = 3,
105-
ParameterSetName = ByContainerObjectParameterSet,
106-
HelpMessage = "The name of the blob to use for the import")]
10786
[Parameter(Mandatory = true, Position = 4,
10887
ParameterSetName = ByContainerNameParameterSet,
10988
HelpMessage = "The name of the blob to use for the import")]
@@ -217,17 +196,6 @@ public override void ExecuteCmdlet()
217196
this.BlobName;
218197
break;
219198

220-
case ByContainerObjectParameterSet:
221-
accessKey =
222-
System.Convert.ToBase64String(
223-
this.StorageContainer.CloudBlobContainer.ServiceClient.Credentials.ExportKey());
224-
225-
blobUri =
226-
this.StorageContainer.Context.BlobEndPoint +
227-
this.StorageContainer.Name + "/" +
228-
this.BlobName;
229-
break;
230-
231199
default:
232200
throw new NotSupportedException("ParameterSet");
233201
}

0 commit comments

Comments
 (0)