Skip to content

[EventGrid] Add CLI support for 2020-04-01-preview and mark preview features with is_Preview=True#14027

Merged
haroldrandom merged 24 commits intoAzure:devfrom
ahamad-MS:dev
Jul 6, 2020
Merged

[EventGrid] Add CLI support for 2020-04-01-preview and mark preview features with is_Preview=True#14027
haroldrandom merged 24 commits intoAzure:devfrom
ahamad-MS:dev

Conversation

@ahamad-MS
Copy link
Contributor

Description

This PR is to add support for all the previewed and GA'ed features from event Grid CLI extension. We are marking all the features that are still in preview with the proper is_Preview tag and will be using this mechanism with all future releases.

  • Features included in GA:

    • Event Delivery Schema
    • Input Mapping.
    • Custom Input Schema EventDelivery Schema
    • Cloud Event V10 Schema
    • Service Bus Topic As Destination
    • Azure Function As Destination
    • WebHook Batching
    • Secure webhook (AAD support)
    • ImmutableId
    • IpFiltering
    • Private Link
  • Features that are still in preview:

    • Partner Topic
    • Msi For Delivery To First Party Destinations
    • Sku
    • Tracked System Topic

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change.
[Component Name 2] az command b: Add some customer-facing feature.


This checklist is used to make sure that common guidelines for a pull request are followed.

@yonzhan yonzhan requested a review from qianwens June 19, 2020 00:54
@yonzhan yonzhan added this to the S172 milestone Jun 19, 2020
@yonzhan
Copy link
Collaborator

yonzhan commented Jun 19, 2020

Event Grid

@ahamad-MS
Copy link
Contributor Author

ahamad-MS commented Jun 19, 2020

Hello @myronfanqiu @haroldrandom , @qianwens and @Juliehzl , Can you please helpo review this PR and help with failures. Some of them does not make sense as these same arguments/commands were used in CLI extension. For example, one of the linter errors complains that the argument destination-resource-group ends with resource-group in the name. I changed that to destination-resource-group-name and the same error occurs.

Can you please provide some help here?

thanks

@yonzhan yonzhan requested a review from mmyyrroonn June 19, 2020 23:12
@mmyyrroonn
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@mmyyrroonn
Copy link
Contributor

@ahamad-MS Hi, please solve other CI issues except for the linter one. We're discussing about the resource group naming rule.

@haroldrandom
Copy link
Contributor

Hi, @ahamad-MS .

