Skip to content

Commit fa9e98d

Browse files
rchlkmdkmillerazclibot
authored
[SQL VM] az sql vm show: Add configuration options to --expand flag (#15156)
* {Docs} Remove stale reference in README to closed issue about extensions (#12771) * Added more sqlvm configuration options to --expand flag * style changes to comply with pylint and pep8 format * removed commments in HISTORY.rst * refactored expand params to use nargs=+ design pattern Co-authored-by: Daniel Miller <daniel.keegan.miller@gmail.com> Co-authored-by: Azure CLI Team <AzPyCLI@microsoft.com>
1 parent 9bc39ba commit fa9e98d

File tree

5 files changed

+1628
-1041
lines changed

5 files changed

+1628
-1041
lines changed

src/azure-cli/azure/cli/command_modules/sqlvm/_format.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ def transform_sqlvm_output(result):
6868
if result.auto_backup_settings is not None:
6969
output['autoBackupSettings'] = format_auto_backup_settings(result.auto_backup_settings)
7070
if result.server_configurations_management_settings is not None:
71-
output['serverConfigurationManagementSettings'] = format_server_configuration_management_settings(result.server_configurations_management_settings)
71+
output['serverConfigurationsManagementSettings'] = format_server_configuration_management_settings(result.server_configurations_management_settings)
72+
if result.key_vault_credential_settings is not None:
73+
output['keyVaultCredentialSettings'] = format_key_vault_credential_settings(result.key_vault_credential_settings)
7274

7375
return output
7476
except AttributeError:

src/azure-cli/azure/cli/command_modules/sqlvm/_params.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
validate_load_balancer,
3434
validate_public_ip_address,
3535
validate_subnet,
36-
validate_sqlmanagement
36+
validate_sqlmanagement,
37+
validate_expand
3738
)
3839

3940

@@ -158,8 +159,10 @@ def load_arguments(self, _):
158159
arg_type=get_location_type(self.cli_ctx),
159160
validator=get_default_location_from_resource_group)
160161
c.argument('expand',
161-
help='Get the SQLIaaSExtension configuration settings.',
162-
arg_type=get_enum_type(['*']))
162+
help='Get the SQLIaaSExtension configuration settings. To view all settings, use *. To select only a few, the settings must be space-separted.',
163+
nargs='+',
164+
validator=validate_expand,
165+
arg_type=get_enum_type(['*', 'AutoBackupSettings', 'AutoPatchingSettings', 'KeyVaultCredentialSettings', 'ServerConfigurationsManagementSettings']))
163166
c.argument('sql_management_mode',
164167
help='SQL Server management type. If NoAgent selected, please provide --image-sku and --offer-type.',
165168
options_list=['--sql-mgmt-type'],

src/azure-cli/azure/cli/command_modules/sqlvm/_validators.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,12 @@ def validate_sqlmanagement(namespace):
108108

109109
if (sql_mgmt_mode == "NoAgent" and (namespace.sql_image_sku is None or namespace.sql_image_offer is None)):
110110
raise CLIError("usage error: --sql-mgmt-type NoAgent --image-sku NAME --image-offer NAME")
111+
112+
113+
# pylint: disable=too-many-statements,line-too-long
114+
def validate_expand(namespace):
115+
'''
116+
Concatenates expand parameters
117+
'''
118+
if namespace.expand is not None:
119+
namespace.expand = ",".join(namespace.expand)

0 commit comments

Comments
 (0)