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

[AutoPR portal] New apis #1532

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/portal/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
Release History
===============

0.1.1
0.1.0
++++++
* Initial release.
39 changes: 29 additions & 10 deletions src/portal/azext_portal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,50 @@
# --------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from .generated._help import helps # pylint: disable=unused-import
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
from azext_portal.generated._client_factory import cf_portal_cl
portal_custom = CliCommandType(
operations_tmpl='azext_portal.custom#{}',
client_factory=cf_portal)
super(PortalCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=portal_custom)
client_factory=cf_portal_cl)
parent = super(PortalCommandsLoader, self)
parent.__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.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_portal.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError:
pass
return self.command_table

def load_arguments(self, command):
from .generated._params import load_arguments
from azext_portal.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_portal.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass


COMMAND_LOADER_CLS = PortalCommandsLoader
11 changes: 8 additions & 3 deletions src/portal/azext_portal/action.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# --------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

Expand Down
2 changes: 1 addition & 1 deletion src/portal/azext_portal/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.3.1"
"azext.minCliCoreVersion": "2.15.0"
}
12 changes: 0 additions & 12 deletions src/portal/azext_portal/commands.py

This file was deleted.

11 changes: 8 additions & 3 deletions src/portal/azext_portal/custom.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# --------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

Expand Down
2 changes: 2 additions & 0 deletions src/portal/azext_portal/generated/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
28 changes: 21 additions & 7 deletions src/portal/azext_portal/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
# --------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------


def cf_portal(cli_ctx, *_):
def cf_portal_cl(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 azext_portal.vendored_sdks.portal import Portal
return get_mgmt_service_client(cli_ctx,
Portal)


def cf_dashboard(cli_ctx, *_):
return cf_portal(cli_ctx).dashboard
return cf_portal_cl(cli_ctx).dashboards


def cf_tenant_configuration(cli_ctx, *_):
return cf_portal_cl(cli_ctx).tenant_configurations


def cf_list_tenant_configuration_violation(cli_ctx, *_):
return cf_portal_cl(cli_ctx).list_tenant_configuration_violations
96 changes: 74 additions & 22 deletions src/portal/azext_portal/generated/_help.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
# --------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long
# 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.
# --------------------------------------------------------------------------
# pylint: disable=too-many-lines

from knack.help_files import helps


helps['portal dashboard'] = """
type: group
short-summary: Manage portal dashboards
short-summary: Manage dashboard with portal
"""

helps['portal dashboard list'] = """
type: command
short-summary: Lists the dashboards within a subscription or resource group.
short-summary: "Gets all the Dashboards within a resource group. And Gets all the dashboards within a \
subscription."
examples:
- name: List all dashboards in a resourceGroup
- name: List all custom resource providers on the resourceGroup
text: |-
az portal dashboard list --resource-group "testRG"
- name: List all dashboards in a subscription
- name: List all custom resource providers on the subscription
text: |-
az portal dashboard list
"""

helps['portal dashboard show'] = """
type: command
short-summary: Gets details for a single dashboard.
short-summary: "Gets the Dashboard."
examples:
- name: Get a Dashboard
text: |-
Expand All @@ -36,40 +41,87 @@

helps['portal dashboard create'] = """
type: command
short-summary: Creates or updates a dashboard.
short-summary: "Create a Dashboard."
examples:
- name: Create or update a Dashboard
text: |-
az portal dashboard create --location "eastus" --name "testDashboard" \\
--resource-group "testRG" --input-path "/src/json/properties.json" \\
--tags aKey=aValue anotherKey=anotherValue
az portal dashboard create --location "eastus" --lenses "[{\\"order\\":1,\\"parts\\":[{\\"position\\":{\
\\"colSpan\\":3,\\"rowSpan\\":4,\\"x\\":1,\\"y\\":2}},{\\"position\\":{\\"colSpan\\":6,\\"rowSpan\\":6,\\"x\\":5,\\"y\\\
":5}}]},{\\"order\\":2,\\"parts\\":[]}]" --metadata "{\\"metadata\\":{\\"ColSpan\\":2,\\"RowSpan\\":1,\\"X\\":4,\\"Y\\"\
:3}}" --tags aKey="aValue" anotherKey="anotherValue" --name "testDashboard" --resource-group "testRG"
"""

helps['portal dashboard update'] = """
type: command
short-summary: Updates an existing dashboard.
short-summary: "Updates an existing Dashboard."
examples:
- name: Update a Dashboard
text: |-
az portal dashboard update --name "testDashboard" --resource-group "testRG" \\
--input-path "/src/json/properties.json"
az portal dashboard update --tags aKey="bValue" anotherKey="anotherValue2" --name "testDashboard" \
--resource-group "testRG"
"""

helps['portal dashboard delete'] = """
type: command
short-summary: Deletes a dashboard.
short-summary: "Deletes the Dashboard."
examples:
- name: Delete a Dashboard
text: |-
az portal dashboard delete --name "testDashboard" --resource-group "testRG"
"""

helps['portal dashboard import'] = """
helps['portal tenant-configuration'] = """
type: group
short-summary: Manage tenant configuration with portal
"""

helps['portal tenant-configuration list'] = """
type: command
short-summary: "Gets list of the tenant configurations."
examples:
- name: Get list of Tenant configurations
text: |-
az portal tenant-configuration list
"""

helps['portal tenant-configuration show'] = """
type: command
short-summary: "Gets the tenant configuration."
examples:
- name: Get Tenant configuration
text: |-
az portal tenant-configuration show
"""

helps['portal tenant-configuration create'] = """
type: command
short-summary: "Create the tenant configuration. If configuration already exists - update it. User has to be a \
Tenant Admin for this operation."
examples:
- name: Create or update Tenant configuration
text: |-
az portal tenant-configuration create --enforce-private-markdown-storage true
"""

helps['portal tenant-configuration delete'] = """
type: command
short-summary: "Delete the tenant configuration. User has to be a Tenant Admin for this operation."
examples:
- name: Delete Tenant configuration
text: |-
az portal tenant-configuration delete
"""

helps['portal list-tenant-configuration-violation'] = """
type: group
short-summary: Manage list tenant configuration violation with portal
"""

helps['portal list-tenant-configuration-violation list'] = """
type: command
short-summary: Imports a dashboard from a JSON file.
short-summary: "Gets list of items that violate tenant's configuration."
examples:
- name: Import a Dashboard
- name: Get list of of items that violate tenant's configuration
text: |-
az portal dashboard import --name "testDashboard" --resource-group "testRG" \\
--input-path "/src/json/dashboard.json"
az portal list-tenant-configuration-violation list
"""
Loading