I don't see what you said related to the CI failure. Instead,

  File "/opt/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/azure/cli/command_modules/eventgrid/custom.py", line 14, in <module>
    from azure.mgmt.eventgrid.models import (
ImportError: cannot import name 'ResourceSku'

@ahamad-MS
Copy link
Contributor Author

Hello @haroldrandom .. This error is observed locally when I ran azdev liter eventgrid.

you are right that import error comes in the online check and I am not sure why this is also happening. i dont see it locally. Any suggestion on how to resolve it?

@haroldrandom
Copy link
Contributor

haroldrandom commented Jun 22, 2020

Hello @haroldrandom .. This error is observed locally when I ran azdev liter eventgrid.

you are right that import error comes in the online check and I am not sure why this is also happening.

The output indicates the file azure/mgmt/eventgrid/models/__init__.py doesn't export ResourceSku. I think the problem hides in SDK generation. You could try to import it manually in Python REPL to test whether it's importable or not. And then, add it explictily in __init__.py to export and import again.

The question why it doesn't occur previously is that the class ResourceSku never used in custom.py

@ahamad-MS
Copy link
Contributor Author

Thanks @haroldrandom for the discussion on teams. As I showed you, the python SDK module for EventGrid is correctly installed on my local machine and my local tests are running fine with no issues along with azdev style.

When looking in model files under $root\azure-cli\env3\Lib\site-packages\azure\mgmt\eventgrid\models , we saw resourcesku was defined and used correctly. Also, init.py file was referencing/importing it correctly.

Please note the setup.py file is referring the correct python package (namely, 'azure-mgmt-eventgrid~=3.0.0rc7',)

Hence, I believe it is something related to the github setting or the check itself where it is not correctly referencing the correct package. This seems an infra issue

Please let me know if more info needed.

@ahamad-MS
Copy link
Contributor Author

@myronfanqiu All comments addressed. If additional info needed, let us discuss in person.

@ahamad-MS
Copy link
Contributor Author

@yonzhan Can you please provide an ETA when this PR will be merged? thanks

@yonzhan
Copy link
Collaborator

yonzhan commented Jun 30, 2020

@ahamad-MS @Juliehzl will help you merge it by this Sprint.

- name: List all partner registrations in a resource group whose name contains the pattern "XYZ"
text: az eventgrid partner registration list -g rg1 --odata-query "Contains(name, 'XYZ')"
- name: List all partner registrations in a resource group except the partner registration with name "name1"
text: az eventgrid partner registration list -g rg1 --odata-query "NOT (name eq 'name1')"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should --odata-query be --filter? cli already has a global parameter named --query.

Copy link
Contributor Author

@ahamad-MS ahamad-MS Jul 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. This is how we handle pagination and search filtering for all existing commands


included_event_types_type = CLIArgumentType(
help="A space-separated list of event types (e.g., Microsoft.Storage.BlobCreated Microsoft.Storage.BlobDeleted). To subscribe to all default event types, do not specify this argument. For event grid topics, event types are customer defined. For Azure events, e.g., Storage Accounts, IoT Hub, etc., you can query their event types using this CLI command 'az eventgrid topic-type list-event-types'.",
help="A space-separated list of event types (e.g., Microsoft.Storage.BlobCreated and Microsoft.Storage.BlobDeleted). In order to subscribe to all default event types, do not specify any value for this argument. For event grid topics, event types are customer defined. For Azure events, e.g., Storage Accounts, IoT Hub, etc., you can query their event types using this CLI command 'az eventgrid topic-type list-event-types'.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to get all related types?

Copy link
Contributor Author

@ahamad-MS ahamad-MS Jul 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "provided" help text is already helping user to get this info specifically:

you can query their event types using this CLI command 'az eventgrid topic-type list-event-types'.

c.argument('domain_name', arg_type=domain_name_type)
c.argument('domain_topic_name', arg_type=domain_topic_name_type)
c.argument('system_topic_name', arg_type=system_topic_name_type)
c.argument('source', help="The ARM Id for the topic, e.g., /subscriptions/{SubId}/resourceGroups/{RgName}/providers/Microsoft.Storage/storageAccounts/{AccountName}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--source should be arm resource id for topic, right? could we use topic resource id as example not storage account resource id?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. This is not same as resource id. the word "source" needs to be maintained and used here. Also, this copied exactly from Event Grid CLI extension and user are using it this way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the example you provided, it is storage account resource id, right? CLI extension is used for private preview commands and for cli modules, we need to be consistent with cli command guidline.
here we want the description for --source could be more clear. If it is not resource id, could you provide another example?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Juliehzl source is a concept used in Event Grid and messaging world. it just happens to be the arm id for the system topic (Storage in this case). We will not change the name (source) as this is the expected name we want to use in our documentation and command. this is unique to event grid and we use source-resource-id in event subsription creation/update command and yes it matches what you are talking about. The case here is totally different.

This is still by design and won't fix.


with self.command_group('eventgrid system-topic', system_topics_mgmt_util, client_factory=system_topics_factory, is_preview=True) as g:
g.show_command('show', 'get')
g.command('delete', 'delete')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we add confirmation=True for all delete commands?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. We keep consistency with all other existing delete commands.

@ahamad-MS
Copy link
Contributor Author

ahamad-MS commented Jul 1, 2020

Hello @Juliehzl all comments resolved. Please merge the changes asap. thx

Copy link
Contributor

@mmyyrroonn mmyyrroonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved for private link part. 😃

@yonzhan
Copy link
Collaborator

yonzhan commented Jul 3, 2020

@Juliehzl Please help review this PR and get it merged by this Sprint.

@Juliehzl
Copy link
Contributor

Juliehzl commented Jul 3, 2020

Hello @Juliehzl all comments resolved. Please merge the changes asap. thx

#14027 (comment)

@ahamad-MS
Copy link
Contributor Author

@Juliehzl ... #14027 (comment) is already addressed and it is Won't Fix. Source is not Azure concept here. It is Event Grid concept stems from Cloud Event 1.0 specification. The world "source" is what we want to use and what makes sense to our customer. it can be Azure ARM ID or external to azure.

@ahamad-MS
Copy link
Contributor Author

@Juliehzl What is the ETA for merging this change?

@ahamad-MS
Copy link
Contributor Author

@myronfanqiu All new comments addressed on 7/6 are addressed.

@haroldrandom haroldrandom changed the title [Azure Event Grid]: Add CLI support for 2020-04-01-preview and mark preview features with is_Preview=True [Azure Event Grid] Add CLI support for 2020-04-01-preview and mark preview features with is_Preview=True Jul 6, 2020
@haroldrandom haroldrandom changed the title [Azure Event Grid] Add CLI support for 2020-04-01-preview and mark preview features with is_Preview=True [Event Grid] Add CLI support for 2020-04-01-preview and mark preview features with is_Preview=True Jul 6, 2020
@haroldrandom haroldrandom changed the title [Event Grid] Add CLI support for 2020-04-01-preview and mark preview features with is_Preview=True [EventGrid] Add CLI support for 2020-04-01-preview and mark preview features with is_Preview=True Jul 6, 2020
@haroldrandom haroldrandom merged commit 2c3a93d into Azure:dev Jul 6, 2020
@ahamad-MS ahamad-MS deleted the dev branch March 19, 2021 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants