Skip to content

Commit

Permalink
AMG: add Grafana major version arg to update command (#7303)
Browse files Browse the repository at this point in the history
* Add arg to update command and fix typos

* Remove resource group name from None value check

* Replace local SDK files with PyPI SDK

* Lint fix

* Regenerate test files

* Add confirmation dialog

* Lint fix

* Fix input logic

* Lint fix

* Update minor version

* Update test recordings

* Lint fixes

---------

Co-authored-by: Alan Zhang <alanzhang@microsoft.com>
  • Loading branch information
ABZhang0 and Alan Zhang committed Mar 6, 2024
1 parent 97928d0 commit 2c5d63e
Show file tree
Hide file tree
Showing 42 changed files with 2,371 additions and 11,119 deletions.
6 changes: 5 additions & 1 deletion src/amg/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ Release History

1.2.10
++++++
* `az grafana backup`: exclude provisioned dashboards during backup
* `az grafana backup`: exclude provisioned dashboards during backup

1.3.0
++++++
* `az grafana update`: support Grafana major version argument
2 changes: 1 addition & 1 deletion src/amg/azext_amg/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
def cf_amg(cli_ctx, subscription, *_):
# pylint: disable=unused-argument
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_amg.vendored_sdks import DashboardManagementClient
from azure.mgmt.dashboard import DashboardManagementClient
return get_mgmt_service_client(cli_ctx, DashboardManagementClient, subscription_id=subscription)
90 changes: 45 additions & 45 deletions src/amg/azext_amg/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
helps['grafana'] = """
type: group
short-summary: Commands to manage Azure Grafana instances.
long-summary: For optimized experience, not all data plane Apis, documented at https://grafana.com/docs/grafana/latest/http_api/, are exposed. On coverage gap, please reach out to ad4g@microsoft.com
long-summary: For optimized experience, not all data plane APIs, documented at https://grafana.com/docs/grafana/latest/http_api/, are exposed. On coverage gap, please reach out to ad4g@microsoft.com
"""

helps['grafana create'] = """
type: command
short-summary: Create a Azure Managed Grafana instance.
short-summary: Create an Azure Managed Grafana instance.
"""

helps['grafana list'] = """
Expand All @@ -25,19 +25,19 @@

helps['grafana delete'] = """
type: command
short-summary: Delete a Azure Managed Grafana instance.
short-summary: Delete an Azure Managed Grafana instance.
"""

helps['grafana show'] = """
type: command
short-summary: Show details of a Azure Managed Grafana instance.
short-summary: Show details of an Azure Managed Grafana instance.
"""

helps['grafana backup'] = """
type: command
short-summary: Backup an Azure Managed Grafana instance's content to an achive.
short-summary: Backup an Azure Managed Grafana instance's content to an archive.
examples:
- name: backup dashboards under 2 folders (data sources are included to enable name remapping when restore dashboards to another worksapce)
- name: backup dashboards under 2 folders (data sources are included to enable name remapping when restore dashboards to another workspace)
text: |
az grafana backup -g MyResourceGroup -n MyGrafana -d c:\\temp --folders-to-include "Prod" "Compute Gateway" --components datasources dashboards folders
- name: backup dashboards and skip a few folders
Expand All @@ -48,16 +48,16 @@

helps['grafana restore'] = """
type: command
short-summary: Restore an Azure Managed Grafana instance from an achive.
short-summary: Restore an Azure Managed Grafana instance from an archive.
examples:
- name: Restore dashboards. If they are under folders, include "folders" in the components list; use "--remap-data-sources" so CLI will update dashboards to point to same data sourceses at target workspace
- name: Restore dashboards. If they are under folders, include "folders" in the components list; use "--remap-data-sources" so CLI will update dashboards to point to same data sources at target workspace
text: |
az grafana restore -g MyResourceGroup -n MyGrafana --archive-file backup\\dashboards\\ServiceHealth-202307051036.tar.gz --components dashboards folders --remap-data-sources
"""

helps['grafana update'] = """
type: command
short-summary: Update a Azure Managed Grafana instance.
short-summary: Update an Azure Managed Grafana instance.
examples:
- name: disable the public network access
text: |
Expand All @@ -76,7 +76,7 @@
type: command
short-summary: Create a data source.
examples:
- name: create a data source of Azure Monitor using Managed Identity
- name: create an Azure Monitor data source using Managed Identity
text: |
az grafana data-source create -n MyGrafana --definition '{
"access": "proxy",
Expand All @@ -87,7 +87,7 @@
"name": "Azure Monitor-3",
"type": "grafana-azure-monitor-datasource"
}'
- name: create a data source of Azure Monitor using App Registration
- name: create an Azure Monitor data source using App Registration
text: |
az grafana data-source create -n MyGrafana --definition '{
"name": "Azure Monitor-2",
Expand All @@ -102,7 +102,7 @@
},
"secureJsonData": { "clientSecret": "verySecret" }
}'
- name: create a data source of Azure Data Explorer using Managed Identity
- name: create an Azure Data Explorer data source using Managed Identity
text: |
az grafana data-source create -n MyGrafana --definition '{
"name": "Azure Data Explorer Datasource-2",
Expand All @@ -113,7 +113,7 @@
"clusterUrl": "https://mykusto.westcentralus.kusto.windows.net"
}
}'
- name: create a data source of Azure Data Explorer using App Registration
- name: create an Azure Data Explorer data source using App Registration
text: |
az grafana data-source create -n MyGrafana --definition '{
"name": "Azure Data Explorer Datasource-1",
Expand All @@ -130,7 +130,7 @@
},
"secureJsonData": { "azureClientSecret": "verySecret" }
}'
- name: create a data source of Azure Managed Prometheus using App Registration
- name: create an Azure Managed Prometheus data source using App Registration
text: |
az grafana data-source create -n MyGrafana --definition '{
"name": "Azure Managed Prometheus-1",
Expand All @@ -149,7 +149,7 @@
},
"secureJsonData": { "azureClientSecret": "verySecret" }
}'
- name: create a data source of Azure Managed Prometheus using managed identity
- name: create an Azure Managed Prometheus data source using managed identity
text: |
az grafana data-source create -n MyGrafana --definition '{
"name": "Azure Managed Prometheus-1",
Expand All @@ -161,7 +161,7 @@
"azureCredentials": { "authType": "msi" }
}
}'
- name: create a data source of Azure SQL
- name: create an Azure SQL data source
text: |
az grafana data-source create -n MyGrafana --definition '{
"access": "proxy",
Expand All @@ -187,12 +187,12 @@

helps['grafana data-source show'] = """
type: command
short-summary: get details of a data source
short-summary: Get the details of a data source
"""

helps['grafana data-source delete'] = """
type: command
short-summary: delete a data source
short-summary: Delete a data source
"""

helps['grafana data-source list'] = """
Expand All @@ -202,13 +202,13 @@

helps['grafana data-source query'] = """
type: command
short-summary: query a data source having backend implementation
short-summary: Query a data source having backend implementation
"""

helps['grafana notification-channel'] = """
type: group
short-summary: Commands to manage notification channels of an instance.
long-summary: as part of legacy alerting, this command group will be deprecated in a future release
long-summary: As part of legacy alerting, this command group will be deprecated in a future release
"""

helps['grafana notification-channel list'] = """
Expand All @@ -218,7 +218,7 @@

helps['grafana notification-channel show'] = """
type: command
short-summary: get details of a notification channel
short-summary: Get the details of a notification channel
"""

helps['grafana notification-channel create'] = """
Expand All @@ -244,12 +244,12 @@

helps['grafana notification-channel delete'] = """
type: command
short-summary: delete a notification channel.
short-summary: Delete a notification channel.
"""

helps['grafana notification-channel test'] = """
type: command
short-summary: tests a notification channels.
short-summary: Test a notification channel.
"""

helps['grafana dashboard'] = """
Expand Down Expand Up @@ -288,7 +288,7 @@

helps['grafana dashboard import'] = """
type: command
short-summary: import a dashboard.
short-summary: Import a dashboard.
long-summary: CLI command will fill in required parameters for data sources if configured
examples:
- name: import the dashboard of "AKS Container Insights" from Grafana gallery.
Expand All @@ -310,7 +310,7 @@

helps['grafana dashboard show'] = """
type: command
short-summary: show the detail of a dashboard.
short-summary: Get the details of a dashboard.
examples:
- name: Get details of a dashboard specified by an unique identifier(use "az grafana dashboard list" command to retrieve the uid)
text: |
Expand All @@ -319,7 +319,7 @@

helps['grafana dashboard delete'] = """
type: command
short-summary: delete a dashboard
short-summary: Delete a dashboard.
examples:
- name: Delete a dashboard specified by an unique identifier(use "az grafana dashboard list" command to retrieve the uid)
text: |
Expand Down Expand Up @@ -348,27 +348,27 @@

helps['grafana folder create'] = """
type: command
short-summary: create a new folder.
short-summary: Create a new folder.
"""

helps['grafana folder show'] = """
type: command
short-summary: show the details of a folder.
short-summary: Get the details of a folder.
"""

helps['grafana folder list'] = """
type: command
short-summary: list all folders of an instance.
short-summary: List all folders of an instance.
"""

helps['grafana folder update'] = """
type: command
short-summary: update a folder.
short-summary: Update a folder.
"""

helps['grafana folder delete'] = """
type: command
short-summary: delete a folder.
short-summary: Delete a folder.
"""

helps['grafana user'] = """
Expand All @@ -378,17 +378,17 @@

helps['grafana user actual-user'] = """
type: command
short-summary: show details of current user.
short-summary: Get the details of the current user.
"""

helps['grafana user list'] = """
type: command
short-summary: list users.
short-summary: List users.
"""

helps['grafana user show'] = """
type: command
short-summary: show detail of a user.
short-summary: Get the details of a user.
"""

helps['grafana api-key'] = """
Expand All @@ -398,17 +398,17 @@

helps['grafana api-key create'] = """
type: command
short-summary: create a new api key.
short-summary: Create a new API key.
"""

helps['grafana api-key list'] = """
type: command
short-summary: list existing api keys.
short-summary: List existing API keys.
"""

helps['grafana api-key delete'] = """
type: command
short-summary: delete an api key.
short-summary: Delete an API key.
"""

helps['grafana service-account'] = """
Expand All @@ -418,7 +418,7 @@

helps['grafana service-account create'] = """
type: command
short-summary: create a new service account.
short-summary: Create a new service account.
examples:
- name: Create a service account with admin role
text: |
Expand All @@ -427,7 +427,7 @@

helps['grafana service-account update'] = """
type: command
short-summary: update a service account.
short-summary: Update a service account.
examples:
- name: disable a service account
text: |
Expand All @@ -436,17 +436,17 @@

helps['grafana service-account show'] = """
type: command
short-summary: show details of a service account.
short-summary: Get the details of a service account.
"""

helps['grafana service-account list'] = """
type: command
short-summary: list existing service accounts.
short-summary: List existing service accounts.
"""

helps['grafana service-account delete'] = """
type: command
short-summary: delete a service account.
short-summary: Delete a service account.
"""

helps['grafana service-account token'] = """
Expand All @@ -456,7 +456,7 @@

helps['grafana service-account token create'] = """
type: command
short-summary: create a new service account token.
short-summary: Create a new service account token.
examples:
- name: create a service account token lasting 1 day
text: |
Expand All @@ -465,10 +465,10 @@

helps['grafana service-account token list'] = """
type: command
short-summary: list existing service account tokens.
short-summary: List existing service account tokens.
"""

helps['grafana service-account token delete'] = """
type: command
short-summary: delete a service account token.
short-summary: Delete a service account token.
"""
Loading

0 comments on commit 2c5d63e

Please sign in to comment.