Skip to content

Commit

Permalink
[skip ci] Archive 7016264 (#26556)
Browse files Browse the repository at this point in the history
Co-authored-by: azure-powershell-bot <[email protected]>
  • Loading branch information
1 parent 2579030 commit dc5ff83
Show file tree
Hide file tree
Showing 20 changed files with 463 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<PropertyGroup>
<PsModuleName>DataProtection</PsModuleName>
<PsRootModuleName>DataProtection</PsRootModuleName>
<PsModuleFolder>DataProtection.Autorest</PsModuleFolder>
</PropertyGroup>

<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., build.proj))\src\Az.autorest.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., build.proj))\src\Az.Post.props" />

</Project>
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the ""License"");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// distributed under the License is distributed on an ""AS IS"" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("Microsoft Azure Powershell - DataProtection")]
[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)]
[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)]
[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)]

[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
[assembly: Guid("6dd4370e-6b01-492a-baea-93dac2e9aa07")]
[assembly: AssemblyVersion("2.4.0")]
[assembly: AssemblyFileVersion("2.4.0")]
[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - DataProtection")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.4.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.4.0")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ $recoveryPointsCrr = Get-AzDataProtectionRecoveryPoint -BackupInstanceName $inst
$targetContainerURI = "https://{targetStorageAccountName}.blob.core.windows.net/{targetContainerName}"
$fileNamePrefix = "oss-pstest-crrasfiles"
$OssRestoreReq = Initialize-AzDataProtectionRestoreRequest -DatasourceType AzureDatabaseForPostgreSQL -SourceDataStore VaultStore -RestoreLocation $vault.ReplicatedRegion[0] -RestoreType RestoreAsFiles -RecoveryPoint $recoveryPointsCrr[0].Property.RecoveryPointId -TargetContainerURI $targetContainerURI -FileNamePrefix $fileNamePrefix
.Example
$subId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$resourceGroupName = "resourceGroupName"
$vaultName = "vaultName"
$location = "eastasia"
$snapshotResourceGroupId = "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/stagingRG"
$stagingStorageAccount = "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/stagingRG/providers/Microsoft.Storage/storageAccounts/snapshotsa"
$targetAKSClusterARMId = "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/targetRG/providers/Microsoft.ContainerService/managedClusters/targetKubernetesCluster"
$instance = Get-AzDataProtectionBackupInstance -SubscriptionId $subId -ResourceGroupName $resourceGroupName -VaultName $vaultName | Where-Object { $_.Name -match "aks-cluster-name" }
$rp = Get-AzDataProtectionRecoveryPoint -SubscriptionId $subId -ResourceGroupName $resourceGroupName -VaultName $vaultName -BackupInstanceName $instance.Name
$aksRestoreCriteria = New-AzDataProtectionRestoreConfigurationClientObject -DatasourceType AzureKubernetesService -PersistentVolumeRestoreMode RestoreWithVolumeData -IncludeClusterScopeResource $true -StagingResourceGroupId $snapshotResourceGroupId -StagingStorageAccountId $stagingStorageAccount -IncludedNamespace "hrweb" -NamespaceMapping @{"hrweb"="hrwebrestore"}
$aksALRRestoreRequest = Initialize-AzDataProtectionRestoreRequest -DatasourceType AzureKubernetesService -SourceDataStore VaultStore -RestoreLocation $location -RestoreType AlternateLocation -RecoveryPoint $rp[0].Property.RecoveryPointId -RestoreConfiguration $aksRestoreCriteria -TargetResourceId $targetAKSClusterARMId
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20240401.IAzureBackupRestoreRequest
Expand Down Expand Up @@ -100,24 +116,6 @@ BACKUPINSTANCE <BackupInstanceResource>: Backup Instance object to trigger origi
[ValidationType <ValidationType?>]: Specifies the type of validation. In case of DeepValidation, all validations from /validateForBackup API will run again.
[Tag <IDppProxyResourceTags>]: Proxy Resource tags.
[(Any) <String>]: This indicates any property can be added to this object.
RESTORECONFIGURATION <KubernetesClusterRestoreCriteria>: Restore configuration for restore. Use this parameter to restore with AzureKubernetesService.
IncludeClusterScopeResource <Boolean>: Gets or sets the include cluster resources property. This property if enabled will include cluster scope resources during restore.
ObjectType <String>: Type of the specific object - used for deserializing
[ConflictPolicy <ExistingResourcePolicy?>]: Gets or sets the Conflict Policy property. This property sets policy during conflict of resources during restore.
[ExcludedNamespace <String[]>]: Gets or sets the exclude namespaces property. This property sets the namespaces to be excluded during restore.
[ExcludedResourceType <String[]>]: Gets or sets the exclude resource types property. This property sets the resource types to be excluded during restore.
[IncludedNamespace <String[]>]: Gets or sets the include namespaces property. This property sets the namespaces to be included during restore.
[IncludedResourceType <String[]>]: Gets or sets the include resource types property. This property sets the resource types to be included during restore.
[LabelSelector <String[]>]: Gets or sets the LabelSelectors property. This property sets the resource with such label selectors to be included during restore.
[NamespaceMapping <IKubernetesClusterRestoreCriteriaNamespaceMappings>]: Gets or sets the Namespace Mappings property. This property sets if namespace needs to be change during restore.
[(Any) <String>]: This indicates any property can be added to this object.
[PersistentVolumeRestoreMode <PersistentVolumeRestoreMode?>]: Gets or sets the PV (Persistent Volume) Restore Mode property. This property sets whether volumes needs to be restored.
[ResourceModifierReferenceName <String>]: Name of the resource
[ResourceModifierReferenceNamespace <String>]: Namespace in which the resource exists
[RestoreHookReference <INamespacedNameResource[]>]: Gets or sets the restore hook references. This property sets the hook reference to be executed during restore.
[Name <String>]: Name of the resource
[Namespace <String>]: Namespace in which the resource exists
.Link
https://learn.microsoft.com/powershell/module/az.dataprotection/initialize-azdataprotectionrestorerequest
#>
Expand Down Expand Up @@ -195,10 +193,9 @@ param(
[Parameter(ParameterSetName='OriginalLocationILR')]
[Parameter(ParameterSetName='OriginalLocationFullRecovery')]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20240401.KubernetesClusterRestoreCriteria]
[System.Management.Automation.PSObject]
# Restore configuration for restore.
# Use this parameter to restore with AzureKubernetesService.
# To construct, see NOTES section for RESTORECONFIGURATION properties and create a hash table.
${RestoreConfiguration},

[Parameter(ParameterSetName='AlternateLocationFullRecovery')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,28 @@ Edit-AzDataProtectionPolicyTriggerClientObject -Schedule $trigger -Policy $defau
$tagCriteria = New-AzDataProtectionPolicyTagCriteriaClientObject -MonthsOfYear January -DaysOfMonth 1,5,Last
Edit-AzDataProtectionPolicyTagClientObject -Policy $defaultPol -Name Monthly -Criteria $tagCriteria
$pgflexPolicy = New-AzDataProtectionBackupPolicy -SubscriptionId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -ResourceGroupName "resourceGroupName" -VaultName "vaultName" -Name "pgflex-policy" -Policy $defaultPol
.Example
$defaultPol = Get-AzDataProtectionPolicyTemplate -DatasourceType AzureKubernetesService
$schDate = @(
(
(Get-Date -Year 2024 -Month 10 -Day 02 -Hour 15 -Minute 30 -Second 0)
))
$trigger = New-AzDataProtectionPolicyTriggerScheduleClientObject -ScheduleDays $schDate -IntervalType Daily -IntervalCount 1
Edit-AzDataProtectionPolicyTriggerClientObject -Schedule $trigger -Policy $defaultPol
# Adding default retention rule below
$lifeCycleDefault = New-AzDataProtectionRetentionLifeCycleClientObject -SourceDataStore OperationalStore -SourceRetentionDurationType Days -SourceRetentionDurationCount 9
Edit-AzDataProtectionPolicyRetentionRuleClientObject -Policy $defaultPol -Name Default -LifeCycles $lifeCycleDefault -IsDefault $true
# Adding daily retention rule below
$lifeCycleDailyOperational = New-AzDataProtectionRetentionLifeCycleClientObject -SourceDataStore OperationalStore -SourceRetentionDurationType Days -SourceRetentionDurationCount 9 -TargetDataStore VaultStore -CopyOption ImmediateCopyOption
$lifeCycleDailyVaulted = New-AzDataProtectionRetentionLifeCycleClientObject -SourceDataStore VaultStore -SourceRetentionDurationType Days -SourceRetentionDurationCount 86
Edit-AzDataProtectionPolicyRetentionRuleClientObject -Policy $defaultPol -Name Daily -LifeCycles $lifeCycleDailyOperational, $lifeCycleDailyVaulted -IsDefault $false
$tagCriteriaDaily = New-AzDataProtectionPolicyTagCriteriaClientObject -AbsoluteCriteria FirstOfDay
Edit-AzDataProtectionPolicyTagClientObject -Policy $defaultPol -Name Daily -Criteria $tagCriteriaDaily
New-AzDataProtectionBackupPolicy -SubscriptionId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -ResourceGroupName "resourceGroupName" -VaultName "vaultName" -Name "newAKSPolicy" -Policy $defaultPol
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20240401.IBaseBackupPolicyResource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ To create the parameters described below, construct a hash table containing the
NAMESPACEMAPPING <KubernetesClusterRestoreCriteriaNamespaceMappings>: Namespaces mapping from source namespaces to target namespaces to resolve namespace naming conflicts in the target cluster.
[(Any) <String>]: This indicates any property can be added to this object.
RESOURCEMODIFIERREFERENCE <NamespacedNameResource>: Resource modifier reference to be executed during restore.
[Name <String>]: Name of the resource
[Namespace <String>]: Namespace in which the resource exists
RESTOREHOOKREFERENCE <NamespacedNameResource[]>: Hook reference to be executed during restore.
[Name <String>]: Name of the resource
[Namespace <String>]: Namespace in which the resource exists
Expand Down Expand Up @@ -113,7 +117,26 @@ param(
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20240401.NamespacedNameResource[]]
# Hook reference to be executed during restore.
# To construct, see NOTES section for RESTOREHOOKREFERENCE properties and create a hash table.
${RestoreHookReference}
${RestoreHookReference},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20240401.NamespacedNameResource]
# Resource modifier reference to be executed during restore.
# To construct, see NOTES section for RESOURCEMODIFIERREFERENCE properties and create a hash table.
${ResourceModifierReference},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Category('Body')]
[System.String]
# Staging resource group Id for restore.
${StagingResourceGroupId},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Category('Body')]
[System.String]
# Staging storage account Id for restore.
${StagingStorageAccountId}
)

begin {
Expand Down
Loading

0 comments on commit dc5ff83

Please sign in to comment.