Skip to content

Commit

Permalink
[dataprotection] Add support for Cross Region Restore for Backup Vaul…
Browse files Browse the repository at this point in the history
…ts (#7282)

* Ignore intermediary jsons

* Upgrade all modules to 2023-11-01

* all tests passing for updated API version

* Add CRR group, validateCRR working, add ARG vault, modify ARG BI, cleanup BI init

* fixed BI init, imports in helpers

* Restore trigger now definitely works, about to start customizing

* Validate CRR, BV list from resourcegraph complete

Also code cleanup.

* Recovery point list supports use-secondary-region now

* Complete commands: restore trigger, job fetch. Added a secondary region mapping as fallback in case of poorly populated fields from service.

* Hiding explicit CRR commands

* backup vault creation/editing with CRR

* Alias for --cross-region-restore-state

* Backup vault ID option for list-from-resourcegraph

* CRR Vault create, update tests updated

* Backup vault list from RG test created

* Cleaning up restore initialize

* Running tests

* Complete all tests for CRR refresh

* fixed Update msi permissions

* add tests, commented out

* fix linter

* version number update

* single job show added, all tests except CRR recorded

* committing CRR test, runs but not recorded

* Everything complete, proceeding to review

* Trying to pass the linter rules

* Updating history

* linter show_job rules

* flake8 for test folder

* flake8 more issues

* show_command for linter

* fix show command

* All linters work

* All linters work

* Help examples for CRR commands

* Re-adding pagination parameters and no-wait for restore trigger

* Versioning with 1.0.0

* style fixes

---------

Co-authored-by: Zubair Abid <zubairabid@microsoft.com>
  • Loading branch information
zubairabid and Zubair Abid committed Mar 13, 2024
1 parent 65dec6d commit e95fbac
Show file tree
Hide file tree
Showing 102 changed files with 11,746 additions and 5,752 deletions.
1 change: 1 addition & 0 deletions src/dataprotection/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.json
13 changes: 13 additions & 0 deletions src/dataprotection/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
Release History
===============

1.0.0
++++++
* Added support for Cross Region Restore for Backup Vaults.
* `az dataprotection backup-vault create`: New parameter `--cross-region-restore-state/--crr-state` that can be set to Enabled/Disabled.
* `az dataprotection backup-vault update`: New parameter `--cross-region-restore-state/--crr-state` that can be set to Enabled/Disabled.
* `az dataprotection backup-vault list-from-resourcegraph`: New command to fetch Backup Vault details from Azure Resource Graph.
* `az dataprotection recovery-point list`: New parameter `--use-secondary-region` to be used when listing from the secondary region.
* `az dataprotection backup-instance validate-for-restore`: New parameter `--use-secondary-region` to be used when restoring to the secondary region.
* `az dataprotection backup-instance restore trigger`: New parameter `--use-secondary-region` to be used when restoring to the secondary region.
* `az dataprotection backup-job list`: New parameter `--use-secondary-region` which can be used in disaster scenario when primary region is down.
* `az dataprotection backup-job show`: New parameter `--use-secondary-region` which can be used in disaster scenario when primary region is down.

0.11.2
++++++
* `az dataprotection backup-instance update-msi-permissions`: Added UAMI support for AKS backup/restore.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class AdhocBackup(AAZCommand):
"""

_aaz_info = {
"version": "2023-05-01",
"version": "2023-11-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}/backup", "2023-05-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}/backup", "2023-11-01"],
]
}

Expand Down Expand Up @@ -168,7 +168,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-05-01",
"api-version", "2023-11-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class Create(AAZCommand):
"""

_aaz_info = {
"version": "2023-05-01",
"version": "2023-11-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}", "2023-05-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}", "2023-11-01"],
]
}

Expand Down Expand Up @@ -170,7 +170,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-05-01",
"api-version", "2023-11-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class Delete(AAZCommand):
"""

_aaz_info = {
"version": "2023-05-01",
"version": "2023-11-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}", "2023-05-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}", "2023-11-01"],
]
}

Expand Down Expand Up @@ -154,7 +154,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-05-01",
"api-version", "2023-11-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class List(AAZCommand):
"""

_aaz_info = {
"version": "2023-05-01",
"version": "2023-11-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances", "2023-05-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances", "2023-11-01"],
]
}

Expand Down Expand Up @@ -122,7 +122,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-05-01",
"api-version", "2023-11-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class ResumeProtection(AAZCommand):
"""

_aaz_info = {
"version": "2023-05-01",
"version": "2023-11-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}/resumeprotection", "2023-05-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}/resumeprotection", "2023-11-01"],
]
}

Expand Down Expand Up @@ -144,7 +144,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-05-01",
"api-version", "2023-11-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class Show(AAZCommand):
"""

_aaz_info = {
"version": "2023-05-01",
"version": "2023-11-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}", "2023-05-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}", "2023-11-01"],
]
}

Expand Down Expand Up @@ -131,7 +131,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-05-01",
"api-version", "2023-11-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class StopProtection(AAZCommand):
"""

_aaz_info = {
"version": "2023-05-01",
"version": "2023-11-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}/stopprotection", "2023-05-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}/stopprotection", "2023-11-01"],
]
}

Expand Down Expand Up @@ -144,7 +144,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-05-01",
"api-version", "2023-11-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class SuspendBackup(AAZCommand):
"""

_aaz_info = {
"version": "2023-05-01",
"version": "2023-11-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}/suspendbackups", "2023-05-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}/suspendbackups", "2023-11-01"],
]
}

Expand Down Expand Up @@ -144,7 +144,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-05-01",
"api-version", "2023-11-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@
from azure.cli.core.aaz import *


@register_command(
"dataprotection backup-instance update",
is_experimental=True,
)
class Update(AAZCommand):
"""Update a backup instance in a backup vault
"""

_aaz_info = {
"version": "2023-05-01",
"version": "2023-11-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}", "2023-05-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/backupinstances/{}", "2023-11-01"],
]
}

Expand Down Expand Up @@ -360,7 +356,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-05-01",
"api-version", "2023-11-01",
required=True,
),
}
Expand Down Expand Up @@ -463,7 +459,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-05-01",
"api-version", "2023-11-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class ValidateForBackup(AAZCommand):
"""

_aaz_info = {
"version": "2023-05-01",
"version": "2023-11-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/validateforbackup", "2023-05-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dataprotection/backupvaults/{}/validateforbackup", "2023-11-01"],
]
}

Expand Down Expand Up @@ -439,7 +439,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-05-01",
"api-version", "2023-11-01",
required=True,
),
}
Expand Down
Loading

0 comments on commit e95fbac

Please sign in to comment.