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.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/azure_mgmt_operational_insights.rb +8 -0
- data/lib/generated/azure_mgmt_operational_insights.rb +72 -0
- data/lib/generated/azure_mgmt_operational_insights/data_sources.rb +567 -0
- data/lib/generated/azure_mgmt_operational_insights/linked_services.rb +440 -0
- data/lib/generated/azure_mgmt_operational_insights/models/core_summary.rb +54 -0
- data/lib/generated/azure_mgmt_operational_insights/models/data_source.rb +108 -0
- data/lib/generated/azure_mgmt_operational_insights/models/data_source_filter.rb +49 -0
- data/lib/generated/azure_mgmt_operational_insights/models/data_source_kind.rb +29 -0
- data/lib/generated/azure_mgmt_operational_insights/models/data_source_list_result.rb +94 -0
- data/lib/generated/azure_mgmt_operational_insights/models/entity_status.rb +20 -0
- data/lib/generated/azure_mgmt_operational_insights/models/intelligence_pack.rb +55 -0
- data/lib/generated/azure_mgmt_operational_insights/models/link_target.rb +74 -0
- data/lib/generated/azure_mgmt_operational_insights/models/linked_service.rb +83 -0
- data/lib/generated/azure_mgmt_operational_insights/models/linked_service_list_result.rb +53 -0
- data/lib/generated/azure_mgmt_operational_insights/models/management_group.rb +119 -0
- data/lib/generated/azure_mgmt_operational_insights/models/metric_name.rb +54 -0
- data/lib/generated/azure_mgmt_operational_insights/models/proxy_resource.rb +84 -0
- data/lib/generated/azure_mgmt_operational_insights/models/resource.rb +94 -0
- data/lib/generated/azure_mgmt_operational_insights/models/saved_search.rb +121 -0
- data/lib/generated/azure_mgmt_operational_insights/models/saved_searches_list_result.rb +63 -0
- data/lib/generated/azure_mgmt_operational_insights/models/search_error.rb +54 -0
- data/lib/generated/azure_mgmt_operational_insights/models/search_get_schema_response.rb +63 -0
- data/lib/generated/azure_mgmt_operational_insights/models/search_highlight.rb +54 -0
- data/lib/generated/azure_mgmt_operational_insights/models/search_metadata.rb +221 -0
- data/lib/generated/azure_mgmt_operational_insights/models/search_metadata_schema.rb +54 -0
- data/lib/generated/azure_mgmt_operational_insights/models/search_parameters.rb +88 -0
- data/lib/generated/azure_mgmt_operational_insights/models/search_results_response.rb +84 -0
- data/lib/generated/azure_mgmt_operational_insights/models/search_schema_value.rb +114 -0
- data/lib/generated/azure_mgmt_operational_insights/models/search_sort.rb +55 -0
- data/lib/generated/azure_mgmt_operational_insights/models/search_sort_enum.rb +16 -0
- data/lib/generated/azure_mgmt_operational_insights/models/shared_keys.rb +54 -0
- data/lib/generated/azure_mgmt_operational_insights/models/sku.rb +45 -0
- data/lib/generated/azure_mgmt_operational_insights/models/sku_name_enum.rb +20 -0
- data/lib/generated/azure_mgmt_operational_insights/models/storage_account.rb +55 -0
- data/lib/generated/azure_mgmt_operational_insights/models/storage_insight.rb +141 -0
- data/lib/generated/azure_mgmt_operational_insights/models/storage_insight_list_result.rb +95 -0
- data/lib/generated/azure_mgmt_operational_insights/models/storage_insight_state.rb +16 -0
- data/lib/generated/azure_mgmt_operational_insights/models/storage_insight_status.rb +55 -0
- data/lib/generated/azure_mgmt_operational_insights/models/tag.rb +54 -0
- data/lib/generated/azure_mgmt_operational_insights/models/usage_metric.rb +96 -0
- data/lib/generated/azure_mgmt_operational_insights/models/workspace.rb +165 -0
- data/lib/generated/azure_mgmt_operational_insights/models/workspace_list_management_groups_result.rb +53 -0
- data/lib/generated/azure_mgmt_operational_insights/models/workspace_list_result.rb +52 -0
- data/lib/generated/azure_mgmt_operational_insights/models/workspace_list_usages_result.rb +53 -0
- data/lib/generated/azure_mgmt_operational_insights/module_definition.rb +8 -0
- data/lib/generated/azure_mgmt_operational_insights/operational_insights_management_client.rb +143 -0
- data/lib/generated/azure_mgmt_operational_insights/saved_searches.rb +513 -0
- data/lib/generated/azure_mgmt_operational_insights/storage_insights.rb +560 -0
- data/lib/generated/azure_mgmt_operational_insights/version.rb +8 -0
- data/lib/generated/azure_mgmt_operational_insights/workspaces.rb +1569 -0
- metadata +164 -0
@@ -0,0 +1,513 @@
|
|
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 SavedSearches
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the SavedSearches 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
|
+
# Deletes the specified saved search in 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] Log Analytics workspace name
|
30
|
+
# @param saved_search_name [String] Name of the saved search.
|
31
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
32
|
+
# will be added to the HTTP request.
|
33
|
+
#
|
34
|
+
#
|
35
|
+
def delete(resource_group_name, workspace_name, saved_search_name, custom_headers = nil)
|
36
|
+
response = delete_async(resource_group_name, workspace_name, saved_search_name, custom_headers).value!
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# Deletes the specified saved search in a given workspace.
|
42
|
+
#
|
43
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
44
|
+
# The name is case insensitive.
|
45
|
+
# @param workspace_name [String] Log Analytics workspace name
|
46
|
+
# @param saved_search_name [String] Name of the saved search.
|
47
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
48
|
+
# will be added to the HTTP request.
|
49
|
+
#
|
50
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
51
|
+
#
|
52
|
+
def delete_with_http_info(resource_group_name, workspace_name, saved_search_name, custom_headers = nil)
|
53
|
+
delete_async(resource_group_name, workspace_name, saved_search_name, custom_headers).value!
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# Deletes the specified saved search in a given workspace.
|
58
|
+
#
|
59
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
60
|
+
# The name is case insensitive.
|
61
|
+
# @param workspace_name [String] Log Analytics workspace name
|
62
|
+
# @param saved_search_name [String] Name of the saved search.
|
63
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
64
|
+
# to the HTTP request.
|
65
|
+
#
|
66
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
67
|
+
#
|
68
|
+
def delete_async(resource_group_name, workspace_name, saved_search_name, custom_headers = nil)
|
69
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
70
|
+
fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
|
71
|
+
fail ArgumentError, 'saved_search_name is nil' if saved_search_name.nil?
|
72
|
+
api_version = '2015-03-20'
|
73
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
74
|
+
|
75
|
+
|
76
|
+
request_headers = {}
|
77
|
+
|
78
|
+
# Set Headers
|
79
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
80
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
81
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchName}'
|
82
|
+
|
83
|
+
request_url = @base_url || @client.base_url
|
84
|
+
|
85
|
+
options = {
|
86
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
87
|
+
path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'savedSearchName' => saved_search_name,'subscriptionId' => @client.subscription_id},
|
88
|
+
query_params: {'api-version' => api_version},
|
89
|
+
headers: request_headers.merge(custom_headers || {}),
|
90
|
+
base_url: request_url
|
91
|
+
}
|
92
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
93
|
+
|
94
|
+
promise = promise.then do |result|
|
95
|
+
http_response = result.response
|
96
|
+
status_code = http_response.status
|
97
|
+
response_content = http_response.body
|
98
|
+
unless status_code == 200
|
99
|
+
error_model = JSON.load(response_content)
|
100
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
101
|
+
end
|
102
|
+
|
103
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
104
|
+
|
105
|
+
result
|
106
|
+
end
|
107
|
+
|
108
|
+
promise.execute
|
109
|
+
end
|
110
|
+
|
111
|
+
#
|
112
|
+
# Creates or updates a saved search for a given workspace.
|
113
|
+
#
|
114
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
115
|
+
# The name is case insensitive.
|
116
|
+
# @param workspace_name [String] Log Analytics workspace name
|
117
|
+
# @param saved_search_name [String] The id of the saved search.
|
118
|
+
# @param parameters [SavedSearch] The parameters required to save a search.
|
119
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
120
|
+
# will be added to the HTTP request.
|
121
|
+
#
|
122
|
+
# @return [SavedSearch] operation results.
|
123
|
+
#
|
124
|
+
def create_or_update(resource_group_name, workspace_name, saved_search_name, parameters, custom_headers = nil)
|
125
|
+
response = create_or_update_async(resource_group_name, workspace_name, saved_search_name, parameters, custom_headers).value!
|
126
|
+
response.body unless response.nil?
|
127
|
+
end
|
128
|
+
|
129
|
+
#
|
130
|
+
# Creates or updates a saved search for a given workspace.
|
131
|
+
#
|
132
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
133
|
+
# The name is case insensitive.
|
134
|
+
# @param workspace_name [String] Log Analytics workspace name
|
135
|
+
# @param saved_search_name [String] The id of the saved search.
|
136
|
+
# @param parameters [SavedSearch] The parameters required to save a search.
|
137
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
138
|
+
# will be added to the HTTP request.
|
139
|
+
#
|
140
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
141
|
+
#
|
142
|
+
def create_or_update_with_http_info(resource_group_name, workspace_name, saved_search_name, parameters, custom_headers = nil)
|
143
|
+
create_or_update_async(resource_group_name, workspace_name, saved_search_name, parameters, custom_headers).value!
|
144
|
+
end
|
145
|
+
|
146
|
+
#
|
147
|
+
# Creates or updates a saved search for a given workspace.
|
148
|
+
#
|
149
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
150
|
+
# The name is case insensitive.
|
151
|
+
# @param workspace_name [String] Log Analytics workspace name
|
152
|
+
# @param saved_search_name [String] The id of the saved search.
|
153
|
+
# @param parameters [SavedSearch] The parameters required to save a search.
|
154
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
155
|
+
# to the HTTP request.
|
156
|
+
#
|
157
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
158
|
+
#
|
159
|
+
def create_or_update_async(resource_group_name, workspace_name, saved_search_name, parameters, custom_headers = nil)
|
160
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
161
|
+
fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
|
162
|
+
fail ArgumentError, 'saved_search_name is nil' if saved_search_name.nil?
|
163
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
164
|
+
api_version = '2015-03-20'
|
165
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
166
|
+
|
167
|
+
|
168
|
+
request_headers = {}
|
169
|
+
|
170
|
+
# Set Headers
|
171
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
172
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
173
|
+
|
174
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
175
|
+
|
176
|
+
# Serialize Request
|
177
|
+
request_mapper = Azure::ARM::OperationalInsights::Models::SavedSearch.mapper()
|
178
|
+
request_content = @client.serialize(request_mapper, parameters)
|
179
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
180
|
+
|
181
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchName}'
|
182
|
+
|
183
|
+
request_url = @base_url || @client.base_url
|
184
|
+
|
185
|
+
options = {
|
186
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
187
|
+
path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'savedSearchName' => saved_search_name,'subscriptionId' => @client.subscription_id},
|
188
|
+
query_params: {'api-version' => api_version},
|
189
|
+
body: request_content,
|
190
|
+
headers: request_headers.merge(custom_headers || {}),
|
191
|
+
base_url: request_url
|
192
|
+
}
|
193
|
+
promise = @client.make_request_async(:put, path_template, options)
|
194
|
+
|
195
|
+
promise = promise.then do |result|
|
196
|
+
http_response = result.response
|
197
|
+
status_code = http_response.status
|
198
|
+
response_content = http_response.body
|
199
|
+
unless status_code == 200
|
200
|
+
error_model = JSON.load(response_content)
|
201
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
202
|
+
end
|
203
|
+
|
204
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
205
|
+
# Deserialize Response
|
206
|
+
if status_code == 200
|
207
|
+
begin
|
208
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
209
|
+
result_mapper = Azure::ARM::OperationalInsights::Models::SavedSearch.mapper()
|
210
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
211
|
+
rescue Exception => e
|
212
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
result
|
217
|
+
end
|
218
|
+
|
219
|
+
promise.execute
|
220
|
+
end
|
221
|
+
|
222
|
+
#
|
223
|
+
# Gets the specified saved search 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] Log Analytics workspace name
|
228
|
+
# @param saved_search_name [String] The id of the saved search.
|
229
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
230
|
+
# will be added to the HTTP request.
|
231
|
+
#
|
232
|
+
# @return [SavedSearch] operation results.
|
233
|
+
#
|
234
|
+
def get(resource_group_name, workspace_name, saved_search_name, custom_headers = nil)
|
235
|
+
response = get_async(resource_group_name, workspace_name, saved_search_name, custom_headers).value!
|
236
|
+
response.body unless response.nil?
|
237
|
+
end
|
238
|
+
|
239
|
+
#
|
240
|
+
# Gets the specified saved search for a given workspace.
|
241
|
+
#
|
242
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
243
|
+
# The name is case insensitive.
|
244
|
+
# @param workspace_name [String] Log Analytics workspace name
|
245
|
+
# @param saved_search_name [String] The id of the saved search.
|
246
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
247
|
+
# will be added to the HTTP request.
|
248
|
+
#
|
249
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
250
|
+
#
|
251
|
+
def get_with_http_info(resource_group_name, workspace_name, saved_search_name, custom_headers = nil)
|
252
|
+
get_async(resource_group_name, workspace_name, saved_search_name, custom_headers).value!
|
253
|
+
end
|
254
|
+
|
255
|
+
#
|
256
|
+
# Gets the specified saved search for a given workspace.
|
257
|
+
#
|
258
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
259
|
+
# The name is case insensitive.
|
260
|
+
# @param workspace_name [String] Log Analytics workspace name
|
261
|
+
# @param saved_search_name [String] The id of the saved search.
|
262
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
263
|
+
# to the HTTP request.
|
264
|
+
#
|
265
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
266
|
+
#
|
267
|
+
def get_async(resource_group_name, workspace_name, saved_search_name, custom_headers = nil)
|
268
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
269
|
+
fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
|
270
|
+
fail ArgumentError, 'saved_search_name is nil' if saved_search_name.nil?
|
271
|
+
api_version = '2015-03-20'
|
272
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
273
|
+
|
274
|
+
|
275
|
+
request_headers = {}
|
276
|
+
|
277
|
+
# Set Headers
|
278
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
279
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
280
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchName}'
|
281
|
+
|
282
|
+
request_url = @base_url || @client.base_url
|
283
|
+
|
284
|
+
options = {
|
285
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
286
|
+
path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'savedSearchName' => saved_search_name,'subscriptionId' => @client.subscription_id},
|
287
|
+
query_params: {'api-version' => api_version},
|
288
|
+
headers: request_headers.merge(custom_headers || {}),
|
289
|
+
base_url: request_url
|
290
|
+
}
|
291
|
+
promise = @client.make_request_async(:get, path_template, options)
|
292
|
+
|
293
|
+
promise = promise.then do |result|
|
294
|
+
http_response = result.response
|
295
|
+
status_code = http_response.status
|
296
|
+
response_content = http_response.body
|
297
|
+
unless status_code == 200
|
298
|
+
error_model = JSON.load(response_content)
|
299
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
300
|
+
end
|
301
|
+
|
302
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
303
|
+
# Deserialize Response
|
304
|
+
if status_code == 200
|
305
|
+
begin
|
306
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
307
|
+
result_mapper = Azure::ARM::OperationalInsights::Models::SavedSearch.mapper()
|
308
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
309
|
+
rescue Exception => e
|
310
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
result
|
315
|
+
end
|
316
|
+
|
317
|
+
promise.execute
|
318
|
+
end
|
319
|
+
|
320
|
+
#
|
321
|
+
# Gets the saved searches for a given Log Analytics Workspace
|
322
|
+
#
|
323
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
324
|
+
# The name is case insensitive.
|
325
|
+
# @param workspace_name [String] Log Analytics workspace name
|
326
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
327
|
+
# will be added to the HTTP request.
|
328
|
+
#
|
329
|
+
# @return [SavedSearchesListResult] operation results.
|
330
|
+
#
|
331
|
+
def list_by_workspace(resource_group_name, workspace_name, custom_headers = nil)
|
332
|
+
response = list_by_workspace_async(resource_group_name, workspace_name, custom_headers).value!
|
333
|
+
response.body unless response.nil?
|
334
|
+
end
|
335
|
+
|
336
|
+
#
|
337
|
+
# Gets the saved searches for a given Log Analytics Workspace
|
338
|
+
#
|
339
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
340
|
+
# The name is case insensitive.
|
341
|
+
# @param workspace_name [String] Log Analytics workspace name
|
342
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
343
|
+
# will be added to the HTTP request.
|
344
|
+
#
|
345
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
346
|
+
#
|
347
|
+
def list_by_workspace_with_http_info(resource_group_name, workspace_name, custom_headers = nil)
|
348
|
+
list_by_workspace_async(resource_group_name, workspace_name, custom_headers).value!
|
349
|
+
end
|
350
|
+
|
351
|
+
#
|
352
|
+
# Gets the saved searches for a given Log Analytics Workspace
|
353
|
+
#
|
354
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
355
|
+
# The name is case insensitive.
|
356
|
+
# @param workspace_name [String] Log Analytics workspace name
|
357
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
358
|
+
# to the HTTP request.
|
359
|
+
#
|
360
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
361
|
+
#
|
362
|
+
def list_by_workspace_async(resource_group_name, workspace_name, custom_headers = nil)
|
363
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
364
|
+
fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
|
365
|
+
api_version = '2015-03-20'
|
366
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
367
|
+
|
368
|
+
|
369
|
+
request_headers = {}
|
370
|
+
|
371
|
+
# Set Headers
|
372
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
373
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
374
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches'
|
375
|
+
|
376
|
+
request_url = @base_url || @client.base_url
|
377
|
+
|
378
|
+
options = {
|
379
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
380
|
+
path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
|
381
|
+
query_params: {'api-version' => api_version},
|
382
|
+
headers: request_headers.merge(custom_headers || {}),
|
383
|
+
base_url: request_url
|
384
|
+
}
|
385
|
+
promise = @client.make_request_async(:get, path_template, options)
|
386
|
+
|
387
|
+
promise = promise.then do |result|
|
388
|
+
http_response = result.response
|
389
|
+
status_code = http_response.status
|
390
|
+
response_content = http_response.body
|
391
|
+
unless status_code == 200
|
392
|
+
error_model = JSON.load(response_content)
|
393
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
394
|
+
end
|
395
|
+
|
396
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
397
|
+
# Deserialize Response
|
398
|
+
if status_code == 200
|
399
|
+
begin
|
400
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
401
|
+
result_mapper = Azure::ARM::OperationalInsights::Models::SavedSearchesListResult.mapper()
|
402
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
403
|
+
rescue Exception => e
|
404
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
result
|
409
|
+
end
|
410
|
+
|
411
|
+
promise.execute
|
412
|
+
end
|
413
|
+
|
414
|
+
#
|
415
|
+
# Gets the results from a saved search for a given workspace.
|
416
|
+
#
|
417
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
418
|
+
# The name is case insensitive.
|
419
|
+
# @param workspace_name [String] Log Analytics workspace name
|
420
|
+
# @param saved_search_name [String] The name of the saved search.
|
421
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
422
|
+
# will be added to the HTTP request.
|
423
|
+
#
|
424
|
+
# @return [SearchResultsResponse] operation results.
|
425
|
+
#
|
426
|
+
def get_results(resource_group_name, workspace_name, saved_search_name, custom_headers = nil)
|
427
|
+
response = get_results_async(resource_group_name, workspace_name, saved_search_name, custom_headers).value!
|
428
|
+
response.body unless response.nil?
|
429
|
+
end
|
430
|
+
|
431
|
+
#
|
432
|
+
# Gets the results from a saved search for a given workspace.
|
433
|
+
#
|
434
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
435
|
+
# The name is case insensitive.
|
436
|
+
# @param workspace_name [String] Log Analytics workspace name
|
437
|
+
# @param saved_search_name [String] The name of the saved search.
|
438
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
439
|
+
# will be added to the HTTP request.
|
440
|
+
#
|
441
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
442
|
+
#
|
443
|
+
def get_results_with_http_info(resource_group_name, workspace_name, saved_search_name, custom_headers = nil)
|
444
|
+
get_results_async(resource_group_name, workspace_name, saved_search_name, custom_headers).value!
|
445
|
+
end
|
446
|
+
|
447
|
+
#
|
448
|
+
# Gets the results from a saved search for a given workspace.
|
449
|
+
#
|
450
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
451
|
+
# The name is case insensitive.
|
452
|
+
# @param workspace_name [String] Log Analytics workspace name
|
453
|
+
# @param saved_search_name [String] The name of the saved search.
|
454
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
455
|
+
# to the HTTP request.
|
456
|
+
#
|
457
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
458
|
+
#
|
459
|
+
def get_results_async(resource_group_name, workspace_name, saved_search_name, custom_headers = nil)
|
460
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
461
|
+
fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
|
462
|
+
fail ArgumentError, 'saved_search_name is nil' if saved_search_name.nil?
|
463
|
+
api_version = '2015-03-20'
|
464
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
465
|
+
|
466
|
+
|
467
|
+
request_headers = {}
|
468
|
+
|
469
|
+
# Set Headers
|
470
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
471
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
472
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchName}/results'
|
473
|
+
|
474
|
+
request_url = @base_url || @client.base_url
|
475
|
+
|
476
|
+
options = {
|
477
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
478
|
+
path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'savedSearchName' => saved_search_name,'subscriptionId' => @client.subscription_id},
|
479
|
+
query_params: {'api-version' => api_version},
|
480
|
+
headers: request_headers.merge(custom_headers || {}),
|
481
|
+
base_url: request_url
|
482
|
+
}
|
483
|
+
promise = @client.make_request_async(:get, path_template, options)
|
484
|
+
|
485
|
+
promise = promise.then do |result|
|
486
|
+
http_response = result.response
|
487
|
+
status_code = http_response.status
|
488
|
+
response_content = http_response.body
|
489
|
+
unless status_code == 200
|
490
|
+
error_model = JSON.load(response_content)
|
491
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
492
|
+
end
|
493
|
+
|
494
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
495
|
+
# Deserialize Response
|
496
|
+
if status_code == 200
|
497
|
+
begin
|
498
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
499
|
+
result_mapper = Azure::ARM::OperationalInsights::Models::SearchResultsResponse.mapper()
|
500
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
501
|
+
rescue Exception => e
|
502
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
503
|
+
end
|
504
|
+
end
|
505
|
+
|
506
|
+
result
|
507
|
+
end
|
508
|
+
|
509
|
+
promise.execute
|
510
|
+
end
|
511
|
+
|
512
|
+
end
|
513
|
+
end
|