Skip to content
Closed
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.11.0"
}
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__)
26 changes: 20 additions & 6 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)
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).dashboard


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


def cf_list_tenant_configuration_violation(cli_ctx, *_):
return cf_portal_cl(cli_ctx).list_tenant_configuration_violation
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: portal dashboard
"""

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: portal tenant-configuration
"""

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: portal list-tenant-configuration-violation
"""

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
"""
76 changes: 40 additions & 36 deletions src/portal/azext_portal/generated/_params.py
Original file line number Diff line number Diff line change
@@ -1,61 +1,65 @@
# --------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------
# 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
# pylint: disable=too-many-statements

from argcomplete.completers import FilesCompleter
from azure.cli.core.commands.parameters import (
tags_type,
get_three_state_flag,
resource_group_name_type,
get_location_type,
file_type
get_location_type
)
from azure.cli.core.commands.validators import (
get_default_location_from_resource_group,
validate_file_or_dict
)
from azure.cli.core.commands.validators import get_default_location_from_resource_group


def load_arguments(self, _):

with self.argument_context('portal dashboard list') as c:
c.argument('resource_group_name', resource_group_name_type,
help='The name of the resource group.')
c.argument('resource_group_name', resource_group_name_type)

with self.argument_context('portal dashboard show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('name', options_list=[
'--name', '-n'], help='The name of the dashboard.')
c.argument('dashboard_name', options_list=['--name', '-n', '--dashboard-name'], type=str, help='The name of '
'the dashboard.', id_part='name')

with self.argument_context('portal dashboard create') as c:
c.argument('resource_group_name', resource_group_name_type,
help='The name of the resource group.')
c.argument('name', options_list=[
'--name', '-n'], help='The name of the dashboard.')
c.argument('resource_group_name', resource_group_name_type)
c.argument('dashboard_name', options_list=['--name', '-n', '--dashboard-name'], type=str, help='The name of '
'the dashboard.')
c.argument('location', arg_type=get_location_type(self.cli_ctx),
validator=get_default_location_from_resource_group)
c.argument('tags', tags_type)
c.argument('input_path', type=file_type,
help='The path to the dashboard properties JSON file.', completer=FilesCompleter())
c.argument('lenses', type=validate_file_or_dict, help='The dashboard lenses. Expected value: '
'json-string/@json-file.')
c.argument('metadata', type=validate_file_or_dict, help='The dashboard metadata. Expected value: '
'json-string/@json-file.')

with self.argument_context('portal dashboard update') as c:
c.argument('resource_group_name', resource_group_name_type,
help='The name of the resource group.')
c.argument('name', options_list=[
'--name', '-n'], help='The name of the dashboard.')
c.argument('input_path', type=file_type,
help='The path to the dashboard properties JSON file.', completer=FilesCompleter())
c.argument('resource_group_name', resource_group_name_type)
c.argument('dashboard_name', options_list=['--name', '-n', '--dashboard-name'], type=str, help='The name of '
'the dashboard.', id_part='name')
c.argument('tags', tags_type)
c.argument('lenses', type=validate_file_or_dict, help='The dashboard lenses. Expected value: '
'json-string/@json-file.')
c.argument('metadata', type=validate_file_or_dict, help='The dashboard metadata. Expected value: '
'json-string/@json-file.')

with self.argument_context('portal dashboard delete') as c:
c.argument('resource_group_name', resource_group_name_type,
help='The name of the resource group.')
c.argument('name', options_list=[
'--name', '-n'], help='The name of the dashboard.')

with self.argument_context('portal dashboard import') as c:
c.argument('resource_group_name', resource_group_name_type,
help='The name of the resource group.')
c.argument('name', options_list=[
'--name', '-n'], help='The name of the dashboard.')
c.argument('input_path', type=file_type,
help='The path to the dashboard json file.', completer=FilesCompleter())
c.argument('resource_group_name', resource_group_name_type)
c.argument('dashboard_name', options_list=['--name', '-n', '--dashboard-name'], type=str, help='The name of '
'the dashboard.', id_part='name')

with self.argument_context('portal tenant-configuration create') as c:
c.argument('enforce_private_markdown_storage', arg_type=get_three_state_flag(), help='When flag is set to true '
'Markdown tile will require external storage configuration (URI). The inline content configuration '
'will be prohibited.')
Loading