-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[MySQL] az mysql flexible-server maintenance
: New command group for managing maintenance of MySQL flexible server
#29505
Conversation
🔄AzureCLI-FullTest
|
Hi @Xiaoy666, |
|
rule | cmd_name | rule_message | suggest_message |
---|---|---|---|
mysql flexible-server maintenance | sub group mysql flexible-server maintenance added |
MySQL |
@microsoft-github-policy-service agree company="Microsoft" |
az mysql flexible-server maintenance
command group for managing maintenance of MySQL flexible serveraz mysql flexible-server maintenance
: New command group for managing maintenance of MySQL flexible server
with self.argument_context('mysql flexible-server maintenance reschedule') as c: | ||
c.argument('resource_group_name', arg_type=resource_group_name_type, help='Resource Group Name of the server.') | ||
c.argument('server_name', options_list=['--server-name', '-s'], help='The name of the server.') | ||
c.argument('maintenance_name', options_list=['--maintenance-name', '-m'], help='The name of the maintenance.') |
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.
Is this enumeration?
c.argument('resource_group_name', arg_type=resource_group_name_type, help='Resource Group Name of the server.') | ||
c.argument('server_name', options_list=['--server-name', '-s'], help='The name of the server.') | ||
c.argument('maintenance_name', options_list=['--maintenance-name', '-m'], help='The name of the maintenance.') | ||
c.argument('maintenance_start_time', arg_type=maintenance_reschedule_time_arg_type, help='The new start time of the rescheduled maintenance.') |
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.
We may need add validator for date format. If cannot add here, please add to custom.py
@@ -588,6 +595,21 @@ def load_arguments(self, _): # pylint: disable=too-many-statements, too-many- | |||
with self.argument_context('mysql flexible-server identity show') as c: | |||
c.argument('identity', options_list=['--identity', '-n'], help='Name or ID of identity to show.', validator=validate_identity) | |||
|
|||
with self.argument_context('mysql flexible-server maintenance reschedule') as c: | |||
c.argument('resource_group_name', arg_type=resource_group_name_type, help='Resource Group Name of the server.') | |||
c.argument('server_name', options_list=['--server-name', '-s'], help='The name of the server.') |
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.
If we don't need to check other attributes for server besides existence, I think we can skip server name validate here and make sure backend will check.
def flexible_server_maintenance_list(client, resource_group_name, server_name): | ||
return client.list(resource_group_name=resource_group_name, server_name=server_name) | ||
|
||
|
||
def flexible_server_maintenance_show(client, resource_group_name, server_name, maintenance_name): | ||
return client.read(resource_group_name=resource_group_name, server_name=server_name, maintenance_name=maintenance_name) |
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.
If there's no custom logic, you don't need to define custom_command
with custom func, just use command
to call SDK function directly
Related command
az mysql flexible-server maintenance show
az mysql flexible-server maintenance list
az mysql flexible-server maintenance reschedule
Description
Add az command group 'az mysql flexible-server maintenance' which contains above three az commands. These commands will support customers to manage their maintenance on Azure MySQL flexible servers.
Testing Guide
az mysql flexible-server maintenance show --resource-group testgroup --server-name testserver --maintenance-name _T9Q-TS8
explanation: Get a maintenance of mysql flexible server 'testserver' under resource group 'testgroup', with maintenance name '_T9Q-TS8'
az mysql flexible-server maintenance list --resource-group testgroup --server-name testserver
explanation: List all of the maintenances of mysql flexible server 'testserver' under resource group 'testgroup'.
az mysql flexible-server maintenance reschedule --resource-group testgroup --server-name testserver --maintenance-name _T9Q-TS8 --start-time 2024-06-01T09:00:00Z
explanation: reschedule an existing maintenance '_T9Q-TS8' of the server 'testserver' under resource gruop 'testgroup' to a new start time 'UTC 20240601