Skip to content

Commit 8df5506

Browse files
committed
re-recorded all test cases
1 parent 9734e3b commit 8df5506

File tree

42 files changed

+9089
-4846
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+9089
-4846
lines changed

src/DataProtection/DataProtection.Autorest/custom/Cmdlets/Backupcenter/Search-AzDataProtectionBackupInstanceInAzGraph.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
param (
88
[Parameter(Mandatory, HelpMessage='Subscription of Vault')]
99
[System.String[]]
10-
${Subscription},
10+
${Subscription}, # TODO: add alias to all ARG command params
1111

1212
[Parameter(Mandatory=$false, HelpMessage='Resource Group of Vault')]
1313
[System.String[]]

src/DataProtection/DataProtection.Autorest/custom/Cmdlets/Backupcenter/Search-AzDataProtectionBackupVaultInAzGraph.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[Parameter(Mandatory, HelpMessage='Subscription of Vault')]
99
[Alias('SubscriptionId')]
1010
[System.String[]]
11-
${Subscription}, # TODO: add alias to all ARG command params
11+
${Subscription},
1212

1313
[Parameter(Mandatory=$false, HelpMessage='Resource Group of Vault')]
1414
[Alias('ResourceGroupName')]

src/DataProtection/DataProtection.Autorest/custom/Cmdlets/Platform/Restore/Initialize-AzDataProtectionRestoreRequest.ps1

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
[System.String]
9090
${TargetContainerURI},
9191

92-
[Parameter(ParameterSetName="RestoreAsFiles", Mandatory, HelpMessage='File name to be prefixed to the restored backup data.')]
92+
[Parameter(ParameterSetName="RestoreAsFiles", Mandatory=$false, HelpMessage='File name to be prefixed to the restored backup data.')]
9393
[System.String]
9494
${FileNamePrefix},
9595

@@ -192,12 +192,26 @@
192192
$restoreRequest.RestoreTargetInfo = [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.RestoreFilesTargetInfo]::new()
193193
$restoreRequest.RestoreTargetInfo.ObjectType = "RestoreFilesTargetInfo"
194194

195-
if(!($PSBoundParameters.ContainsKey("FileNamePrefix")) -or !($PSBoundParameters.ContainsKey("TargetContainerURI")) ){
196-
$errormsg = "FileNamePrefix and TargetContainerURI parameters are required for RestoreAsFiles "
197-
throw $errormsg
195+
if($manifest.fileNamePrefixDisabled -and $PSBoundParameters.ContainsKey("FileNamePrefix")){
196+
$errormsg = "FileNamePrefix can't be set for given DatasourceType. Please try again after removing FileNamePrefix parameter"
197+
throw $errormsg
198+
}
199+
elseif($manifest.fileNamePrefixDisabled -and !($PSBoundParameters.ContainsKey("TargetContainerURI"))){
200+
$errormsg = "TargetContainerURI parameter is required for RestoreAsFiles for given DatasourceType"
201+
throw $errormsg
202+
}
203+
elseif( !$manifest.fileNamePrefixDisabled -and (!($PSBoundParameters.ContainsKey("FileNamePrefix")) -or !($PSBoundParameters.ContainsKey("TargetContainerURI"))) ){
204+
$errormsg = "FileNamePrefix and TargetContainerURI parameters are required for RestoreAsFiles for given DatasourceType"
205+
throw $errormsg
198206
}
199207

200-
$restoreRequest.RestoreTargetInfo.TargetDetail.FilePrefix = $FileNamePrefix
208+
if($manifest.fileNamePrefixDisabled){
209+
$restoreRequest.RestoreTargetInfo.TargetDetail.FilePrefix = "dummyprefix"
210+
}
211+
else{
212+
$restoreRequest.RestoreTargetInfo.TargetDetail.FilePrefix = $FileNamePrefix
213+
}
214+
201215
$restoreRequest.RestoreTargetInfo.TargetDetail.RestoreTargetLocationType = "AzureBlobs"
202216
$restoreRequest.RestoreTargetInfo.TargetDetail.Url = $TargetContainerURI
203217

src/DataProtection/DataProtection.Autorest/custom/Cmdlets/Platform/Vault/Set-AzDataProtectionMSIPermission.ps1

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -213,30 +213,17 @@
213213
$storageAccountSubId = ($targetResourceArmId -split "/resourceGroups/")[0]
214214
}
215215
else{
216-
if($StorageAccountARMId -eq ""){#$StorageAccountResourceGroupName -eq $null){
216+
if($StorageAccountARMId -eq ""){
217217
$err = "Permissions can't be assigned to target storage account. Please input parameter StorageAccountARMId"
218218
throw $err
219219
}
220220

221221
# storage Account subscription and resource group
222-
$storageAccountSubId = ($StorageAccountARMId -split "/resourceGroups/")[0] # "/subscriptions/" + $subscriptionIdInternal
223-
$storageAccResourceGroupId = ($StorageAccountARMId -split "/providers/")[0] #$storageAccountSubId + "/resourceGroups/" + $StorageAccountResourceGroupName
224-
225-
# $url = $restoreRequest.RestoreTargetInfo.TargetDetail.Url
226-
#
227-
# if(-not ($url -match "^https://.+blob.core.windows.net/.+")){
228-
# $err = "Parameter restoreRequest.RestoreTargetInfo.TargetDetail.Url is not in correct format"
229-
# throw $err
230-
# }
231-
# $storageAccName = (($url -split "//")[1] -split "\.")[0]
232-
#
233-
# CheckStorageModuleDependency
234-
# $contextSub = (Get-AzContext).Subscription.Id
235-
# Set-AzContext -SubscriptionId $subscriptionIdInternal | Out-Null
222+
$storageAccountSubId = ($StorageAccountARMId -split "/resourceGroups/")[0]
223+
$storageAccResourceGroupId = ($StorageAccountARMId -split "/providers/")[0]
236224

237225
# storage Account ID
238-
$storageAccId = $StorageAccountARMId #(Get-AzStorageAccount -ResourceGroupName $StorageAccountResourceGroupName -Name $storageAccName).Id
239-
# Set-AzContext -SubscriptionId $contextSub | Out-Null
226+
$storageAccId = $StorageAccountARMId
240227
}
241228

242229
$CheckPermission = $AllRoles | Where-Object { ($_.Scope -eq $storageAccId -or $_.Scope -eq $storageAccResourceGroupId -or $_.Scope -eq $storageAccountSubId) -and $_.RoleDefinitionName -eq $Permission}

src/DataProtection/DataProtection.Autorest/custom/manifests/AzureBlob.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"allowedRestoreModes": [ "PointInTimeBased", "RecoveryPointBased" ],
1616
"allowedRestoreTargetTypes": [ "OriginalLocation", "AlternateLocation" ],
1717
"itemLevelRecoveyEnabled": true,
18+
"fileNamePrefixDisabled": false,
1819
"addBackupDatasourceParametersList": true,
1920
"backupConfigurationRequired": false,
2021
"addDataStoreParametersList": false,

src/DataProtection/DataProtection.Autorest/custom/manifests/AzureDatabaseForMySQL.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"allowedRestoreModes": [ "RecoveryPointBased" ],
1616
"allowedRestoreTargetTypes": [ "RestoreAsFiles" ],
1717
"itemLevelRecoveyEnabled": false,
18+
"fileNamePrefixDisabled": true,
1819
"addBackupDatasourceParametersList": false,
1920
"backupConfigurationRequired": false,
2021
"addDataStoreParametersList": false,
@@ -28,7 +29,7 @@
2829
"disableAddRetentionRule": false,
2930
"disableCustomRetentionTag": false,
3031
"backupScheduleSupported": true,
31-
"supportedBackupFrequency": [ "Weekly", "Monthly" ],
32+
"supportedBackupFrequency": [ "Weekly" ],
3233
"defaultPolicy": {
3334
"name": "MySQLPolicy1",
3435
"datasourceTypes": [ "Microsoft.DBforMySQL/flexibleServers" ],

src/DataProtection/DataProtection.Autorest/custom/manifests/AzureDatabaseForPGFlexServer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"allowedRestoreModes": [ "RecoveryPointBased" ],
1616
"allowedRestoreTargetTypes": [ "RestoreAsFiles" ],
1717
"itemLevelRecoveyEnabled": false,
18+
"fileNamePrefixDisabled": true,
1819
"addBackupDatasourceParametersList": false,
1920
"backupConfigurationRequired": false,
2021
"addDataStoreParametersList": false,
@@ -28,7 +29,7 @@
2829
"disableAddRetentionRule": false,
2930
"disableCustomRetentionTag": false,
3031
"backupScheduleSupported": true,
31-
"supportedBackupFrequency": [ "Weekly", "Monthly" ],
32+
"supportedBackupFrequency": [ "Daily", "Weekly" ],
3233
"defaultPolicy": {
3334
"name": "PGFlexPolicy1",
3435
"datasourceTypes": [ "Microsoft.DBforPostgreSQL/flexibleServers" ],

src/DataProtection/DataProtection.Autorest/custom/manifests/AzureDatabaseForPostgreSQL.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"allowedRestoreModes": [ "RecoveryPointBased" ],
1616
"allowedRestoreTargetTypes": [ "AlternateLocation", "RestoreAsFiles" ],
1717
"itemLevelRecoveyEnabled": false,
18+
"fileNamePrefixDisabled": false,
1819
"addBackupDatasourceParametersList": false,
1920
"backupConfigurationRequired": false,
2021
"addDataStoreParametersList": false,

src/DataProtection/DataProtection.Autorest/custom/manifests/AzureDisk.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"allowedRestoreModes": [ "RecoveryPointBased" ],
1616
"allowedRestoreTargetTypes": [ "AlternateLocation" ],
1717
"itemLevelRecoveyEnabled": false,
18+
"fileNamePrefixDisabled": false,
1819
"addBackupDatasourceParametersList": false,
1920
"backupConfigurationRequired": false,
2021
"addDataStoreParametersList": true,

src/DataProtection/DataProtection.Autorest/custom/manifests/AzureKubernetesService.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"allowedRestoreModes": [ "RecoveryPointBased" ],
1616
"allowedRestoreTargetTypes": [ "AlternateLocation", "OriginalLocation" ],
1717
"itemLevelRecoveyEnabled": true,
18+
"fileNamePrefixDisabled": false,
1819
"addBackupDatasourceParametersList": true,
1920
"backupConfigurationRequired": true,
2021
"addDataStoreParametersList": true,

0 commit comments

Comments
 (0)