azure_mgmt_event_grid 0.14.0

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 (38) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_event_grid.rb +6 -0
  4. data/lib/generated/azure_mgmt_event_grid.rb +57 -0
  5. data/lib/generated/azure_mgmt_event_grid/event_grid_management_client.rb +143 -0
  6. data/lib/generated/azure_mgmt_event_grid/event_subscriptions.rb +1803 -0
  7. data/lib/generated/azure_mgmt_event_grid/models/event_hub_event_subscription_destination.rb +59 -0
  8. data/lib/generated/azure_mgmt_event_grid/models/event_subscription.rb +126 -0
  9. data/lib/generated/azure_mgmt_event_grid/models/event_subscription_destination.rb +46 -0
  10. data/lib/generated/azure_mgmt_event_grid/models/event_subscription_filter.rb +92 -0
  11. data/lib/generated/azure_mgmt_event_grid/models/event_subscription_full_url.rb +45 -0
  12. data/lib/generated/azure_mgmt_event_grid/models/event_subscription_provisioning_state.rb +20 -0
  13. data/lib/generated/azure_mgmt_event_grid/models/event_subscription_update_parameters.rb +78 -0
  14. data/lib/generated/azure_mgmt_event_grid/models/event_subscriptions_list_result.rb +52 -0
  15. data/lib/generated/azure_mgmt_event_grid/models/event_type.rb +88 -0
  16. data/lib/generated/azure_mgmt_event_grid/models/event_types_list_result.rb +52 -0
  17. data/lib/generated/azure_mgmt_event_grid/models/operation.rb +76 -0
  18. data/lib/generated/azure_mgmt_event_grid/models/operation_info.rb +74 -0
  19. data/lib/generated/azure_mgmt_event_grid/models/operation_origin.rb +17 -0
  20. data/lib/generated/azure_mgmt_event_grid/models/operations_list_result.rb +52 -0
  21. data/lib/generated/azure_mgmt_event_grid/models/resource.rb +67 -0
  22. data/lib/generated/azure_mgmt_event_grid/models/resource_region_type.rb +16 -0
  23. data/lib/generated/azure_mgmt_event_grid/models/topic.rb +103 -0
  24. data/lib/generated/azure_mgmt_event_grid/models/topic_provisioning_state.rb +20 -0
  25. data/lib/generated/azure_mgmt_event_grid/models/topic_regenerate_key_request.rb +44 -0
  26. data/lib/generated/azure_mgmt_event_grid/models/topic_shared_access_keys.rb +54 -0
  27. data/lib/generated/azure_mgmt_event_grid/models/topic_type_info.rb +128 -0
  28. data/lib/generated/azure_mgmt_event_grid/models/topic_type_provisioning_state.rb +20 -0
  29. data/lib/generated/azure_mgmt_event_grid/models/topic_types_list_result.rb +52 -0
  30. data/lib/generated/azure_mgmt_event_grid/models/topics_list_result.rb +52 -0
  31. data/lib/generated/azure_mgmt_event_grid/models/tracked_resource.rb +85 -0
  32. data/lib/generated/azure_mgmt_event_grid/models/web_hook_event_subscription_destination.rb +71 -0
  33. data/lib/generated/azure_mgmt_event_grid/module_definition.rb +8 -0
  34. data/lib/generated/azure_mgmt_event_grid/operations.rb +115 -0
  35. data/lib/generated/azure_mgmt_event_grid/topic_types.rb +296 -0
  36. data/lib/generated/azure_mgmt_event_grid/topics.rb +926 -0
  37. data/lib/generated/azure_mgmt_event_grid/version.rb +8 -0
  38. metadata +149 -0
