Skip to content

Commit c676ce8

Browse files
authored
{portal} Migrate to AAZ (#8383)
* codegen * init module with aaz command * custom command, update test * fix custom command param register * fix custom command help message * remove unused code * fix style * update custom.py * update custom.py * update version
1 parent d667d26 commit c676ce8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2615
-2948
lines changed

src/portal/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
Release History
44
===============
55

6+
1.0.0b1
7+
++++++
8+
* Migrate to AAZ
9+
610
0.1.3
711
++++++
812
* [Fix] `az portal dashboard`: `--input-path` should accept other encoding types besides UTF-8 encoding.

src/portal/azext_portal/__init__.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,36 @@
44
# --------------------------------------------------------------------------------------------
55

66
from azure.cli.core import AzCommandsLoader
7-
from azext_portal.generated._help import helps # pylint: disable=unused-import
8-
try:
9-
from azext_portal.manual._help import helps # pylint: disable=reimported
10-
except ImportError:
11-
pass
127

138

149
class PortalCommandsLoader(AzCommandsLoader):
1510

1611
def __init__(self, cli_ctx=None):
1712
from azure.cli.core.commands import CliCommandType
18-
from .generated._client_factory import cf_portal
1913
portal_custom = CliCommandType(
20-
operations_tmpl='azext_portal.custom#{}',
21-
client_factory=cf_portal)
14+
operations_tmpl='azext_portal.custom#{}'
15+
)
2216
super(PortalCommandsLoader, self).__init__(cli_ctx=cli_ctx,
2317
custom_command_type=portal_custom)
2418

2519
def load_command_table(self, args):
26-
from .generated.commands import load_command_table
20+
from azext_portal.commands import load_command_table
21+
from azure.cli.core.aaz import load_aaz_command_table
22+
try:
23+
from . import aaz
24+
except ImportError:
25+
aaz = None
26+
if aaz:
27+
load_aaz_command_table(
28+
loader=self,
29+
aaz_pkg_name=aaz.__name__,
30+
args=args
31+
)
2732
load_command_table(self, args)
2833
return self.command_table
2934

3035
def load_arguments(self, command):
31-
from .generated._params import load_arguments
36+
from azext_portal._params import load_arguments
3237
load_arguments(self, command)
3338

3439

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
# Copyright (c) Microsoft Corporation. All rights reserved.
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# --------------------------------------------------------------------------------------------
5-
# pylint: disable=too-many-lines
65

7-
from knack.help_files import helps
6+
from knack.help_files import helps # pylint: disable=unused-import
87

9-
helps['portal'] = """
10-
type: group
11-
short-summary: Manage Portal
12-
"""
8+
# pylint: disable=line-too-long
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
# Copyright (c) Microsoft Corporation. All rights reserved.
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# --------------------------------------------------------------------------------------------
5-
# pylint: disable=wildcard-import
6-
# pylint: disable=unused-wildcard-import
75

8-
from .generated.action import * # noqa: F403
9-
try:
10-
from .manual.action import * # noqa: F403
11-
except ImportError:
6+
# pylint: disable=line-too-long
7+
8+
9+
def load_arguments(self, _): # pylint: disable=unused-argument
1210
pass
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# coding=utf-8
2-
# --------------------------------------------------------------------------
1+
# --------------------------------------------------------------------------------------------
32
# Copyright (c) Microsoft Corporation. All rights reserved.
43
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
6-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7-
# --------------------------------------------------------------------------
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
810

9-
from ._portal import Portal
10-
__all__ = ['Portal']

src/portal/azext_portal/generated/_client_factory.py renamed to src/portal/azext_portal/aaz/latest/portal/__cmd_group.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
# --------------------------------------------------------------------------------------------
22
# Copyright (c) Microsoft Corporation. All rights reserved.
33
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
46
# --------------------------------------------------------------------------------------------
57

8+
# pylint: skip-file
9+
# flake8: noqa
610

7-
def cf_portal(cli_ctx, *_):
8-
from azure.cli.core.commands.client_factory import get_mgmt_service_client
9-
from ..vendored_sdks.portal import Portal
10-
return get_mgmt_service_client(cli_ctx, Portal)
11+
from azure.cli.core.aaz import *
1112

1213

13-
def cf_dashboard(cli_ctx, *_):
14-
return cf_portal(cli_ctx).dashboard
14+
@register_command_group(
15+
"portal",
16+
)
17+
class __CMDGroup(AAZCommandGroup):
18+
"""Manage Portal.
19+
"""
20+
pass
21+
22+
23+
__all__ = ["__CMDGroup"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from .__cmd_group import *
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command_group(
15+
"portal dashboard",
16+
)
17+
class __CMDGroup(AAZCommandGroup):
18+
"""Manage portal dashboards.
19+
"""
20+
pass
21+
22+
23+
__all__ = ["__CMDGroup"]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from .__cmd_group import *
12+
from ._create import *
13+
from ._delete import *
14+
from ._list import *
15+
from ._show import *
16+
from ._update import *

0 commit comments

Comments
 (0)