Skip to content
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

{SQL VM} Update Python SDK to 1.0.0b3 #23035

Merged
merged 8 commits into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/azure-cli/azure/cli/command_modules/sqlvm/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
DayOfWeek,
SqlVmGroupImageSku,
SqlImageSku,
SqlManagementMode
SqlManagementMode,
AssessmentDayOfWeek
)

from azure.cli.core.commands.parameters import (
Expand Down Expand Up @@ -161,7 +162,7 @@ def load_arguments(self, _):
arg_type=get_location_type(self.cli_ctx),
validator=get_default_location_from_resource_group)
c.argument('expand',
help='Get the SQLIaaSExtension configuration settings. To view all settings, use *. To select only a few, the settings must be space-separted.',
help='Get the SQLIaaSExtension configuration settings. To view all settings, use *. To select only a few, the settings must be space-separated.',
nargs='+',
validator=validate_expand,
arg_type=get_enum_type(['*', 'AssessmentSettings', 'AutoBackupSettings', 'AutoPatchingSettings', 'KeyVaultCredentialSettings', 'ServerConfigurationsManagementSettings']))
Expand Down Expand Up @@ -336,12 +337,12 @@ def load_arguments(self, _):
arg_type=get_enum_type(['1', '2', '3', '4', '5', '6']))
c.argument('assessment_monthly_occurrence',
options_list=['--assessment-monthly-occurrence', '--am-month-occ'],
help='Occurence of the DayOfWeek day within a month to schedule assessment. Supports values 1,2,3,4 and -1. Use -1 for last DayOfWeek day of the month (for example - last Tuesday of the month).',
help='Occurrence of the DayOfWeek day within a month to schedule assessment. Supports values 1,2,3,4 and -1. Use -1 for last DayOfWeek day of the month (for example - last Tuesday of the month).',
arg_type=get_enum_type(['1', '2', '3', '4', '-1']))
c.argument('assessment_day_of_week',
options_list=['--assessment-day-of-week', '--am-day'],
help='Day of the week to run assessment.',
arg_type=get_enum_type(DayOfWeek))
arg_type=get_enum_type(AssessmentDayOfWeek))
c.argument('assessment_start_time_local',
options_list=['--assessment-start-time-local', '--am-time'],
help='Time of the day in HH:mm format. Examples include 17:30, 05:13.',
Expand Down
8 changes: 4 additions & 4 deletions src/azure-cli/azure/cli/command_modules/sqlvm/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,14 +510,14 @@ def set_assessment_properties(cmd, instance, enable_assessment, enable_assessmen
# In case workspace arguments provided by customer, verify they match with workspace associated with VM
if workspace_name is None:
workspace_name = workspace_name_found
elif workspace_name != workspace_name_found:
raise InvalidArgumentValueError(f"VM is already associated with worksapce '{workspace.id}'. "
elif workspace_name.lower() != workspace_name_found.lower():
raise InvalidArgumentValueError(f"VM is already associated with workspace '{workspace.id}'. "
"Skip workspace arguments to continue with associated workspace or dissociate workspace using Azure Portal first.")

if workspace_rg is None:
workspace_rg = workspace_rg_found
elif workspace_rg != workspace_rg_found:
raise InvalidArgumentValueError(f"VM is already associated with worksapce {workspace.id}. "
elif workspace_rg.lower() != workspace_rg_found.lower():
raise InvalidArgumentValueError(f"VM is already associated with workspace {workspace.id}. "
"Skip workspace arguments to continue with associated workspace or dissociate workspace from Azure Portal.")

# Validate custom log definition on workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import string
from azure.cli.core.azclierror import (
RequiredArgumentMissingError
)
Expand All @@ -20,7 +21,6 @@
from azure.cli.testsdk.preparers import (
AbstractPreparer,
SingleValueReplacer)
from time import sleep


# Constants
Expand Down Expand Up @@ -65,8 +65,6 @@ def _get_resource_group(self, **kwargs):


class DomainPreparer(AbstractPreparer, SingleValueReplacer):
import string

def __init__(self, name_prefix=sqlvm_domain_prefix, location='westus',
vm_user='admin123', vm_password='SecretPassword123', parameter_name='domainvm',
resource_group_parameter_name='resource_group', skip_delete=True):
Expand All @@ -79,8 +77,11 @@ def __init__(self, name_prefix=sqlvm_domain_prefix, location='westus',
self.skip_delete = skip_delete

def id_generator(self, size=6, chars=string.ascii_lowercase + string.digits):
'''
dns name must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$.'}
'''
import random
return ''.join(random.choice(chars) for _ in range(size))
return random.choice(string.ascii_lowercase) + ''.join(random.choice(chars) for _ in range(size))

def create_resource(self, name, **kwargs):
group = self._get_resource_group(**kwargs)
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/requirements.py3.Darwin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ azure-mgmt-servicefabricmanagedclusters==1.0.0
azure-mgmt-servicelinker==1.0.0
azure-mgmt-signalr==1.0.0b2
azure-mgmt-sql==4.0.0b2
azure-mgmt-sqlvirtualmachine==1.0.0b2
azure-mgmt-sqlvirtualmachine==1.0.0b3
azure-mgmt-storage==20.0.0
azure-mgmt-synapse==2.1.0b2
azure-mgmt-trafficmanager==1.0.0
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/requirements.py3.Linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ azure-mgmt-servicefabricmanagedclusters==1.0.0
azure-mgmt-servicelinker==1.0.0
azure-mgmt-signalr==1.0.0b2
azure-mgmt-sql==4.0.0b2
azure-mgmt-sqlvirtualmachine==1.0.0b2
azure-mgmt-sqlvirtualmachine==1.0.0b3
azure-mgmt-storage==20.0.0
azure-mgmt-synapse==2.1.0b2
azure-mgmt-trafficmanager==1.0.0
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/requirements.py3.windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ azure-mgmt-servicefabricmanagedclusters==1.0.0
azure-mgmt-servicelinker==1.0.0
azure-mgmt-signalr==1.0.0b2
azure-mgmt-sql==4.0.0b2
azure-mgmt-sqlvirtualmachine==1.0.0b2
azure-mgmt-sqlvirtualmachine==1.0.0b3
azure-mgmt-storage==20.0.0
azure-mgmt-synapse==2.1.0b2
azure-mgmt-trafficmanager==1.0.0
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
'azure-mgmt-servicelinker==1.0.0',
'azure-mgmt-servicefabric~=1.0.0',
'azure-mgmt-signalr==1.0.0b2',
'azure-mgmt-sqlvirtualmachine==1.0.0b2',
'azure-mgmt-sqlvirtualmachine==1.0.0b3',
'azure-mgmt-sql==4.0.0b2',
'azure-mgmt-storage~=20.0.0',
'azure-mgmt-synapse==2.1.0b2',
Expand Down