Skip to content
Open
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
14 changes: 13 additions & 1 deletion src/amg/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,16 @@ Release History

2.8.1
++++++
* `az grafana create`: block creation for resources of Essential SKU tier
* `az grafana create`: block creation for resources of Essential SKU tier

3.0.0
++++++
* `az grafana notification-channel`: remove deprecated command group due to Grafana legacy alerting deprecation
* `az grafana api-key`: remove deprecated command group; use `az grafana service-account` instead
* `az grafana backup`: GA
* `az grafana restore`: GA
* `az grafana mpe`: rename to `az grafana managed-private-endpoint`
* `az grafana list-available-plugin`: rename to `az grafana plugin list`
* `az grafana integrations`: rename to `az grafana integration`
* `az grafana integration monitor`: drop `--monitor-resource-group-name` option; use `--monitor-rg-name` instead
* `az grafana data-source`: drop lookup by numeric ID and switch to UID-based endpoints due to deprecated Grafana API
8 changes: 0 additions & 8 deletions src/amg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ az grafana data-source create \
--definition ~/data-source-sql.json
```

#### configure a notification channel
*Examples:*
```
az grafana notification-channel create \
-n MyGrafanaInstance \
--definition ~/notification-channel-teams.json
```

#### Create a dashboard
*Examples:*
```
Expand Down
83 changes: 6 additions & 77 deletions src/amg/azext_amg/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,53 +177,6 @@
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 Grafana legacy alerting, this command group only works with Grafana 10 and below.
"""

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

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

helps['grafana notification-channel create'] = """
type: command
short-summary: Create a notification channel.
examples:
- name: create a notification channel for Teams
text: |
az grafana notification-channel create -n MyGrafana --definition '{
"name": "Teams",
"settings": {
"uploadImage": true,
"url": "https://webhook.office.com/IncomingWebhook/"
},
"type": "teams"
}'
"""

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

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

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

helps['grafana dashboard'] = """
type: group
short-summary: Commands to manage dashboards of an instance.
Expand Down Expand Up @@ -366,30 +319,6 @@
short-summary: Get the details of a user.
"""

helps['grafana api-key'] = """
type: group
short-summary: Commands to manage API keys.
long-summary: API keys are deprecated by Grafana Labs and will not be supported in Grafana 12 and above. Please use service accounts instead.
"""

helps['grafana api-key create'] = """
type: command
short-summary: Create a new API key.
examples:
- name: Create a new API key.
text: az grafana api-key create -g myResourceGroup -n myGrafana --key myKey
"""

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

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

helps['grafana service-account'] = """
type: group
short-summary: Commands to manage service accounts.
Expand Down Expand Up @@ -452,30 +381,30 @@
short-summary: Delete a service account token.
"""

helps['grafana integrations'] = """
helps['grafana integration'] = """
type: group
short-summary: Commands to manage integrations of a Grafana instance.
"""

helps['grafana integrations monitor'] = """
helps['grafana integration monitor'] = """
type: group
short-summary: Commands to manage Azure Monitor workspace integrations of a Grafana instance.
"""

helps['grafana integrations monitor add'] = """
helps['grafana integration monitor add'] = """
type: command
short-summary: Link an Azure Monitor workspace to a Grafana instance.
examples:
- name: Link an Azure Monitor workspace to a Grafana instance.
text: az grafana integrations monitor add -g MyResourceGroup -n MyGrafana --monitor-rg-name MyMonitorResourceGroup --monitor-name MyMonitor
text: az grafana integration monitor add -g MyResourceGroup -n MyGrafana --monitor-rg-name MyMonitorResourceGroup --monitor-name MyMonitor
"""

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

