Skip to content

Migrate DataProtection from generation to main #24498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/DataProtection/DataProtection.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ This file contains the configuration for generating My API from the OpenAPI spec

``` yaml
# it's the same options as command line options, just drop the double-dash!
commit: c0e7b1360c19187fde2497251f784aa82641aa95
commit: 41d1c179dc166b7f16b7e40ef4f2a1d9c85b10cc
require:
- $(this-folder)/../../readme.azure.noprofile.md
input-file:
- $(repo)/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-11-01/dataprotection.json
- $(repo)/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-12-01/dataprotection.json
title: DataProtection
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
use-extension:
Expand Down Expand Up @@ -398,16 +398,16 @@ directive:
- ValidateCrossRegionRestoreRequestObject
- from: source-file-csharp
where: $
transform: $ = $.replace('internal Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.IBaseBackupPolicy Property', 'public Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.IBaseBackupPolicy Property');
transform: $ = $.replace('internal Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.IBaseBackupPolicy Property', 'public Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.IBaseBackupPolicy Property');
- from: source-file-csharp
where: $
transform: $ = $.replace('internal Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.ITriggerContext Trigger', 'public Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.ITriggerContext Trigger');
transform: $ = $.replace('internal Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.ITriggerContext Trigger', 'public Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.ITriggerContext Trigger');
- from: source-file-csharp
where: $
transform: $ = $.replace('internal Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.IBackupParameters BackupParameter', 'public Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.IBackupParameters BackupParameter');
transform: $ = $.replace('internal Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.IBackupParameters BackupParameter', 'public Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.IBackupParameters BackupParameter');
- from: source-file-csharp
where: $
transform: $ = $.replace('internal Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.IAzureBackupRecoveryPoint Property', 'public Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.IAzureBackupRecoveryPoint Property');
transform: $ = $.replace('internal Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.IAzureBackupRecoveryPoint Property', 'public Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.IAzureBackupRecoveryPoint Property');
```

## Alternate settings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "backupVaults/backupInstances/recoveryPoints",
"apiVersion": "2023-11-01",
"apiVersion": "2023-12-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.dataprotection"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "backupVaults/backupInstances",
"apiVersion": "2023-11-01",
"apiVersion": "2023-12-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.dataprotection"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "backupVaults/backupJobs",
"apiVersion": "2023-11-01",
"apiVersion": "2023-12-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.dataprotection"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "backupVaults/backupPolicies",
"apiVersion": "2023-11-01",
"apiVersion": "2023-12-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.dataprotection"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "backupVaults/backupResourceGuardProxies",
"apiVersion": "2023-11-01",
"apiVersion": "2023-12-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.dataprotection"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "backupVaults/deletedBackupInstances",
"apiVersion": "2023-11-01",
"apiVersion": "2023-12-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.dataprotection"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "backupVaults",
"apiVersion": "2023-11-01",
"apiVersion": "2023-12-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.dataprotection"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "locations/operationStatus",
"apiVersion": "2023-11-01",
"apiVersion": "2023-12-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.dataprotection"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "resourceGuards",
"apiVersion": "2023-11-01",
"apiVersion": "2023-12-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.dataprotection"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
param (
[Parameter(Mandatory, HelpMessage='Subscription of Vault')]
[System.String[]]
${Subscription},
${Subscription}, # TODO: add alias to all ARG command params

[Parameter(Mandatory=$false, HelpMessage='Resource Group of Vault')]
[System.String[]]
Expand Down Expand Up @@ -102,7 +102,7 @@
foreach($argResponse in $argInstanceResponse)
{
$jsonStringResponse = $argResponse | ConvertTo-Json -Depth 100
$backupInstances += [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.BackupInstanceResource]::FromJsonString($jsonStringResponse)
$backupInstances += [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.BackupInstanceResource]::FromJsonString($jsonStringResponse)
}
return $backupInstances
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@

param (
[Parameter(Mandatory, HelpMessage='Subscription of Vault')]
[Alias('SubscriptionId')]
[System.String[]]
${Subscription},

[Parameter(Mandatory=$false, HelpMessage='Resource Group of Vault')]
[Alias('ResourceGroupName')]
[System.String[]]
${ResourceGroup},

[Parameter(Mandatory=$false, HelpMessage='Name of the vault')]
[Alias('VaultName')]
[System.String[]]
${Vault},

Expand Down Expand Up @@ -67,7 +70,7 @@
process
{
CheckResourceGraphModuleDependency

# $manifest = LoadManifest -DatasourceType $DatasourceType
$query = GetBackupVaultARGQuery

Expand All @@ -91,7 +94,7 @@
foreach($argVault in $argAllVaults)
{
$jsonStringResponse = $argVault | ConvertTo-Json -Depth 100
$backupVaults += [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.BackupVaultResource]::FromJsonString($jsonStringResponse)
$backupVaults += [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.BackupVaultResource]::FromJsonString($jsonStringResponse)
}
return $backupVaults
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
foreach($jobresponse in $argJobResponse)
{
$jsonStringResponse = $jobresponse | ConvertTo-Json -Depth 100
$backupJobs += [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.AzureBackupJobResource]::FromJsonString($jsonStringResponse)
$backupJobs += [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.AzureBackupJobResource]::FromJsonString($jsonStringResponse)
}
return $backupJobs
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


function Initialize-AzDataProtectionBackupInstance {
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.IBackupInstanceResource')]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.IBackupInstanceResource')]
[CmdletBinding(PositionalBinding=$false)]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Description('Initializes Backup instance Request object for configuring backup')]

Expand Down Expand Up @@ -44,14 +44,14 @@ function Initialize-AzDataProtectionBackupInstance {
${FriendlyName},

[Parameter(Mandatory=$false, HelpMessage='Backup configuration for backup. Use this parameter to configure protection for AzureKubernetesService.')]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.IBackupDatasourceParameters]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.IBackupDatasourceParameters]
${BackupConfiguration}
)

