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

{RDBMS} az postgres flexible-server create/update: change the error message for SKU name validator #30900

Merged
merged 3 commits into from
Mar 4, 2025
Merged
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
10 changes: 7 additions & 3 deletions src/azure-cli/azure/cli/command_modules/rdbms/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,14 +472,18 @@ def compare_sku_names(sku_1, sku_2):


def _pg_sku_name_validator(sku_name, sku_info, tier, instance):
additional_error = ''
if instance is not None:
tier = instance.sku.tier if tier is None else tier
else:
additional_error = 'When --tier is not specified, it defaults to GeneralPurpose. '
if sku_name:
skus = [item.lower() for item in get_postgres_skus(sku_info, tier.lower())]
if sku_name.lower() not in skus:
raise CLIError('Incorrect value for --sku-name. The SKU name does not match {} tier. '
'Specify --tier if you did not. Or CLI will set GeneralPurpose as the default tier. '
'Allowed values : {}'.format(tier, sorted(skus, key=cmp_to_key(compare_sku_names))))
raise CLIError('Incorrect value for --sku-name. The SKU name does not exist in {} tier. {}'
'Provide a valid SKU name for this tier, or specify --tier with the right tier for the '
'SKU name chosen. Allowed values : {}'
.format(tier, additional_error, sorted(skus, key=cmp_to_key(compare_sku_names))))


def _pg_storage_performance_tier_validator(performance_tier, sku_info, tier=None, storage_size=None):
Expand Down