azure_mgmt_operational_insights 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 (53) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_operational_insights.rb +8 -0
  4. data/lib/generated/azure_mgmt_operational_insights.rb +72 -0
  5. data/lib/generated/azure_mgmt_operational_insights/data_sources.rb +567 -0
  6. data/lib/generated/azure_mgmt_operational_insights/linked_services.rb +440 -0
  7. data/lib/generated/azure_mgmt_operational_insights/models/core_summary.rb +54 -0
  8. data/lib/generated/azure_mgmt_operational_insights/models/data_source.rb +108 -0
  9. data/lib/generated/azure_mgmt_operational_insights/models/data_source_filter.rb +49 -0
  10. data/lib/generated/azure_mgmt_operational_insights/models/data_source_kind.rb +29 -0
  11. data/lib/generated/azure_mgmt_operational_insights/models/data_source_list_result.rb +94 -0
  12. data/lib/generated/azure_mgmt_operational_insights/models/entity_status.rb +20 -0
  13. data/lib/generated/azure_mgmt_operational_insights/models/intelligence_pack.rb +55 -0
  14. data/lib/generated/azure_mgmt_operational_insights/models/link_target.rb +74 -0
  15. data/lib/generated/azure_mgmt_operational_insights/models/linked_service.rb +83 -0
  16. data/lib/generated/azure_mgmt_operational_insights/models/linked_service_list_result.rb +53 -0
  17. data/lib/generated/azure_mgmt_operational_insights/models/management_group.rb +119 -0
  18. data/lib/generated/azure_mgmt_operational_insights/models/metric_name.rb +54 -0
  19. data/lib/generated/azure_mgmt_operational_insights/models/proxy_resource.rb +84 -0
  20. data/lib/generated/azure_mgmt_operational_insights/models/resource.rb +94 -0
  21. data/lib/generated/azure_mgmt_operational_insights/models/saved_search.rb +121 -0
  22. data/lib/generated/azure_mgmt_operational_insights/models/saved_searches_list_result.rb +63 -0
  23. data/lib/generated/azure_mgmt_operational_insights/models/search_error.rb +54 -0
  24. data/lib/generated/azure_mgmt_operational_insights/models/search_get_schema_response.rb +63 -0
  25. data/lib/generated/azure_mgmt_operational_insights/models/search_highlight.rb +54 -0
  26. data/lib/generated/azure_mgmt_operational_insights/models/search_metadata.rb +221 -0
  27. data/lib/generated/azure_mgmt_operational_insights/models/search_metadata_schema.rb +54 -0
  28. data/lib/generated/azure_mgmt_operational_insights/models/search_parameters.rb +88 -0
  29. data/lib/generated/azure_mgmt_operational_insights/models/search_results_response.rb +84 -0
  30. data/lib/generated/azure_mgmt_operational_insights/models/search_schema_value.rb +114 -0
  31. data/lib/generated/azure_mgmt_operational_insights/models/search_sort.rb +55 -0
  32. data/lib/generated/azure_mgmt_operational_insights/models/search_sort_enum.rb +16 -0
  33. data/lib/generated/azure_mgmt_operational_insights/models/shared_keys.rb +54 -0
  34. data/lib/generated/azure_mgmt_operational_insights/models/sku.rb +45 -0
  35. data/lib/generated/azure_mgmt_operational_insights/models/sku_name_enum.rb +20 -0
  36. data/lib/generated/azure_mgmt_operational_insights/models/storage_account.rb +55 -0
  37. data/lib/generated/azure_mgmt_operational_insights/models/storage_insight.rb +141 -0
  38. data/lib/generated/azure_mgmt_operational_insights/models/storage_insight_list_result.rb +95 -0
  39. data/lib/generated/azure_mgmt_operational_insights/models/storage_insight_state.rb +16 -0
  40. data/lib/generated/azure_mgmt_operational_insights/models/storage_insight_status.rb +55 -0
  41. data/lib/generated/azure_mgmt_operational_insights/models/tag.rb +54 -0
  42. data/lib/generated/azure_mgmt_operational_insights/models/usage_metric.rb +96 -0
  43. data/lib/generated/azure_mgmt_operational_insights/models/workspace.rb +165 -0
  44. data/lib/generated/azure_mgmt_operational_insights/models/workspace_list_management_groups_result.rb +53 -0
  45. data/lib/generated/azure_mgmt_operational_insights/models/workspace_list_result.rb +52 -0
  46. data/lib/generated/azure_mgmt_operational_insights/models/workspace_list_usages_result.rb +53 -0
  47. data/lib/generated/azure_mgmt_operational_insights/module_definition.rb +8 -0
  48. data/lib/generated/azure_mgmt_operational_insights/operational_insights_management_client.rb +143 -0
  49. data/lib/generated/azure_mgmt_operational_insights/saved_searches.rb +513 -0
  50. data/lib/generated/azure_mgmt_operational_insights/storage_insights.rb +560 -0
  51. data/lib/generated/azure_mgmt_operational_insights/version.rb +8 -0
  52. data/lib/generated/azure_mgmt_operational_insights/workspaces.rb +1569 -0
  53. metadata +164 -0
