Skip to content

Commit 19073d6

Browse files
{EventGrid} Add support for StorageQueueMessageTTL, AdvancedFilters, EnableAdvancedFilteringOnArrays (Azure#17440)
* Azure EventGrid: 2020-10-15-preview-Identity support for System MSI * [EventGrid] Add support for System Topic MSI * Remove secret and replace with <HIDDEN> * Remove secret * Add support for storage-queue-msg-ttl * Add EnableAdvancedFilteringOnArrays + New AdvancedFilters * enable_advanced_filtering_on_arrays arg type * Fix broken tests * Fix style error * Address review comments * address review comments * Add linter exclusion * Fix linter issue * Address review comments Co-authored-by: evelyn-ys <[email protected]>
1 parent 212f925 commit 19073d6

12 files changed

+1303
-2731
lines changed

linter_exclusions.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1650,12 +1650,13 @@ eventgrid partner namespace event-channel create:
16501650
activation_expiration_date:
16511651
rule_exclusions:
16521652
- option_length_too_long
1653-
desination_topic_name:
1653+
destination_topic_name:
16541654
rule_exclusions:
16551655
- option_length_too_long
16561656
destination_resource_group_name:
16571657
rule_exclusions:
16581658
- option_length_too_long
1659+
- parameter_should_not_end_in_resource_group
16591660
destination_subscription_id:
16601661
rule_exclusions:
16611662
- option_length_too_long

src/azure-cli/azure/cli/command_modules/eventgrid/_help.py

+121-6
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/eventgrid/_params.py

+26-8
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,18 @@ def load_arguments(self, _): # pylint: disable=too-many-statements
159159
c.argument('resource_group_name', arg_type=resource_group_name_type)
160160
c.argument('location', arg_type=get_location_type(self.cli_ctx))
161161
c.argument('tags', arg_type=tags_type)
162-
c.argument('included_event_types', arg_type=included_event_types_type)
162+
c.argument('included_event_types', arg_group="Filtering", arg_type=included_event_types_type)
163163
c.argument('labels', arg_type=labels_type)
164164
c.argument('endpoint_type', arg_type=get_enum_type(['webhook', 'eventhub', 'storagequeue', 'hybridconnection', 'servicebusqueue', 'servicebustopic', 'azurefunction'], default='webhook'))
165165
c.argument('delivery_identity_endpoint_type', arg_type=get_enum_type(['webhook', 'eventhub', 'storagequeue', 'hybridconnection', 'servicebusqueue', 'servicebustopic', 'azurefunction'], default=None), is_preview=True)
166166
c.argument('source_resource_id', help="Fully qualified identifier of the source Azure resource.")
167167
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. It is expected that the destination endpoint to be already created and available for use before executing any Event Grid command.")
168168
c.argument('delivery_identity_endpoint', help="Endpoint with identity 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.", is_preview=True)
169169
c.argument('event_subscription_name', help="Name of the event subscription.")
170-
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.")
171-
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.")
170+
c.argument('subject_begins_with', arg_group="Filtering", help="An optional string to filter events for an event subscription based on a prefix. Wildcard characters are not supported.")
171+
c.argument('subject_ends_with', arg_group="Filtering", help="An optional string to filter events for an event subscription based on a suffix. Wildcard characters are not supported.")
172172
c.argument('topic_type_name', help="Name of the topic type.")
173-
c.argument('is_subject_case_sensitive', arg_type=get_three_state_flag(), options_list=['--subject-case-sensitive'], help="Specify to indicate whether the subject fields should be compared in a case sensitive manner. True if flag present.", )
173+
c.argument('is_subject_case_sensitive', arg_group="Filtering", arg_type=get_three_state_flag(), options_list=['--subject-case-sensitive'], help="Specify to indicate whether the subject fields should be compared in a case sensitive manner. True if flag present.", )
174174
c.argument('input_mapping_fields', arg_type=input_mapping_fields_type)
175175
c.argument('input_mapping_default_values', arg_type=input_mapping_default_values_type)
176176
c.argument('input_schema', arg_type=input_schema_type)
@@ -198,10 +198,13 @@ def load_arguments(self, _): # pylint: disable=too-many-statements
198198
c.argument('setup_uri', help="URI of the partner website that can be used by Azure customers to setup Event Grid integration on an event source.")
199199
c.argument('partner_registration_id', help="The fully qualified ARM Id of the partner registration that should be associated with this partner namespace. This takes the following format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}.")
200200
c.argument('partner_topic_source', arg_type=partner_topic_source_type)
201-
c.argument('desination_topic_name', help="Name of the partner topic associated with the event channel.")
201+
c.argument('destination_topic_name', help="Name of the partner topic associated with the event channel.")
202202
c.argument('destination_resource_group_name', help="Azure Resource Group of the customer creating the event channel. The partner topic associated with the event channel will be created under this resource group.")
203203
c.argument('destination_subscription_id', help="Azure subscription Id of the customer creating the event channel. The partner topic associated with the event channel will be created under this Azure subscription.")
204204
c.argument('topic_type', help="Name of the topic type.", completer=get_resource_name_completion_list('Microsoft.EventGrid/topictypes'))
205+
c.argument('enable_advanced_filtering_on_arrays', is_preview=True, arg_type=get_three_state_flag(),
206+
options_list=['--enable-advanced-filtering-on-arrays', '--enable-af-arr'], arg_group="Filtering",
207+
help="Allows advanced filters to be evaluated against an array of values instead of expecting a singular value.")
205208

206209
with self.argument_context('eventgrid topic') as c:
207210
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'))
@@ -290,14 +293,19 @@ def load_arguments(self, _): # pylint: disable=too-many-statements
290293
c.argument('event_ttl', help="Event time to live (in minutes). Must be a number between 1 and 1440.")
291294
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.")
292295
c.argument('deadletter_identity_endpoint', help="The Azure resource ID of an Azure Storage blob container destination with identity where EventGrid should deadletter undeliverable events for this event subscription.")
293-
c.argument('advanced_filter', action=EventSubscriptionAddFilter, nargs='+')
296+
c.argument('advanced_filter', arg_group="Filtering", action=EventSubscriptionAddFilter, nargs='+')
294297
c.argument('expiration_date', help="Date or datetime (in UTC, e.g. '2018-11-30T11:59:59+00:00' or '2018-11-30') after which the event subscription would expire. By default, there is no expiration for the event subscription.")
295298
c.argument('azure_active_directory_tenant_id', help="The Azure Active Directory Tenant Id to get the access token that will be included as the bearer token in delivery requests. Applicable only for webhook as a destination")
296299
c.argument('azure_active_directory_application_id_or_uri', help="The Azure Active Directory Application Id or Uri to get the access token that will be included as the bearer token in delivery requests. Applicable only for webhook as a destination")
297300
c.argument('delivery_identity', arg_type=delivery_identity_type)
298301
c.argument('deadletter_identity', arg_type=deadletter_identity_type)
299302
c.argument('delivery_identity_endpoint', help="Endpoint with identity 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.", is_preview=True)
300303
c.argument('delivery_identity_endpoint_type', arg_type=get_enum_type(['webhook', 'eventhub', 'storagequeue', 'hybridconnection', 'servicebusqueue', 'servicebustopic', 'azurefunction'], default=None), is_preview=True)
304+
c.argument('storage_queue_msg_ttl',
305+
help="Storage queue message time to live in seconds.",
306+
type=int,
307+
options_list=['--storage-queue-msg-ttl', '--qttl'],
308+
is_preview=True)
301309

302310
with self.argument_context('eventgrid event-subscription list') as c:
303311
c.argument('odata_query', arg_type=odata_query_type, id_part=None)
@@ -315,11 +323,16 @@ def load_arguments(self, _): # pylint: disable=too-many-statements
315323
c.argument('preferred_batch_size_in_kilobytes', help="Preferred batch size in kilobytes. Must be a number between 1 and 1024.")
316324
c.argument('event_ttl', help="Event time to live (in minutes). Must be a number between 1 and 1440.")
317325
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.")
318-
c.argument('advanced_filter', action=EventSubscriptionAddFilter, nargs='+')
326+
c.argument('advanced_filter', arg_group="Filtering", action=EventSubscriptionAddFilter, nargs='+')
319327
c.argument('expiration_date', help="Date or datetime (in UTC, e.g. '2018-11-30T11:59:59+00:00' or '2018-11-30') after which the event subscription would expire. By default, there is no expiration for the event subscription.")
320328
c.argument('azure_active_directory_tenant_id', help="The Azure Active Directory Tenant Id to get the access token that will be included as the bearer token in delivery requests. Applicable only for webhook as a destination")
321329
c.argument('azure_active_directory_application_id_or_uri', help="The Azure Active Directory Application Id or Uri to get the access token that will be included as the bearer token in delivery requests. Applicable only for webhook as a destination")
322330
c.argument('resource_group_name', arg_type=resource_group_name_type)
331+
c.argument('storage_queue_msg_ttl',
332+
help="Storage queue message time to live in seconds.",
333+
type=int,
334+
options_list=['--storage-queue-msg-ttl', '--qttl'],
335+
is_preview=True)
323336

324337
with self.argument_context('eventgrid system-topic event-subscription list') as c:
325338
c.argument('odata_query', arg_type=odata_query_type, id_part=None)
@@ -338,11 +351,16 @@ def load_arguments(self, _): # pylint: disable=too-many-statements
338351
c.argument('preferred_batch_size_in_kilobytes', help="Preferred batch size in kilobytes. Must be a number between 1 and 1024.")
339352
c.argument('event_ttl', help="Event time to live (in minutes). Must be a number between 1 and 1440.")
340353
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.")
341-
c.argument('advanced_filter', action=EventSubscriptionAddFilter, nargs='+')
354+
c.argument('advanced_filter', arg_group="Filtering", action=EventSubscriptionAddFilter, nargs='+')
342355
c.argument('expiration_date', help="Date or datetime (in UTC, e.g. '2018-11-30T11:59:59+00:00' or '2018-11-30') after which the event subscription would expire. By default, there is no expiration for the event subscription.")
343356
c.argument('azure_active_directory_tenant_id', help="The Azure Active Directory Tenant Id to get the access token that will be included as the bearer token in delivery requests. Applicable only for webhook as a destination")
344357
c.argument('azure_active_directory_application_id_or_uri', help="The Azure Active Directory Application Id or Uri to get the access token that will be included as the bearer token in delivery requests. Applicable only for webhook as a destination")
345358
c.argument('resource_group_name', arg_type=resource_group_name_type)
359+
c.argument('storage_queue_msg_ttl',
360+
help="Storage queue message time to live in seconds.",
361+
type=int,
362+
options_list=['--storage-queue-msg-ttl', '--qttl'],
363+
is_preview=True)
346364

347365
with self.argument_context('eventgrid partner topic event-subscription list') as c:
348366
c.argument('odata_query', arg_type=odata_query_type, id_part=None)

0 commit comments

Comments
 (0)