Repository navigation
[dataprotection] Add Cosmos DB item-level recovery #10486
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
base: main
Are you sure you want to change the base?
Changes from all commits
77b4681
3230471
429605f
bc67e9b
4ebb7cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1054,6 +1054,18 @@ def dataprotection_backup_instance_initialize_restoreconfig(datasource_type, exc | |
| "resource_selectors": resource_selectors | ||
| } | ||
|
|
||
| if datasource_type == "AzureCosmosDB": | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] For AzureCosmosDB, |
||
| if not resource_identifiers: | ||
| raise RequiredArgumentMissingError('--resource-identifiers is required for AzureCosmosDB restore configuration. ' | ||
| 'Provide the list of database or database/container names to restore.') | ||
| return { | ||
| "object_type": "GenericRestoreDatasourceCriteria", | ||
| "resource_selectors": { | ||
| "object_type": "ResourceListSelectionCriteria", | ||
| "resource_identifiers": resource_identifiers | ||
| } | ||
| } | ||
|
|
||
| if datasource_type != "AzureKubernetesService": | ||
| raise InvalidArgumentValueError("This command is currently not supported for datasource types other than AzureKubernetesService") | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| # pylint: disable=unnecessary-list-index-lookup | ||
| # pylint: disable=unidiomatic-typecheck | ||
| # pylint: disable=possibly-used-before-assignment | ||
| # pylint: disable=chained-comparison | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Nit] Consider scoping |
||
|
|
||
| import uuid | ||
| import re | ||
|
|
@@ -585,6 +586,16 @@ def get_resource_criteria_list(datasource_type, restore_configuration, container | |
| restore_criteria_list.append(restore_criteria) | ||
| return restore_criteria_list | ||
|
|
||
| if datasource_type == "AzureCosmosDB": | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] |
||
| if restore_configuration is not None: | ||
| restore_criteria = restore_configuration | ||
| else: | ||
| raise RequiredArgumentMissingError( | ||
| "Please input parameter restore_configuration for AzureCosmosDB restore.\n" | ||
| "Use command initialize-restoreconfig for creating the RestoreConfiguration") | ||
| restore_criteria_list.append(restore_criteria) | ||
| return restore_criteria_list | ||
|
|
||
| # implicit else: | ||
| # For non-AKS workloads (blobs (non-vaulted)), we need either a prefix-pattern or a container-list. Accordingly, the restore | ||
| # criteria's min_matching_value and max_matching_value are set. We need to provide one, but can't provide both | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Nit] The first sentence still reads "List of source volume identifiers". Consider making it datasource-neutral, for example "List of resource identifiers to restore", and keeping the per-datasource details after it.