Skip to content

Commit 67e2293

Browse files
ABZhang0Alan Zhang
andauthored
Fixes to prep for Grafana 13 (#9891)
* Fixes to prep for Grafana 13 * Change major version * renaming mpe and plugin list * Address PR comments * Linter fixes --------- Co-authored-by: Alan Zhang <alanzhang@microsoft.com>
1 parent 3467788 commit 67e2293

32 files changed

Lines changed: 32002 additions & 6875 deletions

src/amg/HISTORY.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,16 @@ Release History
155155

156156
2.8.1
157157
++++++
158-
* `az grafana create`: block creation for resources of Essential SKU tier
158+
* `az grafana create`: block creation for resources of Essential SKU tier
159+
160+
3.0.0
161+
++++++
162+
* `az grafana notification-channel`: remove deprecated command group due to Grafana legacy alerting deprecation
163+
* `az grafana api-key`: remove deprecated command group; use `az grafana service-account` instead
164+
* `az grafana backup`: GA
165+
* `az grafana restore`: GA
166+
* `az grafana mpe`: rename to `az grafana managed-private-endpoint`
167+
* `az grafana list-available-plugin`: rename to `az grafana plugin list`
168+
* `az grafana integrations`: rename to `az grafana integration`
169+
* `az grafana integration monitor`: drop `--monitor-resource-group-name` option; use `--monitor-rg-name` instead
170+
* `az grafana data-source`: drop lookup by numeric ID and switch to UID-based endpoints due to deprecated Grafana API

src/amg/README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@ az grafana data-source create \
4444
--definition ~/data-source-sql.json
4545
```
4646

47-
#### configure a notification channel
48-
*Examples:*
49-
```
50-
az grafana notification-channel create \
51-
-n MyGrafanaInstance \
52-
--definition ~/notification-channel-teams.json
53-
```
54-
5547
#### Create a dashboard
5648
*Examples:*
5749
```

src/amg/azext_amg/_help.py

Lines changed: 6 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -177,53 +177,6 @@
177177
short-summary: Query a data source having backend implementation
178178
"""
179179

180-
helps['grafana notification-channel'] = """
181-
type: group
182-
short-summary: Commands to manage notification channels of an instance.
183-
long-summary: As part of Grafana legacy alerting, this command group only works with Grafana 10 and below.
184-
"""
185-
186-
helps['grafana notification-channel list'] = """
187-
type: command
188-
short-summary: List all notification channels of an instance.
189-
"""
190-
191-
helps['grafana notification-channel show'] = """
192-
type: command
193-
short-summary: Get the details of a notification channel
194-
"""
195-
196-
helps['grafana notification-channel create'] = """
197-
type: command
198-
short-summary: Create a notification channel.
199-
examples:
200-
- name: create a notification channel for Teams
201-
text: |
202-
az grafana notification-channel create -n MyGrafana --definition '{
203-
"name": "Teams",
204-
"settings": {
205-
"uploadImage": true,
206-
"url": "https://webhook.office.com/IncomingWebhook/"
207-
},
208-
"type": "teams"
209-
}'
210-
"""
211-
212-
helps['grafana notification-channel update'] = """
213-
type: command
214-
short-summary: Update a notification channel.
215-
"""
216-
217-
helps['grafana notification-channel delete'] = """
218-
type: command
219-
short-summary: Delete a notification channel.
220-
"""
221-
222-
helps['grafana notification-channel test'] = """
223-
type: command
224-
short-summary: Test a notification channel.
225-
"""
226-
227180
helps['grafana dashboard'] = """
228181
type: group
229182
short-summary: Commands to manage dashboards of an instance.
@@ -366,30 +319,6 @@
366319
short-summary: Get the details of a user.
367320
"""
368321

369-
helps['grafana api-key'] = """
370-
type: group
371-
short-summary: Commands to manage API keys.
372-
long-summary: API keys are deprecated by Grafana Labs and will not be supported in Grafana 12 and above. Please use service accounts instead.
373-
"""
374-
375-
helps['grafana api-key create'] = """
376-
type: command
377-
short-summary: Create a new API key.
378-
examples:
379-
- name: Create a new API key.
380-
text: az grafana api-key create -g myResourceGroup -n myGrafana --key myKey
381-
"""
382-
383-
helps['grafana api-key list'] = """
384-
type: command
385-
short-summary: List existing API keys.
386-
"""
387-
388-
helps['grafana api-key delete'] = """
389-
type: command
390-
short-summary: Delete an API key.
391-
"""
392-
393322
helps['grafana service-account'] = """
394323
type: group
395324
short-summary: Commands to manage service accounts.
@@ -452,30 +381,30 @@
452381
short-summary: Delete a service account token.
453382
"""
454383

455-
helps['grafana integrations'] = """
384+
helps['grafana integration'] = """
456385
type: group
457386
short-summary: Commands to manage integrations of a Grafana instance.
458387
"""
459388