@@ -0,0 +1,926 @@
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::ARM::EventGrid
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::ARM::EventGrid::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::ARM::EventGrid::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
+ # List topics under an Azure subscription
216
+ #
217
+ # List all the topics under an Azure subscription
218
+ #
219
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
220
+ # will be added to the HTTP request.
221
+ #
222
+ # @return [TopicsListResult] operation results.
223
+ #
224
+ def list_by_subscription(custom_headers = nil)
225
+ response = list_by_subscription_async(custom_headers).value!
226
+ response.body unless response.nil?
227
+ end
228
+
229
+ #
230
+ # List topics under an Azure subscription
231
+ #
232
+ # List all the topics under an Azure subscription
233
+ #
234
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
235
+ # will be added to the HTTP request.
236
+ #
237
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
238
+ #
239
+ def list_by_subscription_with_http_info(custom_headers = nil)
240
+ list_by_subscription_async(custom_headers).value!
241
+ end
242
+
243
+ #
244
+ # List topics under an Azure subscription
245
+ #
246
+ # List all the topics under an Azure subscription
247
+ #
248
+ # @param [Hash{String => String}] A hash of custom headers that will be added
249
+ # to the HTTP request.
250
+ #
251
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
252
+ #
253
+ def list_by_subscription_async(custom_headers = nil)
254
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
255
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
256
+
257
+
258
+ request_headers = {}
259
+
260
+ # Set Headers
261
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
262
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
263
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics'
264
+
265
+ request_url = @base_url || @client.base_url
266
+
267
+ options = {
268
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
269
+ path_params: {'subscriptionId' => @client.subscription_id},
270
+ query_params: {'api-version' => @client.api_version},
271
+ headers: request_headers.merge(custom_headers || {}),
272
+ base_url: request_url
273
+ }
274
+ promise = @client.make_request_async(:get, path_template, options)
275
+
276
+ promise = promise.then do |result|
277
+ http_response = result.response
278
+ status_code = http_response.status
279
+ response_content = http_response.body
280
+ unless status_code == 200
281
+ error_model = JSON.load(response_content)
282
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
283
+ end
284
+
285
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
286
+ # Deserialize Response
287
+ if status_code == 200
288
+ begin
289
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
290
+ result_mapper = Azure::ARM::EventGrid::Models::TopicsListResult.mapper()
291
+ result.body = @client.deserialize(result_mapper, parsed_response)
292
+ rescue Exception => e
293
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
294
+ end
295
+ end
296
+
297
+ result
298
+ end
299
+
300
+ promise.execute
301
+ end
302
+
303
+ #
304
+ # List topics under a resource group
305
+ #
306
+ # List all the topics under a resource group
307
+ #
308
+ # @param resource_group_name [String] The name of the resource group within the
309
+ # user's subscription.
310
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
311
+ # will be added to the HTTP request.
312
+ #
313
+ # @return [TopicsListResult] operation results.
314
+ #
315
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
316
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
317
+ response.body unless response.nil?
318
+ end
319
+
320
+ #
321
+ # List topics under a resource group
322
+ #
323
+ # List all the topics under a resource group
324
+ #
325
+ # @param resource_group_name [String] The name of the resource group within the
326
+ # user's subscription.
327
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
328
+ # will be added to the HTTP request.
329
+ #
330
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
331
+ #
332
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
333
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
334
+ end
335
+
336
+ #
337
+ # List topics under a resource group
338
+ #
339
+ # List all the topics under a resource group
340
+ #
341
+ # @param resource_group_name [String] The name of the resource group within the
342
+ # user's subscription.
343
+ # @param [Hash{String => String}] A hash of custom headers that will be added
344
+ # to the HTTP request.
345
+ #
346
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
347
+ #
348
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
349
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
350
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
351
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
352
+
353
+
354
+ request_headers = {}
355
+
356
+ # Set Headers
357
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
358
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
359
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics'
360
+
361
+ request_url = @base_url || @client.base_url
362
+
363
+ options = {
364
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
365
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
366
+ query_params: {'api-version' => @client.api_version},
367
+ headers: request_headers.merge(custom_headers || {}),
368
+ base_url: request_url
369
+ }
370
+ promise = @client.make_request_async(:get, path_template, options)
371
+
372
+ promise = promise.then do |result|
373
+ http_response = result.response
374
+ status_code = http_response.status
375
+ response_content = http_response.body
376
+ unless status_code == 200
377
+ error_model = JSON.load(response_content)
378
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
379
+ end
380
+
381
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
382
+ # Deserialize Response
383
+ if status_code == 200
384
+ begin
385
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
386
+ result_mapper = Azure::ARM::EventGrid::Models::TopicsListResult.mapper()
387
+ result.body = @client.deserialize(result_mapper, parsed_response)
388
+ rescue Exception => e
389
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
390
+ end
391
+ end
392
+
393
+ result
394
+ end
395
+
396
+ promise.execute
397
+ end
398
+
399
+ #
400
+ # List keys for a topic
401
+ #
402
+ # List the two keys used to publish to a topic
403
+ #
404
+ # @param resource_group_name [String] The name of the resource group within the
405
+ # user's subscription.
406
+ # @param topic_name [String] Name of the topic
407
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
408
+ # will be added to the HTTP request.
409
+ #
410
+ # @return [TopicSharedAccessKeys] operation results.
411
+ #
412
+ def list_shared_access_keys(resource_group_name, topic_name, custom_headers = nil)
413
+ response = list_shared_access_keys_async(resource_group_name, topic_name, custom_headers).value!
414
+ response.body unless response.nil?
415
+ end
416
+
417
+ #
418
+ # List keys for a topic
419
+ #
420
+ # List the two keys used to publish to a topic
421
+ #
422
+ # @param resource_group_name [String] The name of the resource group within the
423
+ # user's subscription.
424
+ # @param topic_name [String] Name of the topic
425
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
426
+ # will be added to the HTTP request.
427
+ #
428
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
429
+ #
430
+ def list_shared_access_keys_with_http_info(resource_group_name, topic_name, custom_headers = nil)
431
+ list_shared_access_keys_async(resource_group_name, topic_name, custom_headers).value!
432
+ end
433
+
434
+ #
435
+ # List keys for a topic
436
+ #
437
+ # List the two keys used to publish to a topic
438
+ #
439
+ # @param resource_group_name [String] The name of the resource group within the
440
+ # user's subscription.
441
+ # @param topic_name [String] Name of the topic
442
+ # @param [Hash{String => String}] A hash of custom headers that will be added
443
+ # to the HTTP request.
444
+ #
445
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
446
+ #
447
+ def list_shared_access_keys_async(resource_group_name, topic_name, custom_headers = nil)
448
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
449
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
450
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
451
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
452
+
453
+
454
+ request_headers = {}
455
+
456
+ # Set Headers
457
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
458
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
459
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/listKeys'
460
+
461
+ request_url = @base_url || @client.base_url
462
+
463
+ options = {
464
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
465
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name},
466
+ query_params: {'api-version' => @client.api_version},
467
+ headers: request_headers.merge(custom_headers || {}),
468
+ base_url: request_url
469
+ }
470
+ promise = @client.make_request_async(:post, path_template, options)
471
+
472
+ promise = promise.then do |result|
473
+ http_response = result.response
474
+ status_code = http_response.status
475
+ response_content = http_response.body
476
+ unless status_code == 200
477
+ error_model = JSON.load(response_content)
478
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
479
+ end
480
+
481
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
482
+ # Deserialize Response
483
+ if status_code == 200
484
+ begin
485
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
486
+ result_mapper = Azure::ARM::EventGrid::Models::TopicSharedAccessKeys.mapper()
487
+ result.body = @client.deserialize(result_mapper, parsed_response)
488
+ rescue Exception => e
489
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
490
+ end
491
+ end
492
+
493
+ result
494
+ end
495
+
496
+ promise.execute
497
+ end
498
+
499
+ #
500
+ # Regenerate key for a topic
501
+ #
502
+ # Regenerate a shared access key for a topic
503
+ #
504
+ # @param resource_group_name [String] The name of the resource group within the
505
+ # user's subscription.
506
+ # @param topic_name [String] Name of the topic
507
+ # @param regenerate_key_request [TopicRegenerateKeyRequest] Request body to
508
+ # regenerate key
509
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
510
+ # will be added to the HTTP request.
511
+ #
512
+ # @return [TopicSharedAccessKeys] operation results.
513
+ #
514
+ def regenerate_key(resource_group_name, topic_name, regenerate_key_request, custom_headers = nil)
515
+ response = regenerate_key_async(resource_group_name, topic_name, regenerate_key_request, custom_headers).value!
516
+ response.body unless response.nil?
517
+ end
518
+
519
+ #
520
+ # Regenerate key for a topic
521
+ #
522
+ # Regenerate a shared access key for a topic
523
+ #
524
+ # @param resource_group_name [String] The name of the resource group within the
525
+ # user's subscription.
526
+ # @param topic_name [String] Name of the topic
527
+ # @param regenerate_key_request [TopicRegenerateKeyRequest] Request body to
528
+ # regenerate key
529
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
530
+ # will be added to the HTTP request.
531
+ #
532
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
533
+ #
534
+ def regenerate_key_with_http_info(resource_group_name, topic_name, regenerate_key_request, custom_headers = nil)
535
+ regenerate_key_async(resource_group_name, topic_name, regenerate_key_request, custom_headers).value!
536
+ end
537
+
538
+ #
539
+ # Regenerate key for a topic
540
+ #
541
+ # Regenerate a shared access key for a topic
542
+ #
543
+ # @param resource_group_name [String] The name of the resource group within the
544
+ # user's subscription.
545
+ # @param topic_name [String] Name of the topic
546
+ # @param regenerate_key_request [TopicRegenerateKeyRequest] Request body to
547
+ # regenerate key
548
+ # @param [Hash{String => String}] A hash of custom headers that will be added
549
+ # to the HTTP request.
550
+ #
551
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
552
+ #
553
+ def regenerate_key_async(resource_group_name, topic_name, regenerate_key_request, custom_headers = nil)
554
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
555
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
556
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
557
+ fail ArgumentError, 'regenerate_key_request is nil' if regenerate_key_request.nil?
558
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
559
+
560
+
561
+ request_headers = {}
562
+
563
+ # Set Headers
564
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
565
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
566
+
567
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
568
+
569
+ # Serialize Request
570
+ request_mapper = Azure::ARM::EventGrid::Models::TopicRegenerateKeyRequest.mapper()
571
+ request_content = @client.serialize(request_mapper, regenerate_key_request)
572
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
573
+
574
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/regenerateKey'
575
+
576
+ request_url = @base_url || @client.base_url
577
+
578
+ options = {
579
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
580
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name},
581
+ query_params: {'api-version' => @client.api_version},
582
+ body: request_content,
583
+ headers: request_headers.merge(custom_headers || {}),
584
+ base_url: request_url
585
+ }
586
+ promise = @client.make_request_async(:post, path_template, options)
587
+
588
+ promise = promise.then do |result|
589
+ http_response = result.response
590
+ status_code = http_response.status
591
+ response_content = http_response.body
592
+ unless status_code == 200
593
+ error_model = JSON.load(response_content)
594
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
595
+ end
596
+
597
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
598
+ # Deserialize Response
599
+ if status_code == 200
600
+ begin
601
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
602
+ result_mapper = Azure::ARM::EventGrid::Models::TopicSharedAccessKeys.mapper()
603
+ result.body = @client.deserialize(result_mapper, parsed_response)
604
+ rescue Exception => e
605
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
606
+ end
607
+ end
608
+
609
+ result
610
+ end
611
+
612
+ promise.execute
613
+ end
614
+
615
+ #
616
+ # List topic event types
617
+ #
618
+ # List event types for a topic
619
+ #
620
+ # @param resource_group_name [String] The name of the resource group within the
621
+ # user's subscription.
622
+ # @param provider_namespace [String] Namespace of the provider of the topic
623
+ # @param resource_type_name [String] Name of the topic type
624
+ # @param resource_name [String] Name of the topic
625
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
626
+ # will be added to the HTTP request.
627
+ #
628
+ # @return [EventTypesListResult] operation results.
629
+ #
630
+ def list_event_types(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers = nil)
631
+ response = list_event_types_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers).value!
632
+ response.body unless response.nil?
633
+ end
634
+
635
+ #
636
+ # List topic event types
637
+ #
638
+ # List event types for a topic
639
+ #
640
+ # @param resource_group_name [String] The name of the resource group within the
641
+ # user's subscription.
642
+ # @param provider_namespace [String] Namespace of the provider of the topic
643
+ # @param resource_type_name [String] Name of the topic type
644
+ # @param resource_name [String] Name of the topic
645
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
646
+ # will be added to the HTTP request.
647
+ #
648
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
649
+ #
650
+ def list_event_types_with_http_info(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers = nil)
651
+ list_event_types_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers).value!
652
+ end
653
+
654
+ #
655
+ # List topic event types
656
+ #
657
+ # List event types for a topic
658
+ #
659
+ # @param resource_group_name [String] The name of the resource group within the
660
+ # user's subscription.
661
+ # @param provider_namespace [String] Namespace of the provider of the topic
662
+ # @param resource_type_name [String] Name of the topic type
663
+ # @param resource_name [String] Name of the topic
664
+ # @param [Hash{String => String}] A hash of custom headers that will be added
665
+ # to the HTTP request.
666
+ #
667
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
668
+ #
669
+ def list_event_types_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers = nil)
670
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
671
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
672
+ fail ArgumentError, 'provider_namespace is nil' if provider_namespace.nil?
673
+ fail ArgumentError, 'resource_type_name is nil' if resource_type_name.nil?
674
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
675
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
676
+
677
+
678
+ request_headers = {}
679
+
680
+ # Set Headers
681
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
682
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
683
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes'
684
+
685
+ request_url = @base_url || @client.base_url
686
+
687
+ options = {
688
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
689
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerNamespace' => provider_namespace,'resourceTypeName' => resource_type_name,'resourceName' => resource_name},
690
+ query_params: {'api-version' => @client.api_version},
691
+ headers: request_headers.merge(custom_headers || {}),
692
+ base_url: request_url
693
+ }
694
+ promise = @client.make_request_async(:get, path_template, options)
695
+
696
+ promise = promise.then do |result|
697
+ http_response = result.response
698
+ status_code = http_response.status
699
+ response_content = http_response.body
700
+ unless status_code == 200
701
+ error_model = JSON.load(response_content)
702
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
703
+ end
704
+
705
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
706
+ # Deserialize Response
707
+ if status_code == 200
708
+ begin
709
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
710
+ result_mapper = Azure::ARM::EventGrid::Models::EventTypesListResult.mapper()
711
+ result.body = @client.deserialize(result_mapper, parsed_response)
712
+ rescue Exception => e
713
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
714
+ end
715
+ end
716
+
717
+ result
718
+ end
719
+
720
+ promise.execute
721
+ end
722
+
723
+ #
724
+ # Create a topic
725
+ #
726
+ # Asynchronously creates a new topic with the specified parameters.
727
+ #
728
+ # @param resource_group_name [String] The name of the resource group within the
729
+ # user's subscription.
730
+ # @param topic_name [String] Name of the topic
731
+ # @param topic_info [Topic] Topic information
732
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
733
+ # will be added to the HTTP request.
734
+ #
735
+ # @return [Topic] operation results.
736
+ #
737
+ def begin_create_or_update(resource_group_name, topic_name, topic_info, custom_headers = nil)
738
+ response = begin_create_or_update_async(resource_group_name, topic_name, topic_info, custom_headers).value!
739
+ response.body unless response.nil?
740
+ end
741
+
742
+ #
743
+ # Create a topic
744
+ #
745
+ # Asynchronously creates a new topic with the specified parameters.
746
+ #
747
+ # @param resource_group_name [String] The name of the resource group within the
748
+ # user's subscription.
749
+ # @param topic_name [String] Name of the topic
750
+ # @param topic_info [Topic] Topic information
751
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
752
+ # will be added to the HTTP request.
753
+ #
754
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
755
+ #
756
+ def begin_create_or_update_with_http_info(resource_group_name, topic_name, topic_info, custom_headers = nil)
757
+ begin_create_or_update_async(resource_group_name, topic_name, topic_info, custom_headers).value!
758
+ end
759
+
760
+ #
761
+ # Create a topic
762
+ #
763
+ # Asynchronously creates a new topic with the specified parameters.
764
+ #
765
+ # @param resource_group_name [String] The name of the resource group within the
766
+ # user's subscription.
767
+ # @param topic_name [String] Name of the topic
768
+ # @param topic_info [Topic] Topic information
769
+ # @param [Hash{String => String}] A hash of custom headers that will be added
770
+ # to the HTTP request.
771
+ #
772
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
773
+ #
774
+ def begin_create_or_update_async(resource_group_name, topic_name, topic_info, custom_headers = nil)
775
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
776
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
777
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
778
+ fail ArgumentError, 'topic_info is nil' if topic_info.nil?
779
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
780
+
781
+
782
+ request_headers = {}
783
+
784
+ # Set Headers
785
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
786
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
787
+
788
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
789
+
790
+ # Serialize Request
791
+ request_mapper = Azure::ARM::EventGrid::Models::Topic.mapper()
792
+ request_content = @client.serialize(request_mapper, topic_info)
793
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
794
+
795
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
796
+
797
+ request_url = @base_url || @client.base_url
798
+
799
+ options = {
800
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
801
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name},
802
+ query_params: {'api-version' => @client.api_version},
803
+ body: request_content,
804
+ headers: request_headers.merge(custom_headers || {}),
805
+ base_url: request_url
806
+ }
807
+ promise = @client.make_request_async(:put, path_template, options)
808
+
809
+ promise = promise.then do |result|
810
+ http_response = result.response
811
+ status_code = http_response.status
812
+ response_content = http_response.body
813
+ unless status_code == 201
814
+ error_model = JSON.load(response_content)
815
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
816
+ end
817
+
818
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
819
+ # Deserialize Response
820
+ if status_code == 201
821
+ begin
822
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
823
+ result_mapper = Azure::ARM::EventGrid::Models::Topic.mapper()
824
+ result.body = @client.deserialize(result_mapper, parsed_response)
825
+ rescue Exception => e
826
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
827
+ end
828
+ end
829
+
830
+ result
831
+ end
832
+
833
+ promise.execute
834
+ end
835
+
836
+ #
837
+ # Delete a topic
838
+ #
839
+ # Delete existing topic
840
+ #
841
+ # @param resource_group_name [String] The name of the resource group within the
842
+ # user's subscription.
843
+ # @param topic_name [String] Name of the topic
844
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
845
+ # will be added to the HTTP request.
846
+ #
847
+ #
848
+ def begin_delete(resource_group_name, topic_name, custom_headers = nil)
849
+ response = begin_delete_async(resource_group_name, topic_name, custom_headers).value!
850
+ nil
851
+ end
852
+
853
+ #
854
+ # Delete a topic
855
+ #
856
+ # Delete existing topic
857
+ #
858
+ # @param resource_group_name [String] The name of the resource group within the
859
+ # user's subscription.
860
+ # @param topic_name [String] Name of the topic
861
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
862
+ # will be added to the HTTP request.
863
+ #
864
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
865
+ #
866
+ def begin_delete_with_http_info(resource_group_name, topic_name, custom_headers = nil)
867
+ begin_delete_async(resource_group_name, topic_name, custom_headers).value!
868
+ end
869
+
870
+ #
871
+ # Delete a topic
872
+ #
873
+ # Delete existing topic
874
+ #
875
+ # @param resource_group_name [String] The name of the resource group within the
876
+ # user's subscription.
877
+ # @param topic_name [String] Name of the topic
878
+ # @param [Hash{String => String}] A hash of custom headers that will be added
879
+ # to the HTTP request.
880
+ #
881
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
882
+ #
883
+ def begin_delete_async(resource_group_name, topic_name, custom_headers = nil)
884
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
885
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
886
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
887
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
888
+
889
+
890
+ request_headers = {}
891
+
892
+ # Set Headers
893
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
894
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
895
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
896
+
897
+ request_url = @base_url || @client.base_url
898
+
899
+ options = {
900
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
901
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name},
902
+ query_params: {'api-version' => @client.api_version},
903
+ headers: request_headers.merge(custom_headers || {}),
904
+ base_url: request_url
905
+ }
906
+ promise = @client.make_request_async(:delete, path_template, options)
907
+
908
+ promise = promise.then do |result|
909
+ http_response = result.response
910
+ status_code = http_response.status
911
+ response_content = http_response.body
912
+ unless status_code == 202 || status_code == 204
913
+ error_model = JSON.load(response_content)
914
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
915
+ end
916
+
917
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
918
+
919
+ result
920
+ end
921
+
922
+ promise.execute
923
+ end
924
+
925
+ end
926
+ end