Hello community,

here is the log from the commit of package azure-cli-eventgrid for 
openSUSE:Factory checked in at 2019-05-22 10:59:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/azure-cli-eventgrid (Old)
 and      /work/SRC/openSUSE:Factory/.azure-cli-eventgrid.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "azure-cli-eventgrid"

Wed May 22 10:59:55 2019 rev:5 rq:696833 version:0.2.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/azure-cli-eventgrid/azure-cli-eventgrid.changes  
2018-10-15 10:48:08.811088490 +0200
+++ 
/work/SRC/openSUSE:Factory/.azure-cli-eventgrid.new.5148/azure-cli-eventgrid.changes
        2019-05-22 10:59:59.146769882 +0200
@@ -1,0 +2,16 @@
+Tue Apr 16 14:32:12 UTC 2019 - John Paul Adrian Glaubitz 
<adrian.glaub...@suse.com>
+
+- New upstream release
+  + Version 0.2.1
+  + For detailed information about changes see the
+    HISTORY.txt file provided with this package
+- Bump minimum version for Python Azure SDK namespace
+  packages to 3.0.0 in BuildRequires and Requires
+- Remove python3-devel package from BuildRequires
+- Remove unzip package from BuildRequires
+- Run fdupes to hardlink duplicate files
+  + Add fdupes to BuildRequires
+  + Add %fdupes invocation to %install
+- Update Requires from setup.py
+
+-------------------------------------------------------------------

Old:
----
  azure-cli-eventgrid-0.2.0.tar.gz

New:
----
  azure-cli-eventgrid-0.2.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ azure-cli-eventgrid.spec ++++++
--- /var/tmp/diff_new_pack.Vbe9Tt/_old  2019-05-22 11:00:00.782767763 +0200
+++ /var/tmp/diff_new_pack.Vbe9Tt/_new  2019-05-22 11:00:00.822767711 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package azure-cli-eventgrid
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           azure-cli-eventgrid
-Version:        0.2.0
+Version:        0.2.1
 Release:        0
 Summary:        Microsoft Azure CLI 'eventgrid' Command Module
 License:        MIT
@@ -27,15 +27,14 @@
 Source1:        LICENSE.txt
 BuildRequires:  azure-cli-command-modules-nspkg
 BuildRequires:  azure-cli-nspkg
-BuildRequires:  python3-azure-nspkg
-BuildRequires:  python3-devel
+BuildRequires:  fdupes
+BuildRequires:  python3-azure-nspkg >= 3.0.0
 BuildRequires:  python3-setuptools
-BuildRequires:  unzip
 Requires:       azure-cli-command-modules-nspkg
 Requires:       azure-cli-core
 Requires:       azure-cli-nspkg
-Requires:       python3-azure-mgmt-eventgrid >= 0.4.0
-Requires:       python3-azure-nspkg
+Requires:       python3-azure-mgmt-eventgrid >= 2.0.0
+Requires:       python3-azure-nspkg >= 3.0.0
 Requires:       python3-six
 Conflicts:      azure-cli < 2.0.0
 
@@ -56,6 +55,7 @@
 
 %install
 python3 setup.py install --root=%{buildroot} --prefix=%{_prefix} 
--install-lib=%{python3_sitelib}
+%python_expand %fdupes %{buildroot}%{$python_sitelib}
 rm -rf %{buildroot}%{python3_sitelib}/azure/cli/command_modules/__init__.*
 rm -rf %{buildroot}%{python3_sitelib}/azure/cli/command_modules/__pycache__
 rm -rf %{buildroot}%{python3_sitelib}/azure/cli/__init__.*

++++++ azure-cli-eventgrid-0.2.0.tar.gz -> azure-cli-eventgrid-0.2.1.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/azure-cli-eventgrid-0.2.0/HISTORY.rst 
new/azure-cli-eventgrid-0.2.1/HISTORY.rst
--- old/azure-cli-eventgrid-0.2.0/HISTORY.rst   2018-07-14 01:41:34.000000000 
+0200
+++ new/azure-cli-eventgrid-0.2.1/HISTORY.rst   2019-01-25 20:43:40.000000000 
+0100
@@ -3,6 +3,14 @@
 Release History
 ===============
 
+0.2.1
++++++
+* `event-subscription create/update`: Added `--deadletter-endpoint` parameter.
+* 'event-subscription create/update`: Added storagequeue and hybridconnection 
as new values for the `--endpoint-type` parameter.
+* `event-subscription create`: Added `--max-delivery-attempts` and 
`--event-ttl` parameters to specify the retry policy for events.
+* `event-subscription create/update`: Added a warning message for manual 
handshake validation when Webhook as destination is used for an event 
subscription.
+* Added source-resource-id parameter for all event subscription related 
commands and mark all other source resource related parameters as deprecated.
+
 0.2.0
 +++++
 * BREAKING CHANGE: 'show' commands log error message and fail with exit code 
of 3 upon a missing resource.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/azure-cli-eventgrid-0.2.0/PKG-INFO 
new/azure-cli-eventgrid-0.2.1/PKG-INFO
--- old/azure-cli-eventgrid-0.2.0/PKG-INFO      2018-07-14 01:41:43.000000000 
+0200
+++ new/azure-cli-eventgrid-0.2.1/PKG-INFO      2019-01-25 20:44:06.000000000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: azure-cli-eventgrid
-Version: 0.2.0
+Version: 0.2.1
 Summary: Microsoft Azure Command-Line Tools EventGrid Command Module
 Home-page: https://github.com/Azure/azure-cli
 Author: Microsoft Corporation
@@ -20,6 +20,14 @@
         Release History
         ===============
         
+        0.2.1
+        +++++
+        * `event-subscription create/update`: Added `--deadletter-endpoint` 
parameter.
+        * 'event-subscription create/update`: Added storagequeue and 
hybridconnection as new values for the `--endpoint-type` parameter.
+        * `event-subscription create`: Added `--max-delivery-attempts` and 
`--event-ttl` parameters to specify the retry policy for events.
+        * `event-subscription create/update`: Added a warning message for 
manual handshake validation when Webhook as destination is used for an event 
subscription.
+        * Added source-resource-id parameter for all event subscription 
related commands and mark all other source resource related parameters as 
deprecated.
+        
         0.2.0
         +++++
         * BREAKING CHANGE: 'show' commands log error message and fail with 
exit code of 3 upon a missing resource.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-eventgrid-0.2.0/azure/cli/command_modules/eventgrid/_help.py 
new/azure-cli-eventgrid-0.2.1/azure/cli/command_modules/eventgrid/_help.py
--- old/azure-cli-eventgrid-0.2.0/azure/cli/command_modules/eventgrid/_help.py  
2018-07-14 01:41:34.000000000 +0200
+++ new/azure-cli-eventgrid-0.2.1/azure/cli/command_modules/eventgrid/_help.py  
2019-01-25 20:43:40.000000000 +0100
@@ -53,7 +53,7 @@
         - name: Show the details of a topic.
           text: az eventgrid topic show -g rg1 -n topic1
         - name: Show the details of a topic based on resource ID.
-          text: az eventgrid topic show --ids 
/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/kalstest/providers/Microsoft.EventGrid/topics/topic1
+          text: az eventgrid topic show --ids 
/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1
     """
 helps['eventgrid topic key'] = """
     type: group