460-
helps['grafana integrations monitor'] = """
389+
helps['grafana integration monitor'] = """
461390
type: group
462391
short-summary: Commands to manage Azure Monitor workspace integrations of a Grafana instance.
463392
"""
464393

465-
helps['grafana integrations monitor add'] = """
394+
helps['grafana integration monitor add'] = """
466395
type: command
467396
short-summary: Link an Azure Monitor workspace to a Grafana instance.
468397
examples:
469398
- name: Link an Azure Monitor workspace to a Grafana instance.
470-
text: az grafana integrations monitor add -g MyResourceGroup -n MyGrafana --monitor-rg-name MyMonitorResourceGroup --monitor-name MyMonitor
399+
text: az grafana integration monitor add -g MyResourceGroup -n MyGrafana --monitor-rg-name MyMonitorResourceGroup --monitor-name MyMonitor
471400
"""
472401

473-
helps['grafana integrations monitor list'] = """
402+
helps['grafana integration monitor list'] = """
474403
type: command
475404
short-summary: List all Azure Monitor workspaces linked to a Grafana instance.
476405
"""
477406

478-
helps['grafana integrations monitor delete'] = """
407+
helps['grafana integration monitor delete'] = """
479408
type: command
480409
short-summary: Unlink an Azure Monitor workspace from a Grafana instance.
481410
"""

src/amg/azext_amg/_params.py

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -72,26 +72,10 @@ def load_arguments(self, _):
7272
c.argument("dashboards_to_include", nargs='+', help="Space separated titles of dashboards to include in sync. Pair with --folders-to-include for folders specific")
7373
c.argument("dashboards_to_exclude", nargs='+', help="Space separated titles of dashboards to exclude in sync. Pair with --folders-to-exclude for folders specific")
7474

75-
with self.argument_context("grafana api-key") as c:
76-
c.argument("key_name", help="api key name")
77-
c.argument("role", grafana_role_type, default="Viewer")
78-
c.argument("time_to_live", default="1d", help="The API key life duration. For example, 1d if your key is going to last fr one day. Supported units are: s,m,h,d,w,M,y")
79-
80-
with self.argument_context("grafana api-key create") as c:
81-
c.argument("key", help="api key name")
82-
83-
with self.argument_context("grafana api-key delete") as c:
84-
c.argument("key", help="id or name that identify an api-key to delete")
85-
8675
with self.argument_context("grafana data-source") as c:
87-
c.argument("data_source", help="name, id, uid which can identify a data source. CLI will search in the order of name, id, and uid, till finds a match")
76+
c.argument("data_source", help="name or UID that identifies a data source. CLI will search by name first, then by UID, and use the first match.")
8877
c.argument("definition", type=validate_file_or_dict, help="json string with data source definition, or a path to a file with such content")
8978

90-
with self.argument_context("grafana notification-channel") as c:
91-
c.argument("notification_channel", help="id, uid which can identify a data source. CLI will search in the order of id, and uid, till finds a match")
92-
c.argument("definition", type=validate_file_or_dict, help="json string with notification channel definition, or a path to a file with such content")
93-
c.argument("short", action='store_true', help="list notification channels in short format.")
94-
9579
with self.argument_context("grafana data-source query") as c:
9680
c.argument("conditions", nargs="+", help="space-separated condition in a format of `<name>=<value>`")
9781
c.argument("time_from", options_list=["--from"], help="start time in iso 8601, e.g. '2022-01-02T16:15:00'. Default: 1 hour early")
@@ -125,8 +109,8 @@ def load_arguments(self, _):
125109
with self.argument_context("grafana service-account token create") as c:
126110
c.argument("token", help="name of the new service account token")
127111

