[MySQL Flexible Server] Add --maintenance-batch to flexible-server update#33768
[MySQL Flexible Server] Add --maintenance-batch to flexible-server update#33768aalishapatro23 wants to merge 4 commits into
Conversation
…et/preserve custom maintenance window batch Adds an optional --maintenance-batch parameter (Default/Batch1/Batch2) to az mysql flexible-server update. When omitted, the existing batchOfMaintenance is preserved; when the maintenance window is disabled the batch is cleared. Wires the SDK MaintenanceWindow.batch_of_maintenance field (already present in azure-mgmt-mysqlflexibleservers 1.1.0b2) through the CLI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f9c96871-4d63-4a60-9622-70bfffb3cc7a
Adds test_mysql_flexible_server_maintenance_batch_mgmt covering: setting the batch on a custom maintenance window, preserving the existing batch when updating the window only, changing the batch explicitly, and the two guardrail error cases. Recording (.yaml) still to be generated live. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f9c96871-4d63-4a60-9622-70bfffb3cc7a
Adds the live recording for test_mysql_flexible_server_maintenance_batch_mgmt so it replays in CI playback. Verified passing in both live (460s) and playback (16s) runs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f9c96871-4d63-4a60-9622-70bfffb3cc7a
|
Hi @aalishapatro23, |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thank you for your contribution @aalishapatro23! We will review the pull request and get back to you soon. |
|
@microsoft-github-policy-service agree company="Microsoft" |
There was a problem hiding this comment.
Pull request overview
Adds support in the MySQL command module for setting a Flexible Server custom-managed maintenance window “batch” via a new optional --maintenance-batch parameter on az mysql flexible-server update, aligning CLI capabilities with the already-supported SDK/RP property.
Changes:
- Add
--maintenance-batchparameter (Default/Batch1/Batch2) toaz mysql flexible-server updateand wire it into the update implementation with guardrails. - Add a new scenario test covering setting/preserving/changing the maintenance batch and invalid parameter combinations.
- Update command help and release notes to document the new parameter.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/azure-cli/HISTORY.rst |
Adds release note entry for the new --maintenance-batch parameter. |
src/azure-cli/azure/cli/command_modules/mysql/tests/latest/test_mysql_scenario.py |
Adds a new scenario test for maintenance batch behavior and guardrails. |
src/azure-cli/azure/cli/command_modules/mysql/custom.py |
Implements maintenance_batch handling in the flexible server update custom function. |
src/azure-cli/azure/cli/command_modules/mysql/_params.py |
Introduces the --maintenance-batch CLI argument with enum validation. |
src/azure-cli/azure/cli/command_modules/mysql/_help.py |
Adds a help example demonstrating --maintenance-batch. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # guardrail: --maintenance-batch cannot be combined with disabling the window | ||
| self.cmd('{} flexible-server update -g {} -n {} --maintenance-window "Disabled" --maintenance-batch Batch2' | ||
| .format(database_engine, resource_group, server_name), expect_failure=True) | ||
|
|
||
| self.cmd('{} flexible-server delete -g {} -n {} --yes' | ||
| .format(database_engine, resource_group, server_name)) |
There was a problem hiding this comment.
Keeping the scenario focused on the new --maintenance-batch parameter and its guardrails. The disable path just clears the field via a thin SDK passthrough, and asserting the exact server-returned value after disable would require verifying RP behavior
|
mysql |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
| * `az keyvault key create`: Add `--external-key-id` to create EKM-backed external keys on Managed HSM (Preview) (#33651) | ||
|
|
||
| **MySQL** | ||
|
|
There was a problem hiding this comment.
Please remove the change in HOSTORY.rst, as will be generated together before release
There was a problem hiding this comment.
Done — removed the HISTORY.rst change . Thanks!
…ase) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Related command
az mysql flexible-server updateDescription
Adds a new optional
--maintenance-batchparameter toaz mysql flexible-server update, allowing customers to set the batch (Default,Batch1,Batch2) of a custom-managed maintenance window.Previously the CLI could set the maintenance window's day/time (
--maintenance-window) but had no way to controlbatchOfMaintenance, even though the RP and the pinned SDK (azure-mgmt-mysqlflexibleservers==1.1.0b2) already support it viaMaintenanceWindow.batch_of_maintenance. Customers who wanted a specific batch had no CLI path (surfaced by a customer case where the batch could not be set/preserved through the CLI).Behavior:
--maintenance-batchis honored only alongside an enabled--maintenance-window. Used alone (or with--maintenance-window Disabled) it raises a clear error.--maintenance-batchis omitted, the server's existing batch is preserved — the request body is unchanged from today, so existing scripts are unaffected.This is a CLI-only passthrough change. No SDK bump, no OpenAPI/RP change. It is non-breaking — verified via
azdev command-change meta-diff(only an added optional parameter, zero breaking changes).Testing Guide
Set a custom maintenance window with a specific batch
az mysql flexible-server update -g testGroup -n testserver
--maintenance-window "Fri:13:00" --maintenance-batch Batch2
Update only the window; the existing batch is preserved (omit --maintenance-batch)
az mysql flexible-server update -g testGroup -n testserver
--maintenance-window "Sat:14:00"
Guardrails (both error out):
az mysql flexible-server update -g testGroup -n testserver --maintenance-batch Batch1
az mysql flexible-server update -g testGroup -n testserver
--maintenance-window Disabled --maintenance-batch Batch1
Validation performed:
azdev style mysql,azdev linter mysql— passazdev test mysql— existing tests pass (26 passed / 5 skipped)test_mysql_flexible_server_maintenance_batch_mgmt— live recording + playback pass; recording includedazdev command-change meta-diff— no breaking changesBatch1, then preserved after a window-only updateHistory Notes
[MySQL Flexible Server]
az mysql flexible-server update: Add--maintenance-batchto set the batch (Default, Batch1, Batch2) of the custom-managed maintenance window; existing batch is preserved when omitted[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.
🤖 PR Validation —⚠️ Review suggested