helps['grafana integrations monitor delete'] = """
helps['grafana integration monitor delete'] = """
type: command
short-summary: Unlink an Azure Monitor workspace from a Grafana instance.
"""
22 changes: 3 additions & 19 deletions src/amg/azext_amg/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,26 +72,10 @@ def load_arguments(self, _):
c.argument("dashboards_to_include", nargs='+', help="Space separated titles of dashboards to include in sync. Pair with --folders-to-include for folders specific")
c.argument("dashboards_to_exclude", nargs='+', help="Space separated titles of dashboards to exclude in sync. Pair with --folders-to-exclude for folders specific")

with self.argument_context("grafana api-key") as c:
c.argument("key_name", help="api key name")
c.argument("role", grafana_role_type, default="Viewer")
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")

with self.argument_context("grafana api-key create") as c:
c.argument("key", help="api key name")

with self.argument_context("grafana api-key delete") as c:
c.argument("key", help="id or name that identify an api-key to delete")

with self.argument_context("grafana data-source") as c:
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")
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.")
c.argument("definition", type=validate_file_or_dict, help="json string with data source definition, or a path to a file with such content")

with self.argument_context("grafana notification-channel") as c:
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")
c.argument("definition", type=validate_file_or_dict, help="json string with notification channel definition, or a path to a file with such content")
c.argument("short", action='store_true', help="list notification channels in short format.")

with self.argument_context("grafana data-source query") as c:
c.argument("conditions", nargs="+", help="space-separated condition in a format of `<name>=<value>`")
c.argument("time_from", options_list=["--from"], help="start time in iso 8601, e.g. '2022-01-02T16:15:00'. Default: 1 hour early")
Expand Down Expand Up @@ -125,8 +109,8 @@ def load_arguments(self, _):
with self.argument_context("grafana service-account token create") as c:
c.argument("token", help="name of the new service account token")

with self.argument_context("grafana integrations monitor") as c:
with self.argument_context("grafana integration monitor") as c:
c.argument("monitor_name", help="name of the Azure Monitor workspace")
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")
c.argument("monitor_resource_group_name", options_list=["--monitor-rg-name"], help="name of the resource group of the Azure Monitor workspace")
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")
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")
2 changes: 1 addition & 1 deletion src/amg/azext_amg/aaz/latest/grafana/__cmd_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class __CMDGroup(AAZCommandGroup):
"""Commands to manage Azure Managed Grafana resources.

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
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
"""
pass

Expand Down
1 change: 0 additions & 1 deletion src/amg/azext_amg/aaz/latest/grafana/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from ._create import *
from ._delete import *
from ._list import *
from ._list_available_plugin import *
from ._show import *
from ._update import *
from ._wait import *
4 changes: 2 additions & 2 deletions src/amg/azext_amg/aaz/latest/grafana/_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def content(self):
typ=AAZObjectType,
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
)
_builder.set_prop("identity", AAZObjectType, ".identity")
_builder.set_prop("identity", AAZIdentityObjectType, ".identity")
_builder.set_prop("location", AAZStrType, ".location")
_builder.set_prop("properties", AAZObjectType)
_builder.set_prop("sku", AAZObjectType)
Expand Down Expand Up @@ -292,7 +292,7 @@ def _build_schema_on_200_201(cls):
_schema_on_200_201.id = AAZStrType(
flags={"read_only": True},
)
_schema_on_200_201.identity = AAZObjectType()
_schema_on_200_201.identity = AAZIdentityObjectType()
_schema_on_200_201.location = AAZStrType()
_schema_on_200_201.name = AAZStrType(
flags={"read_only": True},
Expand Down
4 changes: 2 additions & 2 deletions src/amg/azext_amg/aaz/latest/grafana/_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def _build_schema_on_200(cls):
_element.id = AAZStrType(
flags={"read_only": True},
)
_element.identity = AAZObjectType()
_element.identity = AAZIdentityObjectType()
_element.location = AAZStrType()
_element.name = AAZStrType(
flags={"read_only": True},
Expand Down Expand Up @@ -459,7 +459,7 @@ def _build_schema_on_200(cls):
_element.id = AAZStrType(
flags={"read_only": True},
)
_element.identity = AAZObjectType()
_element.identity = AAZIdentityObjectType()
_element.location = AAZStrType()
_element.name = AAZStrType(
flags={"read_only": True},
Expand Down
2 changes: 1 addition & 1 deletion src/amg/azext_amg/aaz/latest/grafana/_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def _build_schema_on_200(cls):
_schema_on_200.id = AAZStrType(
flags={"read_only": True},
)
_schema_on_200.identity = AAZObjectType()
_schema_on_200.identity = AAZIdentityObjectType()
_schema_on_200.location = AAZStrType()
_schema_on_200.name = AAZStrType(
flags={"read_only": True},
Expand Down
Loading
Loading