Skip to content

Commit d1822f8

Browse files
author
shahkhushi_microsoft
committed
tranform output
1 parent 1a857b5 commit d1822f8

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/containerapp/azext_containerapp/_transformers.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,3 +300,18 @@ def transform_function_keys_list(result):
300300
return table
301301

302302
return []
303+
304+
305+
def transform_containerapp_list_output_with_kind(apps):
306+
"""Transform containerapp list output to include the 'kind' field."""
307+
result = []
308+
for app in apps:
309+
props = ['name', 'location', 'resourceGroup', 'provisioningState']
310+
item = {k: app[k] for k in app if k in props}
311+
item['kind'] = app.get('kind', None)
312+
try:
313+
item['fqdn'] = app['properties']['configuration']['ingress']['fqdn']
314+
except: # pylint: disable=bare-except
315+
item['fqdn'] = None
316+
result.append(item)
317+
return result

src/containerapp/azext_containerapp/commands.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
# pylint: disable=line-too-long, too-many-statements, bare-except
77
# from azure.cli.core.commands import CliCommandType
88
# from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id
9-
from azure.cli.command_modules.containerapp._transformers import (transform_containerapp_output, transform_containerapp_list_output)
9+
from azure.cli.command_modules.containerapp._transformers import transform_containerapp_output
1010
from azext_containerapp._client_factory import ex_handler_factory
1111
from ._transformers import (transform_sensitive_values,
12+
transform_containerapp_list_output_with_kind,
1213
transform_telemetry_data_dog_values,
1314
transform_telemetry_app_insights_values,
1415
transform_telemetry_otlp_values,
@@ -25,7 +26,7 @@
2526
def load_command_table(self, args):
2627
with self.command_group('containerapp') as g:
2728
g.custom_show_command('show', 'show_containerapp', table_transformer=transform_containerapp_output)
28-
g.custom_command('list', 'list_containerapp', table_transformer=transform_containerapp_list_output)
29+
g.custom_command('list', 'list_containerapp', table_transformer=transform_containerapp_list_output_with_kind)
2930
g.custom_command('create', 'create_containerapp', supports_no_wait=True, exception_handler=ex_handler_factory(), table_transformer=transform_containerapp_output, transform=transform_sensitive_values)
3031
g.custom_command('update', 'update_containerapp', supports_no_wait=True, exception_handler=ex_handler_factory(), table_transformer=transform_containerapp_output, transform=transform_sensitive_values)
3132
g.custom_command('delete', 'delete_containerapp', supports_no_wait=True, confirmation=True, exception_handler=ex_handler_factory())

0 commit comments

Comments
 (0)