azure_mgmt_event_grid 0.17.2 → 0.17.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +5 -5
  2. data/lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb +1 -1
  3. data/lib/2017-06-15-preview/generated/azure_mgmt_event_grid/models/topic_regenerate_key_request.rb +1 -1
  4. data/lib/2017-09-15-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb +1 -1
  5. data/lib/2017-09-15-preview/generated/azure_mgmt_event_grid/models/topic_regenerate_key_request.rb +1 -1
  6. data/lib/2018-01-01/generated/azure_mgmt_event_grid/event_grid_management_client.rb +1 -1
  7. data/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_regenerate_key_request.rb +1 -1
  8. data/lib/2018-05-01-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb +1 -1
  9. data/lib/2018-05-01-preview/generated/azure_mgmt_event_grid/models/json_field.rb +1 -1
  10. data/lib/2018-05-01-preview/generated/azure_mgmt_event_grid/models/json_field_with_default.rb +1 -1
  11. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb +1 -1
  12. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/advanced_filter.rb +2 -2
  13. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/json_field.rb +1 -1
  14. data/lib/2018-09-15-preview/generated/azure_mgmt_event_grid/models/json_field_with_default.rb +1 -1
  15. data/lib/2019-01-01/generated/azure_mgmt_event_grid/event_grid_management_client.rb +145 -0
  16. data/lib/2019-01-01/generated/azure_mgmt_event_grid/event_subscriptions.rb +1809 -0
  17. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/dead_letter_destination.rb +50 -0
  18. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/event_hub_event_subscription_destination.rb +62 -0
  19. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/event_subscription.rb +165 -0
  20. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/event_subscription_destination.rb +49 -0
  21. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/event_subscription_filter.rb +98 -0
  22. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/event_subscription_full_url.rb +47 -0
  23. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/event_subscription_provisioning_state.rb +21 -0
  24. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/event_subscription_update_parameters.rb +112 -0
  25. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/event_subscriptions_list_result.rb +55 -0
  26. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/event_type.rb +95 -0
  27. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/event_types_list_result.rb +55 -0
  28. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/hybrid_connection_event_subscription_destination.rb +64 -0
  29. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/operation.rb +80 -0
  30. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/operation_info.rb +79 -0
  31. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/operations_list_result.rb +55 -0
  32. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/resource.rb +80 -0
  33. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/resource_region_type.rb +16 -0
  34. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/retry_policy.rb +57 -0
  35. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/storage_blob_dead_letter_destination.rb +75 -0
  36. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/storage_queue_event_subscription_destination.rb +75 -0
  37. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/topic.rb +112 -0
  38. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/topic_provisioning_state.rb +20 -0
  39. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/topic_regenerate_key_request.rb +46 -0
  40. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/topic_shared_access_keys.rb +57 -0
  41. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/topic_type_info.rb +139 -0
  42. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/topic_type_provisioning_state.rb +20 -0
  43. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/topic_types_list_result.rb +55 -0
  44. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/topic_update_parameters.rb +54 -0
  45. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/topics_list_result.rb +55 -0
  46. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/tracked_resource.rb +92 -0
  47. data/lib/2019-01-01/generated/azure_mgmt_event_grid/models/web_hook_event_subscription_destination.rb +75 -0
  48. data/lib/2019-01-01/generated/azure_mgmt_event_grid/module_definition.rb +9 -0
  49. data/lib/2019-01-01/generated/azure_mgmt_event_grid/operations.rb +116 -0
  50. data/lib/2019-01-01/generated/azure_mgmt_event_grid/topic_types.rb +299 -0
  51. data/lib/2019-01-01/generated/azure_mgmt_event_grid/topics.rb +1095 -0
  52. data/lib/2019-01-01/generated/azure_mgmt_event_grid.rb +62 -0
  53. data/lib/azure_mgmt_event_grid.rb +1 -0
  54. data/lib/profiles/latest/modules/eventgrid_profile_module.rb +81 -193
  55. data/lib/version.rb +1 -1
  56. metadata +41 -3
