azure_mgmt_operational_insights 0.19.1 → 0.19.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/operational_insights_management_client.rb +1 -1
  3. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/operational_insights_management_client.rb +1 -1
  4. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/operational_insights_management_client.rb +1 -1
  5. data/lib/2020-08-01/generated/azure_mgmt_operational_insights.rb +123 -0
  6. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/available_service_tiers.rb +146 -0
  7. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/clusters.rb +959 -0
  8. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/data_exports.rb +473 -0
  9. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/data_sources.rb +603 -0
  10. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/deleted_workspaces.rb +211 -0
  11. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/gateways.rb +123 -0
  12. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/intelligence_packs.rb +351 -0
  13. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/linked_services.rb +577 -0
  14. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/linked_storage_accounts.rb +481 -0
  15. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/management_groups.rb +130 -0
  16. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/available_service_tier.rb +124 -0
  17. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/azure_entity_resource.rb +75 -0
  18. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster.rb +159 -0
  19. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_entity_status.rb +21 -0
  20. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_error_response.rb +48 -0
  21. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_list_result.rb +98 -0
  22. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_patch.rb +78 -0
  23. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_sku.rb +58 -0
  24. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_sku_name_enum.rb +15 -0
  25. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/core_summary.rb +57 -0
  26. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_export.rb +174 -0
  27. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_export_error_response.rb +48 -0
  28. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_export_list_result.rb +56 -0
  29. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_ingestion_status.rb +20 -0
  30. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_source.rb +130 -0
  31. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_source_filter.rb +61 -0
  32. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_source_kind.rb +47 -0
  33. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_source_list_result.rb +98 -0
  34. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_source_type.rb +18 -0
  35. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/error_additional_info.rb +59 -0
  36. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/error_contract.rb +49 -0
  37. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/error_response.rb +113 -0
  38. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/identity.rb +72 -0
  39. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/identity_type.rb +16 -0
  40. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/intelligence_pack.rb +69 -0
  41. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/key_vault_properties.rb +71 -0
  42. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/linked_service.rb +120 -0
  43. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/linked_service_entity_status.rb +18 -0
  44. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/linked_service_list_result.rb +55 -0
  45. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/linked_storage_accounts_list_result.rb +56 -0
  46. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/linked_storage_accounts_resource.rb +95 -0
  47. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/management_group.rb +128 -0
  48. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/metric_name.rb +57 -0
  49. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/operation.rb +59 -0
  50. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/operation_display.rb +79 -0
  51. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/operation_list_result.rb +101 -0
  52. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/operation_status.rb +102 -0
  53. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/private_link_scoped_resource.rb +58 -0
  54. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/proxy_resource.rb +63 -0
  55. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/public_network_access_type.rb +16 -0
  56. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/purge_state.rb +16 -0
  57. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/resource.rb +83 -0
  58. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/saved_search.rb +165 -0
  59. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/saved_searches_list_result.rb +55 -0
  60. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_get_schema_response.rb +67 -0
  61. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_metadata.rb +241 -0
  62. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_metadata_schema.rb +57 -0
  63. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_schema_value.rb +123 -0
  64. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_sort.rb +58 -0
  65. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_sort_enum.rb +16 -0
  66. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/shared_keys.rb +57 -0
  67. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/sku_name_enum.rb +21 -0
  68. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/storage_account.rb +58 -0
  69. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/storage_insight.rb +157 -0
  70. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/storage_insight_list_result.rb +98 -0
  71. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/storage_insight_state.rb +16 -0
  72. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/storage_insight_status.rb +58 -0
  73. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/table.rb +79 -0
  74. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/tables_list_result.rb +55 -0
  75. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/tag.rb +57 -0
  76. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/tracked_resource.rb +92 -0
  77. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/type.rb +16 -0
  78. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/usage_metric.rb +103 -0
  79. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace.rb +213 -0
  80. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_capping.rb +72 -0
  81. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_entity_status.rb +21 -0
  82. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_list_management_groups_result.rb +56 -0
  83. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_list_result.rb +55 -0
  84. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_list_usages_result.rb +56 -0
  85. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_patch.rb +206 -0
  86. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_purge_body.rb +67 -0
  87. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_purge_body_filters.rb +85 -0
  88. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_purge_response.rb +47 -0
  89. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_purge_status_response.rb +47 -0
  90. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_sku.rb +85 -0
  91. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_sku_name_enum.rb +21 -0
  92. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/module_definition.rb +9 -0
  93. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/operation_statuses.rb +121 -0
  94. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/operational_insights_management_client.rb +207 -0
  95. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/operations.rb +220 -0
  96. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/saved_searches.rb +457 -0
  97. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/schema.rb +130 -0
  98. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/shared_keys_operations.rb +238 -0
  99. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/storage_insight_configs.rb +592 -0
  100. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/tables.rb +359 -0
  101. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/usages.rb +130 -0
  102. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/workspace_purge.rb +277 -0
  103. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/workspaces.rb +768 -0
  104. data/lib/azure_mgmt_operational_insights.rb +1 -0
  105. data/lib/profiles/latest/modules/operationalinsights_profile_module.rb +173 -173
  106. data/lib/version.rb +1 -1
  107. metadata +101 -2