@@ -70,124 +70,234 @@
 helps['eventgrid event-subscription'] = """
     type: group
     short-summary: Manage event subscriptions for an Event Grid topic or for 
an Azure resource.
+    long-summary: Manage event subscriptions for an Event Grid topic, Azure 
subscription, resource group or for any other Azure resource that supports 
event notifications.
     """
 helps['eventgrid event-subscription create'] = """
     type: command
     short-summary: Create a new event subscription for an Event Grid topic or 
for an Azure resource.
+    parameters:
+        - name: --source-resource-id
+          short-summary: Fully qualified identifier of the Azure resource to 
which the event subscription needs to be created.
+          long-summary: |
+            Usage:                      --source-resource-id Azure-Resource-ID
+            For Azure subscription:     --source-resource-id 
/subscriptions/{SubID}
+            For resource group:         --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1
+            For EventGrid topic:        --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1
+            For storage account:        --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageaccounts/sa1
+        - name: --deadletter-endpoint
+          short-summary: The Azure resource ID of an Azure Storage blob 
container destination where EventGrid should deadletter undeliverable events 
for this event subscription.
+          long-summary: |
+            Example: --deadletter-endpoint 
/subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/sa1/blobServices/default/containers/containerName
+        - name: --endpoint-type
+          short-summary: The type of the destination endpoint.
     examples:
         - name: Create a new event subscription for an Event Grid topic, using 
default filters.
           text: |
-            az eventgrid event-subscription create -g rg1 --topic-name topic1 
--name es1 \\
+            az eventgrid event-subscription create --name es1 \\
+                --source-resource-id 
/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1
 \\
                 --endpoint https://contoso.azurewebsites.net/api/f1?code=code
-        - name: Create a new event subscription for a subscription, using 
default filters.
+        - name: Create a new event subscription for an Azure subscription 
subscription, using default filters.
           text: |
             az eventgrid event-subscription create --name es2 \\
+                --source-resource-id /subscriptions/{SubID} \\
                 --endpoint https://contoso.azurewebsites.net/api/f1?code=code
         - name: Create a new event subscription for a resource group, using 
default filters.
           text: |
-            az eventgrid event-subscription create -g rg1 --name es3 \\
+            az eventgrid event-subscription create --name es3 \\
+                --source-resource-id 
/subscriptions/{SubID}/resourceGroups/{RG} \\
                 --endpoint https://contoso.azurewebsites.net/api/f1?code=code
         - name: Create a new event subscription for a storage account, using 
default filters.
           text: |
-            az eventgrid event-subscription create --resource-id 
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/kalstest/providers/Microsoft.Storage/storageaccounts/kalsegblob"
 --name es3 \\
+            az eventgrid event-subscription create --name es3 \\
+                --source-resource-id 
"/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/s1"
  \\
                 --endpoint https://contoso.azurewebsites.net/api/f1?code=code
-        - name: Create a new event subscription for a subscription, with a 
filter specifying a subject prefix.
+        - name: Create a new event subscription for an Azure subscription, 
with a filter specifying a subject prefix.
           text: |
             az eventgrid event-subscription create --name es4 \\
+                --source-resource-id /subscriptions/{SubID} \\
                 --endpoint https://contoso.azurewebsites.net/api/f1?code=code 
\\
                 --subject-begins-with mysubject_prefix
         - name: Create a new event subscription for a resource group, with a 
filter specifying a subject suffix.
           text: |
-            az eventgrid event-subscription create -g rg2 --name es5 \\
+            az eventgrid event-subscription create --name es5 \\
+                --source-resource-id 
/subscriptions/{SubID}/resourceGroups/{RG} \\
                 --endpoint https://contoso.azurewebsites.net/api/f1?code=code 
\\
                 --subject-ends-with mysubject_suffix
-        - name: Create a new event subscription for a subscription, using 
default filters, and an EventHub as a destination.
+        - name: Create a new event subscription for an Azure subscription, 
using default filters, and an EventHub as a destination.
           text: |
-            az eventgrid event-subscription create --name es2 --endpoint-type 
eventhub \\
-                --endpoint 
/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1
+            az eventgrid event-subscription create --name es2 \\
+                --source-resource-id /subscriptions/{SubID} \\
+                --endpoint-type eventhub \\
+                --endpoint 
/subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/n1/eventhubs/EH1
+        - name: Create a new event subscription for an Azure subscription, 
using default filters, and an Azure Storage queue as a destination.
+          text: |
+            az eventgrid event-subscription create --name es2 \\
+                --source-resource-id /subscriptions/{SubID} \\
+                --endpoint-type storagequeue \\
+                --endpoint 
/subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/sa1/queueservices/default/queues/q1
+        - name: Create a new event subscription for a storage account, with a 
deadletter destination and custom retry policy of maximum 10 delivery attempts 
and an Event TTL of 2 hours (whichever happens earlier).
+          text: |
+            az eventgrid event-subscription create --name es2 \\
+                --source-resource-id 
"/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/s1"
 \\
+                --endpoint https://contoso.azurewebsites.net/api/f1?code=code 
\\
+                --deadletter-endpoint 
/subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/s2/blobServices/default/containers/blobcontainer1
 \\
+                --max-delivery-attempts 10 --event-ttl 120
     """
 helps['eventgrid event-subscription update'] = """
     type: command
     short-summary: Update an event subscription.
+    parameters:
+        - name: --source-resource-id
+          short-summary: Fully qualified identifier of the Azure resource 
whose event subscription needs to be updated.
+          long-summary: |
+            Usage:                      --source-resource-id Azure-Resource-ID
+            For Azure subscription:     --source-resource-id 
/subscriptions/{SubID}
+            For resource group:         --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1
+            For EventGrid topic:        --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1
+            For storage account:        --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageaccounts/sa1
+        - name: --endpoint-type
+          short-summary: The type of the destination endpoint.
     examples:
         - name: Update an event subscription for an Event Grid topic to 
specify a new endpoint.
           text: |
-            az eventgrid event-subscription update -g rg1 --topic-name topic1 
--name es1 \\
+            az eventgrid event-subscription update --name es1 \\
+                --source-resource-id 
/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1
 \\
                 --endpoint https://contoso.azurewebsites.net/api/f1?code=code
-        - name: Update an event subscription for a subscription to specify a 
new subject-ends-with filter.
+        - name: Update an event subscription for an Azure subscription to 
specify a new subject-ends-with filter.
           text: |
-            az eventgrid event-subscription update --name es2 
--subject-ends-with .jpg
+            az eventgrid event-subscription update --name es2 \\
+                --source-resource-id /subscriptions/{SubID} \\
+                --subject-ends-with .jpg
         - name: Update an event subscription for a resource group to specify a 
new endpoint and a new subject-ends-with filter.
           text: |
-            az eventgrid event-subscription update -g rg1 --name es3  
--subject-ends-with .png \\
+            az eventgrid event-subscription update --name es3 \\
+                --source-resource-id 
/subscriptions/{SubID}/resourceGroups/{RG} \\
+                --subject-ends-with .png \\
                 --endpoint https://contoso.azurewebsites.net/api/f1?code=code
         - name: Update an event subscription for a storage account to specify 
a new list of included event types.
           text: |
-            az eventgrid event-subscription update --resource-id 
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/kalstest/providers/microsoft.storage/storageaccounts/kalsegblob"
 --name es3 \\
+            az eventgrid event-subscription update --name es3 \\
+                --source-resource-id 
"/subscriptions/{SubID}/resourceGroups/{RG}/providers/microsoft.storage/storageaccounts/kalsegblob"
 \\
                 --included-event-types Microsoft.Storage.BlobCreated 
Microsoft.Storage.BlobDeleted
+        - name: Update an event subscription for a storage account, to include 
a deadletter destination.
+          text: |
+            az eventgrid event-subscription update --name es2 \\
+                --source-resource-id 
"/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/kalsegblob"
 \\
+                --deadletter-endpoint 
/subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/sa1/blobServices/default/containers/blobcontainer1
     """
 helps['eventgrid event-subscription delete'] = """
     type: command
     short-summary: Delete an event subscription.
+    parameters:
+        - name: --source-resource-id
+          short-summary: Fully qualified identifier of the Azure resource 
whose event subscription needs to be deleted.
+          long-summary: |
+            Usage:                      --source-resource-id Azure-Resource-ID
+            For Azure subscription:     --source-resource-id 
/subscriptions/{SubID}
+            For resource group:         --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1
+            For EventGrid topic:        --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1
+            For storage account:        --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageaccounts/sa1
     examples:
         - name: Delete an event subscription for an Event Grid topic.
           text: |
-            az eventgrid event-subscription delete -g rg1 --topic-name topic1 
--name es1
-        - name: Delete an event subscription for a subscription.
+            az eventgrid event-subscription delete --name es1 \\
+                --source-resource-id 
/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1
+        - name: Delete an event subscription for an Azure subscription.
           text: |
-            az eventgrid event-subscription delete --name es2
+            az eventgrid event-subscription delete --name es2 \\
+                --source-resource-id /subscriptions/{SubID}
         - name: Delete an event subscription for a resource group.
           text: |
-            az eventgrid event-subscription delete -g rg1 --name es3
+            az eventgrid event-subscription delete --name es3 \\
+                --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}
         - name: Delete an event subscription for a storage account.
           text: |
-            az eventgrid event-subscription delete --resource-id 
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/kalstest/providers/microsoft.storage/storageaccounts/kalsegblob"
 --name es3
+            az eventgrid event-subscription delete --name es3 \\
+                --source-resource-id 
/subscriptions/{SubID}/resourceGroups/{RG}/providers/microsoft.storage/storageaccounts/kalsegblob
     """
 helps['eventgrid event-subscription list'] = """
     type: command
     short-summary: List event subscriptions.
+    long-summary: |
+        Event Grid supports both regional and global event subscriptions: 
Event subscriptions on regional resources (such as Storage accounts or Event 
Grid topics) are regional, while event subscriptions on global resources (such 
as an Azure subscription or resource group) are global.
+        Hence, you can list event subscriptions in a few different ways:
+        1. To list by the resource ID of the resource whose event 
subscriptions you want to list, specify the --source-resource-id parameter. No 
other parameters must be specified.
+        2. To list by a topic-type (e.g. storage accounts), specify the 
--topic-type parameter along with --location (e.g. "westus2") parameter. For 
global topic types (e.g. "Microsoft.Resources.Subscriptions"), specify the 
location value as "global".
+        3. To list all event subscriptions in a region (across all topic 
types), specify only the --location parameter.
+        4. For both #2 and #3 above, to filter only by a resource group, you 
can additionally specify the --resource-group parameter.
+    parameters:
+        - name: --topic-type-name
+          short-summary: Name of the topic-type whose event subscriptions need 
to be listed. When this is specified, you must also specify --location.
+          long-summary: |
+            Example 1: List all Storage event subscriptions in WestUS2
+                --resource-group TestRG --topic-type-name 
Microsoft.Storage.StorageAccounts --location westus2
+            Example 2: List all event subscriptions on Azure subscriptions
+                --topic-type-name Microsoft.Resources.Subscriptions --location 
global
+        - name: --source-resource-id
+          short-summary: Fully qualified identifier of the Azure resource 
whose event subscription needs to be listed.
+          long-summary: |
+            Usage:                      --source-resource-id Azure-Resource-ID
+            For Azure subscription:     --source-resource-id 
/subscriptions/{SubID}
+            For resource group:         --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1
+            For EventGrid topic:        --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1
+            For storage account:        --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageaccounts/sa1
     examples:
-        - name: List all event subscriptions for an Event Grid topic.
+        - name: List all event subscriptions created for an Event Grid topic.
           text: |
-            az eventgrid event-subscription list -g rg1 --topic-name topic1
-        - name: List all event subscriptions for a storage account.
+            az eventgrid event-subscription list --source-resource-id 
/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1
+        - name: List all event subscriptions created for a storage account.
           text: |
-            az eventgrid event-subscription list --resource-id 
/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/kalstest/providers/Microsoft.Storage/storageaccounts/kalsegblob
-        - name: List all event subscriptions for a topic-type in a specific 
location (under the currently selected Azure subscription).
+            az eventgrid event-subscription list --source-resource-id 
/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/kalsegblob
+        - name: List all event subscriptions created for an Azure subscription.
           text: |
-            az eventgrid event-subscription list --topic-type 
Microsoft.Storage.StorageAccounts --location westus2
-        - name: List all event subscriptions for a topic-type in a specific 
location under a specified resource group.
+            az eventgrid event-subscription list --source-resource-id 
/subscriptions/{SubID}
+        - name: List all event subscriptions created for a resource group.
           text: |
-            az eventgrid event-subscription list --topic-type 
Microsoft.Storage.StorageAccounts --location westus2 --resource-group kalstest
-        - name: List all regional event subscriptions in a specific location 
(under the currently selected Azure subscription).
+            az eventgrid event-subscription list --source-resource-id 
/subscriptions/{SubID}/resourceGroups/{RG}
+        - name: List all Storage event subscriptions (under the currently 
selected Azure subscription) in westus2.
           text: |
-            az eventgrid event-subscription list --location westus2
-        - name: List all event subscriptions in a specific location under a 
specified resource group.
+            az eventgrid event-subscription list --topic-type 
Microsoft.Storage.StorageAccounts --location westus2
+        - name: List all Storage event subscriptions (under the given resource 
group) in westus2.
           text: |
-            az eventgrid event-subscription list --location westus2 
--resource-group kalstest
-        - name: List all global event subscriptions (under the currently 
selected Azure subscription).
+            az eventgrid event-subscription list --topic-type 
Microsoft.Storage.StorageAccounts --location westus2 --resource-group {RG}
+        - name: List all regional or global event subscriptions (under the 
currently selected Azure subscription).
           text: |
-            az eventgrid event-subscription list
-        - name: List all global event subscriptions under the currently 
selected resource group.
+            az eventgrid event-subscription list --location westus2
+            az eventgrid event-subscription list --location global
+        - name: List all regional or global event subscriptions under a 
specified resource group.
           text: |
-            az eventgrid event-subscription list --resource-group kalstest
+            az eventgrid event-subscription list --location westus2 
--resource-group {RG}
+            az eventgrid event-subscription list --location global 
--resource-group {RG}
     """
 helps['eventgrid event-subscription show'] = """
     type: command
     short-summary: Get the details of an event subscription.
+    parameters:
+        - name: --source-resource-id
+          short-summary: Fully qualified identifier of the Azure resource 
whose event subscription needs to be shown.
+          long-summary: |
+            Usage:                      --source-resource-id Azure-Resource-ID
+            For Azure subscription:     --source-resource-id 
/subscriptions/{SubID}
+            For resource group:         --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1
+            For EventGrid topic:        --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1
+            For storage account:        --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageaccounts/sa1
     examples:
         - name: Show the details of an event subscription for an Event Grid 
topic.
           text: |
-            az eventgrid event-subscription show -g rg1 --topic-name topic1 
--name es1
-        - name: Show the details of an event subscription for a subscription.
+            az eventgrid event-subscription show --name es1 \\
+                --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/topic1
+        - name: Show the details of an event subscription for an Azure 
subscription.
           text: |
-            az eventgrid event-subscription show --name es2
+            az eventgrid event-subscription show --name es2 \\
+                --source-resource-id /subscriptions/{SubID}
         - name: Show the details of an event subscription for a resource group.
           text: |
-            az eventgrid event-subscription show -g rg1 --name es3
+            az eventgrid event-subscription show --name es3 \\
+                --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1
         - name: Show the details of an event subscription for a storage 
account.
           text: |
-            az eventgrid event-subscription show --resource-id 
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/kalstest/providers/microsoft.storage/storageaccounts/kalsegblob"
 --name es3
+            az eventgrid event-subscription show --name es3 \\
+                --source-resource-id 
/subscriptions/{SubID}/resourceGroups/rg1/providers/microsoft.storage/storageaccounts/kalsegblob
     """
 helps['eventgrid topic-type'] = """
     type: group
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-eventgrid-0.2.0/azure/cli/command_modules/eventgrid/_params.py 
new/azure-cli-eventgrid-0.2.1/azure/cli/command_modules/eventgrid/_params.py
--- 
old/azure-cli-eventgrid-0.2.0/azure/cli/command_modules/eventgrid/_params.py    
    2018-07-14 01:41:34.000000000 +0200
+++ 
new/azure-cli-eventgrid-0.2.1/azure/cli/command_modules/eventgrid/_params.py    
    2019-01-25 20:43:40.000000000 +0100
@@ -18,7 +18,7 @@
 )
 
 included_event_types_type = CLIArgumentType(
-    help="A space-separated list of event types. To subscribe to all event 
types, the string \"All\" should be specified.",
+    help="A space-separated list of event types. Example: 
Microsoft.Storage.BlobCreated Microsoft.Storage.BlobDeleted. To subscribe to 
all event types, the string \"All\" should be specified.",
     nargs='+'
 )
 
@@ -35,9 +35,10 @@
         c.argument('tags', arg_type=tags_type)
         c.argument('included_event_types', arg_type=included_event_types_type)
         c.argument('labels', arg_type=labels_type)
-        c.argument('endpoint_type', arg_type=get_enum_type(['webhook', 
'eventhub'], default='webhook'))
-        c.argument('resource_id', help="Fully qualified identifier of the 
Azure resource.")
-        c.argument('endpoint', help="Endpoint where EventGrid should deliver 
events matching this event subscription. For webhook endpoint type, this should 
be the corresponding webhook URL. For eventhub endpoint type, this should be 
the Azure ResourceID of the event hub.")
+        c.argument('endpoint_type', arg_type=get_enum_type(['webhook', 
'eventhub', 'storagequeue', 'hybridconnection'], default='webhook'))
+        c.argument('source_resource_id', help="Fully qualified identifier of 
the source Azure resource.")
+        c.argument('resource_id', 
deprecate_info=c.deprecate(redirect="--source-resource-id", expiration='2.1.0', 
hide=True), help="Fully qualified identifier of the Azure resource.")
+        c.argument('endpoint', help="Endpoint where EventGrid should deliver 
events matching this event subscription. For webhook endpoint type, this should 
be the corresponding webhook URL. For other endpoint types, this should be the 
Azure resource identifier of the endpoint.")
         c.argument('event_subscription_name', help="Name of the event 
subscription.")
         c.argument('subject_begins_with', help="An optional string to filter 
events for an event subscription based on a prefix. Wildcard characters are not 
supported.")
         c.argument('subject_ends_with', help="An optional string to filter 
events for an event subscription based on a suffix. Wildcard characters are not 
supported.")
@@ -47,21 +48,27 @@
     with self.argument_context('eventgrid topic') as c:
         c.argument('topic_name', arg_type=name_type, help='Name of the topic', 
id_part='name', 
completer=get_resource_name_completion_list('Microsoft.EventGrid/topics'))
 
+    with self.argument_context('eventgrid topic key list') as c:
+        c.argument('topic_name', id_part=None)
+
     with self.argument_context('eventgrid event-subscription') as c:
-        c.argument('topic_name', help='Name of the Event Grid topic', 
options_list=['--topic-name'], 
completer=get_resource_name_completion_list('Microsoft.EventGrid/topics'))
+        c.argument('topic_name', 
deprecate_info=c.deprecate(redirect="--source-resource-id", expiration='2.1.0', 
hide=True), help='Name of Event Grid topic', options_list=['--topic-name'], 
completer=get_resource_name_completion_list('Microsoft.EventGrid/topics'))
         c.argument('event_subscription_name', arg_type=name_type, help='Name 
of the event subscription')
+        c.argument('max_delivery_attempts', help="Maximum number of delivery 
attempts. Must be a number between 1 and 30.")
+        c.argument('event_ttl', help="Event time to live (in minutes). Must be 
a number between 1 and 1440.")
+        c.argument('deadletter_endpoint', help="The Azure resource ID of an 
Azure Storage blob container destination where EventGrid should deadletter 
undeliverable events for this event subscription.")
 
     with self.argument_context('eventgrid event-subscription create') as c:
-        c.argument('topic_name', help='Name of the Event Grid topic to which 
the event subscription needs to be created.', options_list=['--topic-name'], 
completer=get_resource_name_completion_list('Microsoft.EventGrid/topics'))
-        c.argument('event_subscription_name', arg_type=name_type, help='Name 
of the new event subscription')
-        c.argument('resource_id', help="Fully qualified identifier of the 
Azure resource to which the event subscription needs to be created.")
+        c.argument('resource_group_name', 
deprecate_info=c.deprecate(redirect="--source-resource-id", expiration='2.1.0', 
hide=True), arg_type=resource_group_name_type)
 
     with self.argument_context('eventgrid event-subscription delete') as c:
-        c.argument('topic_name', help='Name of the Event Grid topic whose 
event subscription needs to be deleted.', options_list=['--topic-name'], 
completer=get_resource_name_completion_list('Microsoft.EventGrid/topics'))
-        c.argument('event_subscription_name', arg_type=name_type, help='Name 
of the event subscription')
-        c.argument('resource_id', help="Fully qualified identifier of the 
Azure resource whose event subscription needs to be deleted.")
+        c.argument('resource_group_name', 
deprecate_info=c.deprecate(redirect="--source-resource-id", expiration='2.1.0', 
hide=True), arg_type=resource_group_name_type)
+
+    with self.argument_context('eventgrid event-subscription update') as c:
+        c.argument('resource_group_name', 
deprecate_info=c.deprecate(redirect="--source-resource-id", expiration='2.1.0', 
hide=True), arg_type=resource_group_name_type)
 
     with self.argument_context('eventgrid event-subscription show') as c:
+        c.argument('resource_group_name', 
deprecate_info=c.deprecate(redirect="--source-resource-id", expiration='2.1.0', 
hide=True), arg_type=resource_group_name_type)
         c.argument('include_full_endpoint_url', 
arg_type=get_three_state_flag(), options_list=['--include-full-endpoint-url'], 
help="Specify to indicate whether the full endpoint URL should be returned. 
True if flag present.", )
 
     with self.argument_context('eventgrid topic-type') as c:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-eventgrid-0.2.0/azure/cli/command_modules/eventgrid/commands.py 
new/azure-cli-eventgrid-0.2.1/azure/cli/command_modules/eventgrid/commands.py
--- 
old/azure-cli-eventgrid-0.2.0/azure/cli/command_modules/eventgrid/commands.py   
    2018-07-14 01:41:34.000000000 +0200
+++ 
new/azure-cli-eventgrid-0.2.1/azure/cli/command_modules/eventgrid/commands.py   
    2019-01-25 20:43:40.000000000 +0100
@@ -21,12 +21,12 @@
     )
 
     with self.command_group('eventgrid topic', topics_mgmt_util, 
client_factory=topics_factory) as g:
-        g.command('create', 'create_or_update')
         g.show_command('show', 'get')
         g.command('key list', 'list_shared_access_keys')
         g.command('key regenerate', 'regenerate_key')
         g.command('delete', 'delete')
         g.custom_command('list', 'cli_topic_list')
+        g.custom_command('create', 'cli_topic_create_or_update')
         g.generic_update_command('update',
                                  getter_name='get',
                                  setter_name='update',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-eventgrid-0.2.0/azure/cli/command_modules/eventgrid/custom.py 
new/azure-cli-eventgrid-0.2.1/azure/cli/command_modules/eventgrid/custom.py
--- old/azure-cli-eventgrid-0.2.0/azure/cli/command_modules/eventgrid/custom.py 
2018-07-14 01:41:34.000000000 +0200
+++ new/azure-cli-eventgrid-0.2.1/azure/cli/command_modules/eventgrid/custom.py 
2019-01-25 20:43:40.000000000 +0100
@@ -3,6 +3,7 @@
 # Licensed under the MIT License. See License.txt in the project root for 
license information.
 # 
--------------------------------------------------------------------------------------------
 
+import re
 from six.moves.urllib.parse import quote  # pylint: disable=import-error
 from knack.log import get_logger
 from knack.util import CLIError
@@ -13,7 +14,11 @@
     EventSubscription,
     EventSubscriptionUpdateParameters,
     WebHookEventSubscriptionDestination,
+    RetryPolicy,
     EventHubEventSubscriptionDestination,
+    StorageQueueEventSubscriptionDestination,
+    HybridConnectionEventSubscriptionDestination,
+    StorageBlobDeadLetterDestination,
     EventSubscriptionFilter)
 
 logger = get_logger(__name__)
@@ -25,6 +30,9 @@
 EVENTGRID_TOPICS = "topics"
 WEBHOOK_DESTINATION = "webhook"
 EVENTHUB_DESTINATION = "eventhub"
+STORAGEQUEUE_DESTINATION = "storagequeue"
+HYBRIDCONNECTION_DESTINATION = "hybridconnection"
+GLOBAL = "global"
 
 
 def cli_topic_list(
@@ -36,12 +44,30 @@
     return client.list_by_subscription()
 
 
-def cli_eventgrid_event_subscription_create(
+def cli_topic_create_or_update(
+        client,
+        resource_group_name,
+        topic_name,
+        location,
+        tags=None):
+    async_topic_create = client.create_or_update(
+        resource_group_name,
+        topic_name,
+        location,
+        tags)
+
+    created_topic = async_topic_create.result()
+
+    return created_topic
+
+
+def cli_eventgrid_event_subscription_create(   # pylint: 
disable=too-many-locals
         cmd,
         client,
         event_subscription_name,
         endpoint,
         resource_id=None,
+        source_resource_id=None,
         resource_group_name=None,
         topic_name=None,
         endpoint_type=WEBHOOK_DESTINATION,
@@ -49,27 +75,68 @@
         subject_begins_with=None,
         subject_ends_with=None,
         is_subject_case_sensitive=False,
+        max_delivery_attempts=30,
+        event_ttl=1440,
+        deadletter_endpoint=None,
         labels=None):
-    scope = _get_scope_for_event_subscription(cmd.cli_ctx, resource_id, 
topic_name, resource_group_name)
+    scope = _get_scope_for_event_subscription(
+        cli_ctx=cmd.cli_ctx,
+        source_resource_id=source_resource_id,
+        resource_id=resource_id,
+        topic_name=topic_name,
+        resource_group_name=resource_group_name)
+
+    # Construct RetryPolicy based on max_delivery_attempts and event_ttl
+    max_delivery_attempts = int(max_delivery_attempts)
+    event_ttl = int(event_ttl)
+    _validate_retry_policy(max_delivery_attempts, event_ttl)
+    retry_policy = RetryPolicy(max_delivery_attempts=max_delivery_attempts, 
event_time_to_live_in_minutes=event_ttl)
 
-    if endpoint_type.lower() == WEBHOOK_DESTINATION.lower():
-        destination = WebHookEventSubscriptionDestination(endpoint)
-    elif endpoint_type.lower() == EVENTHUB_DESTINATION.lower():
-        destination = EventHubEventSubscriptionDestination(endpoint)
+    destination = _get_endpoint_destination(endpoint_type, endpoint)
 
     event_subscription_filter = EventSubscriptionFilter(
-        subject_begins_with,
-        subject_ends_with,
-        included_event_types,
-        is_subject_case_sensitive)
-    event_subscription_info = EventSubscription(destination, 
event_subscription_filter, labels)
+        subject_begins_with=subject_begins_with,
+        subject_ends_with=subject_ends_with,
+        included_event_types=included_event_types,
+        is_subject_case_sensitive=is_subject_case_sensitive)
+
+    deadletter_destination = None
+    if deadletter_endpoint is not None:
+        deadletter_destination = 
_get_deadletter_destination(deadletter_endpoint)
+
+    event_subscription_info = EventSubscription(
+        destination=destination,
+        filter=event_subscription_filter,
+        labels=labels,
+        retry_policy=retry_policy,
+        dead_letter_destination=deadletter_destination)
+
+    _warn_if_manual_handshake_needed(endpoint_type, endpoint)
 
-    async_event_subscription_create = client.create_or_update(
+    return client.create_or_update(
         scope,
         event_subscription_name,
-        event_subscription_info)
-    created_event_subscription = async_event_subscription_create.result()
-    return created_event_subscription
+        event_subscription_info).result()
+
+
+def cli_eventgrid_event_subscription_delete(
+        cmd,
+        client,
+        event_subscription_name,
+        resource_id=None,
+        source_resource_id=None,
+        resource_group_name=None,
+        topic_name=None):
+    scope = _get_scope_for_event_subscription(
+        cli_ctx=cmd.cli_ctx,
+        source_resource_id=source_resource_id,
+        resource_id=resource_id,
+        topic_name=topic_name,
+        resource_group_name=resource_group_name)
+    async_event_subscription_delete = client.delete(
+        scope,
+        event_subscription_name)
+    return async_event_subscription_delete.result()
 
 
 def event_subscription_setter(
@@ -77,10 +144,16 @@
         client,
         parameters,
         event_subscription_name,
+        source_resource_id=None,
         resource_id=None,
         resource_group_name=None,
         topic_name=None):
-    scope = _get_scope_for_event_subscription(cmd.cli_ctx, resource_id, 
topic_name, resource_group_name)
+    scope = _get_scope_for_event_subscription(
+        cli_ctx=cmd.cli_ctx,
+        source_resource_id=source_resource_id,
+        resource_id=resource_id,
+        topic_name=topic_name,
+        resource_group_name=resource_group_name)
 
     async_event_subscription_update = client.update(
         scope,
@@ -94,11 +167,18 @@
         cmd,
         client,
         event_subscription_name,
+        source_resource_id=None,
         resource_id=None,
         resource_group_name=None,
         topic_name=None,
         include_full_endpoint_url=False):
-    scope = _get_scope_for_event_subscription(cmd.cli_ctx, resource_id, 
topic_name, resource_group_name)
+    scope = _get_scope_for_event_subscription(
+        cli_ctx=cmd.cli_ctx,
+        source_resource_id=source_resource_id,
+        resource_id=resource_id,
+        topic_name=topic_name,
+        resource_group_name=resource_group_name)
+
     retrieved_event_subscription = client.get(scope, event_subscription_name)
     destination = retrieved_event_subscription.destination
     if include_full_endpoint_url and isinstance(destination, 
WebHookEventSubscriptionDestination):
@@ -108,44 +188,39 @@
     return retrieved_event_subscription
 
 
-def cli_eventgrid_event_subscription_delete(
-        cmd,
-        client,
-        event_subscription_name,
-        resource_id=None,
-        resource_group_name=None,
-        topic_name=None):
-    scope = _get_scope_for_event_subscription(cmd.cli_ctx, resource_id, 
topic_name, resource_group_name)
-    return client.delete(scope, event_subscription_name)
-
-
 def cli_event_subscription_list(   # pylint: disable=too-many-return-statements
         client,
         resource_id=None,
-        resource_group_name=None,
+        source_resource_id=None,
         topic_name=None,
+        resource_group_name=None,
         location=None,
         topic_type_name=None):
-    if resource_id:
-        # Resource ID is specified, we need to list only for the particular 
resource.
-        if resource_group_name is not None or topic_name is not None:
-            raise CLIError('Since ResourceId is specified, topic-name and 
resource-group-name should not be specified.')
-
-        id_parts = parse_resource_id(resource_id)
-        rg_name = id_parts['resource_group']
-        resource_name = id_parts['name']
-        provider_namespace = id_parts['namespace']
-        resource_type = id_parts['resource_type']
+    if source_resource_id is not None:
+        # If Source Resource ID is specified, we need to list event 
subscriptions for that particular resource.
+        # Since a full resource ID is specified, it should override all other 
defaults such as default location and RG
+        # No other parameters must be specified
+        if (topic_type_name is not None or resource_id is not None):
+            raise CLIError('usage error: Since --source-resource-id is 
specified, none of the other parameters must '
+                           'be specified.')
+
+        return _list_event_subscriptions_by_resource_id(client, 
source_resource_id)
+
+    if resource_id is not None:
+        # DEPRECATED
+        # If resource ID is specified, we need to list event subscriptions for 
that particular resource.
+        # Since a full resource ID is specified, it should override all other 
defaults such as default location and RG
+        # No other parameters must be specified
+        if topic_type_name is not None:
+            raise CLIError('usage error: Since --resource-id is specified, 
none of the other parameters must '
+                           'be specified.')
 
-        return client.list_by_resource(
-            rg_name,
-            provider_namespace,
-            resource_type,
-            resource_name)
+        return _list_event_subscriptions_by_resource_id(client, resource_id)
 
     if topic_name:
+        # DEPRECATED
         if resource_group_name is None:
-            raise CLIError('Since topic-name is specified, resource-group-name 
must also be specified.')
+            raise CLIError('Since --topic-name is specified, --resource-group 
must also be specified.')
 
         return client.list_by_resource(
             resource_group_name,
@@ -153,37 +228,37 @@
             EVENTGRID_TOPICS,
             topic_name)
 
-    if topic_type_name:
-        if location:
+    if location is None:
+        # Since resource-id was not specified, location must be specified: 
e.g. "westus2" or "global". If not error OUT.
+        raise CLIError('usage error: --source-resource-id ID | --location 
LOCATION'
+                       ' [--resource-group RG] [--topic-type-name 
TOPIC_TYPE_NAME]')
+
+    if topic_type_name is None:
+        # No topic-type is specified: return event subscriptions across all 
topic types for this location.
+        if location.lower() == GLOBAL.lower():
             if resource_group_name:
-                return client.list_regional_by_resource_group_for_topic_type(
-                    resource_group_name,
-                    location,
-                    topic_type_name)
-
-            return client.list_regional_by_subscription_for_topic_type(
-                location,
-                topic_type_name)
+                return 
client.list_global_by_resource_group(resource_group_name)
+            return client.list_global_by_subscription()
 
         if resource_group_name:
-            return client.list_global_by_resource_group_for_topic_type(
-                resource_group_name,
-                topic_type_name)
-
-        return 
client.list_global_by_subscription_for_topic_type(topic_type_name)
+            return client.list_regional_by_resource_group(resource_group_name, 
location)
+        return client.list_regional_by_subscription(location)
 
-    if location:
+    # Topic type name is specified
+    if location.lower() == GLOBAL.lower():
+        if not _is_topic_type_global_resource(topic_type_name):
+            raise CLIError('Invalid usage: Global cannot be specified for the 
location '
+                           'as the specified topic type is a regional topic 
type with '
+                           'regional event subscriptions. Specify a location 
value such '
+                           'as westus. Global can be used only for global 
topic types: '
+                           'Microsoft.Resources.Subscriptions and 
Microsoft.Resources.ResourceGroups.')
         if resource_group_name:
-            return client.list_regional_by_resource_group(
-                resource_group_name,
-                location)
-
-        return client.list_regional_by_subscription(location)
+            return 
client.list_global_by_resource_group_for_topic_type(resource_group_name, 
topic_type_name)
+        return 
client.list_global_by_subscription_for_topic_type(topic_type_name)
 
     if resource_group_name:
-        return client.list_global_by_resource_group(resource_group_name)
-
-    return client.list_global_by_subscription()
+        return 
client.list_regional_by_resource_group_for_topic_type(resource_group_name, 
location, topic_type_name)
+    return client.list_regional_by_subscription_for_topic_type(location, 
topic_type_name)
 
 
 def _get_scope(
@@ -219,21 +294,42 @@
 def _get_scope_for_event_subscription(
         cli_ctx,
         resource_id,
+        source_resource_id,
         topic_name,
         resource_group_name):
-    if resource_id:
-        # Resource ID is provided, use that as the scope for the event 
subscription.
+    if all([resource_id, source_resource_id]):
+        raise CLIError('usage error: specify either "--resource-id" or 
"--source-resource-id", not both.')
+
+    if all([resource_id, topic_name]):
+        raise CLIError('usage error: specify either "--topic-name" or 
"--resource-id", not both.')
+
+    if all([source_resource_id, topic_name]):
+        raise CLIError('usage error: specify either "--topic-name" or 
"--source-resource-id", not both.')
+
+    # A default resource Group Name could have been configured
+    # but if --resource-id or --source-resource-id is provided, it always 
overrides it.
+
+    if source_resource_id:
+        # Source Resource ID is provided, use that as the scope for the event 
subscription.
+        # This is the latest non-deprecated way of specifying the source 
resource.
+        scope = source_resource_id
+    elif resource_id:
+        # Deprecated
         scope = resource_id
     elif topic_name:
-        # Topic name is provided, use the topic and resource group to build a 
scope for the user topic
+        # DEPRECATED: Topic name is provided, use the topic and resource group 
to build a scope for the user topic
         if resource_group_name is None:
-            raise CLIError("When topic name is specified, the resource group 
name must also be specified.")
+            raise CLIError("When --topic-name is specified, the 
--resource-group-name must also be specified.")
 
         scope = _get_scope(cli_ctx, resource_group_name, EVENTGRID_NAMESPACE, 
EVENTGRID_TOPICS, topic_name)
     elif resource_group_name:
-        # Event subscription to a resource group.
+        # DEPRECATED: Event subscription to a resource group.
         scope = _get_scope(cli_ctx, resource_group_name, RESOURCES_NAMESPACE, 
RESOURCE_GROUPS, resource_group_name)
     else:
+        # DEPRECATED
+        logger.warning('This default option uses Azure subscription as the 
source resource.'
+                       ' This is deprecated and will be removed in a future 
release.'
+                       ' Use `--source-resource-id /subscriptions/{subid}` 
instead.')
         scope = _get_scope(cli_ctx, None, RESOURCES_NAMESPACE, SUBSCRIPTIONS, 
get_subscription_id(cli_ctx))
 
     return scope
@@ -243,12 +339,17 @@
         cmd,
         client,
         event_subscription_name,
+        source_resource_id=None,
         resource_id=None,
         resource_group_name=None,
         topic_name=None):
-    scope = _get_scope_for_event_subscription(cmd.cli_ctx, resource_id, 
topic_name, resource_group_name)
-    retrieved_event_subscription = client.get(scope, event_subscription_name)
-    return retrieved_event_subscription
+    scope = _get_scope_for_event_subscription(
+        cli_ctx=cmd.cli_ctx,
+        source_resource_id=source_resource_id,
+        resource_id=resource_id,
+        topic_name=topic_name,
+        resource_group_name=resource_group_name)
+    return client.get(scope, event_subscription_name)
 
 
 def update_event_subscription(
@@ -258,16 +359,23 @@
         subject_begins_with=None,
         subject_ends_with=None,
         included_event_types=None,
-        labels=None):
+        labels=None,
+        deadletter_endpoint=None):
     event_subscription_destination = None
+    deadletter_destination = None
     event_subscription_labels = instance.labels
     event_subscription_filter = instance.filter
 
+    retry_policy = instance.retry_policy
+
+    if endpoint_type.lower() != WEBHOOK_DESTINATION.lower() and endpoint is 
None:
+        raise CLIError('Invalid usage: Since --endpoint-type is specified, a 
valid endpoint must also be specified.')
+
     if endpoint is not None:
-        if endpoint_type.lower() == WEBHOOK_DESTINATION.lower():
-            event_subscription_destination = 
WebHookEventSubscriptionDestination(endpoint)
-        elif endpoint_type.lower() == EVENTHUB_DESTINATION.lower():
-            event_subscription_destination = 
EventHubEventSubscriptionDestination(endpoint)
+        event_subscription_destination = 
_get_endpoint_destination(endpoint_type, endpoint)
+
+    if deadletter_endpoint is not None:
+        deadletter_destination = 
_get_deadletter_destination(deadletter_endpoint)
 
     if subject_begins_with is not None:
         event_subscription_filter.subject_begins_with = subject_begins_with
@@ -284,7 +392,154 @@
     params = EventSubscriptionUpdateParameters(
         destination=event_subscription_destination,
         filter=event_subscription_filter,
-        labels=event_subscription_labels
+        labels=event_subscription_labels,
+        retry_policy=retry_policy,
+        dead_letter_destination=deadletter_destination
     )
 
     return params
+
+
+def _get_endpoint_destination(endpoint_type, endpoint):
+    if endpoint_type.lower() == WEBHOOK_DESTINATION.lower():
+        destination = 
WebHookEventSubscriptionDestination(endpoint_url=endpoint)
+    elif endpoint_type.lower() == EVENTHUB_DESTINATION.lower():
+        destination = 
EventHubEventSubscriptionDestination(resource_id=endpoint)
+    elif endpoint_type.lower() == HYBRIDCONNECTION_DESTINATION.lower():
+        destination = 
HybridConnectionEventSubscriptionDestination(resource_id=endpoint)
+    elif endpoint_type.lower() == STORAGEQUEUE_DESTINATION.lower():
+        destination = _get_storage_queue_destination(endpoint)
+
+    return destination
+
+
+def _get_storage_queue_destination(endpoint):
+    # Supplied endpoint would be in the following format:
+    # 
/subscriptions/.../storageAccounts/sa1/queueServices/default/queues/{queueName}))
+    # and we need to break it up into:
+    # /subscriptions/.../storageAccounts/sa1 and queueName
+    queue_items = re.split(
+        "/queueServices/default/queues/", endpoint, flags=re.IGNORECASE)
+
+    if len(queue_items) != 2 or queue_items[0] is None or queue_items[1] is 
None:
+        raise CLIError('Argument Error: Expected format of --endpoint for 
storage queue is:' +
+                       
'/subscriptions/id/resourceGroups/rg/providers/Microsoft.Storage/' +
+                       
'storageAccounts/sa1/queueServices/default/queues/queueName')
+
+    return 
StorageQueueEventSubscriptionDestination(resource_id=queue_items[0], 
queue_name=queue_items[1])
+
+
+def _get_deadletter_destination(deadletter_endpoint):
+    blob_items = re.split(
+        "/blobServices/default/containers/", deadletter_endpoint, 
flags=re.IGNORECASE)
+
+    if len(blob_items) != 2 or blob_items[0] is None or blob_items[1] is None:
+        raise CLIError('Argument Error: Expected format of 
--deadletter-endpoint is:' +
+                       
'/subscriptions/id/resourceGroups/rg/providers/Microsoft.Storage/' +
+                       
'storageAccounts/sa1/blobServices/default/containers/containerName')
+
+    return StorageBlobDeadLetterDestination(resource_id=blob_items[0], 
blob_container_name=blob_items[1])
+
+
+def _validate_retry_policy(max_delivery_attempts, event_ttl):
+    if max_delivery_attempts < 1 or max_delivery_attempts > 30:
+        raise CLIError('--max-delivery-attempts should be a number between 1 
and 30.')
+
+    if event_ttl < 1 or event_ttl > 1440:
+        raise CLIError('--event-ttl should be a number between 1 and 1440.')
+
+
+def _warn_if_manual_handshake_needed(endpoint_type, endpoint):
+    # If the endpoint belongs to a service that we know implements the 
subscription validation
+    # handshake, there's no need to show this message, hence we check for 
those services
+    # before showing this message. This list includes Azure Automation, 
EventGrid Trigger based
+    # Azure functions, and Azure Logic Apps.
+    if endpoint_type.lower() == WEBHOOK_DESTINATION.lower() and \
+       "azure-automation" not in endpoint.lower() and \
+       "eventgridextension" not in endpoint.lower() and \
+       "logic.azure" not in endpoint.lower():
+
+        logger.warning('If the provided endpoint does not support subscription 
validation '
+                       'handshake, navigate to the validation URL that you 
receive in the '
+                       'subscription validation event, in order to complete 
the event '
+                       'subscription creation or update. For more details, '
+                       'please visit http://aka.ms/esvalidation')
+
+
+def _list_event_subscriptions_by_resource_id(client, resource_id):
+    # parse_resource_id doesn't handle resource_ids for Azure subscriptions 
and RGs
+    # so, first try to look for those two patterns.
+    if resource_id is not None:
+        id_parts = list(filter(None, resource_id.split('/')))
+        if len(id_parts) < 5:
+            # Azure subscriptions or Resource group
+            if id_parts[0].lower() != "subscriptions":
+                raise CLIError('The specified value for resource-id is not in 
the'
+                               ' expected format. It should start with 
/subscriptions.')
+
+            subscription_id = id_parts[1]
+            _validate_subscription_id_matches_default_subscription_id(
+                default_subscription_id=client.config.subscription_id,
+                provided_subscription_id=subscription_id)
+
+            if len(id_parts) == 2:
+                return 
client.list_global_by_subscription_for_topic_type("Microsoft.Resources.Subscriptions")
+
+            if len(id_parts) == 4 and id_parts[2].lower() == "resourcegroups":
+                resource_group_name = id_parts[3]
+                if resource_group_name is None:
+                    raise CLIError('The specified value for resource-id is not'
+                                   ' in the expected format. A valid value for'
+                                   ' resource group must be provided.')
+                return client.list_global_by_resource_group_for_topic_type(
+                    resource_group_name,
+                    "Microsoft.Resources.ResourceGroups")
+
+    id_parts = parse_resource_id(resource_id)
+    subscription_id = id_parts.get('subscription')
+    _validate_subscription_id_matches_default_subscription_id(
+        default_subscription_id=client.config.subscription_id,
+        provided_subscription_id=subscription_id)
+
+    rg_name = id_parts.get('resource_group')
+    resource_name = id_parts.get('name')
+    namespace = id_parts.get('namespace')
+    resource_type = id_parts.get('type')
+
+    if (subscription_id is None or rg_name is None or resource_name is None or
+            namespace is None or resource_type is None):
+        raise CLIError('The specified value for resource-id is not'
+                       ' in the expected format.')
+
+    # Invoke the standard list_by_resource
+    return client.list_by_resource(
+        rg_name,
+        namespace,
+        resource_type,
+        resource_name)
+
+
+def _is_topic_type_global_resource(topic_type_name):
+    # TODO: Add here if any other global topic types get added in the future.
+    TOPIC_TYPE_AZURE_SUBSCRIPTIONS = "Microsoft.Resources.Subscriptions"
+    TOPIC_TYPE_AZURE_RESOURCE_GROUP = "Microsoft.Resources.ResourceGroups"
+    TOPIC_TYPE_MAPS_ACCOUNTS = "Microsoft.Maps.Accounts"
+
+    if (topic_type_name.lower() == TOPIC_TYPE_AZURE_SUBSCRIPTIONS.lower() or
+            topic_type_name.lower() == TOPIC_TYPE_MAPS_ACCOUNTS or
+            topic_type_name.lower() == 
TOPIC_TYPE_AZURE_RESOURCE_GROUP.lower()):
+        return True
+
+    return False
+
+
+def _validate_subscription_id_matches_default_subscription_id(
+        default_subscription_id,
+        provided_subscription_id):
+    # The CLI/SDK infrastructure doesn't support overriding the subscription 
ID.
+    # Hence, we validate that the provided subscription ID is the same as the 
default
+    # configured subscription.
+    if provided_subscription_id.lower() != default_subscription_id.lower():
+        raise CLIError('The subscription ID in the specified resource-id'
+                       ' does not match the default subscription ID. To set 
the default subscription ID,'
+                       ' use az account set ID_OR_NAME, or use the global 
argument --subscription ')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-eventgrid-0.2.0/azure_cli_eventgrid.egg-info/PKG-INFO 
new/azure-cli-eventgrid-0.2.1/azure_cli_eventgrid.egg-info/PKG-INFO
--- old/azure-cli-eventgrid-0.2.0/azure_cli_eventgrid.egg-info/PKG-INFO 
2018-07-14 01:41:43.000000000 +0200
+++ new/azure-cli-eventgrid-0.2.1/azure_cli_eventgrid.egg-info/PKG-INFO 
2019-01-25 20:44:06.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: azure-cli-eventgrid
-Version: 0.2.0
+Version: 0.2.1
 Summary: Microsoft Azure Command-Line Tools EventGrid Command Module
 Home-page: https://github.com/Azure/azure-cli
 Author: Microsoft Corporation
@@ -20,6 +20,14 @@
         Release History
         ===============
         
+        0.2.1
+        +++++
+        * `event-subscription create/update`: Added `--deadletter-endpoint` 
parameter.
+        * 'event-subscription create/update`: Added storagequeue and 
hybridconnection as new values for the `--endpoint-type` parameter.
+        * `event-subscription create`: Added `--max-delivery-attempts` and 
`--event-ttl` parameters to specify the retry policy for events.
+        * `event-subscription create/update`: Added a warning message for 
manual handshake validation when Webhook as destination is used for an event 
subscription.
+        * Added source-resource-id parameter for all event subscription 
related commands and mark all other source resource related parameters as 
deprecated.
+        
         0.2.0
         +++++
         * BREAKING CHANGE: 'show' commands log error message and fail with 
exit code of 3 upon a missing resource.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-eventgrid-0.2.0/azure_cli_eventgrid.egg-info/requires.txt 
new/azure-cli-eventgrid-0.2.1/azure_cli_eventgrid.egg-info/requires.txt
--- old/azure-cli-eventgrid-0.2.0/azure_cli_eventgrid.egg-info/requires.txt     
2018-07-14 01:41:43.000000000 +0200
+++ new/azure-cli-eventgrid-0.2.1/azure_cli_eventgrid.egg-info/requires.txt     
2019-01-25 20:44:06.000000000 +0100
@@ -1,3 +1,3 @@
 azure-cli-core
 six
-azure-mgmt-eventgrid==0.4.0
+azure-mgmt-eventgrid==2.0.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/azure-cli-eventgrid-0.2.0/setup.py 
new/azure-cli-eventgrid-0.2.1/setup.py
--- old/azure-cli-eventgrid-0.2.0/setup.py      2018-07-14 01:41:34.000000000 
+0200
+++ new/azure-cli-eventgrid-0.2.1/setup.py      2019-01-25 20:43:40.000000000 
+0100
@@ -13,7 +13,7 @@
     logger.warn("Wheel is not available, disabling bdist_wheel hook")
     cmdclass = {}
 
-VERSION = "0.2.0"
+VERSION = "0.2.1"
 
 # The full list of classifiers is available at
 # https://pypi.python.org/pypi?%3Aaction=list_classifiers
@@ -33,7 +33,7 @@
 DEPENDENCIES = [
     'azure-cli-core',
     'six',
-    'azure-mgmt-eventgrid==0.4.0',
+    'azure-mgmt-eventgrid==2.0.0',
 ]
 
 with open('README.rst', 'r', encoding='utf-8') as f:


Reply via email to