@@ -0,0 +1,8 @@
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::OperationalInsights
7
+ VERSION = '0.14.0'
8
+ end
@@ -0,0 +1,1569 @@
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::OperationalInsights
7
+ #
8
+ # Operational Insights Client
9
+ #
10
+ class Workspaces
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Workspaces class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [OperationalInsightsManagementClient] reference to the OperationalInsightsManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Disables an intelligence pack for a given workspace.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group to get.
28
+ # The name is case insensitive.
29
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
30
+ # @param intelligence_pack_name [String] The name of the intelligence pack to
31
+ # be disabled.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ #
36
+ def disable_intelligence_pack(resource_group_name, workspace_name, intelligence_pack_name, custom_headers = nil)
37
+ response = disable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers).value!
38
+ nil
39
+ end
40
+
41
+ #
42
+ # Disables an intelligence pack for a given workspace.
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group to get.
45
+ # The name is case insensitive.
46
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
47
+ # @param intelligence_pack_name [String] The name of the intelligence pack to
48
+ # be disabled.
49
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
50
+ # will be added to the HTTP request.
51
+ #
52
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
53
+ #
54
+ def disable_intelligence_pack_with_http_info(resource_group_name, workspace_name, intelligence_pack_name, custom_headers = nil)
55
+ disable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers).value!
56
+ end
57
+
58
+ #
59
+ # Disables an intelligence pack for a given workspace.
60
+ #
61
+ # @param resource_group_name [String] The name of the resource group to get.
62
+ # The name is case insensitive.
63
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
64
+ # @param intelligence_pack_name [String] The name of the intelligence pack to
65
+ # be disabled.
66
+ # @param [Hash{String => String}] A hash of custom headers that will be added
67
+ # to the HTTP request.
68
+ #
69
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
70
+ #
71
+ def disable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers = nil)
72
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
73
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
74
+ fail ArgumentError, 'intelligence_pack_name is nil' if intelligence_pack_name.nil?
75
+ api_version = '2015-11-01-preview'
76
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Disable'
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: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'intelligencePackName' => intelligence_pack_name,'subscriptionId' => @client.subscription_id},
91
+ query_params: {'api-version' => api_version},
92
+ headers: request_headers.merge(custom_headers || {}),
93
+ base_url: request_url
94
+ }
95
+ promise = @client.make_request_async(:post, 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
+
108
+ result
109
+ end
110
+
111
+ promise.execute
112
+ end
113
+
114
+ #
115
+ # Enables an intelligence pack for a given workspace.
116
+ #
117
+ # @param resource_group_name [String] The name of the resource group to get.
118
+ # The name is case insensitive.
119
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
120
+ # @param intelligence_pack_name [String] The name of the intelligence pack to
121
+ # be enabled.
122
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
123
+ # will be added to the HTTP request.
124
+ #
125
+ #
126
+ def enable_intelligence_pack(resource_group_name, workspace_name, intelligence_pack_name, custom_headers = nil)
127
+ response = enable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers).value!
128
+ nil
129
+ end
130
+
131
+ #
132
+ # Enables an intelligence pack for a given workspace.
133
+ #
134
+ # @param resource_group_name [String] The name of the resource group to get.
135
+ # The name is case insensitive.
136
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
137
+ # @param intelligence_pack_name [String] The name of the intelligence pack to
138
+ # be enabled.
139
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
140
+ # will be added to the HTTP request.
141
+ #
142
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
143
+ #
144
+ def enable_intelligence_pack_with_http_info(resource_group_name, workspace_name, intelligence_pack_name, custom_headers = nil)
145
+ enable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers).value!
146
+ end
147
+
148
+ #
149
+ # Enables an intelligence pack for a given workspace.
150
+ #
151
+ # @param resource_group_name [String] The name of the resource group to get.
152
+ # The name is case insensitive.
153
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
154
+ # @param intelligence_pack_name [String] The name of the intelligence pack to
155
+ # be enabled.
156
+ # @param [Hash{String => String}] A hash of custom headers that will be added
157
+ # to the HTTP request.
158
+ #
159
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
160
+ #
161
+ def enable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers = nil)
162
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
163
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
164
+ fail ArgumentError, 'intelligence_pack_name is nil' if intelligence_pack_name.nil?
165
+ api_version = '2015-11-01-preview'
166
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
167
+
168
+
169
+ request_headers = {}
170
+
171
+ # Set Headers
172
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
173
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
174
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Enable'
175
+
176
+ request_url = @base_url || @client.base_url
177
+
178
+ options = {
179
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
180
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'intelligencePackName' => intelligence_pack_name,'subscriptionId' => @client.subscription_id},
181
+ query_params: {'api-version' => api_version},
182
+ headers: request_headers.merge(custom_headers || {}),
183
+ base_url: request_url
184
+ }
185
+ promise = @client.make_request_async(:post, path_template, options)
186
+
187
+ promise = promise.then do |result|
188
+ http_response = result.response
189
+ status_code = http_response.status
190
+ response_content = http_response.body
191
+ unless status_code == 200
192
+ error_model = JSON.load(response_content)
193
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
194
+ end
195
+
196
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
197
+
198
+ result
199
+ end
200
+
201
+ promise.execute
202
+ end
203
+
204
+ #
205
+ # Lists all the intelligence packs possible and whether they are enabled or
206
+ # disabled for a given workspace.
207
+ #
208
+ # @param resource_group_name [String] The name of the resource group to get.
209
+ # The name is case insensitive.
210
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
211
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
212
+ # will be added to the HTTP request.
213
+ #
214
+ # @return [Array] operation results.
215
+ #
216
+ def list_intelligence_packs(resource_group_name, workspace_name, custom_headers = nil)
217
+ response = list_intelligence_packs_async(resource_group_name, workspace_name, custom_headers).value!
218
+ response.body unless response.nil?
219
+ end
220
+
221
+ #
222
+ # Lists all the intelligence packs possible and whether they are enabled or
223
+ # disabled for a given workspace.
224
+ #
225
+ # @param resource_group_name [String] The name of the resource group to get.
226
+ # The name is case insensitive.
227
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
228
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
229
+ # will be added to the HTTP request.
230
+ #
231
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
232
+ #
233
+ def list_intelligence_packs_with_http_info(resource_group_name, workspace_name, custom_headers = nil)
234
+ list_intelligence_packs_async(resource_group_name, workspace_name, custom_headers).value!
235
+ end
236
+
237
+ #
238
+ # Lists all the intelligence packs possible and whether they are enabled or
239
+ # disabled for a given workspace.
240
+ #
241
+ # @param resource_group_name [String] The name of the resource group to get.
242
+ # The name is case insensitive.
243
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
244
+ # @param [Hash{String => String}] A hash of custom headers that will be added
245
+ # to the HTTP request.
246
+ #
247
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
248
+ #
249
+ def list_intelligence_packs_async(resource_group_name, workspace_name, custom_headers = nil)
250
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
251
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
252
+ api_version = '2015-11-01-preview'
253
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
254
+
255
+
256
+ request_headers = {}
257
+
258
+ # Set Headers
259
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
260
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
261
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks'
262
+
263
+ request_url = @base_url || @client.base_url
264
+
265
+ options = {
266
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
267
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
268
+ query_params: {'api-version' => api_version},
269
+ headers: request_headers.merge(custom_headers || {}),
270
+ base_url: request_url
271
+ }
272
+ promise = @client.make_request_async(:get, path_template, options)
273
+
274
+ promise = promise.then do |result|
275
+ http_response = result.response
276
+ status_code = http_response.status
277
+ response_content = http_response.body
278
+ unless status_code == 200
279
+ error_model = JSON.load(response_content)
280
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
281
+ end
282
+
283
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
284
+ # Deserialize Response
285
+ if status_code == 200
286
+ begin
287
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
288
+ result_mapper = {
289
+ required: false,
290
+ serialized_name: 'parsed_response',
291
+ type: {
292
+ name: 'Sequence',
293
+ element: {
294
+ required: false,
295
+ serialized_name: 'IntelligencePackElementType',
296
+ type: {
297
+ name: 'Composite',
298
+ class_name: 'IntelligencePack'
299
+ }
300
+ }
301
+ }
302
+ }
303
+ result.body = @client.deserialize(result_mapper, parsed_response)
304
+ rescue Exception => e
305
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
306
+ end
307
+ end
308
+
309
+ result
310
+ end
311
+
312
+ promise.execute
313
+ end
314
+
315
+ #
316
+ # Gets the shared keys for a workspace.
317
+ #
318
+ # @param resource_group_name [String] The name of the resource group to get.
319
+ # The name is case insensitive.
320
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
321
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
322
+ # will be added to the HTTP request.
323
+ #
324
+ # @return [SharedKeys] operation results.
325
+ #
326
+ def get_shared_keys(resource_group_name, workspace_name, custom_headers = nil)
327
+ response = get_shared_keys_async(resource_group_name, workspace_name, custom_headers).value!
328
+ response.body unless response.nil?
329
+ end
330
+
331
+ #
332
+ # Gets the shared keys for a workspace.
333
+ #
334
+ # @param resource_group_name [String] The name of the resource group to get.
335
+ # The name is case insensitive.
336
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
337
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
338
+ # will be added to the HTTP request.
339
+ #
340
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
341
+ #
342
+ def get_shared_keys_with_http_info(resource_group_name, workspace_name, custom_headers = nil)
343
+ get_shared_keys_async(resource_group_name, workspace_name, custom_headers).value!
344
+ end
345
+
346
+ #
347
+ # Gets the shared keys for a workspace.
348
+ #
349
+ # @param resource_group_name [String] The name of the resource group to get.
350
+ # The name is case insensitive.
351
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
352
+ # @param [Hash{String => String}] A hash of custom headers that will be added
353
+ # to the HTTP request.
354
+ #
355
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
356
+ #
357
+ def get_shared_keys_async(resource_group_name, workspace_name, custom_headers = nil)
358
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
359
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
360
+ api_version = '2015-11-01-preview'
361
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
362
+
363
+
364
+ request_headers = {}
365
+
366
+ # Set Headers
367
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
368
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
369
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/sharedKeys'
370
+
371
+ request_url = @base_url || @client.base_url
372
+
373
+ options = {
374
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
375
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
376
+ query_params: {'api-version' => api_version},
377
+ headers: request_headers.merge(custom_headers || {}),
378
+ base_url: request_url
379
+ }
380
+ promise = @client.make_request_async(:post, path_template, options)
381
+
382
+ promise = promise.then do |result|
383
+ http_response = result.response
384
+ status_code = http_response.status
385
+ response_content = http_response.body
386
+ unless status_code == 200
387
+ error_model = JSON.load(response_content)
388
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
389
+ end
390
+
391
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
392
+ # Deserialize Response
393
+ if status_code == 200
394
+ begin
395
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
396
+ result_mapper = Azure::ARM::OperationalInsights::Models::SharedKeys.mapper()
397
+ result.body = @client.deserialize(result_mapper, parsed_response)
398
+ rescue Exception => e
399
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
400
+ end
401
+ end
402
+
403
+ result
404
+ end
405
+
406
+ promise.execute
407
+ end
408
+
409
+ #
410
+ # Gets a list of usage metrics for a workspace.
411
+ #
412
+ # @param resource_group_name [String] The name of the resource group to get.
413
+ # The name is case insensitive.
414
+ # @param workspace_name [String] The name of the workspace.
415
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
416
+ # will be added to the HTTP request.
417
+ #
418
+ # @return [WorkspaceListUsagesResult] operation results.
419
+ #
420
+ def list_usages(resource_group_name, workspace_name, custom_headers = nil)
421
+ response = list_usages_async(resource_group_name, workspace_name, custom_headers).value!
422
+ response.body unless response.nil?
423
+ end
424
+
425
+ #
426
+ # Gets a list of usage metrics for a workspace.
427
+ #
428
+ # @param resource_group_name [String] The name of the resource group to get.
429
+ # The name is case insensitive.
430
+ # @param workspace_name [String] The name of the workspace.
431
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
432
+ # will be added to the HTTP request.
433
+ #
434
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
435
+ #
436
+ def list_usages_with_http_info(resource_group_name, workspace_name, custom_headers = nil)
437
+ list_usages_async(resource_group_name, workspace_name, custom_headers).value!
438
+ end
439
+
440
+ #
441
+ # Gets a list of usage metrics for a workspace.
442
+ #
443
+ # @param resource_group_name [String] The name of the resource group to get.
444
+ # The name is case insensitive.
445
+ # @param workspace_name [String] The name of the workspace.
446
+ # @param [Hash{String => String}] A hash of custom headers that will be added
447
+ # to the HTTP request.
448
+ #
449
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
450
+ #
451
+ def list_usages_async(resource_group_name, workspace_name, custom_headers = nil)
452
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
453
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
454
+ api_version = '2015-11-01-preview'
455
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
456
+
457
+
458
+ request_headers = {}
459
+
460
+ # Set Headers
461
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
462
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
463
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/usages'
464
+
465
+ request_url = @base_url || @client.base_url
466
+
467
+ options = {
468
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
469
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
470
+ query_params: {'api-version' => api_version},
471
+ headers: request_headers.merge(custom_headers || {}),
472
+ base_url: request_url
473
+ }
474
+ promise = @client.make_request_async(:get, path_template, options)
475
+
476
+ promise = promise.then do |result|
477
+ http_response = result.response
478
+ status_code = http_response.status
479
+ response_content = http_response.body
480
+ unless status_code == 200
481
+ error_model = JSON.load(response_content)
482
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
483
+ end
484
+
485
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
486
+ # Deserialize Response
487
+ if status_code == 200
488
+ begin
489
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
490
+ result_mapper = Azure::ARM::OperationalInsights::Models::WorkspaceListUsagesResult.mapper()
491
+ result.body = @client.deserialize(result_mapper, parsed_response)
492
+ rescue Exception => e
493
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
494
+ end
495
+ end
496
+
497
+ result
498
+ end
499
+
500
+ promise.execute
501
+ end
502
+
503
+ #
504
+ # Gets a list of management groups connected to a workspace.
505
+ #
506
+ # @param resource_group_name [String] The name of the resource group to get.
507
+ # The name is case insensitive.
508
+ # @param workspace_name [String] The name of the workspace.
509
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
510
+ # will be added to the HTTP request.
511
+ #
512
+ # @return [WorkspaceListManagementGroupsResult] operation results.
513
+ #
514
+ def list_management_groups(resource_group_name, workspace_name, custom_headers = nil)
515
+ response = list_management_groups_async(resource_group_name, workspace_name, custom_headers).value!
516
+ response.body unless response.nil?
517
+ end
518
+
519
+ #
520
+ # Gets a list of management groups connected to a workspace.
521
+ #
522
+ # @param resource_group_name [String] The name of the resource group to get.
523
+ # The name is case insensitive.
524
+ # @param workspace_name [String] The name of the workspace.
525
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
526
+ # will be added to the HTTP request.
527
+ #
528
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
529
+ #
530
+ def list_management_groups_with_http_info(resource_group_name, workspace_name, custom_headers = nil)
531
+ list_management_groups_async(resource_group_name, workspace_name, custom_headers).value!
532
+ end
533
+
534
+ #
535
+ # Gets a list of management groups connected to a workspace.
536
+ #
537
+ # @param resource_group_name [String] The name of the resource group to get.
538
+ # The name is case insensitive.
539
+ # @param workspace_name [String] The name of the workspace.
540
+ # @param [Hash{String => String}] A hash of custom headers that will be added
541
+ # to the HTTP request.
542
+ #
543
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
544
+ #
545
+ def list_management_groups_async(resource_group_name, workspace_name, custom_headers = nil)
546
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
547
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
548
+ api_version = '2015-11-01-preview'
549
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
550
+
551
+
552
+ request_headers = {}
553
+
554
+ # Set Headers
555
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
556
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
557
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/managementGroups'
558
+
559
+ request_url = @base_url || @client.base_url
560
+
561
+ options = {
562
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
563
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
564
+ query_params: {'api-version' => api_version},
565
+ headers: request_headers.merge(custom_headers || {}),
566
+ base_url: request_url
567
+ }
568
+ promise = @client.make_request_async(:get, path_template, options)
569
+
570
+ promise = promise.then do |result|
571
+ http_response = result.response
572
+ status_code = http_response.status
573
+ response_content = http_response.body
574
+ unless status_code == 200
575
+ error_model = JSON.load(response_content)
576
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
577
+ end
578
+
579
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
580
+ # Deserialize Response
581
+ if status_code == 200
582
+ begin
583
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
584
+ result_mapper = Azure::ARM::OperationalInsights::Models::WorkspaceListManagementGroupsResult.mapper()
585
+ result.body = @client.deserialize(result_mapper, parsed_response)
586
+ rescue Exception => e
587
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
588
+ end
589
+ end
590
+
591
+ result
592
+ end
593
+
594
+ promise.execute
595
+ end
596
+
597
+ #
598
+ # Gets workspaces in a resource group.
599
+ #
600
+ # @param resource_group_name [String] The name of the resource group to get.
601
+ # The name is case insensitive.
602
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
603
+ # will be added to the HTTP request.
604
+ #
605
+ # @return [WorkspaceListResult] operation results.
606
+ #
607
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
608
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
609
+ response.body unless response.nil?
610
+ end
611
+
612
+ #
613
+ # Gets workspaces in a resource group.
614
+ #
615
+ # @param resource_group_name [String] The name of the resource group to get.
616
+ # The name is case insensitive.
617
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
618
+ # will be added to the HTTP request.
619
+ #
620
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
621
+ #
622
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
623
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
624
+ end
625
+
626
+ #
627
+ # Gets workspaces in a resource group.
628
+ #
629
+ # @param resource_group_name [String] The name of the resource group to get.
630
+ # The name is case insensitive.
631
+ # @param [Hash{String => String}] A hash of custom headers that will be added
632
+ # to the HTTP request.
633
+ #
634
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
635
+ #
636
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
637
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
638
+ api_version = '2015-11-01-preview'
639
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
640
+
641
+
642
+ request_headers = {}
643
+
644
+ # Set Headers
645
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
646
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
647
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces'
648
+
649
+ request_url = @base_url || @client.base_url
650
+
651
+ options = {
652
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
653
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
654
+ query_params: {'api-version' => api_version},
655
+ headers: request_headers.merge(custom_headers || {}),
656
+ base_url: request_url
657
+ }
658
+ promise = @client.make_request_async(:get, path_template, options)
659
+
660
+ promise = promise.then do |result|
661
+ http_response = result.response
662
+ status_code = http_response.status
663
+ response_content = http_response.body
664
+ unless status_code == 200
665
+ error_model = JSON.load(response_content)
666
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
667
+ end
668
+
669
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
670
+ # Deserialize Response
671
+ if status_code == 200
672
+ begin
673
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
674
+ result_mapper = Azure::ARM::OperationalInsights::Models::WorkspaceListResult.mapper()
675
+ result.body = @client.deserialize(result_mapper, parsed_response)
676
+ rescue Exception => e
677
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
678
+ end
679
+ end
680
+
681
+ result
682
+ end
683
+
684
+ promise.execute
685
+ end
686
+
687
+ #
688
+ # Gets the workspaces in a subscription.
689
+ #
690
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
691
+ # will be added to the HTTP request.
692
+ #
693
+ # @return [WorkspaceListResult] operation results.
694
+ #
695
+ def list(custom_headers = nil)
696
+ response = list_async(custom_headers).value!
697
+ response.body unless response.nil?
698
+ end
699
+
700
+ #
701
+ # Gets the workspaces in a subscription.
702
+ #
703
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
704
+ # will be added to the HTTP request.
705
+ #
706
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
707
+ #
708
+ def list_with_http_info(custom_headers = nil)
709
+ list_async(custom_headers).value!
710
+ end
711
+
712
+ #
713
+ # Gets the workspaces in a subscription.
714
+ #
715
+ # @param [Hash{String => String}] A hash of custom headers that will be added
716
+ # to the HTTP request.
717
+ #
718
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
719
+ #
720
+ def list_async(custom_headers = nil)
721
+ api_version = '2015-11-01-preview'
722
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
723
+
724
+
725
+ request_headers = {}
726
+
727
+ # Set Headers
728
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
729
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
730
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/workspaces'
731
+
732
+ request_url = @base_url || @client.base_url
733
+
734
+ options = {
735
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
736
+ path_params: {'subscriptionId' => @client.subscription_id},
737
+ query_params: {'api-version' => api_version},
738
+ headers: request_headers.merge(custom_headers || {}),
739
+ base_url: request_url
740
+ }
741
+ promise = @client.make_request_async(:get, path_template, options)
742
+
743
+ promise = promise.then do |result|
744
+ http_response = result.response
745
+ status_code = http_response.status
746
+ response_content = http_response.body
747
+ unless status_code == 200
748
+ error_model = JSON.load(response_content)
749
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
750
+ end
751
+
752
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
753
+ # Deserialize Response
754
+ if status_code == 200
755
+ begin
756
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
757
+ result_mapper = Azure::ARM::OperationalInsights::Models::WorkspaceListResult.mapper()
758
+ result.body = @client.deserialize(result_mapper, parsed_response)
759
+ rescue Exception => e
760
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
761
+ end
762
+ end
763
+
764
+ result
765
+ end
766
+
767
+ promise.execute
768
+ end
769
+
770
+ #
771
+ # Create or update a workspace.
772
+ #
773
+ # @param resource_group_name [String] The resource group name of the workspace.
774
+ # @param workspace_name [String] The name of the workspace.
775
+ # @param parameters [Workspace] The parameters required to create or update a
776
+ # workspace.
777
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
778
+ # will be added to the HTTP request.
779
+ #
780
+ # @return [Workspace] operation results.
781
+ #
782
+ def create_or_update(resource_group_name, workspace_name, parameters, custom_headers = nil)
783
+ response = create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers).value!
784
+ response.body unless response.nil?
785
+ end
786
+
787
+ #
788
+ # @param resource_group_name [String] The resource group name of the workspace.
789
+ # @param workspace_name [String] The name of the workspace.
790
+ # @param parameters [Workspace] The parameters required to create or update a
791
+ # workspace.
792
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
793
+ # will be added to the HTTP request.
794
+ #
795
+ # @return [Concurrent::Promise] promise which provides async access to http
796
+ # response.
797
+ #
798
+ def create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers = nil)
799
+ # Send request
800
+ promise = begin_create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers)
801
+
802
+ promise = promise.then do |response|
803
+ # Defining deserialization method.
804
+ deserialize_method = lambda do |parsed_response|
805
+ result_mapper = Azure::ARM::OperationalInsights::Models::Workspace.mapper()
806
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
807
+ end
808
+
809
+ # Waiting for response.
810
+ @client.get_long_running_operation_result(response, deserialize_method)
811
+ end
812
+
813
+ promise
814
+ end
815
+
816
+ #
817
+ # Deletes a workspace instance.
818
+ #
819
+ # @param resource_group_name [String] The resource group name of the workspace.
820
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
821
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
822
+ # will be added to the HTTP request.
823
+ #
824
+ #
825
+ def delete(resource_group_name, workspace_name, custom_headers = nil)
826
+ response = delete_async(resource_group_name, workspace_name, custom_headers).value!
827
+ nil
828
+ end
829
+
830
+ #
831
+ # Deletes a workspace instance.
832
+ #
833
+ # @param resource_group_name [String] The resource group name of the workspace.
834
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
835
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
836
+ # will be added to the HTTP request.
837
+ #
838
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
839
+ #
840
+ def delete_with_http_info(resource_group_name, workspace_name, custom_headers = nil)
841
+ delete_async(resource_group_name, workspace_name, custom_headers).value!
842
+ end
843
+
844
+ #
845
+ # Deletes a workspace instance.
846
+ #
847
+ # @param resource_group_name [String] The resource group name of the workspace.
848
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
849
+ # @param [Hash{String => String}] A hash of custom headers that will be added
850
+ # to the HTTP request.
851
+ #
852
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
853
+ #
854
+ def delete_async(resource_group_name, workspace_name, custom_headers = nil)
855
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
856
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
857
+ api_version = '2015-11-01-preview'
858
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
859
+
860
+
861
+ request_headers = {}
862
+
863
+ # Set Headers
864
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
865
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
866
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}'
867
+
868
+ request_url = @base_url || @client.base_url
869
+
870
+ options = {
871
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
872
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
873
+ query_params: {'api-version' => api_version},
874
+ headers: request_headers.merge(custom_headers || {}),
875
+ base_url: request_url
876
+ }
877
+ promise = @client.make_request_async(:delete, path_template, options)
878
+
879
+ promise = promise.then do |result|
880
+ http_response = result.response
881
+ status_code = http_response.status
882
+ response_content = http_response.body
883
+ unless status_code == 200 || status_code == 204
884
+ error_model = JSON.load(response_content)
885
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
886
+ end
887
+
888
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
889
+
890
+ result
891
+ end
892
+
893
+ promise.execute
894
+ end
895
+
896
+ #
897
+ # Gets a workspace instance.
898
+ #
899
+ # @param resource_group_name [String] The resource group name of the workspace.
900
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
901
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
902
+ # will be added to the HTTP request.
903
+ #
904
+ # @return [Workspace] operation results.
905
+ #
906
+ def get(resource_group_name, workspace_name, custom_headers = nil)
907
+ response = get_async(resource_group_name, workspace_name, custom_headers).value!
908
+ response.body unless response.nil?
909
+ end
910
+
911
+ #
912
+ # Gets a workspace instance.
913
+ #
914
+ # @param resource_group_name [String] The resource group name of the workspace.
915
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
916
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
917
+ # will be added to the HTTP request.
918
+ #
919
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
920
+ #
921
+ def get_with_http_info(resource_group_name, workspace_name, custom_headers = nil)
922
+ get_async(resource_group_name, workspace_name, custom_headers).value!
923
+ end
924
+
925
+ #
926
+ # Gets a workspace instance.
927
+ #
928
+ # @param resource_group_name [String] The resource group name of the workspace.
929
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
930
+ # @param [Hash{String => String}] A hash of custom headers that will be added
931
+ # to the HTTP request.
932
+ #
933
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
934
+ #
935
+ def get_async(resource_group_name, workspace_name, custom_headers = nil)
936
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
937
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
938
+ api_version = '2015-11-01-preview'
939
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
940
+
941
+
942
+ request_headers = {}
943
+
944
+ # Set Headers
945
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
946
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
947
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}'
948
+
949
+ request_url = @base_url || @client.base_url
950
+
951
+ options = {
952
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
953
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
954
+ query_params: {'api-version' => api_version},
955
+ headers: request_headers.merge(custom_headers || {}),
956
+ base_url: request_url
957
+ }
958
+ promise = @client.make_request_async(:get, path_template, options)
959
+
960
+ promise = promise.then do |result|
961
+ http_response = result.response
962
+ status_code = http_response.status
963
+ response_content = http_response.body
964
+ unless status_code == 200
965
+ error_model = JSON.load(response_content)
966
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
967
+ end
968
+
969
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
970
+ # Deserialize Response
971
+ if status_code == 200
972
+ begin
973
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
974
+ result_mapper = Azure::ARM::OperationalInsights::Models::Workspace.mapper()
975
+ result.body = @client.deserialize(result_mapper, parsed_response)
976
+ rescue Exception => e
977
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
978
+ end
979
+ end
980
+
981
+ result
982
+ end
983
+
984
+ promise.execute
985
+ end
986
+
987
+ #
988
+ # Get a list of workspaces which the current user has administrator privileges
989
+ # and are not associated with an Azure Subscription. The subscriptionId
990
+ # parameter in the Url is ignored.
991
+ #
992
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
993
+ # will be added to the HTTP request.
994
+ #
995
+ # @return [Array] operation results.
996
+ #
997
+ def list_link_targets(custom_headers = nil)
998
+ response = list_link_targets_async(custom_headers).value!
999
+ response.body unless response.nil?
1000
+ end
1001
+
1002
+ #
1003
+ # Get a list of workspaces which the current user has administrator privileges
1004
+ # and are not associated with an Azure Subscription. The subscriptionId
1005
+ # parameter in the Url is ignored.
1006
+ #
1007
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1008
+ # will be added to the HTTP request.
1009
+ #
1010
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1011
+ #
1012
+ def list_link_targets_with_http_info(custom_headers = nil)
1013
+ list_link_targets_async(custom_headers).value!
1014
+ end
1015
+
1016
+ #
1017
+ # Get a list of workspaces which the current user has administrator privileges
1018
+ # and are not associated with an Azure Subscription. The subscriptionId
1019
+ # parameter in the Url is ignored.
1020
+ #
1021
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1022
+ # to the HTTP request.
1023
+ #
1024
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1025
+ #
1026
+ def list_link_targets_async(custom_headers = nil)
1027
+ api_version = '2015-03-20'
1028
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1029
+
1030
+
1031
+ request_headers = {}
1032
+
1033
+ # Set Headers
1034
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1035
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1036
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/linkTargets'
1037
+
1038
+ request_url = @base_url || @client.base_url
1039
+
1040
+ options = {
1041
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1042
+ path_params: {'subscriptionId' => @client.subscription_id},
1043
+ query_params: {'api-version' => api_version},
1044
+ headers: request_headers.merge(custom_headers || {}),
1045
+ base_url: request_url
1046
+ }
1047
+ promise = @client.make_request_async(:get, path_template, options)
1048
+
1049
+ promise = promise.then do |result|
1050
+ http_response = result.response
1051
+ status_code = http_response.status
1052
+ response_content = http_response.body
1053
+ unless status_code == 200
1054
+ error_model = JSON.load(response_content)
1055
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1056
+ end
1057
+
1058
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1059
+ # Deserialize Response
1060
+ if status_code == 200
1061
+ begin
1062
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1063
+ result_mapper = {
1064
+ required: false,
1065
+ serialized_name: 'parsed_response',
1066
+ type: {
1067
+ name: 'Sequence',
1068
+ element: {
1069
+ required: false,
1070
+ serialized_name: 'LinkTargetElementType',
1071
+ type: {
1072
+ name: 'Composite',
1073
+ class_name: 'LinkTarget'
1074
+ }
1075
+ }
1076
+ }
1077
+ }
1078
+ result.body = @client.deserialize(result_mapper, parsed_response)
1079
+ rescue Exception => e
1080
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1081
+ end
1082
+ end
1083
+
1084
+ result
1085
+ end
1086
+
1087
+ promise.execute
1088
+ end
1089
+
1090
+ #
1091
+ # Gets the schema for a given workspace.
1092
+ #
1093
+ # @param resource_group_name [String] The name of the resource group to get.
1094
+ # The name is case insensitive.
1095
+ # @param workspace_name [String] Log Analytics workspace name
1096
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1097
+ # will be added to the HTTP request.
1098
+ #
1099
+ # @return [SearchGetSchemaResponse] operation results.
1100
+ #
1101
+ def get_schema(resource_group_name, workspace_name, custom_headers = nil)
1102
+ response = get_schema_async(resource_group_name, workspace_name, custom_headers).value!
1103
+ response.body unless response.nil?
1104
+ end
1105
+
1106
+ #
1107
+ # Gets the schema for a given workspace.
1108
+ #
1109
+ # @param resource_group_name [String] The name of the resource group to get.
1110
+ # The name is case insensitive.
1111
+ # @param workspace_name [String] Log Analytics workspace name
1112
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1113
+ # will be added to the HTTP request.
1114
+ #
1115
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1116
+ #
1117
+ def get_schema_with_http_info(resource_group_name, workspace_name, custom_headers = nil)
1118
+ get_schema_async(resource_group_name, workspace_name, custom_headers).value!
1119
+ end
1120
+
1121
+ #
1122
+ # Gets the schema for a given workspace.
1123
+ #
1124
+ # @param resource_group_name [String] The name of the resource group to get.
1125
+ # The name is case insensitive.
1126
+ # @param workspace_name [String] Log Analytics workspace name
1127
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1128
+ # to the HTTP request.
1129
+ #
1130
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1131
+ #
1132
+ def get_schema_async(resource_group_name, workspace_name, custom_headers = nil)
1133
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1134
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
1135
+ api_version = '2015-03-20'
1136
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1137
+
1138
+
1139
+ request_headers = {}
1140
+
1141
+ # Set Headers
1142
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1143
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1144
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/schema'
1145
+
1146
+ request_url = @base_url || @client.base_url
1147
+
1148
+ options = {
1149
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1150
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
1151
+ query_params: {'api-version' => api_version},
1152
+ headers: request_headers.merge(custom_headers || {}),
1153
+ base_url: request_url
1154
+ }
1155
+ promise = @client.make_request_async(:post, path_template, options)
1156
+
1157
+ promise = promise.then do |result|
1158
+ http_response = result.response
1159
+ status_code = http_response.status
1160
+ response_content = http_response.body
1161
+ unless status_code == 200
1162
+ error_model = JSON.load(response_content)
1163
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1164
+ end
1165
+
1166
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1167
+ # Deserialize Response
1168
+ if status_code == 200
1169
+ begin
1170
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1171
+ result_mapper = Azure::ARM::OperationalInsights::Models::SearchGetSchemaResponse.mapper()
1172
+ result.body = @client.deserialize(result_mapper, parsed_response)
1173
+ rescue Exception => e
1174
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1175
+ end
1176
+ end
1177
+
1178
+ result
1179
+ end
1180
+
1181
+ promise.execute
1182
+ end
1183
+
1184
+ #
1185
+ # Submit a search for a given workspace. The response will contain an id to
1186
+ # track the search. User can use the id to poll the search status and get the
1187
+ # full search result later if the search takes long time to finish.
1188
+ #
1189
+ # @param resource_group_name [String] The name of the resource group to get.
1190
+ # The name is case insensitive.
1191
+ # @param workspace_name [String] Log Analytics workspace name
1192
+ # @param parameters [SearchParameters] The parameters required to execute a
1193
+ # search query.
1194
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1195
+ # will be added to the HTTP request.
1196
+ #
1197
+ # @return [SearchResultsResponse] operation results.
1198
+ #
1199
+ def get_search_results(resource_group_name, workspace_name, parameters, custom_headers = nil)
1200
+ response = get_search_results_async(resource_group_name, workspace_name, parameters, custom_headers).value!
1201
+ response.body unless response.nil?
1202
+ end
1203
+
1204
+ #
1205
+ # @param resource_group_name [String] The name of the resource group to get.
1206
+ # The name is case insensitive.
1207
+ # @param workspace_name [String] Log Analytics workspace name
1208
+ # @param parameters [SearchParameters] The parameters required to execute a
1209
+ # search query.
1210
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1211
+ # will be added to the HTTP request.
1212
+ #
1213
+ # @return [Concurrent::Promise] promise which provides async access to http
1214
+ # response.
1215
+ #
1216
+ def get_search_results_async(resource_group_name, workspace_name, parameters, custom_headers = nil)
1217
+ # Send request
1218
+ promise = begin_get_search_results_async(resource_group_name, workspace_name, parameters, custom_headers)
1219
+
1220
+ promise = promise.then do |response|
1221
+ # Defining deserialization method.
1222
+ deserialize_method = lambda do |parsed_response|
1223
+ result_mapper = Azure::ARM::OperationalInsights::Models::SearchResultsResponse.mapper()
1224
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1225
+ end
1226
+
1227
+ # Waiting for response.
1228
+ @client.get_long_running_operation_result(response, deserialize_method)
1229
+ end
1230
+
1231
+ promise
1232
+ end
1233
+
1234
+ #
1235
+ # Gets updated search results for a given search query.
1236
+ #
1237
+ # @param resource_group_name [String] The name of the resource group to get.
1238
+ # The name is case insensitive.
1239
+ # @param workspace_name [String] Log Analytics workspace name
1240
+ # @param id [String] The id of the search that will have results updated. You
1241
+ # can get the id from the response of the GetResults call.
1242
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1243
+ # will be added to the HTTP request.
1244
+ #
1245
+ # @return [SearchResultsResponse] operation results.
1246
+ #
1247
+ def update_search_results(resource_group_name, workspace_name, id, custom_headers = nil)
1248
+ response = update_search_results_async(resource_group_name, workspace_name, id, custom_headers).value!
1249
+ response.body unless response.nil?
1250
+ end
1251
+
1252
+ #
1253
+ # Gets updated search results for a given search query.
1254
+ #
1255
+ # @param resource_group_name [String] The name of the resource group to get.
1256
+ # The name is case insensitive.
1257
+ # @param workspace_name [String] Log Analytics workspace name
1258
+ # @param id [String] The id of the search that will have results updated. You
1259
+ # can get the id from the response of the GetResults call.
1260
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1261
+ # will be added to the HTTP request.
1262
+ #
1263
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1264
+ #
1265
+ def update_search_results_with_http_info(resource_group_name, workspace_name, id, custom_headers = nil)
1266
+ update_search_results_async(resource_group_name, workspace_name, id, custom_headers).value!
1267
+ end
1268
+
1269
+ #
1270
+ # Gets updated search results for a given search query.
1271
+ #
1272
+ # @param resource_group_name [String] The name of the resource group to get.
1273
+ # The name is case insensitive.
1274
+ # @param workspace_name [String] Log Analytics workspace name
1275
+ # @param id [String] The id of the search that will have results updated. You
1276
+ # can get the id from the response of the GetResults call.
1277
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1278
+ # to the HTTP request.
1279
+ #
1280
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1281
+ #
1282
+ def update_search_results_async(resource_group_name, workspace_name, id, custom_headers = nil)
1283
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1284
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
1285
+ fail ArgumentError, 'id is nil' if id.nil?
1286
+ api_version = '2015-03-20'
1287
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1288
+
1289
+
1290
+ request_headers = {}
1291
+
1292
+ # Set Headers
1293
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1294
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1295
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/search/{id}'
1296
+
1297
+ request_url = @base_url || @client.base_url
1298
+
1299
+ options = {
1300
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1301
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'id' => id,'subscriptionId' => @client.subscription_id},
1302
+ query_params: {'api-version' => api_version},
1303
+ headers: request_headers.merge(custom_headers || {}),
1304
+ base_url: request_url
1305
+ }
1306
+ promise = @client.make_request_async(:post, path_template, options)
1307
+
1308
+ promise = promise.then do |result|
1309
+ http_response = result.response
1310
+ status_code = http_response.status
1311
+ response_content = http_response.body
1312
+ unless status_code == 200
1313
+ error_model = JSON.load(response_content)
1314
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1315
+ end
1316
+
1317
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1318
+ # Deserialize Response
1319
+ if status_code == 200
1320
+ begin
1321
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1322
+ result_mapper = Azure::ARM::OperationalInsights::Models::SearchResultsResponse.mapper()
1323
+ result.body = @client.deserialize(result_mapper, parsed_response)
1324
+ rescue Exception => e
1325
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1326
+ end
1327
+ end
1328
+
1329
+ result
1330
+ end
1331
+
1332
+ promise.execute
1333
+ end
1334
+
1335
+ #
1336
+ # Create or update a workspace.
1337
+ #
1338
+ # @param resource_group_name [String] The resource group name of the workspace.
1339
+ # @param workspace_name [String] The name of the workspace.
1340
+ # @param parameters [Workspace] The parameters required to create or update a
1341
+ # workspace.
1342
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1343
+ # will be added to the HTTP request.
1344
+ #
1345
+ # @return [Workspace] operation results.
1346
+ #
1347
+ def begin_create_or_update(resource_group_name, workspace_name, parameters, custom_headers = nil)
1348
+ response = begin_create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers).value!
1349
+ response.body unless response.nil?
1350
+ end
1351
+
1352
+ #
1353
+ # Create or update a workspace.
1354
+ #
1355
+ # @param resource_group_name [String] The resource group name of the workspace.
1356
+ # @param workspace_name [String] The name of the workspace.
1357
+ # @param parameters [Workspace] The parameters required to create or update a
1358
+ # workspace.
1359
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1360
+ # will be added to the HTTP request.
1361
+ #
1362
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1363
+ #
1364
+ def begin_create_or_update_with_http_info(resource_group_name, workspace_name, parameters, custom_headers = nil)
1365
+ begin_create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers).value!
1366
+ end
1367
+
1368
+ #
1369
+ # Create or update a workspace.
1370
+ #
1371
+ # @param resource_group_name [String] The resource group name of the workspace.
1372
+ # @param workspace_name [String] The name of the workspace.
1373
+ # @param parameters [Workspace] The parameters required to create or update a
1374
+ # workspace.
1375
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1376
+ # to the HTTP request.
1377
+ #
1378
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1379
+ #
1380
+ def begin_create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers = nil)
1381
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1382
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
1383
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1384
+ api_version = '2015-11-01-preview'
1385
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1386
+
1387
+
1388
+ request_headers = {}
1389
+
1390
+ # Set Headers
1391
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1392
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1393
+
1394
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1395
+
1396
+ # Serialize Request
1397
+ request_mapper = Azure::ARM::OperationalInsights::Models::Workspace.mapper()
1398
+ request_content = @client.serialize(request_mapper, parameters)
1399
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1400
+
1401
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}'
1402
+
1403
+ request_url = @base_url || @client.base_url
1404
+
1405
+ options = {
1406
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1407
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
1408
+ query_params: {'api-version' => api_version},
1409
+ body: request_content,
1410
+ headers: request_headers.merge(custom_headers || {}),
1411
+ base_url: request_url
1412
+ }
1413
+ promise = @client.make_request_async(:put, path_template, options)
1414
+
1415
+ promise = promise.then do |result|
1416
+ http_response = result.response
1417
+ status_code = http_response.status
1418
+ response_content = http_response.body
1419
+ unless status_code == 200 || status_code == 201
1420
+ error_model = JSON.load(response_content)
1421
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1422
+ end
1423
+
1424
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1425
+ # Deserialize Response
1426
+ if status_code == 200
1427
+ begin
1428
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1429
+ result_mapper = Azure::ARM::OperationalInsights::Models::Workspace.mapper()
1430
+ result.body = @client.deserialize(result_mapper, parsed_response)
1431
+ rescue Exception => e
1432
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1433
+ end
1434
+ end
1435
+ # Deserialize Response
1436
+ if status_code == 201
1437
+ begin
1438
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1439
+ result_mapper = Azure::ARM::OperationalInsights::Models::Workspace.mapper()
1440
+ result.body = @client.deserialize(result_mapper, parsed_response)
1441
+ rescue Exception => e
1442
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1443
+ end
1444
+ end
1445
+
1446
+ result
1447
+ end
1448
+
1449
+ promise.execute
1450
+ end
1451
+
1452
+ #
1453
+ # Submit a search for a given workspace. The response will contain an id to
1454
+ # track the search. User can use the id to poll the search status and get the
1455
+ # full search result later if the search takes long time to finish.
1456
+ #
1457
+ # @param resource_group_name [String] The name of the resource group to get.
1458
+ # The name is case insensitive.
1459
+ # @param workspace_name [String] Log Analytics workspace name
1460
+ # @param parameters [SearchParameters] The parameters required to execute a
1461
+ # search query.
1462
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1463
+ # will be added to the HTTP request.
1464
+ #
1465
+ # @return [SearchResultsResponse] operation results.
1466
+ #
1467
+ def begin_get_search_results(resource_group_name, workspace_name, parameters, custom_headers = nil)
1468
+ response = begin_get_search_results_async(resource_group_name, workspace_name, parameters, custom_headers).value!
1469
+ response.body unless response.nil?
1470
+ end
1471
+
1472
+ #
1473
+ # Submit a search for a given workspace. The response will contain an id to
1474
+ # track the search. User can use the id to poll the search status and get the
1475
+ # full search result later if the search takes long time to finish.
1476
+ #
1477
+ # @param resource_group_name [String] The name of the resource group to get.
1478
+ # The name is case insensitive.
1479
+ # @param workspace_name [String] Log Analytics workspace name
1480
+ # @param parameters [SearchParameters] The parameters required to execute a
1481
+ # search query.
1482
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1483
+ # will be added to the HTTP request.
1484
+ #
1485
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1486
+ #
1487
+ def begin_get_search_results_with_http_info(resource_group_name, workspace_name, parameters, custom_headers = nil)
1488
+ begin_get_search_results_async(resource_group_name, workspace_name, parameters, custom_headers).value!
1489
+ end
1490
+
1491
+ #
1492
+ # Submit a search for a given workspace. The response will contain an id to
1493
+ # track the search. User can use the id to poll the search status and get the
1494
+ # full search result later if the search takes long time to finish.
1495
+ #
1496
+ # @param resource_group_name [String] The name of the resource group to get.
1497
+ # The name is case insensitive.
1498
+ # @param workspace_name [String] Log Analytics workspace name
1499
+ # @param parameters [SearchParameters] The parameters required to execute a
1500
+ # search query.
1501
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1502
+ # to the HTTP request.
1503
+ #
1504
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1505
+ #
1506
+ def begin_get_search_results_async(resource_group_name, workspace_name, parameters, custom_headers = nil)
1507
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1508
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
1509
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1510
+ api_version = '2015-03-20'
1511
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1512
+
1513
+
1514
+ request_headers = {}
1515
+
1516
+ # Set Headers
1517
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1518
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1519
+
1520
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1521
+
1522
+ # Serialize Request
1523
+ request_mapper = Azure::ARM::OperationalInsights::Models::SearchParameters.mapper()
1524
+ request_content = @client.serialize(request_mapper, parameters)
1525
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1526
+
1527
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/search'
1528
+
1529
+ request_url = @base_url || @client.base_url
1530
+
1531
+ options = {
1532
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1533
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
1534
+ query_params: {'api-version' => api_version},
1535
+ body: request_content,
1536
+ headers: request_headers.merge(custom_headers || {}),
1537
+ base_url: request_url
1538
+ }
1539
+ promise = @client.make_request_async(:post, path_template, options)
1540
+
1541
+ promise = promise.then do |result|
1542
+ http_response = result.response
1543
+ status_code = http_response.status
1544
+ response_content = http_response.body
1545
+ unless status_code == 200 || status_code == 202
1546
+ error_model = JSON.load(response_content)
1547
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1548
+ end
1549
+
1550
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1551
+ # Deserialize Response
1552
+ if status_code == 200
1553
+ begin
1554
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1555
+ result_mapper = Azure::ARM::OperationalInsights::Models::SearchResultsResponse.mapper()
1556
+ result.body = @client.deserialize(result_mapper, parsed_response)
1557
+ rescue Exception => e
1558
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1559
+ end
1560
+ end
1561
+
1562
+ result
1563
+ end
1564
+
1565
+ promise.execute
1566
+ end
1567
+
1568
+ end
1569
+ end