-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[amg] Azure managed grafana options for notification channels #5033
[amg] Azure managed grafana options for notification channels #5033
Conversation
Thank you for your contribution michelletaal-shell! We will review the pull request and get back to you soon. |
amg |
@kairu-ms, can you please review this PR and merge appropriately? |
src/amg/azext_amg/commands.py
Outdated
@@ -32,6 +32,15 @@ def load_command_table(self, _): | |||
g.custom_command('query', 'query_data_source') | |||
g.custom_command('update', 'update_data_source') | |||
|
|||
with self.command_group('grafana notification-channel') as g: | |||
g.custom_command('list', 'list_notification_channels') | |||
g.custom_command('list-short', 'list_notification_channels_short') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we merge this with list
command and expose an argument of --short
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid suggestion. Applied in commit [REV1]
src/amg/azext_amg/_params.py
Outdated
@@ -43,6 +43,10 @@ def load_arguments(self, _): | |||
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("definition", 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", help="json string with notification channel definition, or a path to a file with such content") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use type=validate_file_or_dict
for json string or json file.
azure-cli-extensions/src/datafactory/azext_datafactory/generated/_params.py
Lines 395 to 400 in 81dd55b
c.argument('activities', type=validate_file_or_dict, help='List of activities in pipeline. Expected value: ' | |
'json-string/json-file/@json-file.') | |
c.argument('parameters', type=validate_file_or_dict, help='List of parameters for pipeline. Expected value: ' | |
'json-string/json-file/@json-file.') | |
c.argument('variables', type=validate_file_or_dict, help='List of variables for pipeline. Expected value: ' | |
'json-string/json-file/@json-file.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, none of the arguments have type validation in place. Would you like me to expand my scope slightly and add type validation to all pre-existing commands as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please. BTW, we usually don't need to specify type
for most simple arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied in commits [REV2]
Type validation of the argument was added, leading to improved error messaging but also to conflict with the _try_load_file_content function currently executing type validation. This function was therefore omitted for all cli arguments except 'az grafana dashboard import' as this command takes int, str and json objects.
Could you add tests for your changes? |
@michelletaal-shell your PR looks solid we would like to merge. Do you need any help on adding the test? Assume you have followed the dev doc, you can add a test in Or I can push the test change to your branch if you prefer. |
Thank you for accepting my pr. I've been working on writing some tests, but have been otherwise occupied the last few days. I've been having issues with the tests as automatically setting up the Managed Identity requires Azure permissions I don't have in my professional subscription. I'll be trying to work my way around that later this week. I suspect this is why there are also no tests for the other API-call functionalities. Once I get over that hump, the actual tests should be in place rather quickly. |
@michelletaal-shell, sounds good. If the permission is hard to workaround, |
@michelletaal-shell, let you know that we are on the way to move to Grafana 9.0 with unified alerting. This will light up the contact-point which is similar with notification channel. I suggest we hold on to this PR and I will work with you in a couple of weeks to migrate this PR to support |
@yugangw-msft, thank you for the update. I'm nearly done with setting up tests for all features and will commit those this week. I'm definitely willing to work with you to support contact point. Just let me know when you guys are ready to move forward. |
Pull from main
…/michelletaal-shell/azure-cli-extensions into feature/amg-notification-channel
@yugangw-msft does this PR ready for review and merge? |
@kairu-ms, please merge. |
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
General Guidelines
azdev style <YOUR_EXT>
locally? (pip install azdev
required)python scripts/ci/test_index.py -q
locally?For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.json
automatically.The precondition is to put your code inside this repository and upgrade the version in the pull request but do not modify
src/index.json
.