Skip to content

Commit

Permalink
[cosmodb-preview] CosmosDB Mongo Cluster Support (#5860)
Browse files Browse the repository at this point in the history
* update python sdk

* sdk version 10-15

* crud tests

* minor changes

* rename test files

* minor changes

* minor change

* minor cleanup

* fix tests failure

* create test

* delete and shw commands

* working test

* firewall changes

* minor update

* update sdk with 03-01 version

* add tests

* fix update and tests

* minor cleanup

* added test case

* added param source_backup_location

* update sdk

* mayank public network access changes

* burst capacity changes

* update shard-node-sku to shard-node-tier

* address review comments

* address built issues

* fix static analysis errors

* updates to crossregionrestore

* reverted models_py3 changes - not needed, this is for sdk

* added validation for location in test case

* multi region account

* addressed comments

* Fixing merge conflicts

* mayank public network access changes

* update implementation and test records

* update test records

* cross region restore fixes and clean run

* address review comments

* addressed comments, removed mayanks changes as his seperate PR got merged.

* style fixes from azdev style

* updated comments

* resolve static analysis issues

* address review comments

* address revie comments

* address revie comments

* added single region account cross region scenario fixes

* minor changes, updated comments, changed region to eastus and westus

* updated region for batch1. batch2, cross region restore test

* updating recordings

* resolve linter issues

* added recordings

* azdev style update

* update recordings

* update recordings for mongocluster operations

* minor changes

* update test recordings

* added recording for burst capacity

* recordings

* update recordings

* update recordings

* address review comments

* address review comments

* wip for inaccount restore suggestions

* update assertions for inaccount restore tests

* address review comments

---------

Co-authored-by: dsapaliga <dsapaliga@microsoft.com>
Co-authored-by: Mayank Katwal <mayankkatwal@microsoft.com>
Co-authored-by: Richa Sharma <richasharma@microsoft.com>
Co-authored-by: Dinesh Kumar Dhamotharan <ddhamotharan@microsoft.com>
Co-authored-by: mayankkatwal <121567171+mayankkatwal@users.noreply.github.com>
Co-authored-by: Richa Sharma <richasharma.amu@gmail.com>
  • Loading branch information
7 people authored Apr 19, 2023
1 parent 93a9ecb commit 8e5bf16
Show file tree
Hide file tree
Showing 147 changed files with 67,307 additions and 41,174 deletions.
7 changes: 7 additions & 0 deletions src/cosmosdb-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
Release History
===============
0.24.0
* Create and manage mongo clusters.
* Add 'source_backup_location' parameter to 'cosmosdb restore' command
* Add support for performing in-account restore of deleted databases and graphs in a Gremlin account.
* Add support for performing in-account restore of deleted tables in a Table account.

++++++
0.23.0
* Add 'enable_public_network' param to 'cosmosdb restore' command

Expand Down
25 changes: 25 additions & 0 deletions src/cosmosdb-preview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,28 @@ az cosmosdb mongodb collection restore --account-name "account-name" \
--collection-name "collection-name"
--restore-timestamp "2020-07-20T16:09:53+0000" \
```

#### Restore a deleted container within same account for a Gremlin database account ####

```sh
az cosmosdb gremlin graph restore --account-name "account-name" \
--database-name "database-name"
--name "graph-name"
--restore-timestamp "2022-07-20T16:09:53+0000" \
```

#### Restore a deleted database within same account for a Gremlin database account ####

```sh
az cosmosdb gremlin database restore --account-name "account-name" \
--name "database-name"
--restore-timestamp "2022-07-20T16:09:53+0000" \
```

#### Restore a deleted collection within same account for a Table account ####

```sh
az cosmosdb table restore --account-name "account-name" \
--table-name "table-name"
--restore-timestamp "2022-07-20T16:09:53+0000" \
```
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,7 @@ def cf_restorable_database_accounts(cli_ctx, _):

def cf_data_transfer_job(cli_ctx, _):
return cf_cosmosdb_preview(cli_ctx).data_transfer_jobs


def cf_mongo_cluster_job(cli_ctx, _):
return cf_cosmosdb_preview(cli_ctx).mongo_clusters
166 changes: 166 additions & 0 deletions src/cosmosdb-preview/azext_cosmosdb_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,142 @@

from knack.help_files import helps # pylint: disable=unused-import

helps['cosmosdb mongocluster firewall'] = """
type: group
short-summary: Mongo cluster firewall.
"""

helps['cosmosdb mongocluster firewall rule'] = """
type: group
short-summary: Mongo cluster firewall rule.
"""

helps['cosmosdb mongocluster firewall rule create'] = """
type: command
short-summary: Create a Mongo cluster firewall rule.
examples:
- name: Create a Mongo cluster firewall rule.
text: |
az cosmosdb mongocluster firewall rule create \\
--cluster-name MyCluster \\
--resource-group MyResourceGroup \\
--rule-name MyRule \\
--start-ip-address MyStartIpAddress \\
--end-ip-address MyEndIpAddress \\
"""

helps['cosmosdb mongocluster firewall rule update'] = """
type: command
short-summary: Create a Mongo cluster firewall rule.
examples:
- name: Update a Mongo cluster firewall rule.
text: |
az cosmosdb mongocluster firewall rule update \\
--cluster-name MyCluster \\
--resource-group MyResourceGroup \\
--rule-name MyRule \\
--start-ip-address MyStartIpAddress \\
--end-ip-address MyEndIpAddress \\
"""

helps['cosmosdb mongocluster firewall rule list'] = """
type: command
short-summary: Lists firewall rule on a Mongo cluster.
examples:
- name: Lists a Mongo cluster firewall rule in a resource group.
text: |
az cosmosdb mongocluster firewall rule list --cluster-name MyCluster --resource-group MyResourceGroup
"""

helps['cosmosdb mongocluster firewall rule show'] = """
type: command
short-summary: Get a Mongo cluster firewall rule.
examples:
- name: Gets a Mongo cluster firewall rule. If the firewall rule does not exist a NotFound response is returned.
text: |
az cosmosdb mongocluster firewall rule show --cluster-name MyCluster --resource-group MyResourceGroup --rule-name MyRuleName
"""

helps['cosmosdb mongocluster firewall rule delete'] = """
type: command
short-summary: Delete a Mongo cluster firewall rule.
examples:
- name: Delete a Mongo Cluster firewall rule. If the firewall rule does not exist a NoContent response is returned.
text: |
az cosmosdb mongocluster firewall rule delete --cluster-name MyCluster --resource-group MyResourceGroup --rule-name MyRuleName
"""

helps['cosmosdb mongocluster'] = """
type: group
short-summary: Mongo cluster.
"""

helps['cosmosdb mongocluster create'] = """
type: command
short-summary: Create a Mongo cluster.
examples:
- name: Create a Mongo cluster.
text: |
az cosmosdb mongocluster create \\
--cluster-name MyCluster \\
--resource-group MyResourceGroup \\
--location MyLocation \\
--administrator-login MyAdminUser \\
--administrator-login-password MyAdminPassword \\
--server-version 5.0 \\
--shard-node-tier "M30" \\
--shard-node-ha true \\
--shard-node-disk-size-gb 128 \\
--shard-node-count 2
"""

helps['cosmosdb mongocluster update'] = """
type: command
short-summary: Update a Mongo cluster.
examples:
- name: Update a Mongo cluster.
text: |
az cosmosdb mongocluster update \\
--cluster-name MyCluster \\
--resource-group MyResourceGroup \\
--administrator-login MyAdminUser \\
--administrator-login-password MyAdminPassword \\
--server-version 5.0 \\
--shard-node-tier "M30" \\
--shard-node-ha true \\
--shard-node-disk-size-gb 128
"""

helps['cosmosdb mongocluster list'] = """
type: command
short-summary: List a Mongo Cluster Resource.
examples:
- name: Lists Mongo Cluster Resource list in a resource group.
text: |
az cosmosdb mongocluster list --resource-group MyResourceGroup
- name: Lists a Mongo Cluster Resource list in the subscription.
text: |
az cosmosdb mongocluster list
"""

helps['cosmosdb mongocluster show'] = """
type: command
short-summary: Get a Mongo Cluster Resource.
examples:
- name: Gets a Mongo Cluster Resource. ProvisioningState tells the state of this cluster. If the cluster does not exist a NotFound response is returned.
text: |
az cosmosdb mongocluster show --cluster-name MyCluster --resource-group MyResourceGroup
"""

helps['cosmosdb mongocluster delete'] = """
type: command
short-summary: Delete a Mongo Cluster Resource.
examples:
- name: Deletes a Mongo Cluster Resource. If the cluster does not exist a NoContent response is returned.
text: |
az cosmosdb mongocluster delete --cluster-name MyCluster --resource-group MyResourceGroup
"""

helps['managed-cassandra'] = """
type: group
short-summary: Azure Managed Cassandra.
Expand Down Expand Up @@ -747,3 +883,33 @@
text: |-
az cosmosdb mongodb collection restore --resource-group resource_group --account-name database_account_name --database-name parent_database_name --name name_of_collection_needs_to_be_restored --restore-timestamp 2020-07-13T16:03:41+0000
"""

# in-account restore of a deleted gremlin database
helps['cosmosdb gremlin database restore'] = """
type: command
short-summary: "Restore a deleted gremlin database within the same account."
examples:
- name: Restore a deleted gremlin database within the same account.
text: |-
az cosmosdb gremlin database restore --resource-group resource_group --account-name database_account_name --name name_of_database_needs_to_be_restored --restore-timestamp 2020-07-13T16:03:41+0000
"""

# in-account restore of a deleted gremlin graph
helps['cosmosdb gremlin graph restore'] = """
type: command
short-summary: "Restore a deleted gremlin graph within the same account."
examples:
- name: Restore a deleted gremlin graph within the same account.
text: |-
az cosmosdb gremlin graph restore --resource-group resource_group --account-name database_account_name --database-name parent_database_name --name name_of_graph_needs_to_be_restored --restore-timestamp 2020-07-13T16:03:41+0000
"""

# in-account restore of a deleted table
helps['cosmosdb table restore'] = """
type: command
short-summary: "Restore a deleted table within the same account."
examples:
- name: Restore a deleted table within the same account.
text: |-
az cosmosdb table restore --resource-group resource_group --account-name database_account_name --table-name name_of_table_needs_to_be_restored --restore-timestamp 2020-07-13T16:03:41+0000
"""
Loading

0 comments on commit 8e5bf16

Please sign in to comment.