128-
with self.argument_context("grafana integrations monitor") as c:
112+
with self.argument_context("grafana integration monitor") as c:
129113
c.argument("monitor_name", help="name of the Azure Monitor workspace")
130-
c.argument("monitor_resource_group_name", options_list=["--monitor-resource-group-name", "--monitor-rg-name"], help="name of the resource group of the Azure Monitor workspace")
114+
c.argument("monitor_resource_group_name", options_list=["--monitor-rg-name"], help="name of the resource group of the Azure Monitor workspace")
131115
c.argument("monitor_subscription_id", options_list=["--monitor-subscription-id", "--monitor-sub-id"], help="subscription id of the Azure Monitor workspace. Uses the current subscription id if not specified")
132116
c.argument("skip_role_assignments", options_list=["-s", "--skip-role-assignments"], arg_type=get_three_state_flag(), help="skip assigning the appropriate role on the Azure Monitor workspace to let Grafana read data from it. Default: false")

src/amg/azext_amg/aaz/latest/grafana/__cmd_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class __CMDGroup(AAZCommandGroup):
1818
"""Commands to manage Azure Managed Grafana resources.
1919
20-
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
20+
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
2121
"""
2222
pass
2323

src/amg/azext_amg/aaz/latest/grafana/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from ._create import *
1313
from ._delete import *
1414
from ._list import *
15-
from ._list_available_plugin import *
1615
from ._show import *
1716
from ._update import *
1817
from ._wait import *

src/amg/azext_amg/aaz/latest/grafana/_create.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def content(self):
238238
typ=AAZObjectType,
239239
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
240240
)
241-
_builder.set_prop("identity", AAZObjectType, ".identity")
241+
_builder.set_prop("identity", AAZIdentityObjectType, ".identity")
242242
_builder.set_prop("location", AAZStrType, ".location")
243243
_builder.set_prop("properties", AAZObjectType)
244244
_builder.set_prop("sku", AAZObjectType)
@@ -292,7 +292,7 @@ def _build_schema_on_200_201(cls):
292292
_schema_on_200_201.id = AAZStrType(
293293
flags={"read_only": True},
294294
)
295-
_schema_on_200_201.identity = AAZObjectType()
295+
_schema_on_200_201.identity = AAZIdentityObjectType()
296296
_schema_on_200_201.location = AAZStrType()
297297
_schema_on_200_201.name = AAZStrType(
298298
flags={"read_only": True},

src/amg/azext_amg/aaz/latest/grafana/_list.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def _build_schema_on_200(cls):
158158
_element.id = AAZStrType(
159159
flags={"read_only": True},
160160
)
161-
_element.identity = AAZObjectType()
161+
_element.identity = AAZIdentityObjectType()
162162
_element.location = AAZStrType()
163163
_element.name = AAZStrType(
164164
flags={"read_only": True},
@@ -459,7 +459,7 @@ def _build_schema_on_200(cls):
459459
_element.id = AAZStrType(
460460
flags={"read_only": True},
461461
)
462-
_element.identity = AAZObjectType()
462+
_element.identity = AAZIdentityObjectType()
463463
_element.location = AAZStrType()
464464
_element.name = AAZStrType(
465465
flags={"read_only": True},

src/amg/azext_amg/aaz/latest/grafana/_show.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def _build_schema_on_200(cls):
153153
_schema_on_200.id = AAZStrType(
154154
flags={"read_only": True},
155155
)
156-
_schema_on_200.identity = AAZObjectType()
156+
_schema_on_200.identity = AAZIdentityObjectType()
157157
_schema_on_200.location = AAZStrType()
158158
_schema_on_200.name = AAZStrType(
159159
flags={"read_only": True},

0 commit comments

Comments
 (0)