azure_mgmt_event_grid 0.15.2 → 0.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,1092 @@
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 Topics
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Topics 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 a topic
26
+ #
27
+ # Get properties of a topic
28
+ #
29
+ # @param resource_group_name [String] The name of the resource group within the
30
+ # user's subscription.
31
+ # @param topic_name [String] Name of the topic
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [Topic] operation results.
36
+ #
37
+ def get(resource_group_name, topic_name, custom_headers = nil)
38
+ response = get_async(resource_group_name, topic_name, custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # Get a topic
44
+ #
45
+ # Get properties of a topic
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group within the
48
+ # user's subscription.
49
+ # @param topic_name [String] Name of the topic
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def get_with_http_info(resource_group_name, topic_name, custom_headers = nil)
56
+ get_async(resource_group_name, topic_name, custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # Get a topic
61
+ #
62
+ # Get properties of a topic
63
+ #
64
+ # @param resource_group_name [String] The name of the resource group within the
65
+ # user's subscription.
66
+ # @param topic_name [String] Name of the topic
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def get_async(resource_group_name, topic_name, custom_headers = nil)
73
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
74
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
75
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
76
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
77
+
78
+
79
+ request_headers = {}
80
+
81
+ # Set Headers
82
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
83
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
84
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
85
+
86
+ request_url = @base_url || @client.base_url
87
+
88
+ options = {
89
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
90
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name},
91
+ query_params: {'api-version' => @client.api_version},
92
+ headers: request_headers.merge(custom_headers || {}),
93
+ base_url: request_url
94
+ }
95
+ promise = @client.make_request_async(:get, path_template, options)
96
+
97
+ promise = promise.then do |result|
98
+ http_response = result.response
99
+ status_code = http_response.status
100
+ response_content = http_response.body
101
+ unless status_code == 200
102
+ error_model = JSON.load(response_content)
103
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
104
+ end
105
+
106
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
107
+ # Deserialize Response
108
+ if status_code == 200
109
+ begin
110
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
111
+ result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::Topic.mapper()
112
+ result.body = @client.deserialize(result_mapper, parsed_response)
113
+ rescue Exception => e
114
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
115
+ end
116
+ end
117
+
118
+ result
119
+ end
120
+
121
+ promise.execute
122
+ end
123
+
124
+ #
125
+ # Create a topic
126
+ #
127
+ # Asynchronously creates a new topic with the specified parameters.
128
+ #
129
+ # @param resource_group_name [String] The name of the resource group within the
130
+ # user's subscription.
131
+ # @param topic_name [String] Name of the topic
132
+ # @param topic_info [Topic] Topic information
133
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
134
+ # will be added to the HTTP request.
135
+ #
136
+ # @return [Topic] operation results.
137
+ #
138
+ def create_or_update(resource_group_name, topic_name, topic_info, custom_headers = nil)
139
+ response = create_or_update_async(resource_group_name, topic_name, topic_info, custom_headers).value!
140
+ response.body unless response.nil?
141
+ end
142
+
143
+ #
144
+ # @param resource_group_name [String] The name of the resource group within the
145
+ # user's subscription.
146
+ # @param topic_name [String] Name of the topic
147
+ # @param topic_info [Topic] Topic information
148
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
149
+ # will be added to the HTTP request.
150
+ #
151
+ # @return [Concurrent::Promise] promise which provides async access to http
152
+ # response.
153
+ #
154
+ def create_or_update_async(resource_group_name, topic_name, topic_info, custom_headers = nil)
155
+ # Send request
156
+ promise = begin_create_or_update_async(resource_group_name, topic_name, topic_info, custom_headers)
157
+
158
+ promise = promise.then do |response|
159
+ # Defining deserialization method.
160
+ deserialize_method = lambda do |parsed_response|
161
+ result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::Topic.mapper()
162
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
163
+ end
164
+
165
+ # Waiting for response.
166
+ @client.get_long_running_operation_result(response, deserialize_method)
167
+ end
168
+
169
+ promise
170
+ end
171
+
172
+ #
173
+ # Delete a topic
174
+ #
175
+ # Delete existing topic
176
+ #
177
+ # @param resource_group_name [String] The name of the resource group within the
178
+ # user's subscription.
179
+ # @param topic_name [String] Name of the topic
180
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
181
+ # will be added to the HTTP request.
182
+ #
183
+ def delete(resource_group_name, topic_name, custom_headers = nil)
184
+ response = delete_async(resource_group_name, topic_name, custom_headers).value!
185
+ nil
186
+ end
187
+
188
+ #
189
+ # @param resource_group_name [String] The name of the resource group within the
190
+ # user's subscription.
191
+ # @param topic_name [String] Name of the topic
192
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
193
+ # will be added to the HTTP request.
194
+ #
195
+ # @return [Concurrent::Promise] promise which provides async access to http
196
+ # response.
197
+ #
198
+ def delete_async(resource_group_name, topic_name, custom_headers = nil)
199
+ # Send request
200
+ promise = begin_delete_async(resource_group_name, topic_name, custom_headers)
201
+
202
+ promise = promise.then do |response|
203
+ # Defining deserialization method.
204
+ deserialize_method = lambda do |parsed_response|
205
+ end
206
+
207
+ # Waiting for response.
208
+ @client.get_long_running_operation_result(response, deserialize_method)
209
+ end
210
+
211
+ promise
212
+ end
213
+
214
+ #
215
+ # Update a topic
216
+ #
217
+ # Asynchronously updates a topic with the specified parameters.
218
+ #
219
+ # @param resource_group_name [String] The name of the resource group within the
220
+ # user's subscription.
221
+ # @param topic_name [String] Name of the topic
222
+ # @param topic_update_parameters [TopicUpdateParameters] Topic update
223
+ # information
224
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
225
+ # will be added to the HTTP request.
226
+ #
227
+ # @return [Topic] operation results.
228
+ #
229
+ def update(resource_group_name, topic_name, topic_update_parameters, custom_headers = nil)
230
+ response = update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers).value!
231
+ response.body unless response.nil?
232
+ end
233
+
234
+ #
235
+ # @param resource_group_name [String] The name of the resource group within the
236
+ # user's subscription.
237
+ # @param topic_name [String] Name of the topic
238
+ # @param topic_update_parameters [TopicUpdateParameters] Topic update
239
+ # information
240
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
241
+ # will be added to the HTTP request.
242
+ #
243
+ # @return [Concurrent::Promise] promise which provides async access to http
244
+ # response.
245
+ #
246
+ def update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers = nil)
247
+ # Send request
248
+ promise = begin_update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers)
249
+
250
+ promise = promise.then do |response|
251
+ # Defining deserialization method.
252
+ deserialize_method = lambda do |parsed_response|
253
+ result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::Topic.mapper()
254
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
255
+ end
256
+
257
+ # Waiting for response.
258
+ @client.get_long_running_operation_result(response, deserialize_method)
259
+ end
260
+
261
+ promise
262
+ end
263
+
264
+ #
265
+ # List topics under an Azure subscription
266
+ #
267
+ # List all the topics under an Azure subscription
268
+ #
269
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
270
+ # will be added to the HTTP request.
271
+ #
272
+ # @return [TopicsListResult] operation results.
273
+ #
274
+ def list_by_subscription(custom_headers = nil)
275
+ response = list_by_subscription_async(custom_headers).value!
276
+ response.body unless response.nil?
277
+ end
278
+
279
+ #
280
+ # List topics under an Azure subscription
281
+ #
282
+ # List all the topics under an Azure subscription
283
+ #
284
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
285
+ # will be added to the HTTP request.
286
+ #
287
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
288
+ #
289
+ def list_by_subscription_with_http_info(custom_headers = nil)
290
+ list_by_subscription_async(custom_headers).value!
291
+ end
292
+
293
+ #
294
+ # List topics under an Azure subscription
295
+ #
296
+ # List all the topics under an Azure subscription
297
+ #
298
+ # @param [Hash{String => String}] A hash of custom headers that will be added
299
+ # to the HTTP request.
300
+ #
301
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
302
+ #
303
+ def list_by_subscription_async(custom_headers = nil)
304
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
305
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
306
+
307
+
308
+ request_headers = {}
309
+
310
+ # Set Headers
311
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
312
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
313
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics'
314
+
315
+ request_url = @base_url || @client.base_url
316
+
317
+ options = {
318
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
319
+ path_params: {'subscriptionId' => @client.subscription_id},
320
+ query_params: {'api-version' => @client.api_version},
321
+ headers: request_headers.merge(custom_headers || {}),
322
+ base_url: request_url
323
+ }
324
+ promise = @client.make_request_async(:get, path_template, options)
325
+
326
+ promise = promise.then do |result|
327
+ http_response = result.response
328
+ status_code = http_response.status
329
+ response_content = http_response.body
330
+ unless status_code == 200
331
+ error_model = JSON.load(response_content)
332
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
333
+ end
334
+
335
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
336
+ # Deserialize Response
337
+ if status_code == 200
338
+ begin
339
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
340
+ result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicsListResult.mapper()
341
+ result.body = @client.deserialize(result_mapper, parsed_response)
342
+ rescue Exception => e
343
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
344
+ end
345
+ end
346
+
347
+ result
348
+ end
349
+
350
+ promise.execute
351
+ end
352
+
353
+ #
354
+ # List topics under a resource group
355
+ #
356
+ # List all the topics under a resource group
357
+ #
358
+ # @param resource_group_name [String] The name of the resource group within the
359
+ # user's subscription.
360
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
361
+ # will be added to the HTTP request.
362
+ #
363
+ # @return [TopicsListResult] operation results.
364
+ #
365
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
366
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
367
+ response.body unless response.nil?
368
+ end
369
+
370
+ #
371
+ # List topics under a resource group
372
+ #
373
+ # List all the topics under a resource group
374
+ #
375
+ # @param resource_group_name [String] The name of the resource group within the
376
+ # user's subscription.
377
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
378
+ # will be added to the HTTP request.
379
+ #
380
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
381
+ #
382
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
383
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
384
+ end
385
+
386
+ #
387
+ # List topics under a resource group
388
+ #
389
+ # List all the topics under a resource group
390
+ #
391
+ # @param resource_group_name [String] The name of the resource group within the
392
+ # user's subscription.
393
+ # @param [Hash{String => String}] A hash of custom headers that will be added
394
+ # to the HTTP request.
395
+ #
396
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
397
+ #
398
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
399
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
400
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
401
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
402
+
403
+
404
+ request_headers = {}
405
+
406
+ # Set Headers
407
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
408
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
409
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics'
410
+
411
+ request_url = @base_url || @client.base_url
412
+
413
+ options = {
414
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
415
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
416
+ query_params: {'api-version' => @client.api_version},
417
+ headers: request_headers.merge(custom_headers || {}),
418
+ base_url: request_url
419
+ }
420
+ promise = @client.make_request_async(:get, path_template, options)
421
+
422
+ promise = promise.then do |result|
423
+ http_response = result.response
424
+ status_code = http_response.status
425
+ response_content = http_response.body
426
+ unless status_code == 200
427
+ error_model = JSON.load(response_content)
428
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
429
+ end
430
+
431
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
432
+ # Deserialize Response
433
+ if status_code == 200
434
+ begin
435
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
436
+ result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicsListResult.mapper()
437
+ result.body = @client.deserialize(result_mapper, parsed_response)
438
+ rescue Exception => e
439
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
440
+ end
441
+ end
442
+
443
+ result
444
+ end
445
+
446
+ promise.execute
447
+ end
448
+
449
+ #
450
+ # List keys for a topic
451
+ #
452
+ # List the two keys used to publish to a topic
453
+ #
454
+ # @param resource_group_name [String] The name of the resource group within the
455
+ # user's subscription.
456
+ # @param topic_name [String] Name of the topic
457
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
458
+ # will be added to the HTTP request.
459
+ #
460
+ # @return [TopicSharedAccessKeys] operation results.
461
+ #
462
+ def list_shared_access_keys(resource_group_name, topic_name, custom_headers = nil)
463
+ response = list_shared_access_keys_async(resource_group_name, topic_name, custom_headers).value!
464
+ response.body unless response.nil?
465
+ end
466
+
467
+ #
468
+ # List keys for a topic
469
+ #
470
+ # List the two keys used to publish to a topic
471
+ #
472
+ # @param resource_group_name [String] The name of the resource group within the
473
+ # user's subscription.
474
+ # @param topic_name [String] Name of the topic
475
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
476
+ # will be added to the HTTP request.
477
+ #
478
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
479
+ #
480
+ def list_shared_access_keys_with_http_info(resource_group_name, topic_name, custom_headers = nil)
481
+ list_shared_access_keys_async(resource_group_name, topic_name, custom_headers).value!
482
+ end
483
+
484
+ #
485
+ # List keys for a topic
486
+ #
487
+ # List the two keys used to publish to a topic
488
+ #
489
+ # @param resource_group_name [String] The name of the resource group within the
490
+ # user's subscription.
491
+ # @param topic_name [String] Name of the topic
492
+ # @param [Hash{String => String}] A hash of custom headers that will be added
493
+ # to the HTTP request.
494
+ #
495
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
496
+ #
497
+ def list_shared_access_keys_async(resource_group_name, topic_name, custom_headers = nil)
498
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
499
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
500
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
501
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
502
+
503
+
504
+ request_headers = {}
505
+
506
+ # Set Headers
507
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
508
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
509
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/listKeys'
510
+
511
+ request_url = @base_url || @client.base_url
512
+
513
+ options = {
514
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
515
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name},
516
+ query_params: {'api-version' => @client.api_version},
517
+ headers: request_headers.merge(custom_headers || {}),
518
+ base_url: request_url
519
+ }
520
+ promise = @client.make_request_async(:post, path_template, options)
521
+
522
+ promise = promise.then do |result|
523
+ http_response = result.response
524
+ status_code = http_response.status
525
+ response_content = http_response.body
526
+ unless status_code == 200
527
+ error_model = JSON.load(response_content)
528
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
529
+ end
530
+
531
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
532
+ # Deserialize Response
533
+ if status_code == 200
534
+ begin
535
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
536
+ result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicSharedAccessKeys.mapper()
537
+ result.body = @client.deserialize(result_mapper, parsed_response)
538
+ rescue Exception => e
539
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
540
+ end
541
+ end
542
+
543
+ result
544
+ end
545
+
546
+ promise.execute
547
+ end
548
+
549
+ #
550
+ # Regenerate key for a topic
551
+ #
552
+ # Regenerate a shared access key for a topic
553
+ #
554
+ # @param resource_group_name [String] The name of the resource group within the
555
+ # user's subscription.
556
+ # @param topic_name [String] Name of the topic
557
+ # @param regenerate_key_request [TopicRegenerateKeyRequest] Request body to
558
+ # regenerate key
559
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
560
+ # will be added to the HTTP request.
561
+ #
562
+ # @return [TopicSharedAccessKeys] operation results.
563
+ #
564
+ def regenerate_key(resource_group_name, topic_name, regenerate_key_request, custom_headers = nil)
565
+ response = regenerate_key_async(resource_group_name, topic_name, regenerate_key_request, custom_headers).value!
566
+ response.body unless response.nil?
567
+ end
568
+
569
+ #
570
+ # Regenerate key for a topic
571
+ #
572
+ # Regenerate a shared access key for a topic
573
+ #
574
+ # @param resource_group_name [String] The name of the resource group within the
575
+ # user's subscription.
576
+ # @param topic_name [String] Name of the topic
577
+ # @param regenerate_key_request [TopicRegenerateKeyRequest] Request body to
578
+ # regenerate key
579
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
580
+ # will be added to the HTTP request.
581
+ #
582
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
583
+ #
584
+ def regenerate_key_with_http_info(resource_group_name, topic_name, regenerate_key_request, custom_headers = nil)
585
+ regenerate_key_async(resource_group_name, topic_name, regenerate_key_request, custom_headers).value!
586
+ end
587
+
588
+ #
589
+ # Regenerate key for a topic
590
+ #
591
+ # Regenerate a shared access key for a topic
592
+ #
593
+ # @param resource_group_name [String] The name of the resource group within the
594
+ # user's subscription.
595
+ # @param topic_name [String] Name of the topic
596
+ # @param regenerate_key_request [TopicRegenerateKeyRequest] Request body to
597
+ # regenerate key
598
+ # @param [Hash{String => String}] A hash of custom headers that will be added
599
+ # to the HTTP request.
600
+ #
601
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
602
+ #
603
+ def regenerate_key_async(resource_group_name, topic_name, regenerate_key_request, custom_headers = nil)
604
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
605
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
606
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
607
+ fail ArgumentError, 'regenerate_key_request is nil' if regenerate_key_request.nil?
608
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
609
+
610
+
611
+ request_headers = {}
612
+
613
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
614
+
615
+ # Set Headers
616
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
617
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
618
+
619
+ # Serialize Request
620
+ request_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicRegenerateKeyRequest.mapper()
621
+ request_content = @client.serialize(request_mapper, regenerate_key_request)
622
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
623
+
624
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/regenerateKey'
625
+
626
+ request_url = @base_url || @client.base_url
627
+
628
+ options = {
629
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
630
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name},
631
+ query_params: {'api-version' => @client.api_version},
632
+ body: request_content,
633
+ headers: request_headers.merge(custom_headers || {}),
634
+ base_url: request_url
635
+ }
636
+ promise = @client.make_request_async(:post, path_template, options)
637
+
638
+ promise = promise.then do |result|
639
+ http_response = result.response
640
+ status_code = http_response.status
641
+ response_content = http_response.body
642
+ unless status_code == 200
643
+ error_model = JSON.load(response_content)
644
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
645
+ end
646
+
647
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
648
+ # Deserialize Response
649
+ if status_code == 200
650
+ begin
651
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
652
+ result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicSharedAccessKeys.mapper()
653
+ result.body = @client.deserialize(result_mapper, parsed_response)
654
+ rescue Exception => e
655
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
656
+ end
657
+ end
658
+
659
+ result
660
+ end
661
+
662
+ promise.execute
663
+ end
664
+
665
+ #
666
+ # List topic event types
667
+ #
668
+ # List event types for a topic
669
+ #
670
+ # @param resource_group_name [String] The name of the resource group within the
671
+ # user's subscription.
672
+ # @param provider_namespace [String] Namespace of the provider of the topic
673
+ # @param resource_type_name [String] Name of the topic type
674
+ # @param resource_name [String] Name of the topic
675
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
676
+ # will be added to the HTTP request.
677
+ #
678
+ # @return [EventTypesListResult] operation results.
679
+ #
680
+ def list_event_types(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers = nil)
681
+ response = list_event_types_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers).value!
682
+ response.body unless response.nil?
683
+ end
684
+
685
+ #
686
+ # List topic event types
687
+ #
688
+ # List event types for a topic
689
+ #
690
+ # @param resource_group_name [String] The name of the resource group within the
691
+ # user's subscription.
692
+ # @param provider_namespace [String] Namespace of the provider of the topic
693
+ # @param resource_type_name [String] Name of the topic type
694
+ # @param resource_name [String] Name of the topic
695
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
696
+ # will be added to the HTTP request.
697
+ #
698
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
699
+ #
700
+ def list_event_types_with_http_info(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers = nil)
701
+ list_event_types_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers).value!
702
+ end
703
+
704
+ #
705
+ # List topic event types
706
+ #
707
+ # List event types for a topic
708
+ #
709
+ # @param resource_group_name [String] The name of the resource group within the
710
+ # user's subscription.
711
+ # @param provider_namespace [String] Namespace of the provider of the topic
712
+ # @param resource_type_name [String] Name of the topic type
713
+ # @param resource_name [String] Name of the topic
714
+ # @param [Hash{String => String}] A hash of custom headers that will be added
715
+ # to the HTTP request.
716
+ #
717
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
718
+ #
719
+ def list_event_types_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers = nil)
720
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
721
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
722
+ fail ArgumentError, 'provider_namespace is nil' if provider_namespace.nil?
723
+ fail ArgumentError, 'resource_type_name is nil' if resource_type_name.nil?
724
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
725
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
726
+
727
+
728
+ request_headers = {}
729
+
730
+ # Set Headers
731
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
732
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
733
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes'
734
+
735
+ request_url = @base_url || @client.base_url
736
+
737
+ options = {
738
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
739
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerNamespace' => provider_namespace,'resourceTypeName' => resource_type_name,'resourceName' => resource_name},
740
+ query_params: {'api-version' => @client.api_version},
741
+ headers: request_headers.merge(custom_headers || {}),
742
+ base_url: request_url
743
+ }
744
+ promise = @client.make_request_async(:get, path_template, options)
745
+
746
+ promise = promise.then do |result|
747
+ http_response = result.response
748
+ status_code = http_response.status
749
+ response_content = http_response.body
750
+ unless status_code == 200
751
+ error_model = JSON.load(response_content)
752
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
753
+ end
754
+
755
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
756
+ # Deserialize Response
757
+ if status_code == 200
758
+ begin
759
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
760
+ result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventTypesListResult.mapper()
761
+ result.body = @client.deserialize(result_mapper, parsed_response)
762
+ rescue Exception => e
763
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
764
+ end
765
+ end
766
+
767
+ result
768
+ end
769
+
770
+ promise.execute
771
+ end
772
+
773
+ #
774
+ # Create a topic
775
+ #
776
+ # Asynchronously creates a new topic with the specified parameters.
777
+ #
778
+ # @param resource_group_name [String] The name of the resource group within the
779
+ # user's subscription.
780
+ # @param topic_name [String] Name of the topic
781
+ # @param topic_info [Topic] Topic information
782
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
783
+ # will be added to the HTTP request.
784
+ #
785
+ # @return [Topic] operation results.
786
+ #
787
+ def begin_create_or_update(resource_group_name, topic_name, topic_info, custom_headers = nil)
788
+ response = begin_create_or_update_async(resource_group_name, topic_name, topic_info, custom_headers).value!
789
+ response.body unless response.nil?
790
+ end
791
+
792
+ #
793
+ # Create a topic
794
+ #
795
+ # Asynchronously creates a new topic with the specified parameters.
796
+ #
797
+ # @param resource_group_name [String] The name of the resource group within the
798
+ # user's subscription.
799
+ # @param topic_name [String] Name of the topic
800
+ # @param topic_info [Topic] Topic information
801
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
802
+ # will be added to the HTTP request.
803
+ #
804
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
805
+ #
806
+ def begin_create_or_update_with_http_info(resource_group_name, topic_name, topic_info, custom_headers = nil)
807
+ begin_create_or_update_async(resource_group_name, topic_name, topic_info, custom_headers).value!
808
+ end
809
+
810
+ #
811
+ # Create a topic
812
+ #
813
+ # Asynchronously creates a new topic with the specified parameters.
814
+ #
815
+ # @param resource_group_name [String] The name of the resource group within the
816
+ # user's subscription.
817
+ # @param topic_name [String] Name of the topic
818
+ # @param topic_info [Topic] Topic information
819
+ # @param [Hash{String => String}] A hash of custom headers that will be added
820
+ # to the HTTP request.
821
+ #
822
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
823
+ #
824
+ def begin_create_or_update_async(resource_group_name, topic_name, topic_info, custom_headers = nil)
825
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
826
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
827
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
828
+ fail ArgumentError, 'topic_info is nil' if topic_info.nil?
829
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
830
+
831
+
832
+ request_headers = {}
833
+
834
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
835
+
836
+ # Set Headers
837
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
838
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
839
+
840
+ # Serialize Request
841
+ request_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::Topic.mapper()
842
+ request_content = @client.serialize(request_mapper, topic_info)
843
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
844
+
845
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
846
+
847
+ request_url = @base_url || @client.base_url
848
+
849
+ options = {
850
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
851
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name},
852
+ query_params: {'api-version' => @client.api_version},
853
+ body: request_content,
854
+ headers: request_headers.merge(custom_headers || {}),
855
+ base_url: request_url
856
+ }
857
+ promise = @client.make_request_async(:put, path_template, options)
858
+
859
+ promise = promise.then do |result|
860
+ http_response = result.response
861
+ status_code = http_response.status
862
+ response_content = http_response.body
863
+ unless status_code == 201
864
+ error_model = JSON.load(response_content)
865
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
866
+ end
867
+
868
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
869
+ # Deserialize Response
870
+ if status_code == 201
871
+ begin
872
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
873
+ result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::Topic.mapper()
874
+ result.body = @client.deserialize(result_mapper, parsed_response)
875
+ rescue Exception => e
876
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
877
+ end
878
+ end
879
+
880
+ result
881
+ end
882
+
883
+ promise.execute
884
+ end
885
+
886
+ #
887
+ # Delete a topic
888
+ #
889
+ # Delete existing topic
890
+ #
891
+ # @param resource_group_name [String] The name of the resource group within the
892
+ # user's subscription.
893
+ # @param topic_name [String] Name of the topic
894
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
895
+ # will be added to the HTTP request.
896
+ #
897
+ #
898
+ def begin_delete(resource_group_name, topic_name, custom_headers = nil)
899
+ response = begin_delete_async(resource_group_name, topic_name, custom_headers).value!
900
+ nil
901
+ end
902
+
903
+ #
904
+ # Delete a topic
905
+ #
906
+ # Delete existing topic
907
+ #
908
+ # @param resource_group_name [String] The name of the resource group within the
909
+ # user's subscription.
910
+ # @param topic_name [String] Name of the topic
911
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
912
+ # will be added to the HTTP request.
913
+ #
914
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
915
+ #
916
+ def begin_delete_with_http_info(resource_group_name, topic_name, custom_headers = nil)
917
+ begin_delete_async(resource_group_name, topic_name, custom_headers).value!
918
+ end
919
+
920
+ #
921
+ # Delete a topic
922
+ #
923
+ # Delete existing topic
924
+ #
925
+ # @param resource_group_name [String] The name of the resource group within the
926
+ # user's subscription.
927
+ # @param topic_name [String] Name of the topic
928
+ # @param [Hash{String => String}] A hash of custom headers that will be added
929
+ # to the HTTP request.
930
+ #
931
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
932
+ #
933
+ def begin_delete_async(resource_group_name, topic_name, custom_headers = nil)
934
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
935
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
936
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
937
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
938
+
939
+
940
+ request_headers = {}
941
+
942
+ # Set Headers
943
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
944
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
945
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
946
+
947
+ request_url = @base_url || @client.base_url
948
+
949
+ options = {
950
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
951
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name},
952
+ query_params: {'api-version' => @client.api_version},
953
+ headers: request_headers.merge(custom_headers || {}),
954
+ base_url: request_url
955
+ }
956
+ promise = @client.make_request_async(:delete, path_template, options)
957
+
958
+ promise = promise.then do |result|
959
+ http_response = result.response
960
+ status_code = http_response.status
961
+ response_content = http_response.body
962
+ unless status_code == 202 || status_code == 204
963
+ error_model = JSON.load(response_content)
964
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
965
+ end
966
+
967
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
968
+
969
+ result
970
+ end
971
+
972
+ promise.execute
973
+ end
974
+
975
+ #
976
+ # Update a topic
977
+ #
978
+ # Asynchronously updates a topic with the specified parameters.
979
+ #
980
+ # @param resource_group_name [String] The name of the resource group within the
981
+ # user's subscription.
982
+ # @param topic_name [String] Name of the topic
983
+ # @param topic_update_parameters [TopicUpdateParameters] Topic update
984
+ # information
985
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
986
+ # will be added to the HTTP request.
987
+ #
988
+ # @return [Topic] operation results.
989
+ #
990
+ def begin_update(resource_group_name, topic_name, topic_update_parameters, custom_headers = nil)
991
+ response = begin_update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers).value!
992
+ response.body unless response.nil?
993
+ end
994
+
995
+ #
996
+ # Update a topic
997
+ #
998
+ # Asynchronously updates a topic with the specified parameters.
999
+ #
1000
+ # @param resource_group_name [String] The name of the resource group within the
1001
+ # user's subscription.
1002
+ # @param topic_name [String] Name of the topic
1003
+ # @param topic_update_parameters [TopicUpdateParameters] Topic update
1004
+ # information
1005
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1006
+ # will be added to the HTTP request.
1007
+ #
1008
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1009
+ #
1010
+ def begin_update_with_http_info(resource_group_name, topic_name, topic_update_parameters, custom_headers = nil)
1011
+ begin_update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers).value!
1012
+ end
1013
+
1014
+ #
1015
+ # Update a topic
1016
+ #
1017
+ # Asynchronously updates a topic with the specified parameters.
1018
+ #
1019
+ # @param resource_group_name [String] The name of the resource group within the
1020
+ # user's subscription.
1021
+ # @param topic_name [String] Name of the topic
1022
+ # @param topic_update_parameters [TopicUpdateParameters] Topic update
1023
+ # information
1024
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1025
+ # to the HTTP request.
1026
+ #
1027
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1028
+ #
1029
+ def begin_update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers = nil)
1030
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1031
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1032
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
1033
+ fail ArgumentError, 'topic_update_parameters is nil' if topic_update_parameters.nil?
1034
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1035
+
1036
+
1037
+ request_headers = {}
1038
+
1039
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1040
+
1041
+ # Set Headers
1042
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1043
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1044
+
1045
+ # Serialize Request
1046
+ request_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicUpdateParameters.mapper()
1047
+ request_content = @client.serialize(request_mapper, topic_update_parameters)
1048
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1049
+
1050
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
1051
+
1052
+ request_url = @base_url || @client.base_url
1053
+
1054
+ options = {
1055
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1056
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name},
1057
+ query_params: {'api-version' => @client.api_version},
1058
+ body: request_content,
1059
+ headers: request_headers.merge(custom_headers || {}),
1060
+ base_url: request_url
1061
+ }
1062
+ promise = @client.make_request_async(:patch, path_template, options)
1063
+
1064
+ promise = promise.then do |result|
1065
+ http_response = result.response
1066
+ status_code = http_response.status
1067
+ response_content = http_response.body
1068
+ unless status_code == 201
1069
+ error_model = JSON.load(response_content)
1070
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1071
+ end
1072
+
1073
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1074
+ # Deserialize Response
1075
+ if status_code == 201
1076
+ begin
1077
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1078
+ result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::Topic.mapper()
1079
+ result.body = @client.deserialize(result_mapper, parsed_response)
1080
+ rescue Exception => e
1081
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1082
+ end
1083
+ end
1084
+
1085
+ result
1086
+ end
1087
+
1088
+ promise.execute
1089
+ end
1090
+
1091
+ end
1092
+ end