Skip to content

Commit

Permalink
{portal} Migrate to AAZ (#8383)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
cxznmhdcxz authored Feb 14, 2025
1 parent d667d26 commit c676ce8
Show file tree
Hide file tree
Showing 46 changed files with 2,615 additions and 2,948 deletions.
4 changes: 4 additions & 0 deletions src/portal/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

1.0.0b1
++++++
* Migrate to AAZ

0.1.3
++++++
* [Fix] `az portal dashboard`: `--input-path` should accept other encoding types besides UTF-8 encoding.
Expand Down
25 changes: 15 additions & 10 deletions src/portal/azext_portal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,36 @@
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from azext_portal.generated._help import helps # pylint: disable=unused-import
try:
from azext_portal.manual._help import helps # pylint: disable=reimported
except ImportError:
pass


class PortalCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from .generated._client_factory import cf_portal
portal_custom = CliCommandType(
operations_tmpl='azext_portal.custom#{}',
client_factory=cf_portal)
operations_tmpl='azext_portal.custom#{}'
)
super(PortalCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=portal_custom)

def load_command_table(self, args):
from .generated.commands import load_command_table
from azext_portal.commands import load_command_table
from azure.cli.core.aaz import load_aaz_command_table
try:
from . import aaz
except ImportError:
aaz = None
if aaz:
load_aaz_command_table(
loader=self,
aaz_pkg_name=aaz.__name__,
args=args
)
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from .generated._params import load_arguments
from azext_portal._params import load_arguments
load_arguments(self, command)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=too-many-lines

from knack.help_files import helps
from knack.help_files import helps # pylint: disable=unused-import

helps['portal'] = """
type: group
short-summary: Manage Portal
"""
# pylint: disable=line-too-long
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError:
# pylint: disable=line-too-long


def load_arguments(self, _): # pylint: disable=unused-argument
pass
6 changes: 6 additions & 0 deletions src/portal/azext_portal/aaz/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from ._portal import Portal
__all__ = ['Portal']
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

def cf_portal(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.portal import Portal
return get_mgmt_service_client(cli_ctx, Portal)
from azure.cli.core.aaz import *


def cf_dashboard(cli_ctx, *_):
return cf_portal(cli_ctx).dashboard
@register_command_group(
"portal",
)
class __CMDGroup(AAZCommandGroup):
"""Manage Portal.
"""
pass


__all__ = ["__CMDGroup"]
11 changes: 11 additions & 0 deletions src/portal/azext_portal/aaz/latest/portal/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
23 changes: 23 additions & 0 deletions src/portal/azext_portal/aaz/latest/portal/dashboard/__cmd_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"portal dashboard",
)
class __CMDGroup(AAZCommandGroup):
"""Manage portal dashboards.
"""
pass


__all__ = ["__CMDGroup"]
16 changes: 16 additions & 0 deletions src/portal/azext_portal/aaz/latest/portal/dashboard/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
from ._create import *
from ._delete import *
from ._list import *
from ._show import *
from ._update import *
Loading

0 comments on commit c676ce8

Please sign in to comment.