azure_mgmt_event_grid 0.15.2 → 0.15.3

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