@@ -0,0 +1,603 @@
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::OperationalInsights::Mgmt::V2020_08_01
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. The name
28
+ # is case insensitive.
29
+ # @param workspace_name [String] The name of the workspace.
30
+ # @param data_source_name [String] The name of the datasource resource.
31
+ # @param parameters [DataSource] The parameters required to create or update a
32
+ # datasource.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [DataSource] operation results.
37
+ #
38
+ def create_or_update(resource_group_name, workspace_name, data_source_name, parameters, custom_headers:nil)
39
+ response = create_or_update_async(resource_group_name, workspace_name, data_source_name, parameters, custom_headers:custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # Create or update a data source.
45
+ #
46
+ # @param resource_group_name [String] The name of the resource group. The name
47
+ # is case insensitive.
48
+ # @param workspace_name [String] The name of the workspace.
49
+ # @param data_source_name [String] The name of the datasource resource.
50
+ # @param parameters [DataSource] The parameters required to create or update a
51
+ # datasource.
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
56
+ #
57
+ def create_or_update_with_http_info(resource_group_name, workspace_name, data_source_name, parameters, custom_headers:nil)
58
+ create_or_update_async(resource_group_name, workspace_name, data_source_name, parameters, custom_headers:custom_headers).value!
59
+ end
60
+
61
+ #
62
+ # Create or update a data source.
63
+ #
64
+ # @param resource_group_name [String] The name of the resource group. The name
65
+ # is case insensitive.
66
+ # @param workspace_name [String] The name of the workspace.
67
+ # @param data_source_name [String] The name of the datasource resource.
68
+ # @param parameters [DataSource] The parameters required to create or update a
69
+ # datasource.
70
+ # @param [Hash{String => String}] A hash of custom headers that will be added
71
+ # to the HTTP request.
72
+ #
73
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
74
+ #
75
+ def create_or_update_async(resource_group_name, workspace_name, data_source_name, parameters, custom_headers:nil)
76
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
77
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
78
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
79
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
80
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
81
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
82
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
83
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$'" if !workspace_name.nil? && workspace_name.match(Regexp.new('^^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$$')).nil?
84
+ fail ArgumentError, 'data_source_name is nil' if data_source_name.nil?
85
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
86
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
87
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
88
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
89
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
90
+
91
+
92
+ request_headers = {}
93
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
94
+
95
+ # Set Headers
96
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
97
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
98
+
99
+ # Serialize Request
100
+ request_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::DataSource.mapper()
101
+ request_content = @client.serialize(request_mapper, parameters)
102
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
103
+
104
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}'
105
+
106
+ request_url = @base_url || @client.base_url
107
+
108
+ options = {
109
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
110
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'dataSourceName' => data_source_name,'subscriptionId' => @client.subscription_id},
111
+ query_params: {'api-version' => @client.api_version},
112
+ body: request_content,
113
+ headers: request_headers.merge(custom_headers || {}),
114
+ base_url: request_url
115
+ }
116
+ promise = @client.make_request_async(:put, path_template, options)
117
+
118
+ promise = promise.then do |result|
119
+ http_response = result.response
120
+ status_code = http_response.status
121
+ response_content = http_response.body
122
+ unless status_code == 200 || status_code == 201
123
+ error_model = JSON.load(response_content)
124
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
125
+ end
126
+
127
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
128
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
129
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
130
+ # Deserialize Response
131
+ if status_code == 200
132
+ begin
133
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
134
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::DataSource.mapper()
135
+ result.body = @client.deserialize(result_mapper, parsed_response)
136
+ rescue Exception => e
137
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
138
+ end
139
+ end
140
+ # Deserialize Response
141
+ if status_code == 201
142
+ begin
143
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
144
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::DataSource.mapper()
145
+ result.body = @client.deserialize(result_mapper, parsed_response)
146
+ rescue Exception => e
147
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
148
+ end
149
+ end
150
+
151
+ result
152
+ end
153
+
154
+ promise.execute
155
+ end
156
+
157
+ #
158
+ # Deletes a data source instance.
159
+ #
160
+ # @param resource_group_name [String] The name of the resource group. The name
161
+ # is case insensitive.
162
+ # @param workspace_name [String] The name of the workspace.
163
+ # @param data_source_name [String] Name of the datasource.
164
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
165
+ # will be added to the HTTP request.
166
+ #
167
+ #
168
+ def delete(resource_group_name, workspace_name, data_source_name, custom_headers:nil)
169
+ response = delete_async(resource_group_name, workspace_name, data_source_name, custom_headers:custom_headers).value!
170
+ nil
171
+ end
172
+
173
+ #
174
+ # Deletes a data source instance.
175
+ #
176
+ # @param resource_group_name [String] The name of the resource group. The name
177
+ # is case insensitive.
178
+ # @param workspace_name [String] The name of the workspace.
179
+ # @param data_source_name [String] Name of the datasource.
180
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
181
+ # will be added to the HTTP request.
182
+ #
183
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
184
+ #
185
+ def delete_with_http_info(resource_group_name, workspace_name, data_source_name, custom_headers:nil)
186
+ delete_async(resource_group_name, workspace_name, data_source_name, custom_headers:custom_headers).value!
187
+ end
188
+
189
+ #
190
+ # Deletes a data source instance.
191
+ #
192
+ # @param resource_group_name [String] The name of the resource group. The name
193
+ # is case insensitive.
194
+ # @param workspace_name [String] The name of the workspace.
195
+ # @param data_source_name [String] Name of the datasource.
196
+ # @param [Hash{String => String}] A hash of custom headers that will be added
197
+ # to the HTTP request.
198
+ #
199
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
200
+ #
201
+ def delete_async(resource_group_name, workspace_name, data_source_name, custom_headers:nil)
202
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
203
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
204
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
205
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
206
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
207
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
208
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
209
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$'" if !workspace_name.nil? && workspace_name.match(Regexp.new('^^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$$')).nil?
210
+ fail ArgumentError, 'data_source_name is nil' if data_source_name.nil?
211
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
212
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
213
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
214
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
215
+
216
+
217
+ request_headers = {}
218
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
219
+
220
+ # Set Headers
221
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
222
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
223
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}'
224
+
225
+ request_url = @base_url || @client.base_url
226
+
227
+ options = {
228
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
229
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'dataSourceName' => data_source_name,'subscriptionId' => @client.subscription_id},
230
+ query_params: {'api-version' => @client.api_version},
231
+ headers: request_headers.merge(custom_headers || {}),
232
+ base_url: request_url
233
+ }
234
+ promise = @client.make_request_async(:delete, path_template, options)
235
+
236
+ promise = promise.then do |result|
237
+ http_response = result.response
238
+ status_code = http_response.status
239
+ response_content = http_response.body
240
+ unless status_code == 200 || status_code == 204
241
+ error_model = JSON.load(response_content)
242
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
243
+ end
244
+
245
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
246
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
247
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
248
+
249
+ result
250
+ end
251
+
252
+ promise.execute
253
+ end
254
+
255
+ #
256
+ # Gets a datasource instance.
257
+ #
258
+ # @param resource_group_name [String] The name of the resource group. The name
259
+ # is case insensitive.
260
+ # @param workspace_name [String] The name of the workspace.
261
+ # @param data_source_name [String] Name of the datasource
262
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
263
+ # will be added to the HTTP request.
264
+ #
265
+ # @return [DataSource] operation results.
266
+ #
267
+ def get(resource_group_name, workspace_name, data_source_name, custom_headers:nil)
268
+ response = get_async(resource_group_name, workspace_name, data_source_name, custom_headers:custom_headers).value!
269
+ response.body unless response.nil?
270
+ end
271
+
272
+ #
273
+ # Gets a datasource instance.
274
+ #
275
+ # @param resource_group_name [String] The name of the resource group. The name
276
+ # is case insensitive.
277
+ # @param workspace_name [String] The name of the workspace.
278
+ # @param data_source_name [String] Name of the datasource
279
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
280
+ # will be added to the HTTP request.
281
+ #
282
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
283
+ #
284
+ def get_with_http_info(resource_group_name, workspace_name, data_source_name, custom_headers:nil)
285
+ get_async(resource_group_name, workspace_name, data_source_name, custom_headers:custom_headers).value!
286
+ end
287
+
288
+ #
289
+ # Gets a datasource instance.
290
+ #
291
+ # @param resource_group_name [String] The name of the resource group. The name
292
+ # is case insensitive.
293
+ # @param workspace_name [String] The name of the workspace.
294
+ # @param data_source_name [String] Name of the datasource
295
+ # @param [Hash{String => String}] A hash of custom headers that will be added
296
+ # to the HTTP request.
297
+ #
298
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
299
+ #
300
+ def get_async(resource_group_name, workspace_name, data_source_name, custom_headers:nil)
301
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
302
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
303
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
304
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
305
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
306
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
307
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
308
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$'" if !workspace_name.nil? && workspace_name.match(Regexp.new('^^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$$')).nil?
309
+ fail ArgumentError, 'data_source_name is nil' if data_source_name.nil?
310
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
311
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
312
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
313
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
314
+
315
+
316
+ request_headers = {}
317
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
318
+
319
+ # Set Headers
320
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
321
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
322
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}'
323
+
324
+ request_url = @base_url || @client.base_url
325
+
326
+ options = {
327
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
328
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'dataSourceName' => data_source_name,'subscriptionId' => @client.subscription_id},
329
+ query_params: {'api-version' => @client.api_version},
330
+ headers: request_headers.merge(custom_headers || {}),
331
+ base_url: request_url
332
+ }
333
+ promise = @client.make_request_async(:get, path_template, options)
334
+
335
+ promise = promise.then do |result|
336
+ http_response = result.response
337
+ status_code = http_response.status
338
+ response_content = http_response.body
339
+ unless status_code == 200
340
+ error_model = JSON.load(response_content)
341
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
342
+ end
343
+
344
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
345
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
346
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
347
+ # Deserialize Response
348
+ if status_code == 200
349
+ begin
350
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
351
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::DataSource.mapper()
352
+ result.body = @client.deserialize(result_mapper, parsed_response)
353
+ rescue Exception => e
354
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
355
+ end
356
+ end
357
+
358
+ result
359
+ end
360
+
361
+ promise.execute
362
+ end
363
+
364
+ #
365
+ # Gets the first page of data source instances in a workspace with the link to
366
+ # the next page.
367
+ #
368
+ # @param resource_group_name [String] The name of the resource group. The name
369
+ # is case insensitive.
370
+ # @param workspace_name [String] The name of the workspace.
371
+ # @param filter [String] The filter to apply on the operation.
372
+ # @param skiptoken [String] Starting point of the collection of data source
373
+ # instances.
374
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
375
+ # will be added to the HTTP request.
376
+ #
377
+ # @return [Array<DataSource>] operation results.
378
+ #
379
+ def list_by_workspace(resource_group_name, workspace_name, filter, skiptoken:nil, custom_headers:nil)
380
+ first_page = list_by_workspace_as_lazy(resource_group_name, workspace_name, filter, skiptoken:skiptoken, custom_headers:custom_headers)
381
+ first_page.get_all_items
382
+ end
383
+
384
+ #
385
+ # Gets the first page of data source instances in a workspace with the link to
386
+ # the next page.
387
+ #
388
+ # @param resource_group_name [String] The name of the resource group. The name
389
+ # is case insensitive.
390
+ # @param workspace_name [String] The name of the workspace.
391
+ # @param filter [String] The filter to apply on the operation.
392
+ # @param skiptoken [String] Starting point of the collection of data source
393
+ # instances.
394
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
395
+ # will be added to the HTTP request.
396
+ #
397
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
398
+ #
399
+ def list_by_workspace_with_http_info(resource_group_name, workspace_name, filter, skiptoken:nil, custom_headers:nil)
400
+ list_by_workspace_async(resource_group_name, workspace_name, filter, skiptoken:skiptoken, custom_headers:custom_headers).value!
401
+ end
402
+
403
+ #
404
+ # Gets the first page of data source instances in a workspace with the link to
405
+ # the next page.
406
+ #
407
+ # @param resource_group_name [String] The name of the resource group. The name
408
+ # is case insensitive.
409
+ # @param workspace_name [String] The name of the workspace.
410
+ # @param filter [String] The filter to apply on the operation.
411
+ # @param skiptoken [String] Starting point of the collection of data source
412
+ # instances.
413
+ # @param [Hash{String => String}] A hash of custom headers that will be added
414
+ # to the HTTP request.
415
+ #
416
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
417
+ #
418
+ def list_by_workspace_async(resource_group_name, workspace_name, filter, skiptoken:nil, custom_headers:nil)
419
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
420
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
421
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
422
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
423
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
424
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
425
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
426
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$'" if !workspace_name.nil? && workspace_name.match(Regexp.new('^^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$$')).nil?
427
+ fail ArgumentError, 'filter is nil' if filter.nil?
428
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
429
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
430
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
431
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
432
+
433
+
434
+ request_headers = {}
435
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
436
+
437
+ # Set Headers
438
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
439
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
440
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources'
441
+
442
+ request_url = @base_url || @client.base_url
443
+
444
+ options = {
445
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
446
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
447
+ query_params: {'$filter' => filter,'$skiptoken' => skiptoken,'api-version' => @client.api_version},
448
+ headers: request_headers.merge(custom_headers || {}),
449
+ base_url: request_url
450
+ }
451
+ promise = @client.make_request_async(:get, path_template, options)
452
+
453
+ promise = promise.then do |result|
454
+ http_response = result.response
455
+ status_code = http_response.status
456
+ response_content = http_response.body
457
+ unless status_code == 200
458
+ error_model = JSON.load(response_content)
459
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
460
+ end
461
+
462
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
463
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
464
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
465
+ # Deserialize Response
466
+ if status_code == 200
467
+ begin
468
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
469
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::DataSourceListResult.mapper()
470
+ result.body = @client.deserialize(result_mapper, parsed_response)
471
+ rescue Exception => e
472
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
473
+ end
474
+ end
475
+
476
+ result
477
+ end
478
+
479
+ promise.execute
480
+ end
481
+
482
+ #
483
+ # Gets the first page of data source instances in a workspace with the link to
484
+ # the next page.
485
+ #
486
+ # @param next_page_link [String] The NextLink from the previous successful call
487
+ # to List operation.
488
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
489
+ # will be added to the HTTP request.
490
+ #
491
+ # @return [DataSourceListResult] operation results.
492
+ #
493
+ def list_by_workspace_next(next_page_link, custom_headers:nil)
494
+ response = list_by_workspace_next_async(next_page_link, custom_headers:custom_headers).value!
495
+ response.body unless response.nil?
496
+ end
497
+
498
+ #
499
+ # Gets the first page of data source instances in a workspace with the link to
500
+ # the next page.
501
+ #
502
+ # @param next_page_link [String] The NextLink from the previous successful call
503
+ # to List operation.
504
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
505
+ # will be added to the HTTP request.
506
+ #
507
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
508
+ #
509
+ def list_by_workspace_next_with_http_info(next_page_link, custom_headers:nil)
510
+ list_by_workspace_next_async(next_page_link, custom_headers:custom_headers).value!
511
+ end
512
+
513
+ #
514
+ # Gets the first page of data source instances in a workspace with the link to
515
+ # the next page.
516
+ #
517
+ # @param next_page_link [String] The NextLink from the previous successful call
518
+ # to List operation.
519
+ # @param [Hash{String => String}] A hash of custom headers that will be added
520
+ # to the HTTP request.
521
+ #
522
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
523
+ #
524
+ def list_by_workspace_next_async(next_page_link, custom_headers:nil)
525
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
526
+
527
+
528
+ request_headers = {}
529
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
530
+
531
+ # Set Headers
532
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
533
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
534
+ path_template = '{nextLink}'
535
+
536
+ request_url = @base_url || @client.base_url
537
+
538
+ options = {
539
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
540
+ skip_encoding_path_params: {'nextLink' => next_page_link},
541
+ headers: request_headers.merge(custom_headers || {}),
542
+ base_url: request_url
543
+ }
544
+ promise = @client.make_request_async(:get, path_template, options)
545
+
546
+ promise = promise.then do |result|
547
+ http_response = result.response
548
+ status_code = http_response.status
549
+ response_content = http_response.body
550
+ unless status_code == 200
551
+ error_model = JSON.load(response_content)
552
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
553
+ end
554
+
555
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
556
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
557
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
558
+ # Deserialize Response
559
+ if status_code == 200
560
+ begin
561
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
562
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::DataSourceListResult.mapper()
563
+ result.body = @client.deserialize(result_mapper, parsed_response)
564
+ rescue Exception => e
565
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
566
+ end
567
+ end
568
+
569
+ result
570
+ end
571
+
572
+ promise.execute
573
+ end
574
+
575
+ #
576
+ # Gets the first page of data source instances in a workspace with the link to
577
+ # the next page.
578
+ #
579
+ # @param resource_group_name [String] The name of the resource group. The name
580
+ # is case insensitive.
581
+ # @param workspace_name [String] The name of the workspace.
582
+ # @param filter [String] The filter to apply on the operation.
583
+ # @param skiptoken [String] Starting point of the collection of data source
584
+ # instances.
585
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
586
+ # will be added to the HTTP request.
587
+ #
588
+ # @return [DataSourceListResult] which provide lazy access to pages of the
589
+ # response.
590
+ #
591
+ def list_by_workspace_as_lazy(resource_group_name, workspace_name, filter, skiptoken:nil, custom_headers:nil)
592
+ response = list_by_workspace_async(resource_group_name, workspace_name, filter, skiptoken:skiptoken, custom_headers:custom_headers).value!
593
+ unless response.nil?
594
+ page = response.body
595
+ page.next_method = Proc.new do |next_page_link|
596
+ list_by_workspace_next_async(next_page_link, custom_headers:custom_headers)
597
+ end
598
+ page
599
+ end
600
+ end
601
+
602
+ end
603
+ end