azure_mgmt_event_grid 0.17.1 → 0.17.2

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