Skip to content

Commit

Permalink
Update from master
Browse files Browse the repository at this point in the history
  • Loading branch information
SDK Automation committed Aug 13, 2020
1 parent 58e3e4b commit eb905d1
Show file tree
Hide file tree
Showing 41 changed files with 1,088 additions and 1,818 deletions.
16 changes: 8 additions & 8 deletions src/portal/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. :changelog:
Release History
===============

0.1.1
++++++
* Initial release.
.. :changelog:
Release History
===============

0.1.0
++++++
* Initial release.
85 changes: 5 additions & 80 deletions src/portal/README.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,5 @@
Microsoft Azure CLI 'portal' Extension
==========================================

This package is for the 'portal' extension. i.e. 'az portal'
More info on what is [Azure portal](https://docs.microsoft.com/en-us/azure/azure-portal/azure-portal-overview).

### How to use ###
Install this extension using the below CLI command
```
az extension add --name portal
```

### Included Features ###
Manage Azure portal dashboards: [more info](https://docs.microsoft.com/en-us/azure/azure-portal/azure-portal-dashboards-create-programmatically#fetch-the-json-representation-of-the-dashboard)


#### Import a portal dashboard ####
You should have a dashboard json template ready before using this operation, the file can be downloaded from Azure portal website.
More info can be found [here](https://docs.microsoft.com/en-us/azure/azure-portal/azure-portal-dashboards-create-programmatically#fetch-the-json-representation-of-the-dashboard)
Example:
```
az portal dashboard import \
--name dashboardName \
--resource-group groupName \
--input-path "/path/to/dashboard/template/file/directory"
```
An example dashboard JSON template may look like:
[dashboard.json](https://github.com/Azure/azure-cli-extensions/blob/master/src/portal/azext_portal/tests/latest/dashboard.json)

#### Create a portal dashboard ####
Example:
```
az portal dashboard create \
--location "eastus" \
--name dashboardName \
--resource-group groupName \
--input-path "/path/to/properties/file/directory"
--tags aKey=aValue anotherKey=anotherValue
```
An example propeties JSON file may look like:
[properties.json](https://github.com/Azure/azure-cli-extensions/blob/master/src/portal/azext_portal/tests/latest/properties.json)

#### List all portal dashboards ####
Example:
List all dashboards in a resourceGroup
```
az portal dashboard list \
--resource-group groupName
```
List all dashboards in a subscription
```
az portal dashboard list
```

#### Show a portal dashboard details ####
Example:
```
az portal dashboard show \
--name dashboardName \
--resource-group groupName
```

#### Update an existing dashboard ####
Example:
```
az portal dashboard update \
--name dashboardName \
--resource-group groupName \
--input-path "/src/json/properties.json"
```

#### Delete a dashboard ####
Example:
```
az portal dashboard delete \
--name dashboardName \
--resource-group groupName \
```

If you have issues, please give feedback by opening an issue at https://github.com/Azure/azure-cli-extensions/issues.
Microsoft Azure CLI 'portal' Extension
==========================================

This package is for the 'portal' extension.
i.e. 'az portal'
77 changes: 46 additions & 31 deletions src/portal/azext_portal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from .generated._help import helps # pylint: disable=unused-import


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)
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
load_command_table(self, args)
return self.command_table

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


COMMAND_LOADER_CLS = PortalCommandsLoader
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from azext_portal.generated._help import helps # pylint: disable=unused-import


class PortalCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_portal.generated._client_factory import cf_portal
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)

def load_command_table(self, args):
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 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
29 changes: 17 additions & 12 deletions src/portal/azext_portal/action.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# --------------------------------------------------------------------------------------------
# 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:
pass
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError:
pass
6 changes: 3 additions & 3 deletions 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.isExperimental": true,
"azext.minCliCoreVersion": "2.3.1"
}
29 changes: 17 additions & 12 deletions src/portal/azext_portal/custom.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# --------------------------------------------------------------------------------------------
# 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.custom import * # noqa: F403
try:
from .manual.custom import * # noqa: F403
except ImportError:
pass
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.custom import * # noqa: F403
try:
from .manual.custom import * # noqa: F403
except ImportError:
pass
22 changes: 12 additions & 10 deletions src/portal/azext_portal/generated/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# 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.
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------

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


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)


def cf_dashboard(cli_ctx, *_):
return cf_portal(cli_ctx).dashboard
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------


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)


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

0 comments on commit eb905d1

Please sign in to comment.