Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
81d2160
Add mongo cluster extension v1
olivertowers Jul 10, 2025
8e840bf
Initial commands a customizations for mongo-cluster
olivertowers Jul 12, 2025
e3e7af6
Add additional commands, make commands preview, add test recordings
olivertowers Jul 15, 2025
5717221
Add mongo-cluster replica wait command
olivertowers Jul 15, 2025
ebe0eb9
Fix style
olivertowers Jul 15, 2025
c7c2630
Modify list connection strings. Follow standards for argument names
olivertowers Jul 15, 2025
ab94b23
fix style
olivertowers Jul 15, 2025
db8024a
Fix resource id handling
olivertowers Jul 15, 2025
a20a561
Initial AAZ generation
olivertowers Jul 18, 2025
f0a9e34
Refactor customizations and tests under document-db
olivertowers Jul 18, 2025
ca0921a
Fix tests and initial recordings
olivertowers Jul 18, 2025
0315d65
Add recording
olivertowers Jul 19, 2025
6cfdcdf
Add readme/history and register ext service name.
olivertowers Jul 21, 2025
fc36793
Merge branch 'feature-mongocluster-cli' into feature-documentdb-cli
olivertowers Jul 22, 2025
c891682
Merge branch 'main' into feature-mongocluster-cli
olivertowers Jul 22, 2025
bc1fc9b
Follow extension versioning schema to start with initial preview vers…
olivertowers Jul 22, 2025
4f2d4ce
Merge branch 'feature-mongocluster-cli' of https://github.com/olivert…
olivertowers Jul 22, 2025
76fd9ad
Full directory move/rename to docdb
olivertowers Jul 22, 2025
ca19801
in file refactory to docdb
olivertowers Jul 22, 2025
b96c887
Re-generate from aaz
olivertowers Jul 22, 2025
b68b154
Renames
olivertowers Jul 22, 2025
d718de0
Fix class names to match DocDB and update documentation in customizat…
olivertowers Jul 22, 2025
774dbd9
Fix recordings
olivertowers Jul 22, 2025
a2d2ed1
Fix service name
olivertowers Jul 22, 2025
342fe9d
Redo recordings
olivertowers Jul 23, 2025
2d6cf89
Merge branch 'main' into feature-mongocluster-cli
olivertowers Sep 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/docdb/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. :changelog:

Release History
===============

1.0.0b1
++++++
* Initial preview version of the Document DB extension for Azure CLI for API version 2024-07-01.
* Adds commands to
* CRUD for clusters.
* CRUD for cluster firewall rules.
* Create, list and promote replica clusters.
* Point in time restore of a cluster.
49 changes: 49 additions & 0 deletions src/docdb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Azure CLI Database for Document DB Extension
This is an extension to Azure CLI to manage Database for Document DB resources.

This includes:
- Create/update cluster instances.
- Add/remove firewall rules to a cluster.
- Restoring cluster to a point in time from backups.
- Promoting a replica cluster to be a primary cluster.

## How to use

Install the extension with this command:

```bash
az extension add --name docdb
```

Use help `-h` to get a list of available commands:
```bash
az docdb cluster -h
```

And to get a description of a command and usage examples:
```bash
az docdb cluster <command> -h
```

### Create a new cluster

```bash
az docdb cluster create --resource-group TestResourceGroup --cluster-name myCluster \
--location westus2 --administrator-name myAdmin --administrator-password password231 \
--server-version 5.0 --storage-size-gb 128 --compute-tier M30 \
--shard-count 1 --high-availability-mode ZoneRedundantPreferred
```

### Create a replica cluster
```bash
az docdb cluster replica create --resource-group TestResourceGroup \
--cluster-name myCluster --location eastus2 --source-location westus3 \
--source-resource mySourceCluster
```

### Promote a replica cluster
```bash
az docdb cluster replica promote --resource-group TestGroup \
--cluster-name replicaCluster --promote-option Forced \
--promote-mode Switchover
```
42 changes: 42 additions & 0 deletions src/docdb/azext_docdb/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from azext_docdb._help import helps # pylint: disable=unused-import


class DocumentDbCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
custom_command_type = CliCommandType(
operations_tmpl='azext_docdb.custom#{}')
super().__init__(cli_ctx=cli_ctx,
custom_command_type=custom_command_type)

def load_command_table(self, args):
from azext_docdb.commands import load_command_table
from azure.cli.core.aaz import load_aaz_command_table
try:
from . import aaz
except ImportError:
aaz = None
if aaz:
load_aaz_command_table(
loader=self,
aaz_pkg_name=aaz.__name__,
args=args
)
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from azext_docdb._params import load_arguments
load_arguments(self, command)


COMMAND_LOADER_CLS = DocumentDbCommandsLoader
11 changes: 11 additions & 0 deletions src/docdb/azext_docdb/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: disable=line-too-long
# pylint: disable=too-many-lines

from knack.help_files import helps # pylint: disable=unused-import
13 changes: 13 additions & 0 deletions src/docdb/azext_docdb/_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: disable=too-many-lines
# pylint: disable=too-many-statements


def load_arguments(self, _): # pylint: disable=unused-argument
pass
6 changes: 6 additions & 0 deletions src/docdb/azext_docdb/aaz/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------
10 changes: 10 additions & 0 deletions src/docdb/azext_docdb/aaz/latest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

24 changes: 24 additions & 0 deletions src/docdb/azext_docdb/aaz/latest/docdb/__cmd_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"docdb",
is_preview=True,
)
class __CMDGroup(AAZCommandGroup):
"""Manage Azure Database for Document DB resources.
"""
pass


__all__ = ["__CMDGroup"]
11 changes: 11 additions & 0 deletions src/docdb/azext_docdb/aaz/latest/docdb/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
24 changes: 24 additions & 0 deletions src/docdb/azext_docdb/aaz/latest/docdb/cluster/__cmd_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"docdb cluster",
is_preview=True,
)
class __CMDGroup(AAZCommandGroup):
"""Manage Document DB cluster resources.
"""
pass


__all__ = ["__CMDGroup"]
19 changes: 19 additions & 0 deletions src/docdb/azext_docdb/aaz/latest/docdb/cluster/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
from ._check_name_availability import *
from ._create import *
from ._delete import *
from ._list import *
from ._list_connection_strings import *
from ._show import *
from ._update import *
from ._wait import *
Loading
Loading