@@ -0,0 +1,1809 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::EventGrid::Mgmt::V2019_01_01
7
+ #
8
+ # Azure EventGrid Management Client
9
+ #
10
+ class EventSubscriptions
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the EventSubscriptions class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [EventGridManagementClient] reference to the EventGridManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Get an event subscription
26
+ #
27
+ # Get properties of an event subscription
28
+ #
29
+ # @param scope [String] The scope of the event subscription. The scope can be a
30
+ # subscription, or a resource group, or a top level resource belonging to a
31
+ # resource provider namespace, or an EventGrid topic. For example, use
32
+ # '/subscriptions/{subscriptionId}/' for a subscription,
33
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
34
+ # resource group, and
35
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
36
+ # for a resource, and
37
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
38
+ # for an EventGrid topic.
39
+ # @param event_subscription_name [String] Name of the event subscription
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [EventSubscription] operation results.
44
+ #
45
+ def get(scope, event_subscription_name, custom_headers:nil)
46
+ response = get_async(scope, event_subscription_name, custom_headers:custom_headers).value!
47
+ response.body unless response.nil?
48
+ end
49
+
50
+ #
51
+ # Get an event subscription
52
+ #
53
+ # Get properties of an event subscription
54
+ #
55
+ # @param scope [String] The scope of the event subscription. The scope can be a
56
+ # subscription, or a resource group, or a top level resource belonging to a
57
+ # resource provider namespace, or an EventGrid topic. For example, use
58
+ # '/subscriptions/{subscriptionId}/' for a subscription,
59
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
60
+ # resource group, and
61
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
62
+ # for a resource, and
63
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
64
+ # for an EventGrid topic.
65
+ # @param event_subscription_name [String] Name of the event subscription
66
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
67
+ # will be added to the HTTP request.
68
+ #
69
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
70
+ #
71
+ def get_with_http_info(scope, event_subscription_name, custom_headers:nil)
72
+ get_async(scope, event_subscription_name, custom_headers:custom_headers).value!
73
+ end
74
+
75
+ #
76
+ # Get an event subscription
77
+ #
78
+ # Get properties of an event subscription
79
+ #
80
+ # @param scope [String] The scope of the event subscription. The scope can be a
81
+ # subscription, or a resource group, or a top level resource belonging to a
82
+ # resource provider namespace, or an EventGrid topic. For example, use
83
+ # '/subscriptions/{subscriptionId}/' for a subscription,
84
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
85
+ # resource group, and
86
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
87
+ # for a resource, and
88
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
89
+ # for an EventGrid topic.
90
+ # @param event_subscription_name [String] Name of the event subscription
91
+ # @param [Hash{String => String}] A hash of custom headers that will be added
92
+ # to the HTTP request.
93
+ #
94
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
95
+ #
96
+ def get_async(scope, event_subscription_name, custom_headers:nil)
97
+ fail ArgumentError, 'scope is nil' if scope.nil?
98
+ fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil?
99
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
100
+
101
+
102
+ request_headers = {}
103
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
104
+
105
+ # Set Headers
106
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
107
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
108
+ path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'
109
+
110
+ request_url = @base_url || @client.base_url
111
+
112
+ options = {
113
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
114
+ path_params: {'eventSubscriptionName' => event_subscription_name},
115
+ skip_encoding_path_params: {'scope' => scope},
116
+ query_params: {'api-version' => @client.api_version},
117
+ headers: request_headers.merge(custom_headers || {}),
118
+ base_url: request_url
119
+ }
120
+ promise = @client.make_request_async(:get, path_template, options)
121
+
122
+ promise = promise.then do |result|
123
+ http_response = result.response
124
+ status_code = http_response.status
125
+ response_content = http_response.body
126
+ unless status_code == 200
127
+ error_model = JSON.load(response_content)
128
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
129
+ end
130
+
131
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
132
+ # Deserialize Response
133
+ if status_code == 200
134
+ begin
135
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
136
+ result_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscription.mapper()
137
+ result.body = @client.deserialize(result_mapper, parsed_response)
138
+ rescue Exception => e
139
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
140
+ end
141
+ end
142
+
143
+ result
144
+ end
145
+
146
+ promise.execute
147
+ end
148
+
149
+ #
150
+ # Create or update an event subscription
151
+ #
152
+ # Asynchronously creates a new event subscription or updates an existing event
153
+ # subscription based on the specified scope.
154
+ #
155
+ # @param scope [String] The identifier of the resource to which the event
156
+ # subscription needs to be created or updated. The scope can be a subscription,
157
+ # or a resource group, or a top level resource belonging to a resource provider
158
+ # namespace, or an EventGrid topic. For example, use
159
+ # '/subscriptions/{subscriptionId}/' for a subscription,
160
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
161
+ # resource group, and
162
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
163
+ # for a resource, and
164
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
165
+ # for an EventGrid topic.
166
+ # @param event_subscription_name [String] Name of the event subscription. Event
167
+ # subscription names must be between 3 and 64 characters in length and should
168
+ # use alphanumeric letters only.
169
+ # @param event_subscription_info [EventSubscription] Event subscription
170
+ # properties containing the destination and filter information
171
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
172
+ # will be added to the HTTP request.
173
+ #
174
+ # @return [EventSubscription] operation results.
175
+ #
176
+ def create_or_update(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
177
+ response = create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers).value!
178
+ response.body unless response.nil?
179
+ end
180
+
181
+ #
182
+ # @param scope [String] The identifier of the resource to which the event
183
+ # subscription needs to be created or updated. The scope can be a subscription,
184
+ # or a resource group, or a top level resource belonging to a resource provider
185
+ # namespace, or an EventGrid topic. For example, use
186
+ # '/subscriptions/{subscriptionId}/' for a subscription,
187
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
188
+ # resource group, and
189
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
190
+ # for a resource, and
191
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
192
+ # for an EventGrid topic.
193
+ # @param event_subscription_name [String] Name of the event subscription. Event
194
+ # subscription names must be between 3 and 64 characters in length and should
195
+ # use alphanumeric letters only.
196
+ # @param event_subscription_info [EventSubscription] Event subscription
197
+ # properties containing the destination and filter information
198
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
199
+ # will be added to the HTTP request.
200
+ #
201
+ # @return [Concurrent::Promise] promise which provides async access to http
202
+ # response.
203
+ #
204
+ def create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
205
+ # Send request
206
+ promise = begin_create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers)
207
+
208
+ promise = promise.then do |response|
209
+ # Defining deserialization method.
210
+ deserialize_method = lambda do |parsed_response|
211
+ result_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscription.mapper()
212
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
213
+ end
214
+
215
+ # Waiting for response.
216
+ @client.get_long_running_operation_result(response, deserialize_method)
217
+ end
218
+
219
+ promise
220
+ end
221
+
222
+ #
223
+ # Delete an event subscription
224
+ #
225
+ # Delete an existing event subscription
226
+ #
227
+ # @param scope [String] The scope of the event subscription. The scope can be a
228
+ # subscription, or a resource group, or a top level resource belonging to a
229
+ # resource provider namespace, or an EventGrid topic. For example, use
230
+ # '/subscriptions/{subscriptionId}/' for a subscription,
231
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
232
+ # resource group, and
233
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
234
+ # for a resource, and
235
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
236
+ # for an EventGrid topic.
237
+ # @param event_subscription_name [String] Name of the event subscription
238
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
239
+ # will be added to the HTTP request.
240
+ #
241
+ def delete(scope, event_subscription_name, custom_headers:nil)
242
+ response = delete_async(scope, event_subscription_name, custom_headers:custom_headers).value!
243
+ nil
244
+ end
245
+
246
+ #
247
+ # @param scope [String] The scope of the event subscription. The scope can be a
248
+ # subscription, or a resource group, or a top level resource belonging to a
249
+ # resource provider namespace, or an EventGrid topic. For example, use
250
+ # '/subscriptions/{subscriptionId}/' for a subscription,
251
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
252
+ # resource group, and
253
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
254
+ # for a resource, and
255
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
256
+ # for an EventGrid topic.
257
+ # @param event_subscription_name [String] Name of the event subscription
258
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
259
+ # will be added to the HTTP request.
260
+ #
261
+ # @return [Concurrent::Promise] promise which provides async access to http
262
+ # response.
263
+ #
264
+ def delete_async(scope, event_subscription_name, custom_headers:nil)
265
+ # Send request
266
+ promise = begin_delete_async(scope, event_subscription_name, custom_headers:custom_headers)
267
+
268
+ promise = promise.then do |response|
269
+ # Defining deserialization method.
270
+ deserialize_method = lambda do |parsed_response|
271
+ end
272
+
273
+ # Waiting for response.
274
+ @client.get_long_running_operation_result(response, deserialize_method)
275
+ end
276
+
277
+ promise
278
+ end
279
+
280
+ #
281
+ # Update an event subscription
282
+ #
283
+ # Asynchronously updates an existing event subscription.
284
+ #
285
+ # @param scope [String] The scope of existing event subscription. The scope can
286
+ # be a subscription, or a resource group, or a top level resource belonging to
287
+ # a resource provider namespace, or an EventGrid topic. For example, use
288
+ # '/subscriptions/{subscriptionId}/' for a subscription,
289
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
290
+ # resource group, and
291
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
292
+ # for a resource, and
293
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
294
+ # for an EventGrid topic.
295
+ # @param event_subscription_name [String] Name of the event subscription to be
296
+ # updated
297
+ # @param event_subscription_update_parameters
298
+ # [EventSubscriptionUpdateParameters] Updated event subscription information
299
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
300
+ # will be added to the HTTP request.
301
+ #
302
+ # @return [EventSubscription] operation results.
303
+ #
304
+ def update(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil)
305
+ response = update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:custom_headers).value!
306
+ response.body unless response.nil?
307
+ end
308
+
309
+ #
310
+ # @param scope [String] The scope of existing event subscription. The scope can
311
+ # be a subscription, or a resource group, or a top level resource belonging to
312
+ # a resource provider namespace, or an EventGrid topic. For example, use
313
+ # '/subscriptions/{subscriptionId}/' for a subscription,
314
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
315
+ # resource group, and
316
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
317
+ # for a resource, and
318
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
319
+ # for an EventGrid topic.
320
+ # @param event_subscription_name [String] Name of the event subscription to be
321
+ # updated
322
+ # @param event_subscription_update_parameters
323
+ # [EventSubscriptionUpdateParameters] Updated event subscription information
324
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
325
+ # will be added to the HTTP request.
326
+ #
327
+ # @return [Concurrent::Promise] promise which provides async access to http
328
+ # response.
329
+ #
330
+ def update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil)
331
+ # Send request
332
+ promise = begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:custom_headers)
333
+
334
+ promise = promise.then do |response|
335
+ # Defining deserialization method.
336
+ deserialize_method = lambda do |parsed_response|
337
+ result_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscription.mapper()
338
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
339
+ end
340
+
341
+ # Waiting for response.
342
+ @client.get_long_running_operation_result(response, deserialize_method)
343
+ end
344
+
345
+ promise
346
+ end
347
+
348
+ #
349
+ # Get full URL of an event subscription
350
+ #
351
+ # Get the full endpoint URL for an event subscription
352
+ #
353
+ # @param scope [String] The scope of the event subscription. The scope can be a
354
+ # subscription, or a resource group, or a top level resource belonging to a
355
+ # resource provider namespace, or an EventGrid topic. For example, use
356
+ # '/subscriptions/{subscriptionId}/' for a subscription,
357
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
358
+ # resource group, and
359
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
360
+ # for a resource, and
361
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
362
+ # for an EventGrid topic.
363
+ # @param event_subscription_name [String] Name of the event subscription
364
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
365
+ # will be added to the HTTP request.
366
+ #
367
+ # @return [EventSubscriptionFullUrl] operation results.
368
+ #
369
+ def get_full_url(scope, event_subscription_name, custom_headers:nil)
370
+ response = get_full_url_async(scope, event_subscription_name, custom_headers:custom_headers).value!
371
+ response.body unless response.nil?
372
+ end
373
+
374
+ #
375
+ # Get full URL of an event subscription
376
+ #
377
+ # Get the full endpoint URL for an event subscription
378
+ #
379
+ # @param scope [String] The scope of the event subscription. The scope can be a
380
+ # subscription, or a resource group, or a top level resource belonging to a
381
+ # resource provider namespace, or an EventGrid topic. For example, use
382
+ # '/subscriptions/{subscriptionId}/' for a subscription,
383
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
384
+ # resource group, and
385
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
386
+ # for a resource, and
387
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
388
+ # for an EventGrid topic.
389
+ # @param event_subscription_name [String] Name of the event subscription
390
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
391
+ # will be added to the HTTP request.
392
+ #
393
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
394
+ #
395
+ def get_full_url_with_http_info(scope, event_subscription_name, custom_headers:nil)
396
+ get_full_url_async(scope, event_subscription_name, custom_headers:custom_headers).value!
397
+ end
398
+
399
+ #
400
+ # Get full URL of an event subscription
401
+ #
402
+ # Get the full endpoint URL for an event subscription
403
+ #
404
+ # @param scope [String] The scope of the event subscription. The scope can be a
405
+ # subscription, or a resource group, or a top level resource belonging to a
406
+ # resource provider namespace, or an EventGrid topic. For example, use
407
+ # '/subscriptions/{subscriptionId}/' for a subscription,
408
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
409
+ # resource group, and
410
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
411
+ # for a resource, and
412
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
413
+ # for an EventGrid topic.
414
+ # @param event_subscription_name [String] Name of the event subscription
415
+ # @param [Hash{String => String}] A hash of custom headers that will be added
416
+ # to the HTTP request.
417
+ #
418
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
419
+ #
420
+ def get_full_url_async(scope, event_subscription_name, custom_headers:nil)
421
+ fail ArgumentError, 'scope is nil' if scope.nil?
422
+ fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil?
423
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
424
+
425
+
426
+ request_headers = {}
427
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
428
+
429
+ # Set Headers
430
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
431
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
432
+ path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl'
433
+
434
+ request_url = @base_url || @client.base_url
435
+
436
+ options = {
437
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
438
+ path_params: {'eventSubscriptionName' => event_subscription_name},
439
+ skip_encoding_path_params: {'scope' => scope},
440
+ query_params: {'api-version' => @client.api_version},
441
+ headers: request_headers.merge(custom_headers || {}),
442
+ base_url: request_url
443
+ }
444
+ promise = @client.make_request_async(:post, path_template, options)
445
+
446
+ promise = promise.then do |result|
447
+ http_response = result.response
448
+ status_code = http_response.status
449
+ response_content = http_response.body
450
+ unless status_code == 200
451
+ error_model = JSON.load(response_content)
452
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
453
+ end
454
+
455
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
456
+ # Deserialize Response
457
+ if status_code == 200
458
+ begin
459
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
460
+ result_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscriptionFullUrl.mapper()
461
+ result.body = @client.deserialize(result_mapper, parsed_response)
462
+ rescue Exception => e
463
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
464
+ end
465
+ end
466
+
467
+ result
468
+ end
469
+
470
+ promise.execute
471
+ end
472
+
473
+ #
474
+ # Get an aggregated list of all global event subscriptions under an Azure
475
+ # subscription
476
+ #
477
+ # List all aggregated global event subscriptions under a specific Azure
478
+ # subscription
479
+ #
480
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
481
+ # will be added to the HTTP request.
482
+ #
483
+ # @return [EventSubscriptionsListResult] operation results.
484
+ #
485
+ def list_global_by_subscription(custom_headers:nil)
486
+ response = list_global_by_subscription_async(custom_headers:custom_headers).value!
487
+ response.body unless response.nil?
488
+ end
489
+
490
+ #
491
+ # Get an aggregated list of all global event subscriptions under an Azure
492
+ # subscription
493
+ #
494
+ # List all aggregated global event subscriptions under a specific Azure
495
+ # subscription
496
+ #
497
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
498
+ # will be added to the HTTP request.
499
+ #
500
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
501
+ #
502
+ def list_global_by_subscription_with_http_info(custom_headers:nil)
503
+ list_global_by_subscription_async(custom_headers:custom_headers).value!
504
+ end
505
+
506
+ #
507
+ # Get an aggregated list of all global event subscriptions under an Azure
508
+ # subscription
509
+ #
510
+ # List all aggregated global event subscriptions under a specific Azure
511
+ # subscription
512
+ #
513
+ # @param [Hash{String => String}] A hash of custom headers that will be added
514
+ # to the HTTP request.
515
+ #
516
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
517
+ #
518
+ def list_global_by_subscription_async(custom_headers:nil)
519
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
520
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
521
+
522
+
523
+ request_headers = {}
524
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
525
+
526
+ # Set Headers
527
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
528
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
529
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions'
530
+
531
+ request_url = @base_url || @client.base_url
532
+
533
+ options = {
534
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
535
+ path_params: {'subscriptionId' => @client.subscription_id},
536
+ query_params: {'api-version' => @client.api_version},
537
+ headers: request_headers.merge(custom_headers || {}),
538
+ base_url: request_url
539
+ }
540
+ promise = @client.make_request_async(:get, path_template, options)
541
+
542
+ promise = promise.then do |result|
543
+ http_response = result.response
544
+ status_code = http_response.status
545
+ response_content = http_response.body
546
+ unless status_code == 200
547
+ error_model = JSON.load(response_content)
548
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
549
+ end
550
+
551
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
552
+ # Deserialize Response
553
+ if status_code == 200
554
+ begin
555
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
556
+ result_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscriptionsListResult.mapper()
557
+ result.body = @client.deserialize(result_mapper, parsed_response)
558
+ rescue Exception => e
559
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
560
+ end
561
+ end
562
+
563
+ result
564
+ end
565
+
566
+ promise.execute
567
+ end
568
+
569
+ #
570
+ # List all global event subscriptions for a topic type
571
+ #
572
+ # List all global event subscriptions under an Azure subscription for a topic
573
+ # type.
574
+ #
575
+ # @param topic_type_name [String] Name of the topic type
576
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
577
+ # will be added to the HTTP request.
578
+ #
579
+ # @return [EventSubscriptionsListResult] operation results.
580
+ #
581
+ def list_global_by_subscription_for_topic_type(topic_type_name, custom_headers:nil)
582
+ response = list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers:custom_headers).value!
583
+ response.body unless response.nil?
584
+ end
585
+
586
+ #
587
+ # List all global event subscriptions for a topic type
588
+ #
589
+ # List all global event subscriptions under an Azure subscription for a topic
590
+ # type.
591
+ #
592
+ # @param topic_type_name [String] Name of the topic type
593
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
594
+ # will be added to the HTTP request.
595
+ #
596
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
597
+ #
598
+ def list_global_by_subscription_for_topic_type_with_http_info(topic_type_name, custom_headers:nil)
599
+ list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers:custom_headers).value!
600
+ end
601
+
602
+ #
603
+ # List all global event subscriptions for a topic type
604
+ #
605
+ # List all global event subscriptions under an Azure subscription for a topic
606
+ # type.
607
+ #
608
+ # @param topic_type_name [String] Name of the topic type
609
+ # @param [Hash{String => String}] A hash of custom headers that will be added
610
+ # to the HTTP request.
611
+ #
612
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
613
+ #
614
+ def list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers:nil)
615
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
616
+ fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil?
617
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
618
+
619
+
620
+ request_headers = {}
621
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
622
+
623
+ # Set Headers
624
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
625
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
626
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'
627
+
628
+ request_url = @base_url || @client.base_url
629
+
630
+ options = {
631
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
632
+ path_params: {'subscriptionId' => @client.subscription_id,'topicTypeName' => topic_type_name},
633
+ query_params: {'api-version' => @client.api_version},
634
+ headers: request_headers.merge(custom_headers || {}),
635
+ base_url: request_url
636
+ }
637
+ promise = @client.make_request_async(:get, path_template, options)
638
+
639
+ promise = promise.then do |result|
640
+ http_response = result.response
641
+ status_code = http_response.status
642
+ response_content = http_response.body
643
+ unless status_code == 200
644
+ error_model = JSON.load(response_content)
645
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
646
+ end
647
+
648
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
649
+ # Deserialize Response
650
+ if status_code == 200
651
+ begin
652
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
653
+ result_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscriptionsListResult.mapper()
654
+ result.body = @client.deserialize(result_mapper, parsed_response)
655
+ rescue Exception => e
656
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
657
+ end
658
+ end
659
+
660
+ result
661
+ end
662
+
663
+ promise.execute
664
+ end
665
+
666
+ #
667
+ # List all global event subscriptions under an Azure subscription and resource
668
+ # group
669
+ #
670
+ # List all global event subscriptions under a specific Azure subscription and
671
+ # resource group
672
+ #
673
+ # @param resource_group_name [String] The name of the resource group within the
674
+ # user's subscription.
675
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
676
+ # will be added to the HTTP request.
677
+ #
678
+ # @return [EventSubscriptionsListResult] operation results.
679
+ #
680
+ def list_global_by_resource_group(resource_group_name, custom_headers:nil)
681
+ response = list_global_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
682
+ response.body unless response.nil?
683
+ end
684
+
685
+ #
686
+ # List all global event subscriptions under an Azure subscription and resource
687
+ # group
688
+ #
689
+ # List all global event subscriptions under a specific Azure subscription and
690
+ # resource group
691
+ #
692
+ # @param resource_group_name [String] The name of the resource group within the
693
+ # user's subscription.
694
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
695
+ # will be added to the HTTP request.
696
+ #
697
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
698
+ #
699
+ def list_global_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
700
+ list_global_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
701
+ end
702
+
703
+ #
704
+ # List all global event subscriptions under an Azure subscription and resource
705
+ # group
706
+ #
707
+ # List all global event subscriptions under a specific Azure subscription and
708
+ # resource group
709
+ #
710
+ # @param resource_group_name [String] The name of the resource group within the
711
+ # user's subscription.
712
+ # @param [Hash{String => String}] A hash of custom headers that will be added
713
+ # to the HTTP request.
714
+ #
715
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
716
+ #
717
+ def list_global_by_resource_group_async(resource_group_name, custom_headers:nil)
718
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
719
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
720
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
721
+
722
+
723
+ request_headers = {}
724
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
725
+
726
+ # Set Headers
727
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
728
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
729
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions'
730
+
731
+ request_url = @base_url || @client.base_url
732
+
733
+ options = {
734
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
735
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
736
+ query_params: {'api-version' => @client.api_version},
737
+ headers: request_headers.merge(custom_headers || {}),
738
+ base_url: request_url
739
+ }
740
+ promise = @client.make_request_async(:get, path_template, options)
741
+
742
+ promise = promise.then do |result|
743
+ http_response = result.response
744
+ status_code = http_response.status
745
+ response_content = http_response.body
746
+ unless status_code == 200
747
+ error_model = JSON.load(response_content)
748
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
749
+ end
750
+
751
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
752
+ # Deserialize Response
753
+ if status_code == 200
754
+ begin
755
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
756
+ result_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscriptionsListResult.mapper()
757
+ result.body = @client.deserialize(result_mapper, parsed_response)
758
+ rescue Exception => e
759
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
760
+ end
761
+ end
762
+
763
+ result
764
+ end
765
+
766
+ promise.execute
767
+ end
768
+
769
+ #
770
+ # List all global event subscriptions under a resource group for a topic type
771
+ #
772
+ # List all global event subscriptions under a resource group for a specific
773
+ # topic type.
774
+ #
775
+ # @param resource_group_name [String] The name of the resource group within the
776
+ # user's subscription.
777
+ # @param topic_type_name [String] Name of the topic type
778
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
779
+ # will be added to the HTTP request.
780
+ #
781
+ # @return [EventSubscriptionsListResult] operation results.
782
+ #
783
+ def list_global_by_resource_group_for_topic_type(resource_group_name, topic_type_name, custom_headers:nil)
784
+ response = list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_name, custom_headers:custom_headers).value!
785
+ response.body unless response.nil?
786
+ end
787
+
788
+ #
789
+ # List all global event subscriptions under a resource group for a topic type
790
+ #
791
+ # List all global event subscriptions under a resource group for a specific
792
+ # topic type.
793
+ #
794
+ # @param resource_group_name [String] The name of the resource group within the
795
+ # user's subscription.
796
+ # @param topic_type_name [String] Name of the topic type
797
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
798
+ # will be added to the HTTP request.
799
+ #
800
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
801
+ #
802
+ def list_global_by_resource_group_for_topic_type_with_http_info(resource_group_name, topic_type_name, custom_headers:nil)
803
+ list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_name, custom_headers:custom_headers).value!
804
+ end
805
+
806
+ #
807
+ # List all global event subscriptions under a resource group for a topic type
808
+ #
809
+ # List all global event subscriptions under a resource group for a specific
810
+ # topic type.
811
+ #
812
+ # @param resource_group_name [String] The name of the resource group within the
813
+ # user's subscription.
814
+ # @param topic_type_name [String] Name of the topic type
815
+ # @param [Hash{String => String}] A hash of custom headers that will be added
816
+ # to the HTTP request.
817
+ #
818
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
819
+ #
820
+ def list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_name, custom_headers:nil)
821
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
822
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
823
+ fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil?
824
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
825
+
826
+
827
+ request_headers = {}
828
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
829
+
830
+ # Set Headers
831
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
832
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
833
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'
834
+
835
+ request_url = @base_url || @client.base_url
836
+
837
+ options = {
838
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
839
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicTypeName' => topic_type_name},
840
+ query_params: {'api-version' => @client.api_version},
841
+ headers: request_headers.merge(custom_headers || {}),
842
+ base_url: request_url
843
+ }
844
+ promise = @client.make_request_async(:get, path_template, options)
845
+
846
+ promise = promise.then do |result|
847
+ http_response = result.response
848
+ status_code = http_response.status
849
+ response_content = http_response.body
850
+ unless status_code == 200
851
+ error_model = JSON.load(response_content)
852
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
853
+ end
854
+
855
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
856
+ # Deserialize Response
857
+ if status_code == 200
858
+ begin
859
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
860
+ result_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscriptionsListResult.mapper()
861
+ result.body = @client.deserialize(result_mapper, parsed_response)
862
+ rescue Exception => e
863
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
864
+ end
865
+ end
866
+
867
+ result
868
+ end
869
+
870
+ promise.execute
871
+ end
872
+
873
+ #
874
+ # List all regional event subscriptions under an Azure subscription
875
+ #
876
+ # List all event subscriptions from the given location under a specific Azure
877
+ # subscription
878
+ #
879
+ # @param location [String] Name of the location
880
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
881
+ # will be added to the HTTP request.
882
+ #
883
+ # @return [EventSubscriptionsListResult] operation results.
884
+ #
885
+ def list_regional_by_subscription(location, custom_headers:nil)
886
+ response = list_regional_by_subscription_async(location, custom_headers:custom_headers).value!
887
+ response.body unless response.nil?
888
+ end
889
+
890
+ #
891
+ # List all regional event subscriptions under an Azure subscription
892
+ #
893
+ # List all event subscriptions from the given location under a specific Azure
894
+ # subscription
895
+ #
896
+ # @param location [String] Name of the location
897
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
898
+ # will be added to the HTTP request.
899
+ #
900
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
901
+ #
902
+ def list_regional_by_subscription_with_http_info(location, custom_headers:nil)
903
+ list_regional_by_subscription_async(location, custom_headers:custom_headers).value!
904
+ end
905
+
906
+ #
907
+ # List all regional event subscriptions under an Azure subscription
908
+ #
909
+ # List all event subscriptions from the given location under a specific Azure
910
+ # subscription
911
+ #
912
+ # @param location [String] Name of the location
913
+ # @param [Hash{String => String}] A hash of custom headers that will be added
914
+ # to the HTTP request.
915
+ #
916
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
917
+ #
918
+ def list_regional_by_subscription_async(location, custom_headers:nil)
919
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
920
+ fail ArgumentError, 'location is nil' if location.nil?
921
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
922
+
923
+
924
+ request_headers = {}
925
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
926
+
927
+ # Set Headers
928
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
929
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
930
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'
931
+
932
+ request_url = @base_url || @client.base_url
933
+
934
+ options = {
935
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
936
+ path_params: {'subscriptionId' => @client.subscription_id,'location' => location},
937
+ query_params: {'api-version' => @client.api_version},
938
+ headers: request_headers.merge(custom_headers || {}),
939
+ base_url: request_url
940
+ }
941
+ promise = @client.make_request_async(:get, path_template, options)
942
+
943
+ promise = promise.then do |result|
944
+ http_response = result.response
945
+ status_code = http_response.status
946
+ response_content = http_response.body
947
+ unless status_code == 200
948
+ error_model = JSON.load(response_content)
949
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
950
+ end
951
+
952
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
953
+ # Deserialize Response
954
+ if status_code == 200
955
+ begin
956
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
957
+ result_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscriptionsListResult.mapper()
958
+ result.body = @client.deserialize(result_mapper, parsed_response)
959
+ rescue Exception => e
960
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
961
+ end
962
+ end
963
+
964
+ result
965
+ end
966
+
967
+ promise.execute
968
+ end
969
+
970
+ #
971
+ # List all regional event subscriptions under an Azure subscription and
972
+ # resource group
973
+ #
974
+ # List all event subscriptions from the given location under a specific Azure
975
+ # subscription and resource group
976
+ #
977
+ # @param resource_group_name [String] The name of the resource group within the
978
+ # user's subscription.
979
+ # @param location [String] Name of the location
980
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
981
+ # will be added to the HTTP request.
982
+ #
983
+ # @return [EventSubscriptionsListResult] operation results.
984
+ #
985
+ def list_regional_by_resource_group(resource_group_name, location, custom_headers:nil)
986
+ response = list_regional_by_resource_group_async(resource_group_name, location, custom_headers:custom_headers).value!
987
+ response.body unless response.nil?
988
+ end
989
+
990
+ #
991
+ # List all regional event subscriptions under an Azure subscription and
992
+ # resource group
993
+ #
994
+ # List all event subscriptions from the given location under a specific Azure
995
+ # subscription and resource group
996
+ #
997
+ # @param resource_group_name [String] The name of the resource group within the
998
+ # user's subscription.
999
+ # @param location [String] Name of the location
1000
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1001
+ # will be added to the HTTP request.
1002
+ #
1003
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1004
+ #
1005
+ def list_regional_by_resource_group_with_http_info(resource_group_name, location, custom_headers:nil)
1006
+ list_regional_by_resource_group_async(resource_group_name, location, custom_headers:custom_headers).value!
1007
+ end
1008
+
1009
+ #
1010
+ # List all regional event subscriptions under an Azure subscription and
1011
+ # resource group
1012
+ #
1013
+ # List all event subscriptions from the given location under a specific Azure
1014
+ # subscription and resource group
1015
+ #
1016
+ # @param resource_group_name [String] The name of the resource group within the
1017
+ # user's subscription.
1018
+ # @param location [String] Name of the location
1019
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1020
+ # to the HTTP request.
1021
+ #
1022
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1023
+ #
1024
+ def list_regional_by_resource_group_async(resource_group_name, location, custom_headers:nil)
1025
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1026
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1027
+ fail ArgumentError, 'location is nil' if location.nil?
1028
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1029
+
1030
+
1031
+ request_headers = {}
1032
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1033
+
1034
+ # Set Headers
1035
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1036
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1037
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'
1038
+
1039
+ request_url = @base_url || @client.base_url
1040
+
1041
+ options = {
1042
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1043
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'location' => location},
1044
+ query_params: {'api-version' => @client.api_version},
1045
+ headers: request_headers.merge(custom_headers || {}),
1046
+ base_url: request_url
1047
+ }
1048
+ promise = @client.make_request_async(:get, path_template, options)
1049
+
1050
+ promise = promise.then do |result|
1051
+ http_response = result.response
1052
+ status_code = http_response.status
1053
+ response_content = http_response.body
1054
+ unless status_code == 200
1055
+ error_model = JSON.load(response_content)
1056
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1057
+ end
1058
+
1059
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1060
+ # Deserialize Response
1061
+ if status_code == 200
1062
+ begin
1063
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1064
+ result_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscriptionsListResult.mapper()
1065
+ result.body = @client.deserialize(result_mapper, parsed_response)
1066
+ rescue Exception => e
1067
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1068
+ end
1069
+ end
1070
+
1071
+ result
1072
+ end
1073
+
1074
+ promise.execute
1075
+ end
1076
+
1077
+ #
1078
+ # List all regional event subscriptions under an Azure subscription for a topic
1079
+ # type
1080
+ #
1081
+ # List all event subscriptions from the given location under a specific Azure
1082
+ # subscription and topic type.
1083
+ #
1084
+ # @param location [String] Name of the location
1085
+ # @param topic_type_name [String] Name of the topic type
1086
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1087
+ # will be added to the HTTP request.
1088
+ #
1089
+ # @return [EventSubscriptionsListResult] operation results.
1090
+ #
1091
+ def list_regional_by_subscription_for_topic_type(location, topic_type_name, custom_headers:nil)
1092
+ response = list_regional_by_subscription_for_topic_type_async(location, topic_type_name, custom_headers:custom_headers).value!
1093
+ response.body unless response.nil?
1094
+ end
1095
+
1096
+ #
1097
+ # List all regional event subscriptions under an Azure subscription for a topic
1098
+ # type
1099
+ #
1100
+ # List all event subscriptions from the given location under a specific Azure
1101
+ # subscription and topic type.
1102
+ #
1103
+ # @param location [String] Name of the location
1104
+ # @param topic_type_name [String] Name of the topic type
1105
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1106
+ # will be added to the HTTP request.
1107
+ #
1108
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1109
+ #
1110
+ def list_regional_by_subscription_for_topic_type_with_http_info(location, topic_type_name, custom_headers:nil)
1111
+ list_regional_by_subscription_for_topic_type_async(location, topic_type_name, custom_headers:custom_headers).value!
1112
+ end
1113
+
1114
+ #
1115
+ # List all regional event subscriptions under an Azure subscription for a topic
1116
+ # type
1117
+ #
1118
+ # List all event subscriptions from the given location under a specific Azure
1119
+ # subscription and topic type.
1120
+ #
1121
+ # @param location [String] Name of the location
1122
+ # @param topic_type_name [String] Name of the topic type
1123
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1124
+ # to the HTTP request.
1125
+ #
1126
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1127
+ #
1128
+ def list_regional_by_subscription_for_topic_type_async(location, topic_type_name, custom_headers:nil)
1129
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1130
+ fail ArgumentError, 'location is nil' if location.nil?
1131
+ fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil?
1132
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1133
+
1134
+
1135
+ request_headers = {}
1136
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1137
+
1138
+ # Set Headers
1139
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1140
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1141
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'
1142
+
1143
+ request_url = @base_url || @client.base_url
1144
+
1145
+ options = {
1146
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1147
+ path_params: {'subscriptionId' => @client.subscription_id,'location' => location,'topicTypeName' => topic_type_name},
1148
+ query_params: {'api-version' => @client.api_version},
1149
+ headers: request_headers.merge(custom_headers || {}),
1150
+ base_url: request_url
1151
+ }
1152
+ promise = @client.make_request_async(:get, path_template, options)
1153
+
1154
+ promise = promise.then do |result|
1155
+ http_response = result.response
1156
+ status_code = http_response.status
1157
+ response_content = http_response.body
1158
+ unless status_code == 200
1159
+ error_model = JSON.load(response_content)
1160
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1161
+ end
1162
+
1163
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1164
+ # Deserialize Response
1165
+ if status_code == 200
1166
+ begin
1167
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1168
+ result_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscriptionsListResult.mapper()
1169
+ result.body = @client.deserialize(result_mapper, parsed_response)
1170
+ rescue Exception => e
1171
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1172
+ end
1173
+ end
1174
+
1175
+ result
1176
+ end
1177
+
1178
+ promise.execute
1179
+ end
1180
+
1181
+ #
1182
+ # List all regional event subscriptions under an Azure subscription and
1183
+ # resource group for a topic type
1184
+ #
1185
+ # List all event subscriptions from the given location under a specific Azure
1186
+ # subscription and resource group and topic type
1187
+ #
1188
+ # @param resource_group_name [String] The name of the resource group within the
1189
+ # user's subscription.
1190
+ # @param location [String] Name of the location
1191
+ # @param topic_type_name [String] Name of the topic type
1192
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1193
+ # will be added to the HTTP request.
1194
+ #
1195
+ # @return [EventSubscriptionsListResult] operation results.
1196
+ #
1197
+ def list_regional_by_resource_group_for_topic_type(resource_group_name, location, topic_type_name, custom_headers:nil)
1198
+ response = list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_name, custom_headers:custom_headers).value!
1199
+ response.body unless response.nil?
1200
+ end
1201
+
1202
+ #
1203
+ # List all regional event subscriptions under an Azure subscription and
1204
+ # resource group for a topic type
1205
+ #
1206
+ # List all event subscriptions from the given location under a specific Azure
1207
+ # subscription and resource group and topic type
1208
+ #
1209
+ # @param resource_group_name [String] The name of the resource group within the
1210
+ # user's subscription.
1211
+ # @param location [String] Name of the location
1212
+ # @param topic_type_name [String] Name of the topic type
1213
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1214
+ # will be added to the HTTP request.
1215
+ #
1216
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1217
+ #
1218
+ def list_regional_by_resource_group_for_topic_type_with_http_info(resource_group_name, location, topic_type_name, custom_headers:nil)
1219
+ list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_name, custom_headers:custom_headers).value!
1220
+ end
1221
+
1222
+ #
1223
+ # List all regional event subscriptions under an Azure subscription and
1224
+ # resource group for a topic type
1225
+ #
1226
+ # List all event subscriptions from the given location under a specific Azure
1227
+ # subscription and resource group and topic type
1228
+ #
1229
+ # @param resource_group_name [String] The name of the resource group within the
1230
+ # user's subscription.
1231
+ # @param location [String] Name of the location
1232
+ # @param topic_type_name [String] Name of the topic type
1233
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1234
+ # to the HTTP request.
1235
+ #
1236
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1237
+ #
1238
+ def list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_name, custom_headers:nil)
1239
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1240
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1241
+ fail ArgumentError, 'location is nil' if location.nil?
1242
+ fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil?
1243
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1244
+
1245
+
1246
+ request_headers = {}
1247
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1248
+
1249
+ # Set Headers
1250
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1251
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1252
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'
1253
+
1254
+ request_url = @base_url || @client.base_url
1255
+
1256
+ options = {
1257
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1258
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'location' => location,'topicTypeName' => topic_type_name},
1259
+ query_params: {'api-version' => @client.api_version},
1260
+ headers: request_headers.merge(custom_headers || {}),
1261
+ base_url: request_url
1262
+ }
1263
+ promise = @client.make_request_async(:get, path_template, options)
1264
+
1265
+ promise = promise.then do |result|
1266
+ http_response = result.response
1267
+ status_code = http_response.status
1268
+ response_content = http_response.body
1269
+ unless status_code == 200
1270
+ error_model = JSON.load(response_content)
1271
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1272
+ end
1273
+
1274
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1275
+ # Deserialize Response
1276
+ if status_code == 200
1277
+ begin
1278
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1279
+ result_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscriptionsListResult.mapper()
1280
+ result.body = @client.deserialize(result_mapper, parsed_response)
1281
+ rescue Exception => e
1282
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1283
+ end
1284
+ end
1285
+
1286
+ result
1287
+ end
1288
+
1289
+ promise.execute
1290
+ end
1291
+
1292
+ #
1293
+ # List all event subscriptions for a specific topic
1294
+ #
1295
+ # List all event subscriptions that have been created for a specific topic
1296
+ #
1297
+ # @param resource_group_name [String] The name of the resource group within the
1298
+ # user's subscription.
1299
+ # @param provider_namespace [String] Namespace of the provider of the topic
1300
+ # @param resource_type_name [String] Name of the resource type
1301
+ # @param resource_name [String] Name of the resource
1302
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1303
+ # will be added to the HTTP request.
1304
+ #
1305
+ # @return [EventSubscriptionsListResult] operation results.
1306
+ #
1307
+ def list_by_resource(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:nil)
1308
+ response = list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:custom_headers).value!
1309
+ response.body unless response.nil?
1310
+ end
1311
+
1312
+ #
1313
+ # List all event subscriptions for a specific topic
1314
+ #
1315
+ # List all event subscriptions that have been created for a specific topic
1316
+ #
1317
+ # @param resource_group_name [String] The name of the resource group within the
1318
+ # user's subscription.
1319
+ # @param provider_namespace [String] Namespace of the provider of the topic
1320
+ # @param resource_type_name [String] Name of the resource type
1321
+ # @param resource_name [String] Name of the resource
1322
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1323
+ # will be added to the HTTP request.
1324
+ #
1325
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1326
+ #
1327
+ def list_by_resource_with_http_info(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:nil)
1328
+ list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:custom_headers).value!
1329
+ end
1330
+
1331
+ #
1332
+ # List all event subscriptions for a specific topic
1333
+ #
1334
+ # List all event subscriptions that have been created for a specific topic
1335
+ #
1336
+ # @param resource_group_name [String] The name of the resource group within the
1337
+ # user's subscription.
1338
+ # @param provider_namespace [String] Namespace of the provider of the topic
1339
+ # @param resource_type_name [String] Name of the resource type
1340
+ # @param resource_name [String] Name of the resource
1341
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1342
+ # to the HTTP request.
1343
+ #
1344
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1345
+ #
1346
+ def list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:nil)
1347
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1348
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1349
+ fail ArgumentError, 'provider_namespace is nil' if provider_namespace.nil?
1350
+ fail ArgumentError, 'resource_type_name is nil' if resource_type_name.nil?
1351
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1352
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1353
+
1354
+
1355
+ request_headers = {}
1356
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1357
+
1358
+ # Set Headers
1359
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1360
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1361
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions'
1362
+
1363
+ request_url = @base_url || @client.base_url
1364
+
1365
+ options = {
1366
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1367
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerNamespace' => provider_namespace,'resourceTypeName' => resource_type_name,'resourceName' => resource_name},
1368
+ query_params: {'api-version' => @client.api_version},
1369
+ headers: request_headers.merge(custom_headers || {}),
1370
+ base_url: request_url
1371
+ }
1372
+ promise = @client.make_request_async(:get, path_template, options)
1373
+
1374
+ promise = promise.then do |result|
1375
+ http_response = result.response
1376
+ status_code = http_response.status
1377
+ response_content = http_response.body
1378
+ unless status_code == 200
1379
+ error_model = JSON.load(response_content)
1380
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1381
+ end
1382
+
1383
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1384
+ # Deserialize Response
1385
+ if status_code == 200
1386
+ begin
1387
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1388
+ result_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscriptionsListResult.mapper()
1389
+ result.body = @client.deserialize(result_mapper, parsed_response)
1390
+ rescue Exception => e
1391
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1392
+ end
1393
+ end
1394
+
1395
+ result
1396
+ end
1397
+
1398
+ promise.execute
1399
+ end
1400
+
1401
+ #
1402
+ # Create or update an event subscription
1403
+ #
1404
+ # Asynchronously creates a new event subscription or updates an existing event
1405
+ # subscription based on the specified scope.
1406
+ #
1407
+ # @param scope [String] The identifier of the resource to which the event
1408
+ # subscription needs to be created or updated. The scope can be a subscription,
1409
+ # or a resource group, or a top level resource belonging to a resource provider
1410
+ # namespace, or an EventGrid topic. For example, use
1411
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1412
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1413
+ # resource group, and
1414
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1415
+ # for a resource, and
1416
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1417
+ # for an EventGrid topic.
1418
+ # @param event_subscription_name [String] Name of the event subscription. Event
1419
+ # subscription names must be between 3 and 64 characters in length and should
1420
+ # use alphanumeric letters only.
1421
+ # @param event_subscription_info [EventSubscription] Event subscription
1422
+ # properties containing the destination and filter information
1423
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1424
+ # will be added to the HTTP request.
1425
+ #
1426
+ # @return [EventSubscription] operation results.
1427
+ #
1428
+ def begin_create_or_update(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
1429
+ response = begin_create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers).value!
1430
+ response.body unless response.nil?
1431
+ end
1432
+
1433
+ #
1434
+ # Create or update an event subscription
1435
+ #
1436
+ # Asynchronously creates a new event subscription or updates an existing event
1437
+ # subscription based on the specified scope.
1438
+ #
1439
+ # @param scope [String] The identifier of the resource to which the event
1440
+ # subscription needs to be created or updated. The scope can be a subscription,
1441
+ # or a resource group, or a top level resource belonging to a resource provider
1442
+ # namespace, or an EventGrid topic. For example, use
1443
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1444
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1445
+ # resource group, and
1446
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1447
+ # for a resource, and
1448
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1449
+ # for an EventGrid topic.
1450
+ # @param event_subscription_name [String] Name of the event subscription. Event
1451
+ # subscription names must be between 3 and 64 characters in length and should
1452
+ # use alphanumeric letters only.
1453
+ # @param event_subscription_info [EventSubscription] Event subscription
1454
+ # properties containing the destination and filter information
1455
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1456
+ # will be added to the HTTP request.
1457
+ #
1458
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1459
+ #
1460
+ def begin_create_or_update_with_http_info(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
1461
+ begin_create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers).value!
1462
+ end
1463
+
1464
+ #
1465
+ # Create or update an event subscription
1466
+ #
1467
+ # Asynchronously creates a new event subscription or updates an existing event
1468
+ # subscription based on the specified scope.
1469
+ #
1470
+ # @param scope [String] The identifier of the resource to which the event
1471
+ # subscription needs to be created or updated. The scope can be a subscription,
1472
+ # or a resource group, or a top level resource belonging to a resource provider
1473
+ # namespace, or an EventGrid topic. For example, use
1474
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1475
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1476
+ # resource group, and
1477
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1478
+ # for a resource, and
1479
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1480
+ # for an EventGrid topic.
1481
+ # @param event_subscription_name [String] Name of the event subscription. Event
1482
+ # subscription names must be between 3 and 64 characters in length and should
1483
+ # use alphanumeric letters only.
1484
+ # @param event_subscription_info [EventSubscription] Event subscription
1485
+ # properties containing the destination and filter information
1486
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1487
+ # to the HTTP request.
1488
+ #
1489
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1490
+ #
1491
+ def begin_create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
1492
+ fail ArgumentError, 'scope is nil' if scope.nil?
1493
+ fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil?
1494
+ fail ArgumentError, 'event_subscription_info is nil' if event_subscription_info.nil?
1495
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1496
+
1497
+
1498
+ request_headers = {}
1499
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1500
+
1501
+ # Set Headers
1502
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1503
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1504
+
1505
+ # Serialize Request
1506
+ request_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscription.mapper()
1507
+ request_content = @client.serialize(request_mapper, event_subscription_info)
1508
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1509
+
1510
+ path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'
1511
+
1512
+ request_url = @base_url || @client.base_url
1513
+
1514
+ options = {
1515
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1516
+ path_params: {'eventSubscriptionName' => event_subscription_name},
1517
+ skip_encoding_path_params: {'scope' => scope},
1518
+ query_params: {'api-version' => @client.api_version},
1519
+ body: request_content,
1520
+ headers: request_headers.merge(custom_headers || {}),
1521
+ base_url: request_url
1522
+ }
1523
+ promise = @client.make_request_async(:put, path_template, options)
1524
+
1525
+ promise = promise.then do |result|
1526
+ http_response = result.response
1527
+ status_code = http_response.status
1528
+ response_content = http_response.body
1529
+ unless status_code == 201
1530
+ error_model = JSON.load(response_content)
1531
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1532
+ end
1533
+
1534
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1535
+ # Deserialize Response
1536
+ if status_code == 201
1537
+ begin
1538
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1539
+ result_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscription.mapper()
1540
+ result.body = @client.deserialize(result_mapper, parsed_response)
1541
+ rescue Exception => e
1542
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1543
+ end
1544
+ end
1545
+
1546
+ result
1547
+ end
1548
+
1549
+ promise.execute
1550
+ end
1551
+
1552
+ #
1553
+ # Delete an event subscription
1554
+ #
1555
+ # Delete an existing event subscription
1556
+ #
1557
+ # @param scope [String] The scope of the event subscription. The scope can be a
1558
+ # subscription, or a resource group, or a top level resource belonging to a
1559
+ # resource provider namespace, or an EventGrid topic. For example, use
1560
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1561
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1562
+ # resource group, and
1563
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1564
+ # for a resource, and
1565
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1566
+ # for an EventGrid topic.
1567
+ # @param event_subscription_name [String] Name of the event subscription
1568
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1569
+ # will be added to the HTTP request.
1570
+ #
1571
+ #
1572
+ def begin_delete(scope, event_subscription_name, custom_headers:nil)
1573
+ response = begin_delete_async(scope, event_subscription_name, custom_headers:custom_headers).value!
1574
+ nil
1575
+ end
1576
+
1577
+ #
1578
+ # Delete an event subscription
1579
+ #
1580
+ # Delete an existing event subscription
1581
+ #
1582
+ # @param scope [String] The scope of the event subscription. The scope can be a
1583
+ # subscription, or a resource group, or a top level resource belonging to a
1584
+ # resource provider namespace, or an EventGrid topic. For example, use
1585
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1586
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1587
+ # resource group, and
1588
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1589
+ # for a resource, and
1590
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1591
+ # for an EventGrid topic.
1592
+ # @param event_subscription_name [String] Name of the event subscription
1593
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1594
+ # will be added to the HTTP request.
1595
+ #
1596
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1597
+ #
1598
+ def begin_delete_with_http_info(scope, event_subscription_name, custom_headers:nil)
1599
+ begin_delete_async(scope, event_subscription_name, custom_headers:custom_headers).value!
1600
+ end
1601
+
1602
+ #
1603
+ # Delete an event subscription
1604
+ #
1605
+ # Delete an existing event subscription
1606
+ #
1607
+ # @param scope [String] The scope of the event subscription. The scope can be a
1608
+ # subscription, or a resource group, or a top level resource belonging to a
1609
+ # resource provider namespace, or an EventGrid topic. For example, use
1610
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1611
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1612
+ # resource group, and
1613
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1614
+ # for a resource, and
1615
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1616
+ # for an EventGrid topic.
1617
+ # @param event_subscription_name [String] Name of the event subscription
1618
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1619
+ # to the HTTP request.
1620
+ #
1621
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1622
+ #
1623
+ def begin_delete_async(scope, event_subscription_name, custom_headers:nil)
1624
+ fail ArgumentError, 'scope is nil' if scope.nil?
1625
+ fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil?
1626
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1627
+
1628
+
1629
+ request_headers = {}
1630
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1631
+
1632
+ # Set Headers
1633
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1634
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1635
+ path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'
1636
+
1637
+ request_url = @base_url || @client.base_url
1638
+
1639
+ options = {
1640
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1641
+ path_params: {'eventSubscriptionName' => event_subscription_name},
1642
+ skip_encoding_path_params: {'scope' => scope},
1643
+ query_params: {'api-version' => @client.api_version},
1644
+ headers: request_headers.merge(custom_headers || {}),
1645
+ base_url: request_url
1646
+ }
1647
+ promise = @client.make_request_async(:delete, path_template, options)
1648
+
1649
+ promise = promise.then do |result|
1650
+ http_response = result.response
1651
+ status_code = http_response.status
1652
+ response_content = http_response.body
1653
+ unless status_code == 200 || status_code == 202 || status_code == 204
1654
+ error_model = JSON.load(response_content)
1655
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1656
+ end
1657
+
1658
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1659
+
1660
+ result
1661
+ end
1662
+
1663
+ promise.execute
1664
+ end
1665
+
1666
+ #
1667
+ # Update an event subscription
1668
+ #
1669
+ # Asynchronously updates an existing event subscription.
1670
+ #
1671
+ # @param scope [String] The scope of existing event subscription. The scope can
1672
+ # be a subscription, or a resource group, or a top level resource belonging to
1673
+ # a resource provider namespace, or an EventGrid topic. For example, use
1674
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1675
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1676
+ # resource group, and
1677
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1678
+ # for a resource, and
1679
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1680
+ # for an EventGrid topic.
1681
+ # @param event_subscription_name [String] Name of the event subscription to be
1682
+ # updated
1683
+ # @param event_subscription_update_parameters
1684
+ # [EventSubscriptionUpdateParameters] Updated event subscription information
1685
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1686
+ # will be added to the HTTP request.
1687
+ #
1688
+ # @return [EventSubscription] operation results.
1689
+ #
1690
+ def begin_update(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil)
1691
+ response = begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:custom_headers).value!
1692
+ response.body unless response.nil?
1693
+ end
1694
+
1695
+ #
1696
+ # Update an event subscription
1697
+ #
1698
+ # Asynchronously updates an existing event subscription.
1699
+ #
1700
+ # @param scope [String] The scope of existing event subscription. The scope can
1701
+ # be a subscription, or a resource group, or a top level resource belonging to
1702
+ # a resource provider namespace, or an EventGrid topic. For example, use
1703
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1704
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1705
+ # resource group, and
1706
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1707
+ # for a resource, and
1708
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1709
+ # for an EventGrid topic.
1710
+ # @param event_subscription_name [String] Name of the event subscription to be
1711
+ # updated
1712
+ # @param event_subscription_update_parameters
1713
+ # [EventSubscriptionUpdateParameters] Updated event subscription information
1714
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1715
+ # will be added to the HTTP request.
1716
+ #
1717
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1718
+ #
1719
+ def begin_update_with_http_info(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil)
1720
+ begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:custom_headers).value!
1721
+ end
1722
+
1723
+ #
1724
+ # Update an event subscription
1725
+ #
1726
+ # Asynchronously updates an existing event subscription.
1727
+ #
1728
+ # @param scope [String] The scope of existing event subscription. The scope can
1729
+ # be a subscription, or a resource group, or a top level resource belonging to
1730
+ # a resource provider namespace, or an EventGrid topic. For example, use
1731
+ # '/subscriptions/{subscriptionId}/' for a subscription,
1732
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
1733
+ # resource group, and
1734
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
1735
+ # for a resource, and
1736
+ # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1737
+ # for an EventGrid topic.
1738
+ # @param event_subscription_name [String] Name of the event subscription to be
1739
+ # updated
1740
+ # @param event_subscription_update_parameters
1741
+ # [EventSubscriptionUpdateParameters] Updated event subscription information
1742
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1743
+ # to the HTTP request.
1744
+ #
1745
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1746
+ #
1747
+ def begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers:nil)
1748
+ fail ArgumentError, 'scope is nil' if scope.nil?
1749
+ fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil?
1750
+ fail ArgumentError, 'event_subscription_update_parameters is nil' if event_subscription_update_parameters.nil?
1751
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1752
+
1753
+
1754
+ request_headers = {}
1755
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1756
+
1757
+ # Set Headers
1758
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1759
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1760
+
1761
+ # Serialize Request
1762
+ request_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscriptionUpdateParameters.mapper()
1763
+ request_content = @client.serialize(request_mapper, event_subscription_update_parameters)
1764
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1765
+
1766
+ path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'
1767
+
1768
+ request_url = @base_url || @client.base_url
1769
+
1770
+ options = {
1771
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1772
+ path_params: {'eventSubscriptionName' => event_subscription_name},
1773
+ skip_encoding_path_params: {'scope' => scope},
1774
+ query_params: {'api-version' => @client.api_version},
1775
+ body: request_content,
1776
+ headers: request_headers.merge(custom_headers || {}),
1777
+ base_url: request_url
1778
+ }
1779
+ promise = @client.make_request_async(:patch, path_template, options)
1780
+
1781
+ promise = promise.then do |result|
1782
+ http_response = result.response
1783
+ status_code = http_response.status
1784
+ response_content = http_response.body
1785
+ unless status_code == 201
1786
+ error_model = JSON.load(response_content)
1787
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1788
+ end
1789
+
1790
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1791
+ # Deserialize Response
1792
+ if status_code == 201
1793
+ begin
1794
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1795
+ result_mapper = Azure::EventGrid::Mgmt::V2019_01_01::Models::EventSubscription.mapper()
1796
+ result.body = @client.deserialize(result_mapper, parsed_response)
1797
+ rescue Exception => e
1798
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1799
+ end
1800
+ end
1801
+
1802
+ result
1803
+ end
1804
+
1805
+ promise.execute
1806
+ end
1807
+
1808
+ end
1809
+ end