@@ -261,11 +261,24 @@ def _flexible_server_params(command_group):
261261 arg_group = 'Authentication'
262262 )
263263
264+ database_name_create_arg_type = CLIArgumentType (
265+ metavar = 'NAME' ,
266+ options_list = ['--database-name' , '-d' ],
267+ id_part = 'child_name_1' ,
268+ help = 'The name of the database to be created when provisioning the database server. '
269+ 'Database name must begin with a letter (a-z) or underscore (_). Subsequent characters '
270+ 'in a name can be letters, digits (0-9), or underscores. Database name length must be less '
271+ 'than 32 characters.' ,
272+ local_context_attribute = LocalContextAttribute (
273+ name = 'database_name' ,
274+ actions = [LocalContextAction .SET ],
275+ scopes = ['{} flexible-server' .format (command_group )]))
276+
264277 database_name_arg_type = CLIArgumentType (
265278 metavar = 'NAME' ,
266279 options_list = ['--database-name' , '-d' ],
267280 id_part = 'child_name_1' ,
268- help = 'The name of the database to be created when provisioning the database server ' ,
281+ help = 'The name of the database' ,
269282 local_context_attribute = LocalContextAttribute (
270283 name = 'database_name' ,
271284 actions = [LocalContextAction .GET , LocalContextAction .SET ],
@@ -641,7 +654,7 @@ def _flexible_server_params(command_group):
641654 c .argument ('zone' , zone_arg_type )
642655 c .argument ('tags' , tags_type )
643656 c .argument ('standby_availability_zone' , arg_type = standby_availability_zone_arg_type )
644- c .argument ('database_name' , arg_type = database_name_arg_type )
657+ c .argument ('database_name' , arg_type = database_name_create_arg_type )
645658 c .argument ('yes' , arg_type = yes_arg_type )
646659
647660 with self .argument_context ('{} flexible-server list' .format (command_group )) as c :
@@ -824,6 +837,10 @@ def _flexible_server_params(command_group):
824837 argument_context_string = '{} flexible-server db {}' .format (command_group , scope )
825838 with self .argument_context (argument_context_string ) as c :
826839 c .argument ('server_name' , options_list = ['--server-name' , '-s' ], arg_type = server_name_arg_type )
840+
841+ for scope in ['delete' , 'list' , 'show' , 'update' ]:
842+ argument_context_string = '{} flexible-server db {}' .format (command_group , scope )
843+ with self .argument_context (argument_context_string ) as c :
827844 c .argument ('database_name' , arg_type = database_name_arg_type )
828845
829846 with self .argument_context ('{} flexible-server db list' .format (command_group )) as c :
@@ -832,6 +849,7 @@ def _flexible_server_params(command_group):
832849 with self .argument_context ('{} flexible-server db create' .format (command_group )) as c :
833850 c .argument ('charset' , help = 'The charset of the database. The default value is UTF8' )
834851 c .argument ('collation' , help = 'The collation of the database.' )
852+ c .argument ('database_name' , arg_type = database_name_create_arg_type )
835853
836854 with self .argument_context ('{} flexible-server db delete' .format (command_group )) as c :
837855 c .argument ('yes' , arg_type = yes_arg_type )
0 commit comments