[documentdb] Add DocumentDB (Mongo vCore) CLI extension#10059
Draft
amatarritamicrosoft wants to merge 7 commits into
Draft
[documentdb] Add DocumentDB (Mongo vCore) CLI extension#10059amatarritamicrosoft wants to merge 7 commits into
amatarritamicrosoft wants to merge 7 commits into
Conversation
Add the initial �z documentdb mongocluster extension for the Microsoft.DocumentDB/mongoClusters resource (API 2026-06-01), generated with aaz-dev plus custom refinements: - Flatten cluster create/update inputs into first-class flags (--admin-user/--admin-password, --tier, --storage-size/--storage-type, --shard-count, --high-availability, --data-api-mode, --auth-allowed-modes); the five provisioning inputs are required on create. - Use --cluster-name for the parent on all sub-resources. - Restrict managed identity to UserAssigned (service rejects SystemAssigned). - user create/update: custom --type/-t flag over the identityProvider discriminated union, and repeatable --role db=x role=y (singular_options). - Drop private-endpoint-connection / private-link-resource in favor of the generic az network commands. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
Hi @amatarritamicrosoft, |
Collaborator
|
documentdb |
Add three hand-written custom commands over the AAZ-generated mongocluster surface: - `mongocluster reset-password`: friendly wrapper over update that exposes only --password and maps it to the administrator object (other update flags hidden). - `mongocluster replica create`: creates a cross-region GeoReplica from a source cluster (--source-cluster / --source-location); sets createMode + replicaParameters internally. - `mongocluster restore`: point-in-time restore into a new cluster (--source-cluster / --restore-time + admin credentials); sets createMode + restoreParameters + administrator internally. Since AAZ drops hide=True args from generated code, the create-variant wrappers inject createMode/replicaParameters/restoreParameters via a content override (set_const + set_prop) rather than hidden args. Irrelevant create/update flags are deregistered so each command stays focused. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
necusjz
reviewed
Jul 2, 2026
Comment on lines
+11
to
+13
| class DocumentdbScenario(ScenarioTest): | ||
| # TODO: add tests here | ||
| pass |
Member
There was a problem hiding this comment.
would mind add some real test cases?
necusjz
reviewed
Jul 2, 2026
Comment on lines
+4
to
+5
| ## How to use ## | ||
| Please add commands usage here. |
Address PR feedback: expand the extension README with background, a command-group table, and usage examples for clusters, firewall rules, users, identity, replicas, reset-password, and point-in-time restore. Flesh out the 1.0.0b1 HISTORY entry with the customer-visible command surface. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reset-password, replica-create, and restore wrappers subclass the generated Create/Update commands. AAZ caches the built arguments schema in the class attribute ``_arguments_schema`` (used by get_arguments_schema, the CLI parser entry point). Because the wrappers inherit that attribute from their base command, when the base command (create/update) loaded its schema first in the same process, the wrapper reused the base's cached schema and never applied its own option rename/deregistration -- e.g. ``reset-password`` failed with "unrecognized arguments: --password". Give each wrapper its own ``_arguments_schema = None`` (and ``_args_schema = None`` for the internal build cache) so every wrapper builds and caches an isolated schema. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a recorded ScenarioTest covering the full mongo cluster lifecycle: check-name-availability, create, show, list, update (tags), reset-password, firewall-rule create/show/list/delete, and delete. Every long-running operation uses --no-wait immediately followed by the matching wait command so each step observes a settled state and the scenario is free of state-condition races. Includes the recorded cassette for offline playback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Mark admin-user, admin-password, tier, storage-size, shard-count, and high-availability as required on `mongocluster create`, matching the AAZ command model. This gives a clear client-side error when a core provisioning input is omitted instead of a server-side 400. storage-type stays optional, and update keeps all of these optional so a single property can be changed in isolation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new Azure CLI extension
documentdbfor Azure Cosmos DB for MongoDB (vCore) — management-plane commands forMicrosoft.DocumentDB/mongoClusters(api-version2026-06-01).Generated with the AAZ codegen tool. Companion command-model PR in Azure/aaz: Azure/aaz#1040.
Command tree
az documentdb mongoclustercreate / update / show / delete / list / list-connection-strings / check-name-availability / waitaz documentdb mongocluster firewall-rulecreate / update / show / delete / list / waitaz documentdb mongocluster identityassign / remove / show / wait (UserAssigned only)az documentdb mongocluster replicalist / promoteaz documentdb mongocluster usercreate / update / show / delete / list / waitDesign notes
--admin-user/-u,--admin-password/-p,--tier,--storage-size,--storage-type,--shard-count,--high-availability,--data-api-mode,--auth-allowed-modes. Core provisioning args required on create, optional on update.user create/updateaccept a repeatable--role(singular option) and a custom--type/-tflag mapping to theidentityProviderdiscriminated union (custom.py).az networkper current guidance).documentdbentry added tosrc/service_name.json.Dependency (why this is a draft)
az documentdbis currently reserved/blocked inazure-clicore. This extension cannot be exercised until the core unblock ships in a releasedazure-cli:Marking ready for review once that lands.
Testing
--role,--type).aaz-dev command-model verify.This checklist is used to make sure that common guidelines for a pull request are followed.