Skip to content

Commit

Permalink
address lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
yugangw-msft committed Mar 8, 2022
1 parent f168b98 commit 73a4e15
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 66 deletions.
1 change: 1 addition & 0 deletions src/amg/azext_amg/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------


def cf_amg(cli_ctx, *_):
# pylint: disable=unused-argument
from azure.cli.core.commands.client_factory import get_mgmt_service_client
Expand Down
64 changes: 3 additions & 61 deletions src/amg/azext_amg/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,44 +42,9 @@
type: command
short-summary: Create a data source.
examples:
- name: create a data source using Managed Service Identity
text: |
az grafana data-source create --definition '{
"access": "proxy",
"basicAuth": false,
"jsonData": {
"azureAuth": true,
"azureCredentials": {
"authType": "msi"
},
"azureEndpointResourceId": "https://monitor.core.windows.net"
},
"name": "Geneva Datasource using MSI",
"type": "geneva-datasource",
"withCredentials": false
}'
- name: create a data source using Service Principal
text: |
az grafana data-source create --definition '{
"access": "proxy",
"basicAuth": false,
"jsonData": {
"azureAuth": true,
"azureCredentials": {
"authType": "clientsecret",
"azureCloud": "AzureCloud",
"clientId": "fb31a2f5-9122-4be9-9705-xxxxxxxxxxxx",
"tenantId": "72f988bf-86f1-41af-91ab-xxxxxxxxxxxx",
"clientSecret": "xxxxxx"
},
"azureEndpointResourceId": "https://monitor.core.windows.net"
},
"name": "Geneva Datasource using Service principal",
"type": "geneva-datasource"
}'
- name: create a data source of Azure SQL
text: |
az grafana data-source create --definition '{
az grafana data-source create -n MyGrafana --definition '{
"access": "proxy",
"database": "testdb",
"jsonData": {
Expand All @@ -100,26 +65,6 @@
helps['grafana data-source update'] = """
type: command
short-summary: Update a data source.
examples:
- name: update a data source's credentials (make sure either set "version" to the latest version, or omit it to overwrite the existing version)
text: |
az grafana data-source create --data-source "Geneva Datasource" --definition '{
"access": "proxy",
"basicAuth": false,
"jsonData": {
"azureAuth": true,
"azureCredentials": {
"authType": "clientsecret",
"azureCloud": "AzureCloud",
"clientId": "fb31a2f5-9122-4be9-9705-xxxxxxxxxxxx",
"tenantId": "72f988bf-86f1-41af-91ab-xxxxxxxxxxxx",
"clientSecret": "newPassword"
},
"azureEndpointResourceId": "https://monitor.core.windows.net"
},
"name": "Geneva Datasource",
"type": "geneva-datasource"
}'
"""

helps['grafana data-source show'] = """
Expand Down Expand Up @@ -191,10 +136,7 @@
examples:
- name: Get details of a dashboard specified by an unique identifier(use "az grafana dashboard list" command to retrieve the uid)
text: |
az grafana dashboard show -g MyResourceGroup -n MyGrafana --uid VdrOA7jGz
- name: Get home dashboard
text: |
az grafana dashboard show -g MyResourceGroup -n MyGrafana --show-home-dashboard
az grafana dashboard show -g MyResourceGroup -n MyGrafana --dashboard VdrOA7jGz
"""

helps['grafana dashboard delete'] = """
Expand All @@ -203,7 +145,7 @@
examples:
- name: Delete a dashboard specified by an unique identifier(use "az grafana dashboard list" command to retrieve the uid)
text: |
az grafana dashboard delete -g MyResourceGroup -n MyGrafana --uid VdrOA7jGz
az grafana dashboard delete -g MyResourceGroup -n MyGrafana --dashboard VdrOA7jGz
"""

helps['grafana folder'] = """
Expand Down
4 changes: 3 additions & 1 deletion src/amg/azext_amg/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long


def load_arguments(self, _):

from knack.arguments import CLIArgumentType
Expand All @@ -25,7 +26,7 @@ def load_arguments(self, _):

with self.argument_context("grafana create") as c:
c.argument("grafana_name", grafana_name_type, options_list=["--name", "-n"], validator=None)
c.argument("skip_system_assigned_identity", arg_type=get_three_state_flag(), help="Do not enable system assigned identity")
c.argument("skip_system_assigned_identity", options_list=["-s", "--skip-system-assigned-identity"], arg_type=get_three_state_flag(), help="Do not enable system assigned identity")
c.argument("skip_role_assignments", arg_type=get_three_state_flag(), help="Do not create role assignments for managed identity and the current login user")

with self.argument_context("grafana delete") as c:
Expand All @@ -45,6 +46,7 @@ def load_arguments(self, _):
c.argument("time_from", options_list=["--from"], help="start time in iso 8601, e.g. '2022-01-02T16:15:00'. Default: 1 hour early")
c.argument("time_to", options_list=["--to"], help="end time in iso 8601, e.g. '2022-01-02T17:15:00'. Default: current time ")
c.argument("max_data_points", help="Maximum amount of data points that dashboard panel can render")
c.argument("query_format", help="format of the resule, e.g. table, time_series")
c.argument("internal_ms", help="The time interval in milliseconds of time series")

with self.argument_context("grafana folder") as c:
Expand Down
8 changes: 4 additions & 4 deletions src/amg/azext_amg/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ def load_command_table(self, _):
g.custom_command('create', 'create_dashboard')
g.custom_command('delete', 'delete_dashboard')
g.custom_command('list', 'list_dashboards')
g.custom_command('show', 'show_dashboard')
g.custom_show_command('show', 'show_dashboard')
g.custom_command('update', 'update_dashboard')

with self.command_group('grafana data-source') as g:
g.custom_command('create', 'create_data_source')
g.custom_command('list', 'list_data_sources')
g.custom_command('show', 'show_data_source')
g.custom_show_command('show', 'show_data_source')
g.custom_command('delete', 'delete_data_source')
g.custom_command('query', 'query_data_source')
g.custom_command('update', 'update_data_source')

with self.command_group('grafana folder') as g:
g.custom_command('create', 'create_folder')
g.custom_command('list', 'list_folders')
g.custom_command('show', 'show_folder')
g.custom_show_command('show', 'show_folder')
g.custom_command('delete', 'delete_folder')
g.custom_command('update', 'update_folder')

with self.command_group('grafana user') as g:
g.custom_command('list', 'list_users')
g.custom_command('show', 'show_user')
g.custom_show_command('show', 'show_user')
g.custom_command('actual-user', 'get_actual_user')

0 comments on commit 73a4e15

Please sign in to comment.