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

Add new command az spring list-support-server-versions #6757

Merged
merged 8 commits into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions src/spring/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Release History
* Add new argument `--server-version` in `az spring app deploy` and `az spring app deployment create` to support WAR file deployment in Standard tier.
* Add argument `--enable-auto-sync` in `az spring certificate add`.
* Add new command `az spring certificate update` to update a certificate.
* Add new command `az spring list-support-server-versions` to list all supported server versions.

1.14.3
---
Expand Down
8 changes: 8 additions & 0 deletions src/spring/azext_spring/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
text: az spring list-marketplace-plan -o table
"""

helps['spring list-support-server-versions'] = """
type: command
short-summary: (Standard and Basic Tier Only) List supported server versions.
examples:
- name: List supported server versions.
text: az spring list-support-server-versions -o table
"""

helps['spring update'] = """
type: command
short-summary: Update an Azure Spring Apps.
Expand Down
14 changes: 14 additions & 0 deletions src/spring/azext_spring/_transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,3 +365,17 @@ def transform_apm_type_output(result):
item['Name'] = item['name']

return result if is_list else result[0]


def transform_support_server_versions_output(result):
is_list = isinstance(result, list)

if not is_list:
result = [result]

for item in result:
item['Value'] = item['value']
item['Server'] = item['server']
item['Version'] = item['version']

return result if is_list else result[0]
yilims marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 6 additions & 2 deletions src/spring/azext_spring/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
transform_build_result_output,
transform_apm_output,
transform_apm_type_output,
transform_container_registry_output)
transform_container_registry_output,
transform_support_server_versions_output)
from ._validators import validate_app_insights_command_not_supported_tier
from ._marketplace import (transform_marketplace_plan_output)
from ._validators_enterprise import (validate_gateway_update, validate_api_portal_update, validate_dev_tool_portal, validate_customized_accelerator, validate_central_build_instance)
from ._validators_enterprise import (validate_gateway_update, validate_api_portal_update, validate_dev_tool_portal, validate_customized_accelerator, validate_central_build_instance, not_support_enterprise)
from ._app_managed_identity_validator import (validate_app_identity_remove_or_warning,
validate_app_identity_assign_or_warning)

Expand Down Expand Up @@ -123,6 +124,9 @@ def load_command_table(self, _):
g.custom_command('list-marketplace-plan', 'spring_list_marketplace_plan',
is_preview=True,
table_transformer=transform_marketplace_plan_output)
g.custom_command('list-support-server-versions', 'spring_list_support_server_versions',
is_preview=True, validator=not_support_enterprise,
table_transformer=transform_support_server_versions_output)

with self.command_group('spring', client_factory=cf_spring,
exception_handler=handle_asc_exception) as g:
Expand Down
4 changes: 4 additions & 0 deletions src/spring/azext_spring/spring_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,7 @@ def _enable_app_insights(cmd, client, resource_group, name, location, app_insigh

def spring_list_marketplace_plan(cmd, client):
return _spring_list_marketplace_plan(cmd, client)


def spring_list_support_server_versions(cmd, client, resource_group, service):
return client.services.list_supported_server_versions(resource_group, service)