process {

$manifest = LoadManifest -DatasourceType $DatasourceType.ToString()
$backupInstance = [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.BackupInstance]::new()
$backupInstance = [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.BackupInstance]::new()
$backupInstance.ObjectType = "BackupInstance"

if($manifest.snapshotRGPermissions.Length -eq 0 -and $SnapshotResourceGroupId -ne "")
Expand All @@ -70,12 +70,15 @@ function Initialize-AzDataProtectionBackupInstance {
$backupInstance.DataSourceSetInfo = GetDatasourceSetInfo -DatasourceInfo $backupInstance.DataSourceInfo -DatasourceType $DatasourceType
}

if(-not($manifest.friendlyNameRequired) -and $FriendlyName -ne ""){
if(-not($manifest.friendlyNameRequired) -and -not($manifest.customFriendlyNameAllowed) -and $FriendlyName -ne ""){
$errormsg = "FriendlyName parameter is not expected for the given DatasourceType"
throw $errormsg
}

if($backupInstance.DataSourceSetInfo.ResourceId -eq $null){

if($manifest.customFriendlyNameAllowed -and $FriendlyName -ne ""){
$backupInstance.FriendlyName = $FriendlyName
}
elseif($backupInstance.DataSourceSetInfo.ResourceId -eq $null -or $manifest.customFriendlyNameAllowed){
$backupInstance.FriendlyName = $backupInstance.DataSourceInfo.ResourceName
}
elseif($manifest.friendlyNameRequired){
Expand Down Expand Up @@ -106,9 +109,9 @@ function Initialize-AzDataProtectionBackupInstance {
$errormsg = "Please input SecretStoreType"
throw $errormsg
}
$backupInstance.DatasourceAuthCredentials = [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.SecretStoreBasedAuthCredentials]::new()
$backupInstance.DatasourceAuthCredentials = [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.SecretStoreBasedAuthCredentials]::new()
$backupInstance.DatasourceAuthCredentials.ObjectType = "SecretStoreBasedAuthCredentials"
$backupInstance.DatasourceAuthCredentials.SecretStoreResource = [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.SecretStoreResource]::new()
$backupInstance.DatasourceAuthCredentials.SecretStoreResource = [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.SecretStoreResource]::new()
$backupInstance.DatasourceAuthCredentials.SecretStoreResource.SecretStoreType = $SecretStoreType
$backupInstance.DatasourceAuthCredentials.SecretStoreResource.Uri = $SecretStoreURI
}
Expand All @@ -118,7 +121,7 @@ function Initialize-AzDataProtectionBackupInstance {
}
}

$backupInstanceResource = [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.BackupInstanceResource]::new()
$backupInstanceResource = [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.BackupInstanceResource]::new()
$backupInstanceResource.Property = $backupInstance

if($PSBoundParameters.ContainsKey("DatasourceId"))
Expand All @@ -136,7 +139,7 @@ function Initialize-AzDataProtectionBackupInstance {

if($manifest.addDataStoreParametersList -eq $true)
{
$operationalParam = [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.AzureOperationalStoreParameters]::new()
$operationalParam = [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.AzureOperationalStoreParameters]::new()
$operationalParam.DataStoreType = "OperationalStore"
$operationalParam.ObjectType = "AzureOperationalStoreParameters"
$operationalParam.ResourceGroupId = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function New-AzDataProtectionBackupConfigurationClientObject{
${IncludeClusterScopeResource},

[Parameter(Mandatory=$false, HelpMessage='Hook reference to be executed during backup.')]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.NamespacedNameResource[]]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.NamespacedNameResource[]]
${BackupHookReference},

[Parameter(Mandatory=$false, HelpMessage='List of containers to be backed up inside the VaultStore. Use this parameter for DatasourceType AzureBlob.')]
Expand Down Expand Up @@ -71,7 +71,7 @@ function New-AzDataProtectionBackupConfigurationClientObject{
throw $message
}

$dataSourceParam = [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.KubernetesClusterBackupDatasourceParameters]::new()
$dataSourceParam = [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.KubernetesClusterBackupDatasourceParameters]::new()
$dataSourceParam.ObjectType = "KubernetesClusterBackupDatasourceParameters"

$dataSourceParam.ExcludedResourceType = $ExcludedResourceType
Expand All @@ -97,7 +97,7 @@ function New-AzDataProtectionBackupConfigurationClientObject{
}

if($DatasourceType.ToString() -eq "AzureBlob"){
$dataSourceParam = [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.BlobBackupDatasourceParameters]::new()
$dataSourceParam = [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.BlobBackupDatasourceParameters]::new()
$dataSourceParam.ObjectType = "BlobBackupDatasourceParameters"

if($VaultedBackupContainer -ne $null){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function New-AzDataProtectionBackupInstance {
${VaultName},

[Parameter(Mandatory, HelpMessage='Backup instance request object which will be used to configure backup')]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.IBackupInstanceResource]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.IBackupInstanceResource]
${BackupInstance},

[Parameter(Mandatory=$false, HelpMessage='Resource tags')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

function New-AzDataProtectionResourceGuard
{
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.IResourceGuardResource')]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.IResourceGuardResource')]
[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess)]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Description('Creates a resource guard under a resource group')]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Unlock-AzDataProtectionResourceGuardOperation
[System.String]
${ResourceToBeDeleted},

[Parameter(ParameterSetName="UnlockDelete", Mandatory=$false, HelpMessage='Parameter to authorize operations protected by cross tenant resource guard. Use command (Get-AzAccessToken -TenantId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"). Token to fetch authorization token for different tenant.')]
[Parameter(ParameterSetName="UnlockDelete", Mandatory=$false, HelpMessage='Parameter to authorize operations protected by cross tenant resource guard. Use command (Get-AzAccessToken -TenantId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").Token to fetch authorization token for different tenant.')]
[System.String]
${Token},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

function Update-AzDataProtectionBackupInstanceAssociatedPolicy
{
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.IBackupInstanceResource')]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.IBackupInstanceResource')]
[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess)]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Description('Updates associated policy for a given backup instance')]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

function Update-AzDataProtectionResourceGuard
{
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.IResourceGuardResource')]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.IResourceGuardResource')]
[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess)]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Description('Updates a resource guard belonging to a resource group')]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function Get-AzDataProtectionJob
{
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231101.IAzureBackupJobResource')]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20231201.IAzureBackupJobResource')]
[CmdletBinding(PositionalBinding=$false)]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Description('Gets or lists jobs in a backup vault')]

Expand Down
Loading