azure_mgmt_operational_insights 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 86b485116b54fbe596761e37e3251f99ea6a4d14
4
+ data.tar.gz: 96b11540ba2b4bc262906573b191a38abcf08aa1
5
+ SHA512:
6
+ metadata.gz: 423895ef3bba97f488be3723da500fae54eb374ebe8c51c79f5d57c72d99565e0f9d222960573d16fcf3c4ae5923cb855245d272e563b4defc3ab50fd50a2b41
7
+ data.tar.gz: 389c3b7e6ecb04ee6f92a1e2e2d8dc14f0e2e78dfe3c9d0f6f6d6adeacfe8bb586cf496c8d117b40f71e314a567024b6db4fc946e9b3c6a4222b57391fe43874
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ require 'generated/azure_mgmt_operational_insights'
6
+
7
+
8
+
@@ -0,0 +1,72 @@
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
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require 'generated/azure_mgmt_operational_insights/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::ARM::OperationalInsights
23
+ autoload :LinkedServices, 'generated/azure_mgmt_operational_insights/linked_services.rb'
24
+ autoload :DataSources, 'generated/azure_mgmt_operational_insights/data_sources.rb'
25
+ autoload :Workspaces, 'generated/azure_mgmt_operational_insights/workspaces.rb'
26
+ autoload :StorageInsights, 'generated/azure_mgmt_operational_insights/storage_insights.rb'
27
+ autoload :SavedSearches, 'generated/azure_mgmt_operational_insights/saved_searches.rb'
28
+ autoload :OperationalInsightsManagementClient, 'generated/azure_mgmt_operational_insights/operational_insights_management_client.rb'
29
+
30
+ module Models
31
+ autoload :LinkTarget, 'generated/azure_mgmt_operational_insights/models/link_target.rb'
32
+ autoload :Tag, 'generated/azure_mgmt_operational_insights/models/tag.rb'
33
+ autoload :LinkedServiceListResult, 'generated/azure_mgmt_operational_insights/models/linked_service_list_result.rb'
34
+ autoload :CoreSummary, 'generated/azure_mgmt_operational_insights/models/core_summary.rb'
35
+ autoload :DataSourceFilter, 'generated/azure_mgmt_operational_insights/models/data_source_filter.rb'
36
+ autoload :SearchSort, 'generated/azure_mgmt_operational_insights/models/search_sort.rb'
37
+ autoload :IntelligencePack, 'generated/azure_mgmt_operational_insights/models/intelligence_pack.rb'
38
+ autoload :SearchMetadataSchema, 'generated/azure_mgmt_operational_insights/models/search_metadata_schema.rb'
39
+ autoload :MetricName, 'generated/azure_mgmt_operational_insights/models/metric_name.rb'
40
+ autoload :SearchMetadata, 'generated/azure_mgmt_operational_insights/models/search_metadata.rb'
41
+ autoload :WorkspaceListUsagesResult, 'generated/azure_mgmt_operational_insights/models/workspace_list_usages_result.rb'
42
+ autoload :SavedSearch, 'generated/azure_mgmt_operational_insights/models/saved_search.rb'
43
+ autoload :WorkspaceListManagementGroupsResult, 'generated/azure_mgmt_operational_insights/models/workspace_list_management_groups_result.rb'
44
+ autoload :SavedSearchesListResult, 'generated/azure_mgmt_operational_insights/models/saved_searches_list_result.rb'
45
+ autoload :Sku, 'generated/azure_mgmt_operational_insights/models/sku.rb'
46
+ autoload :Resource, 'generated/azure_mgmt_operational_insights/models/resource.rb'
47
+ autoload :SearchError, 'generated/azure_mgmt_operational_insights/models/search_error.rb'
48
+ autoload :ProxyResource, 'generated/azure_mgmt_operational_insights/models/proxy_resource.rb'
49
+ autoload :StorageInsightStatus, 'generated/azure_mgmt_operational_insights/models/storage_insight_status.rb'
50
+ autoload :DataSourceListResult, 'generated/azure_mgmt_operational_insights/models/data_source_list_result.rb'
51
+ autoload :SearchResultsResponse, 'generated/azure_mgmt_operational_insights/models/search_results_response.rb'
52
+ autoload :UsageMetric, 'generated/azure_mgmt_operational_insights/models/usage_metric.rb'
53
+ autoload :SearchSchemaValue, 'generated/azure_mgmt_operational_insights/models/search_schema_value.rb'
54
+ autoload :WorkspaceListResult, 'generated/azure_mgmt_operational_insights/models/workspace_list_result.rb'
55
+ autoload :SearchGetSchemaResponse, 'generated/azure_mgmt_operational_insights/models/search_get_schema_response.rb'
56
+ autoload :SharedKeys, 'generated/azure_mgmt_operational_insights/models/shared_keys.rb'
57
+ autoload :SearchHighlight, 'generated/azure_mgmt_operational_insights/models/search_highlight.rb'
58
+ autoload :StorageInsightListResult, 'generated/azure_mgmt_operational_insights/models/storage_insight_list_result.rb'
59
+ autoload :SearchParameters, 'generated/azure_mgmt_operational_insights/models/search_parameters.rb'
60
+ autoload :ManagementGroup, 'generated/azure_mgmt_operational_insights/models/management_group.rb'
61
+ autoload :StorageAccount, 'generated/azure_mgmt_operational_insights/models/storage_account.rb'
62
+ autoload :LinkedService, 'generated/azure_mgmt_operational_insights/models/linked_service.rb'
63
+ autoload :DataSource, 'generated/azure_mgmt_operational_insights/models/data_source.rb'
64
+ autoload :Workspace, 'generated/azure_mgmt_operational_insights/models/workspace.rb'
65
+ autoload :StorageInsight, 'generated/azure_mgmt_operational_insights/models/storage_insight.rb'
66
+ autoload :DataSourceKind, 'generated/azure_mgmt_operational_insights/models/data_source_kind.rb'
67
+ autoload :SkuNameEnum, 'generated/azure_mgmt_operational_insights/models/sku_name_enum.rb'
68
+ autoload :EntityStatus, 'generated/azure_mgmt_operational_insights/models/entity_status.rb'
69
+ autoload :SearchSortEnum, 'generated/azure_mgmt_operational_insights/models/search_sort_enum.rb'
70
+ autoload :StorageInsightState, 'generated/azure_mgmt_operational_insights/models/storage_insight_state.rb'
71
+ end
72
+ end
@@ -0,0 +1,567 @@
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 DataSources
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the DataSources 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
+ # Create or update a data source.
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 that will
30
+ # contain the datasource
31
+ # @param data_source_name [String] The name of the datasource resource.
32
+ # @param parameters [DataSource] The parameters required to create or update a
33
+ # datasource.
34
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [DataSource] operation results.
38
+ #
39
+ def create_or_update(resource_group_name, workspace_name, data_source_name, parameters, custom_headers = nil)
40
+ response = create_or_update_async(resource_group_name, workspace_name, data_source_name, parameters, custom_headers).value!
41
+ response.body unless response.nil?
42
+ end
43
+
44
+ #
45
+ # Create or update a data source.
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group to get.
48
+ # The name is case insensitive.
49
+ # @param workspace_name [String] Name of the Log Analytics Workspace that will
50
+ # contain the datasource
51
+ # @param data_source_name [String] The name of the datasource resource.
52
+ # @param parameters [DataSource] The parameters required to create or update a
53
+ # datasource.
54
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
55
+ # will be added to the HTTP request.
56
+ #
57
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
58
+ #
59
+ def create_or_update_with_http_info(resource_group_name, workspace_name, data_source_name, parameters, custom_headers = nil)
60
+ create_or_update_async(resource_group_name, workspace_name, data_source_name, parameters, custom_headers).value!
61
+ end
62
+
63
+ #
64
+ # Create or update a data source.
65
+ #
66
+ # @param resource_group_name [String] The name of the resource group to get.
67
+ # The name is case insensitive.
68
+ # @param workspace_name [String] Name of the Log Analytics Workspace that will
69
+ # contain the datasource
70
+ # @param data_source_name [String] The name of the datasource resource.
71
+ # @param parameters [DataSource] The parameters required to create or update a
72
+ # datasource.
73
+ # @param [Hash{String => String}] A hash of custom headers that will be added
74
+ # to the HTTP request.
75
+ #
76
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
77
+ #
78
+ def create_or_update_async(resource_group_name, workspace_name, data_source_name, parameters, custom_headers = nil)
79
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
80
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
81
+ fail ArgumentError, 'data_source_name is nil' if data_source_name.nil?
82
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
83
+ api_version = '2015-11-01-preview'
84
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
85
+
86
+
87
+ request_headers = {}
88
+
89
+ # Set Headers
90
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
91
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
92
+
93
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
94
+
95
+ # Serialize Request
96
+ request_mapper = Azure::ARM::OperationalInsights::Models::DataSource.mapper()
97
+ request_content = @client.serialize(request_mapper, parameters)
98
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
99
+
100
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}'
101
+
102
+ request_url = @base_url || @client.base_url
103
+
104
+ options = {
105
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
106
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'dataSourceName' => data_source_name,'subscriptionId' => @client.subscription_id},
107
+ query_params: {'api-version' => api_version},
108
+ body: request_content,
109
+ headers: request_headers.merge(custom_headers || {}),
110
+ base_url: request_url
111
+ }
112
+ promise = @client.make_request_async(:put, path_template, options)
113
+
114
+ promise = promise.then do |result|
115
+ http_response = result.response
116
+ status_code = http_response.status
117
+ response_content = http_response.body
118
+ unless status_code == 200 || status_code == 201
119
+ error_model = JSON.load(response_content)
120
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
121
+ end
122
+
123
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
124
+ # Deserialize Response
125
+ if status_code == 200
126
+ begin
127
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
128
+ result_mapper = Azure::ARM::OperationalInsights::Models::DataSource.mapper()
129
+ result.body = @client.deserialize(result_mapper, parsed_response)
130
+ rescue Exception => e
131
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
132
+ end
133
+ end
134
+ # Deserialize Response
135
+ if status_code == 201
136
+ begin
137
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
138
+ result_mapper = Azure::ARM::OperationalInsights::Models::DataSource.mapper()
139
+ result.body = @client.deserialize(result_mapper, parsed_response)
140
+ rescue Exception => e
141
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
142
+ end
143
+ end
144
+
145
+ result
146
+ end
147
+
148
+ promise.execute
149
+ end
150
+
151
+ #
152
+ # Deletes a data source instance.
153
+ #
154
+ # @param resource_group_name [String] The name of the resource group to get.
155
+ # The name is case insensitive.
156
+ # @param workspace_name [String] Name of the Log Analytics Workspace that
157
+ # contains the datasource.
158
+ # @param data_source_name [String] Name of the datasource.
159
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
160
+ # will be added to the HTTP request.
161
+ #
162
+ #
163
+ def delete(resource_group_name, workspace_name, data_source_name, custom_headers = nil)
164
+ response = delete_async(resource_group_name, workspace_name, data_source_name, custom_headers).value!
165
+ nil
166
+ end
167
+
168
+ #
169
+ # Deletes a data source instance.
170
+ #
171
+ # @param resource_group_name [String] The name of the resource group to get.
172
+ # The name is case insensitive.
173
+ # @param workspace_name [String] Name of the Log Analytics Workspace that
174
+ # contains the datasource.
175
+ # @param data_source_name [String] Name of the datasource.
176
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
177
+ # will be added to the HTTP request.
178
+ #
179
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
180
+ #
181
+ def delete_with_http_info(resource_group_name, workspace_name, data_source_name, custom_headers = nil)
182
+ delete_async(resource_group_name, workspace_name, data_source_name, custom_headers).value!
183
+ end
184
+
185
+ #
186
+ # Deletes a data source instance.
187
+ #
188
+ # @param resource_group_name [String] The name of the resource group to get.
189
+ # The name is case insensitive.
190
+ # @param workspace_name [String] Name of the Log Analytics Workspace that
191
+ # contains the datasource.
192
+ # @param data_source_name [String] Name of the datasource.
193
+ # @param [Hash{String => String}] A hash of custom headers that will be added
194
+ # to the HTTP request.
195
+ #
196
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
197
+ #
198
+ def delete_async(resource_group_name, workspace_name, data_source_name, custom_headers = nil)
199
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
200
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
201
+ fail ArgumentError, 'data_source_name is nil' if data_source_name.nil?
202
+ api_version = '2015-11-01-preview'
203
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
204
+
205
+
206
+ request_headers = {}
207
+
208
+ # Set Headers
209
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
210
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
211
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}'
212
+
213
+ request_url = @base_url || @client.base_url
214
+
215
+ options = {
216
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
217
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'dataSourceName' => data_source_name,'subscriptionId' => @client.subscription_id},
218
+ query_params: {'api-version' => api_version},
219
+ headers: request_headers.merge(custom_headers || {}),
220
+ base_url: request_url
221
+ }
222
+ promise = @client.make_request_async(:delete, path_template, options)
223
+
224
+ promise = promise.then do |result|
225
+ http_response = result.response
226
+ status_code = http_response.status
227
+ response_content = http_response.body
228
+ unless status_code == 200 || status_code == 204
229
+ error_model = JSON.load(response_content)
230
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
231
+ end
232
+
233
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
234
+
235
+ result
236
+ end
237
+
238
+ promise.execute
239
+ end
240
+
241
+ #
242
+ # Gets a datasource instance.
243
+ #
244
+ # @param resource_group_name [String] The name of the resource group to get.
245
+ # The name is case insensitive.
246
+ # @param workspace_name [String] Name of the Log Analytics Workspace that
247
+ # contains the datasource.
248
+ # @param data_source_name [String] Name of the datasource
249
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
250
+ # will be added to the HTTP request.
251
+ #
252
+ # @return [DataSource] operation results.
253
+ #
254
+ def get(resource_group_name, workspace_name, data_source_name, custom_headers = nil)
255
+ response = get_async(resource_group_name, workspace_name, data_source_name, custom_headers).value!
256
+ response.body unless response.nil?
257
+ end
258
+
259
+ #
260
+ # Gets a datasource instance.
261
+ #
262
+ # @param resource_group_name [String] The name of the resource group to get.
263
+ # The name is case insensitive.
264
+ # @param workspace_name [String] Name of the Log Analytics Workspace that
265
+ # contains the datasource.
266
+ # @param data_source_name [String] Name of the datasource
267
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
268
+ # will be added to the HTTP request.
269
+ #
270
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
271
+ #
272
+ def get_with_http_info(resource_group_name, workspace_name, data_source_name, custom_headers = nil)
273
+ get_async(resource_group_name, workspace_name, data_source_name, custom_headers).value!
274
+ end
275
+
276
+ #
277
+ # Gets a datasource instance.
278
+ #
279
+ # @param resource_group_name [String] The name of the resource group to get.
280
+ # The name is case insensitive.
281
+ # @param workspace_name [String] Name of the Log Analytics Workspace that
282
+ # contains the datasource.
283
+ # @param data_source_name [String] Name of the datasource
284
+ # @param [Hash{String => String}] A hash of custom headers that will be added
285
+ # to the HTTP request.
286
+ #
287
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
288
+ #
289
+ def get_async(resource_group_name, workspace_name, data_source_name, custom_headers = nil)
290
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
291
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
292
+ fail ArgumentError, 'data_source_name is nil' if data_source_name.nil?
293
+ api_version = '2015-11-01-preview'
294
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
295
+
296
+
297
+ request_headers = {}
298
+
299
+ # Set Headers
300
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
301
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
302
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}'
303
+
304
+ request_url = @base_url || @client.base_url
305
+
306
+ options = {
307
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
308
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'dataSourceName' => data_source_name,'subscriptionId' => @client.subscription_id},
309
+ query_params: {'api-version' => api_version},
310
+ headers: request_headers.merge(custom_headers || {}),
311
+ base_url: request_url
312
+ }
313
+ promise = @client.make_request_async(:get, path_template, options)
314
+
315
+ promise = promise.then do |result|
316
+ http_response = result.response
317
+ status_code = http_response.status
318
+ response_content = http_response.body
319
+ unless status_code == 200
320
+ error_model = JSON.load(response_content)
321
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
322
+ end
323
+
324
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
325
+ # Deserialize Response
326
+ if status_code == 200
327
+ begin
328
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
329
+ result_mapper = Azure::ARM::OperationalInsights::Models::DataSource.mapper()
330
+ result.body = @client.deserialize(result_mapper, parsed_response)
331
+ rescue Exception => e
332
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
333
+ end
334
+ end
335
+
336
+ result
337
+ end
338
+
339
+ promise.execute
340
+ end
341
+
342
+ #
343
+ # Gets the first page of data source instances in a workspace with the link to
344
+ # the next page.
345
+ #
346
+ # @param resource_group_name [String] The name of the resource group to get.
347
+ # The name is case insensitive.
348
+ # @param workspace_name [String] The workspace that contains the data sources.
349
+ # @param filter [String] The filter to apply on the operation.
350
+ # @param skiptoken [String] Starting point of the collection of data source
351
+ # instances.
352
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
353
+ # will be added to the HTTP request.
354
+ #
355
+ # @return [Array<DataSource>] operation results.
356
+ #
357
+ def list_by_workspace(resource_group_name, workspace_name, filter, skiptoken = nil, custom_headers = nil)
358
+ first_page = list_by_workspace_as_lazy(resource_group_name, workspace_name, filter, skiptoken, custom_headers)
359
+ first_page.get_all_items
360
+ end
361
+
362
+ #
363
+ # Gets the first page of data source instances in a workspace with the link to
364
+ # the next page.
365
+ #
366
+ # @param resource_group_name [String] The name of the resource group to get.
367
+ # The name is case insensitive.
368
+ # @param workspace_name [String] The workspace that contains the data sources.
369
+ # @param filter [String] The filter to apply on the operation.
370
+ # @param skiptoken [String] Starting point of the collection of data source
371
+ # instances.
372
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
373
+ # will be added to the HTTP request.
374
+ #
375
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
376
+ #
377
+ def list_by_workspace_with_http_info(resource_group_name, workspace_name, filter, skiptoken = nil, custom_headers = nil)
378
+ list_by_workspace_async(resource_group_name, workspace_name, filter, skiptoken, custom_headers).value!
379
+ end
380
+
381
+ #
382
+ # Gets the first page of data source instances in a workspace with the link to
383
+ # the next page.
384
+ #
385
+ # @param resource_group_name [String] The name of the resource group to get.
386
+ # The name is case insensitive.
387
+ # @param workspace_name [String] The workspace that contains the data sources.
388
+ # @param filter [String] The filter to apply on the operation.
389
+ # @param skiptoken [String] Starting point of the collection of data source
390
+ # instances.
391
+ # @param [Hash{String => String}] A hash of custom headers that will be added
392
+ # to the HTTP request.
393
+ #
394
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
395
+ #
396
+ def list_by_workspace_async(resource_group_name, workspace_name, filter, skiptoken = nil, custom_headers = nil)
397
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
398
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
399
+ fail ArgumentError, 'filter is nil' if filter.nil?
400
+ api_version = '2015-11-01-preview'
401
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
402
+
403
+
404
+ request_headers = {}
405
+
406
+ # Set Headers
407
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
408
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
409
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources'
410
+
411
+ request_url = @base_url || @client.base_url
412
+
413
+ options = {
414
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
415
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
416
+ query_params: {'$filter' => filter,'$skiptoken' => skiptoken,'api-version' => api_version},
417
+ headers: request_headers.merge(custom_headers || {}),
418
+ base_url: request_url
419
+ }
420
+ promise = @client.make_request_async(:get, path_template, options)
421
+
422
+ promise = promise.then do |result|
423
+ http_response = result.response
424
+ status_code = http_response.status
425
+ response_content = http_response.body
426
+ unless status_code == 200
427
+ error_model = JSON.load(response_content)
428
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
429
+ end
430
+
431
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
432
+ # Deserialize Response
433
+ if status_code == 200
434
+ begin
435
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
436
+ result_mapper = Azure::ARM::OperationalInsights::Models::DataSourceListResult.mapper()
437
+ result.body = @client.deserialize(result_mapper, parsed_response)
438
+ rescue Exception => e
439
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
440
+ end
441
+ end
442
+
443
+ result
444
+ end
445
+
446
+ promise.execute
447
+ end
448
+
449
+ #
450
+ # Gets the first page of data source instances in a workspace with the link to
451
+ # the next page.
452
+ #
453
+ # @param next_page_link [String] The NextLink from the previous successful call
454
+ # to List operation.
455
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
456
+ # will be added to the HTTP request.
457
+ #
458
+ # @return [DataSourceListResult] operation results.
459
+ #
460
+ def list_by_workspace_next(next_page_link, custom_headers = nil)
461
+ response = list_by_workspace_next_async(next_page_link, custom_headers).value!
462
+ response.body unless response.nil?
463
+ end
464
+
465
+ #
466
+ # Gets the first page of data source instances in a workspace with the link to
467
+ # the next page.
468
+ #
469
+ # @param next_page_link [String] The NextLink from the previous successful call
470
+ # to List operation.
471
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
472
+ # will be added to the HTTP request.
473
+ #
474
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
475
+ #
476
+ def list_by_workspace_next_with_http_info(next_page_link, custom_headers = nil)
477
+ list_by_workspace_next_async(next_page_link, custom_headers).value!
478
+ end
479
+
480
+ #
481
+ # Gets the first page of data source instances in a workspace with the link to
482
+ # the next page.
483
+ #
484
+ # @param next_page_link [String] The NextLink from the previous successful call
485
+ # to List operation.
486
+ # @param [Hash{String => String}] A hash of custom headers that will be added
487
+ # to the HTTP request.
488
+ #
489
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
490
+ #
491
+ def list_by_workspace_next_async(next_page_link, custom_headers = nil)
492
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
493
+
494
+
495
+ request_headers = {}
496
+
497
+ # Set Headers
498
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
499
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
500
+ path_template = '{nextLink}'
501
+
502
+ request_url = @base_url || @client.base_url
503
+
504
+ options = {
505
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
506
+ skip_encoding_path_params: {'nextLink' => next_page_link},
507
+ headers: request_headers.merge(custom_headers || {}),
508
+ base_url: request_url
509
+ }
510
+ promise = @client.make_request_async(:get, path_template, options)
511
+
512
+ promise = promise.then do |result|
513
+ http_response = result.response
514
+ status_code = http_response.status
515
+ response_content = http_response.body
516
+ unless status_code == 200
517
+ error_model = JSON.load(response_content)
518
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
519
+ end
520
+
521
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
522
+ # Deserialize Response
523
+ if status_code == 200
524
+ begin
525
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
526
+ result_mapper = Azure::ARM::OperationalInsights::Models::DataSourceListResult.mapper()
527
+ result.body = @client.deserialize(result_mapper, parsed_response)
528
+ rescue Exception => e
529
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
530
+ end
531
+ end
532
+
533
+ result
534
+ end
535
+
536
+ promise.execute
537
+ end
538
+
539
+ #
540
+ # Gets the first page of data source instances in a workspace with the link to
541
+ # the next page.
542
+ #
543
+ # @param resource_group_name [String] The name of the resource group to get.
544
+ # The name is case insensitive.
545
+ # @param workspace_name [String] The workspace that contains the data sources.
546
+ # @param filter [String] The filter to apply on the operation.
547
+ # @param skiptoken [String] Starting point of the collection of data source
548
+ # instances.
549
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
550
+ # will be added to the HTTP request.
551
+ #
552
+ # @return [DataSourceListResult] which provide lazy access to pages of the
553
+ # response.
554
+ #
555
+ def list_by_workspace_as_lazy(resource_group_name, workspace_name, filter, skiptoken = nil, custom_headers = nil)
556
+ response = list_by_workspace_async(resource_group_name, workspace_name, filter, skiptoken, custom_headers).value!
557
+ unless response.nil?
558
+ page = response.body
559
+ page.next_method = Proc.new do |next_page_link|
560
+ list_by_workspace_next_async(next_page_link, custom_headers)
561
+ end
562
+ page
563
+ end
564
+ end
565
+
566
+ end
567
+ end