azure_mgmt_kusto 0.17.2 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/clusters.rb +22 -0
  3. data/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/databases.rb +18 -0
  4. data/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/event_hub_connections.rb +12 -0
  5. data/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/kusto_management_client.rb +1 -1
  6. data/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/operations.rb +4 -0
  7. data/lib/2018-09-07-preview/generated/azure_mgmt_kusto/clusters.rb +22 -0
  8. data/lib/2018-09-07-preview/generated/azure_mgmt_kusto/databases.rb +18 -0
  9. data/lib/2018-09-07-preview/generated/azure_mgmt_kusto/event_hub_connections.rb +12 -0
  10. data/lib/2018-09-07-preview/generated/azure_mgmt_kusto/kusto_management_client.rb +1 -1
  11. data/lib/2018-09-07-preview/generated/azure_mgmt_kusto/operations.rb +4 -0
  12. data/lib/2019-01-21/generated/azure_mgmt_kusto.rb +16 -13
  13. data/lib/2019-01-21/generated/azure_mgmt_kusto/clusters.rb +22 -0
  14. data/lib/2019-01-21/generated/azure_mgmt_kusto/data_connections.rb +127 -0
  15. data/lib/2019-01-21/generated/azure_mgmt_kusto/databases.rb +18 -0
  16. data/lib/2019-01-21/generated/azure_mgmt_kusto/kusto_management_client.rb +1 -1
  17. data/lib/2019-01-21/generated/azure_mgmt_kusto/models/azure_capacity.rb +2 -2
  18. data/lib/2019-01-21/generated/azure_mgmt_kusto/models/azure_resource_sku.rb +1 -1
  19. data/lib/2019-01-21/generated/azure_mgmt_kusto/models/azure_sku.rb +9 -6
  20. data/lib/2019-01-21/generated/azure_mgmt_kusto/models/azure_sku_name.rb +12 -7
  21. data/lib/2019-01-21/generated/azure_mgmt_kusto/models/azure_sku_tier.rb +16 -0
  22. data/lib/2019-01-21/generated/azure_mgmt_kusto/models/check_name_result.rb +12 -0
  23. data/lib/2019-01-21/generated/azure_mgmt_kusto/models/cluster.rb +0 -1
  24. data/lib/2019-01-21/generated/azure_mgmt_kusto/models/data_connection_check_name_request.rb +62 -0
  25. data/lib/2019-01-21/generated/azure_mgmt_kusto/models/reason.rb +16 -0
  26. data/lib/2019-01-21/generated/azure_mgmt_kusto/operations.rb +4 -0
  27. data/lib/2019-05-15/generated/azure_mgmt_kusto.rb +79 -0
  28. data/lib/2019-05-15/generated/azure_mgmt_kusto/clusters.rb +1303 -0
  29. data/lib/2019-05-15/generated/azure_mgmt_kusto/data_connections.rb +963 -0
  30. data/lib/2019-05-15/generated/azure_mgmt_kusto/databases.rb +1149 -0
  31. data/lib/2019-05-15/generated/azure_mgmt_kusto/kusto_management_client.rb +145 -0
  32. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/azure_capacity.rb +80 -0
  33. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/azure_entity_resource.rb +75 -0
  34. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/azure_resource_sku.rb +70 -0
  35. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/azure_scale_type.rb +17 -0
  36. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/azure_sku.rb +74 -0
  37. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/azure_sku_name.rb +26 -0
  38. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/azure_sku_tier.rb +16 -0
  39. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/check_name_result.rb +82 -0
  40. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/cluster.rb +238 -0
  41. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/cluster_check_name_request.rb +60 -0
  42. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/cluster_list_result.rb +55 -0
  43. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/cluster_update.rb +225 -0
  44. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/data_connection.rb +82 -0
  45. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/data_connection_check_name_request.rb +62 -0
  46. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/data_connection_list_result.rb +57 -0
  47. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/data_connection_validation.rb +60 -0
  48. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/data_connection_validation_list_result.rb +56 -0
  49. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/data_connection_validation_result.rb +47 -0
  50. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/data_format.rb +25 -0
  51. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/database.rb +123 -0
  52. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/database_check_name_request.rb +61 -0
  53. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/database_list_result.rb +55 -0
  54. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/database_principal.rb +117 -0
  55. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/database_principal_list_request.rb +56 -0
  56. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/database_principal_list_result.rb +56 -0
  57. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/database_principal_role.rb +20 -0
  58. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/database_principal_type.rb +17 -0
  59. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/database_statistics.rb +47 -0
  60. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/database_update.rb +123 -0
  61. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/event_grid_data_connection.rb +158 -0
  62. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/event_hub_data_connection.rb +165 -0
  63. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/iot_hub_data_connection.rb +176 -0
  64. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/list_resource_skus_result.rb +56 -0
  65. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/operation.rb +82 -0
  66. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/operation_display.rb +80 -0
  67. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/operation_list_result.rb +98 -0
  68. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/optimized_autoscale.rb +80 -0
  69. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/provisioning_state.rb +20 -0
  70. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/proxy_resource.rb +63 -0
  71. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/reason.rb +16 -0
  72. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/resource.rb +83 -0
  73. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/sku_description.rb +132 -0
  74. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/sku_description_list.rb +56 -0
  75. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/sku_location_info_item.rb +65 -0
  76. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/state.rb +23 -0
  77. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/tracked_resource.rb +92 -0
  78. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/trusted_external_tenant.rb +46 -0
  79. data/lib/2019-05-15/generated/azure_mgmt_kusto/models/virtual_network_configuration.rb +69 -0
  80. data/lib/2019-05-15/generated/azure_mgmt_kusto/module_definition.rb +9 -0
  81. data/lib/2019-05-15/generated/azure_mgmt_kusto/operations.rb +221 -0
  82. data/lib/azure_mgmt_kusto.rb +2 -1
  83. data/lib/profiles/latest/modules/kusto_profile_module.rb +133 -101
  84. data/lib/version.rb +1 -1
  85. metadata +63 -5
@@ -0,0 +1,963 @@
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::Kusto::Mgmt::V2019_05_15
7
+ #
8
+ # The Azure Kusto management API provides a RESTful set of web services that
9
+ # interact with Azure Kusto services to manage your clusters and databases.
10
+ # The API enables you to create, update, and delete clusters and databases.
11
+ #
12
+ class DataConnections
13
+ include MsRestAzure
14
+
15
+ #
16
+ # Creates and initializes a new instance of the DataConnections class.
17
+ # @param client service class for accessing basic functionality.
18
+ #
19
+ def initialize(client)
20
+ @client = client
21
+ end
22
+
23
+ # @return [KustoManagementClient] reference to the KustoManagementClient
24
+ attr_reader :client
25
+
26
+ #
27
+ # Returns the list of data connections of the given Kusto database.
28
+ #
29
+ # @param resource_group_name [String] The name of the resource group containing
30
+ # the Kusto cluster.
31
+ # @param cluster_name [String] The name of the Kusto cluster.
32
+ # @param database_name [String] The name of the database in the Kusto cluster.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [DataConnectionListResult] operation results.
37
+ #
38
+ def list_by_database(resource_group_name, cluster_name, database_name, custom_headers:nil)
39
+ response = list_by_database_async(resource_group_name, cluster_name, database_name, custom_headers:custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # Returns the list of data connections of the given Kusto database.
45
+ #
46
+ # @param resource_group_name [String] The name of the resource group containing
47
+ # the Kusto cluster.
48
+ # @param cluster_name [String] The name of the Kusto cluster.
49
+ # @param database_name [String] The name of the database in the Kusto cluster.
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def list_by_database_with_http_info(resource_group_name, cluster_name, database_name, custom_headers:nil)
56
+ list_by_database_async(resource_group_name, cluster_name, database_name, custom_headers:custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # Returns the list of data connections of the given Kusto database.
61
+ #
62
+ # @param resource_group_name [String] The name of the resource group containing
63
+ # the Kusto cluster.
64
+ # @param cluster_name [String] The name of the Kusto cluster.
65
+ # @param database_name [String] The name of the database in the Kusto cluster.
66
+ # @param [Hash{String => String}] A hash of custom headers that will be added
67
+ # to the HTTP request.
68
+ #
69
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
70
+ #
71
+ def list_by_database_async(resource_group_name, cluster_name, database_name, custom_headers:nil)
72
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
73
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
74
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
75
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
76
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
77
+
78
+
79
+ request_headers = {}
80
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
81
+
82
+ # Set Headers
83
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
84
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
85
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections'
86
+
87
+ request_url = @base_url || @client.base_url
88
+
89
+ options = {
90
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
91
+ path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
92
+ query_params: {'api-version' => @client.api_version},
93
+ headers: request_headers.merge(custom_headers || {}),
94
+ base_url: request_url
95
+ }
96
+ promise = @client.make_request_async(:get, path_template, options)
97
+
98
+ promise = promise.then do |result|
99
+ http_response = result.response
100
+ status_code = http_response.status
101
+ response_content = http_response.body
102
+ unless status_code == 200
103
+ error_model = JSON.load(response_content)
104
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
105
+ end
106
+
107
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
108
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
109
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
110
+ # Deserialize Response
111
+ if status_code == 200
112
+ begin
113
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
114
+ result_mapper = Azure::Kusto::Mgmt::V2019_05_15::Models::DataConnectionListResult.mapper()
115
+ result.body = @client.deserialize(result_mapper, parsed_response)
116
+ rescue Exception => e
117
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
118
+ end
119
+ end
120
+
121
+ result
122
+ end
123
+
124
+ promise.execute
125
+ end
126
+
127
+ #
128
+ # Checks that the data connection parameters are valid.
129
+ #
130
+ # @param resource_group_name [String] The name of the resource group containing
131
+ # the Kusto cluster.
132
+ # @param cluster_name [String] The name of the Kusto cluster.
133
+ # @param database_name [String] The name of the database in the Kusto cluster.
134
+ # @param parameters [DataConnectionValidation] The data connection parameters
135
+ # supplied to the CreateOrUpdate operation.
136
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
137
+ # will be added to the HTTP request.
138
+ #
139
+ # @return [DataConnectionValidationListResult] operation results.
140
+ #
141
+ def data_connection_validation_method(resource_group_name, cluster_name, database_name, parameters, custom_headers:nil)
142
+ response = data_connection_validation_method_async(resource_group_name, cluster_name, database_name, parameters, custom_headers:custom_headers).value!
143
+ response.body unless response.nil?
144
+ end
145
+
146
+ #
147
+ # Checks that the data connection parameters are valid.
148
+ #
149
+ # @param resource_group_name [String] The name of the resource group containing
150
+ # the Kusto cluster.
151
+ # @param cluster_name [String] The name of the Kusto cluster.
152
+ # @param database_name [String] The name of the database in the Kusto cluster.
153
+ # @param parameters [DataConnectionValidation] The data connection parameters
154
+ # supplied to the CreateOrUpdate operation.
155
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
156
+ # will be added to the HTTP request.
157
+ #
158
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
159
+ #
160
+ def data_connection_validation_method_with_http_info(resource_group_name, cluster_name, database_name, parameters, custom_headers:nil)
161
+ data_connection_validation_method_async(resource_group_name, cluster_name, database_name, parameters, custom_headers:custom_headers).value!
162
+ end
163
+
164
+ #
165
+ # Checks that the data connection parameters are valid.
166
+ #
167
+ # @param resource_group_name [String] The name of the resource group containing
168
+ # the Kusto cluster.
169
+ # @param cluster_name [String] The name of the Kusto cluster.
170
+ # @param database_name [String] The name of the database in the Kusto cluster.
171
+ # @param parameters [DataConnectionValidation] The data connection parameters
172
+ # supplied to the CreateOrUpdate operation.
173
+ # @param [Hash{String => String}] A hash of custom headers that will be added
174
+ # to the HTTP request.
175
+ #
176
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
177
+ #
178
+ def data_connection_validation_method_async(resource_group_name, cluster_name, database_name, parameters, custom_headers:nil)
179
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
180
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
181
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
182
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
183
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
184
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
185
+
186
+
187
+ request_headers = {}
188
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
189
+
190
+ # Set Headers
191
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
192
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
193
+
194
+ # Serialize Request
195
+ request_mapper = Azure::Kusto::Mgmt::V2019_05_15::Models::DataConnectionValidation.mapper()
196
+ request_content = @client.serialize(request_mapper, parameters)
197
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
198
+
199
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnectionValidation'
200
+
201
+ request_url = @base_url || @client.base_url
202
+
203
+ options = {
204
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
205
+ path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
206
+ query_params: {'api-version' => @client.api_version},
207
+ body: request_content,
208
+ headers: request_headers.merge(custom_headers || {}),
209
+ base_url: request_url
210
+ }
211
+ promise = @client.make_request_async(:post, path_template, options)
212
+
213
+ promise = promise.then do |result|
214
+ http_response = result.response
215
+ status_code = http_response.status
216
+ response_content = http_response.body
217
+ unless status_code == 200
218
+ error_model = JSON.load(response_content)
219
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
220
+ end
221
+
222
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
223
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
224
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
225
+ # Deserialize Response
226
+ if status_code == 200
227
+ begin
228
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
229
+ result_mapper = Azure::Kusto::Mgmt::V2019_05_15::Models::DataConnectionValidationListResult.mapper()
230
+ result.body = @client.deserialize(result_mapper, parsed_response)
231
+ rescue Exception => e
232
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
233
+ end
234
+ end
235
+
236
+ result
237
+ end
238
+
239
+ promise.execute
240
+ end
241
+
242
+ #
243
+ # Checks that the data connection name is valid and is not already in use.
244
+ #
245
+ # @param resource_group_name [String] The name of the resource group containing
246
+ # the Kusto cluster.
247
+ # @param cluster_name [String] The name of the Kusto cluster.
248
+ # @param database_name [String] The name of the database in the Kusto cluster.
249
+ # @param data_connection_name [DataConnectionCheckNameRequest] The name of the
250
+ # data connection.
251
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
252
+ # will be added to the HTTP request.
253
+ #
254
+ # @return [CheckNameResult] operation results.
255
+ #
256
+ def check_name_availability(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:nil)
257
+ response = check_name_availability_async(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:custom_headers).value!
258
+ response.body unless response.nil?
259
+ end
260
+
261
+ #
262
+ # Checks that the data connection name is valid and is not already in use.
263
+ #
264
+ # @param resource_group_name [String] The name of the resource group containing
265
+ # the Kusto cluster.
266
+ # @param cluster_name [String] The name of the Kusto cluster.
267
+ # @param database_name [String] The name of the database in the Kusto cluster.
268
+ # @param data_connection_name [DataConnectionCheckNameRequest] The name of the
269
+ # data connection.
270
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
271
+ # will be added to the HTTP request.
272
+ #
273
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
274
+ #
275
+ def check_name_availability_with_http_info(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:nil)
276
+ check_name_availability_async(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:custom_headers).value!
277
+ end
278
+
279
+ #
280
+ # Checks that the data connection name is valid and is not already in use.
281
+ #
282
+ # @param resource_group_name [String] The name of the resource group containing
283
+ # the Kusto cluster.
284
+ # @param cluster_name [String] The name of the Kusto cluster.
285
+ # @param database_name [String] The name of the database in the Kusto cluster.
286
+ # @param data_connection_name [DataConnectionCheckNameRequest] The name of the
287
+ # data connection.
288
+ # @param [Hash{String => String}] A hash of custom headers that will be added
289
+ # to the HTTP request.
290
+ #
291
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
292
+ #
293
+ def check_name_availability_async(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:nil)
294
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
295
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
296
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
297
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
298
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
299
+ fail ArgumentError, 'data_connection_name is nil' if data_connection_name.nil?
300
+
301
+
302
+ request_headers = {}
303
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
304
+
305
+ # Set Headers
306
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
307
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
308
+
309
+ # Serialize Request
310
+ request_mapper = Azure::Kusto::Mgmt::V2019_05_15::Models::DataConnectionCheckNameRequest.mapper()
311
+ request_content = @client.serialize(request_mapper, data_connection_name)
312
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
313
+
314
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/checkNameAvailability'
315
+
316
+ request_url = @base_url || @client.base_url
317
+
318
+ options = {
319
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
320
+ path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
321
+ query_params: {'api-version' => @client.api_version},
322
+ body: request_content,
323
+ headers: request_headers.merge(custom_headers || {}),
324
+ base_url: request_url
325
+ }
326
+ promise = @client.make_request_async(:post, path_template, options)
327
+
328
+ promise = promise.then do |result|
329
+ http_response = result.response
330
+ status_code = http_response.status
331
+ response_content = http_response.body
332
+ unless status_code == 200
333
+ error_model = JSON.load(response_content)
334
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
335
+ end
336
+
337
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
338
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
339
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
340
+ # Deserialize Response
341
+ if status_code == 200
342
+ begin
343
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
344
+ result_mapper = Azure::Kusto::Mgmt::V2019_05_15::Models::CheckNameResult.mapper()
345
+ result.body = @client.deserialize(result_mapper, parsed_response)
346
+ rescue Exception => e
347
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
348
+ end
349
+ end
350
+
351
+ result
352
+ end
353
+
354
+ promise.execute
355
+ end
356
+
357
+ #
358
+ # Returns a data connection.
359
+ #
360
+ # @param resource_group_name [String] The name of the resource group containing
361
+ # the Kusto cluster.
362
+ # @param cluster_name [String] The name of the Kusto cluster.
363
+ # @param database_name [String] The name of the database in the Kusto cluster.
364
+ # @param data_connection_name [String] The name of the data connection.
365
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
366
+ # will be added to the HTTP request.
367
+ #
368
+ # @return [DataConnection] operation results.
369
+ #
370
+ def get(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:nil)
371
+ response = get_async(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:custom_headers).value!
372
+ response.body unless response.nil?
373
+ end
374
+
375
+ #
376
+ # Returns a data connection.
377
+ #
378
+ # @param resource_group_name [String] The name of the resource group containing
379
+ # the Kusto cluster.
380
+ # @param cluster_name [String] The name of the Kusto cluster.
381
+ # @param database_name [String] The name of the database in the Kusto cluster.
382
+ # @param data_connection_name [String] The name of the data connection.
383
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
384
+ # will be added to the HTTP request.
385
+ #
386
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
387
+ #
388
+ def get_with_http_info(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:nil)
389
+ get_async(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:custom_headers).value!
390
+ end
391
+
392
+ #
393
+ # Returns a data connection.
394
+ #
395
+ # @param resource_group_name [String] The name of the resource group containing
396
+ # the Kusto cluster.
397
+ # @param cluster_name [String] The name of the Kusto cluster.
398
+ # @param database_name [String] The name of the database in the Kusto cluster.
399
+ # @param data_connection_name [String] The name of the data connection.
400
+ # @param [Hash{String => String}] A hash of custom headers that will be added
401
+ # to the HTTP request.
402
+ #
403
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
404
+ #
405
+ def get_async(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:nil)
406
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
407
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
408
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
409
+ fail ArgumentError, 'data_connection_name is nil' if data_connection_name.nil?
410
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
411
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
412
+
413
+
414
+ request_headers = {}
415
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
416
+
417
+ # Set Headers
418
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
419
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
420
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'
421
+
422
+ request_url = @base_url || @client.base_url
423
+
424
+ options = {
425
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
426
+ path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'databaseName' => database_name,'dataConnectionName' => data_connection_name,'subscriptionId' => @client.subscription_id},
427
+ query_params: {'api-version' => @client.api_version},
428
+ headers: request_headers.merge(custom_headers || {}),
429
+ base_url: request_url
430
+ }
431
+ promise = @client.make_request_async(:get, path_template, options)
432
+
433
+ promise = promise.then do |result|
434
+ http_response = result.response
435
+ status_code = http_response.status
436
+ response_content = http_response.body
437
+ unless status_code == 200
438
+ error_model = JSON.load(response_content)
439
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
440
+ end
441
+
442
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
443
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
444
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
445
+ # Deserialize Response
446
+ if status_code == 200
447
+ begin
448
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
449
+ result_mapper = Azure::Kusto::Mgmt::V2019_05_15::Models::DataConnection.mapper()
450
+ result.body = @client.deserialize(result_mapper, parsed_response)
451
+ rescue Exception => e
452
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
453
+ end
454
+ end
455
+
456
+ result
457
+ end
458
+
459
+ promise.execute
460
+ end
461
+
462
+ #
463
+ # Creates or updates a data connection.
464
+ #
465
+ # @param resource_group_name [String] The name of the resource group containing
466
+ # the Kusto cluster.
467
+ # @param cluster_name [String] The name of the Kusto cluster.
468
+ # @param database_name [String] The name of the database in the Kusto cluster.
469
+ # @param data_connection_name [String] The name of the data connection.
470
+ # @param parameters [DataConnection] The data connection parameters supplied to
471
+ # the CreateOrUpdate operation.
472
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
473
+ # will be added to the HTTP request.
474
+ #
475
+ # @return [DataConnection] operation results.
476
+ #
477
+ def create_or_update(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:nil)
478
+ response = create_or_update_async(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:custom_headers).value!
479
+ response.body unless response.nil?
480
+ end
481
+
482
+ #
483
+ # @param resource_group_name [String] The name of the resource group containing
484
+ # the Kusto cluster.
485
+ # @param cluster_name [String] The name of the Kusto cluster.
486
+ # @param database_name [String] The name of the database in the Kusto cluster.
487
+ # @param data_connection_name [String] The name of the data connection.
488
+ # @param parameters [DataConnection] The data connection parameters supplied to
489
+ # the CreateOrUpdate operation.
490
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
491
+ # will be added to the HTTP request.
492
+ #
493
+ # @return [Concurrent::Promise] promise which provides async access to http
494
+ # response.
495
+ #
496
+ def create_or_update_async(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:nil)
497
+ # Send request
498
+ promise = begin_create_or_update_async(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:custom_headers)
499
+
500
+ promise = promise.then do |response|
501
+ # Defining deserialization method.
502
+ deserialize_method = lambda do |parsed_response|
503
+ result_mapper = Azure::Kusto::Mgmt::V2019_05_15::Models::DataConnection.mapper()
504
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
505
+ end
506
+
507
+ # Waiting for response.
508
+ @client.get_long_running_operation_result(response, deserialize_method)
509
+ end
510
+
511
+ promise
512
+ end
513
+
514
+ #
515
+ # Updates a data connection.
516
+ #
517
+ # @param resource_group_name [String] The name of the resource group containing
518
+ # the Kusto cluster.
519
+ # @param cluster_name [String] The name of the Kusto cluster.
520
+ # @param database_name [String] The name of the database in the Kusto cluster.
521
+ # @param data_connection_name [String] The name of the data connection.
522
+ # @param parameters [DataConnection] The data connection parameters supplied to
523
+ # the Update operation.
524
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
525
+ # will be added to the HTTP request.
526
+ #
527
+ # @return [DataConnection] operation results.
528
+ #
529
+ def update(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:nil)
530
+ response = update_async(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:custom_headers).value!
531
+ response.body unless response.nil?
532
+ end
533
+
534
+ #
535
+ # @param resource_group_name [String] The name of the resource group containing
536
+ # the Kusto cluster.
537
+ # @param cluster_name [String] The name of the Kusto cluster.
538
+ # @param database_name [String] The name of the database in the Kusto cluster.
539
+ # @param data_connection_name [String] The name of the data connection.
540
+ # @param parameters [DataConnection] The data connection parameters supplied to
541
+ # the Update operation.
542
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
543
+ # will be added to the HTTP request.
544
+ #
545
+ # @return [Concurrent::Promise] promise which provides async access to http
546
+ # response.
547
+ #
548
+ def update_async(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:nil)
549
+ # Send request
550
+ promise = begin_update_async(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:custom_headers)
551
+
552
+ promise = promise.then do |response|
553
+ # Defining deserialization method.
554
+ deserialize_method = lambda do |parsed_response|
555
+ result_mapper = Azure::Kusto::Mgmt::V2019_05_15::Models::DataConnection.mapper()
556
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
557
+ end
558
+
559
+ # Waiting for response.
560
+ @client.get_long_running_operation_result(response, deserialize_method)
561
+ end
562
+
563
+ promise
564
+ end
565
+
566
+ #
567
+ # Deletes the data connection with the given name.
568
+ #
569
+ # @param resource_group_name [String] The name of the resource group containing
570
+ # the Kusto cluster.
571
+ # @param cluster_name [String] The name of the Kusto cluster.
572
+ # @param database_name [String] The name of the database in the Kusto cluster.
573
+ # @param data_connection_name [String] The name of the data connection.
574
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
575
+ # will be added to the HTTP request.
576
+ #
577
+ def delete(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:nil)
578
+ response = delete_async(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:custom_headers).value!
579
+ nil
580
+ end
581
+
582
+ #
583
+ # @param resource_group_name [String] The name of the resource group containing
584
+ # the Kusto cluster.
585
+ # @param cluster_name [String] The name of the Kusto cluster.
586
+ # @param database_name [String] The name of the database in the Kusto cluster.
587
+ # @param data_connection_name [String] The name of the data connection.
588
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
589
+ # will be added to the HTTP request.
590
+ #
591
+ # @return [Concurrent::Promise] promise which provides async access to http
592
+ # response.
593
+ #
594
+ def delete_async(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:nil)
595
+ # Send request
596
+ promise = begin_delete_async(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:custom_headers)
597
+
598
+ promise = promise.then do |response|
599
+ # Defining deserialization method.
600
+ deserialize_method = lambda do |parsed_response|
601
+ end
602
+
603
+ # Waiting for response.
604
+ @client.get_long_running_operation_result(response, deserialize_method)
605
+ end
606
+
607
+ promise
608
+ end
609
+
610
+ #
611
+ # Creates or updates a data connection.
612
+ #
613
+ # @param resource_group_name [String] The name of the resource group containing
614
+ # the Kusto cluster.
615
+ # @param cluster_name [String] The name of the Kusto cluster.
616
+ # @param database_name [String] The name of the database in the Kusto cluster.
617
+ # @param data_connection_name [String] The name of the data connection.
618
+ # @param parameters [DataConnection] The data connection parameters supplied to
619
+ # the CreateOrUpdate operation.
620
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
621
+ # will be added to the HTTP request.
622
+ #
623
+ # @return [DataConnection] operation results.
624
+ #
625
+ def begin_create_or_update(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:nil)
626
+ response = begin_create_or_update_async(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:custom_headers).value!
627
+ response.body unless response.nil?
628
+ end
629
+
630
+ #
631
+ # Creates or updates a data connection.
632
+ #
633
+ # @param resource_group_name [String] The name of the resource group containing
634
+ # the Kusto cluster.
635
+ # @param cluster_name [String] The name of the Kusto cluster.
636
+ # @param database_name [String] The name of the database in the Kusto cluster.
637
+ # @param data_connection_name [String] The name of the data connection.
638
+ # @param parameters [DataConnection] The data connection parameters supplied to
639
+ # the CreateOrUpdate operation.
640
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
641
+ # will be added to the HTTP request.
642
+ #
643
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
644
+ #
645
+ def begin_create_or_update_with_http_info(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:nil)
646
+ begin_create_or_update_async(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:custom_headers).value!
647
+ end
648
+
649
+ #
650
+ # Creates or updates a data connection.
651
+ #
652
+ # @param resource_group_name [String] The name of the resource group containing
653
+ # the Kusto cluster.
654
+ # @param cluster_name [String] The name of the Kusto cluster.
655
+ # @param database_name [String] The name of the database in the Kusto cluster.
656
+ # @param data_connection_name [String] The name of the data connection.
657
+ # @param parameters [DataConnection] The data connection parameters supplied to
658
+ # the CreateOrUpdate operation.
659
+ # @param [Hash{String => String}] A hash of custom headers that will be added
660
+ # to the HTTP request.
661
+ #
662
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
663
+ #
664
+ def begin_create_or_update_async(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:nil)
665
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
666
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
667
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
668
+ fail ArgumentError, 'data_connection_name is nil' if data_connection_name.nil?
669
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
670
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
671
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
672
+
673
+
674
+ request_headers = {}
675
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
676
+
677
+ # Set Headers
678
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
679
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
680
+
681
+ # Serialize Request
682
+ request_mapper = Azure::Kusto::Mgmt::V2019_05_15::Models::DataConnection.mapper()
683
+ request_content = @client.serialize(request_mapper, parameters)
684
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
685
+
686
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'
687
+
688
+ request_url = @base_url || @client.base_url
689
+
690
+ options = {
691
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
692
+ path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'databaseName' => database_name,'dataConnectionName' => data_connection_name,'subscriptionId' => @client.subscription_id},
693
+ query_params: {'api-version' => @client.api_version},
694
+ body: request_content,
695
+ headers: request_headers.merge(custom_headers || {}),
696
+ base_url: request_url
697
+ }
698
+ promise = @client.make_request_async(:put, path_template, options)
699
+
700
+ promise = promise.then do |result|
701
+ http_response = result.response
702
+ status_code = http_response.status
703
+ response_content = http_response.body
704
+ unless status_code == 200 || status_code == 201 || status_code == 202
705
+ error_model = JSON.load(response_content)
706
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
707
+ end
708
+
709
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
710
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
711
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
712
+ # Deserialize Response
713
+ if status_code == 200
714
+ begin
715
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
716
+ result_mapper = Azure::Kusto::Mgmt::V2019_05_15::Models::DataConnection.mapper()
717
+ result.body = @client.deserialize(result_mapper, parsed_response)
718
+ rescue Exception => e
719
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
720
+ end
721
+ end
722
+ # Deserialize Response
723
+ if status_code == 201
724
+ begin
725
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
726
+ result_mapper = Azure::Kusto::Mgmt::V2019_05_15::Models::DataConnection.mapper()
727
+ result.body = @client.deserialize(result_mapper, parsed_response)
728
+ rescue Exception => e
729
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
730
+ end
731
+ end
732
+
733
+ result
734
+ end
735
+
736
+ promise.execute
737
+ end
738
+
739
+ #
740
+ # Updates a data connection.
741
+ #
742
+ # @param resource_group_name [String] The name of the resource group containing
743
+ # the Kusto cluster.
744
+ # @param cluster_name [String] The name of the Kusto cluster.
745
+ # @param database_name [String] The name of the database in the Kusto cluster.
746
+ # @param data_connection_name [String] The name of the data connection.
747
+ # @param parameters [DataConnection] The data connection parameters supplied to
748
+ # the Update operation.
749
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
750
+ # will be added to the HTTP request.
751
+ #
752
+ # @return [DataConnection] operation results.
753
+ #
754
+ def begin_update(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:nil)
755
+ response = begin_update_async(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:custom_headers).value!
756
+ response.body unless response.nil?
757
+ end
758
+
759
+ #
760
+ # Updates a data connection.
761
+ #
762
+ # @param resource_group_name [String] The name of the resource group containing
763
+ # the Kusto cluster.
764
+ # @param cluster_name [String] The name of the Kusto cluster.
765
+ # @param database_name [String] The name of the database in the Kusto cluster.
766
+ # @param data_connection_name [String] The name of the data connection.
767
+ # @param parameters [DataConnection] The data connection parameters supplied to
768
+ # the Update operation.
769
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
770
+ # will be added to the HTTP request.
771
+ #
772
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
773
+ #
774
+ def begin_update_with_http_info(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:nil)
775
+ begin_update_async(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:custom_headers).value!
776
+ end
777
+
778
+ #
779
+ # Updates a data connection.
780
+ #
781
+ # @param resource_group_name [String] The name of the resource group containing
782
+ # the Kusto cluster.
783
+ # @param cluster_name [String] The name of the Kusto cluster.
784
+ # @param database_name [String] The name of the database in the Kusto cluster.
785
+ # @param data_connection_name [String] The name of the data connection.
786
+ # @param parameters [DataConnection] The data connection parameters supplied to
787
+ # the Update operation.
788
+ # @param [Hash{String => String}] A hash of custom headers that will be added
789
+ # to the HTTP request.
790
+ #
791
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
792
+ #
793
+ def begin_update_async(resource_group_name, cluster_name, database_name, data_connection_name, parameters, custom_headers:nil)
794
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
795
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
796
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
797
+ fail ArgumentError, 'data_connection_name is nil' if data_connection_name.nil?
798
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
799
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
800
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
801
+
802
+
803
+ request_headers = {}
804
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
805
+
806
+ # Set Headers
807
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
808
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
809
+
810
+ # Serialize Request
811
+ request_mapper = Azure::Kusto::Mgmt::V2019_05_15::Models::DataConnection.mapper()
812
+ request_content = @client.serialize(request_mapper, parameters)
813
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
814
+
815
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'
816
+
817
+ request_url = @base_url || @client.base_url
818
+
819
+ options = {
820
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
821
+ path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'databaseName' => database_name,'dataConnectionName' => data_connection_name,'subscriptionId' => @client.subscription_id},
822
+ query_params: {'api-version' => @client.api_version},
823
+ body: request_content,
824
+ headers: request_headers.merge(custom_headers || {}),
825
+ base_url: request_url
826
+ }
827
+ promise = @client.make_request_async(:patch, path_template, options)
828
+
829
+ promise = promise.then do |result|
830
+ http_response = result.response
831
+ status_code = http_response.status
832
+ response_content = http_response.body
833
+ unless status_code == 200 || status_code == 201 || status_code == 202
834
+ error_model = JSON.load(response_content)
835
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
836
+ end
837
+
838
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
839
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
840
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
841
+ # Deserialize Response
842
+ if status_code == 200
843
+ begin
844
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
845
+ result_mapper = Azure::Kusto::Mgmt::V2019_05_15::Models::DataConnection.mapper()
846
+ result.body = @client.deserialize(result_mapper, parsed_response)
847
+ rescue Exception => e
848
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
849
+ end
850
+ end
851
+ # Deserialize Response
852
+ if status_code == 201
853
+ begin
854
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
855
+ result_mapper = Azure::Kusto::Mgmt::V2019_05_15::Models::DataConnection.mapper()
856
+ result.body = @client.deserialize(result_mapper, parsed_response)
857
+ rescue Exception => e
858
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
859
+ end
860
+ end
861
+
862
+ result
863
+ end
864
+
865
+ promise.execute
866
+ end
867
+
868
+ #
869
+ # Deletes the data connection with the given name.
870
+ #
871
+ # @param resource_group_name [String] The name of the resource group containing
872
+ # the Kusto cluster.
873
+ # @param cluster_name [String] The name of the Kusto cluster.
874
+ # @param database_name [String] The name of the database in the Kusto cluster.
875
+ # @param data_connection_name [String] The name of the data connection.
876
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
877
+ # will be added to the HTTP request.
878
+ #
879
+ #
880
+ def begin_delete(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:nil)
881
+ response = begin_delete_async(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:custom_headers).value!
882
+ nil
883
+ end
884
+
885
+ #
886
+ # Deletes the data connection with the given name.
887
+ #
888
+ # @param resource_group_name [String] The name of the resource group containing
889
+ # the Kusto cluster.
890
+ # @param cluster_name [String] The name of the Kusto cluster.
891
+ # @param database_name [String] The name of the database in the Kusto cluster.
892
+ # @param data_connection_name [String] The name of the data connection.
893
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
894
+ # will be added to the HTTP request.
895
+ #
896
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
897
+ #
898
+ def begin_delete_with_http_info(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:nil)
899
+ begin_delete_async(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:custom_headers).value!
900
+ end
901
+
902
+ #
903
+ # Deletes the data connection with the given name.
904
+ #
905
+ # @param resource_group_name [String] The name of the resource group containing
906
+ # the Kusto cluster.
907
+ # @param cluster_name [String] The name of the Kusto cluster.
908
+ # @param database_name [String] The name of the database in the Kusto cluster.
909
+ # @param data_connection_name [String] The name of the data connection.
910
+ # @param [Hash{String => String}] A hash of custom headers that will be added
911
+ # to the HTTP request.
912
+ #
913
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
914
+ #
915
+ def begin_delete_async(resource_group_name, cluster_name, database_name, data_connection_name, custom_headers:nil)
916
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
917
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
918
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
919
+ fail ArgumentError, 'data_connection_name is nil' if data_connection_name.nil?
920
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
921
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
922
+
923
+
924
+ request_headers = {}
925
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
926
+
927
+ # Set Headers
928
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
929
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
930
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'
931
+
932
+ request_url = @base_url || @client.base_url
933
+
934
+ options = {
935
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
936
+ path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'databaseName' => database_name,'dataConnectionName' => data_connection_name,'subscriptionId' => @client.subscription_id},
937
+ query_params: {'api-version' => @client.api_version},
938
+ headers: request_headers.merge(custom_headers || {}),
939
+ base_url: request_url
940
+ }
941
+ promise = @client.make_request_async(:delete, path_template, options)
942
+
943
+ promise = promise.then do |result|
944
+ http_response = result.response
945
+ status_code = http_response.status
946
+ response_content = http_response.body
947
+ unless status_code == 200 || status_code == 202 || status_code == 204
948
+ error_model = JSON.load(response_content)
949
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
950
+ end
951
+
952
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
953
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
954
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
955
+
956
+ result
957
+ end
958
+
959
+ promise.execute
960
+ end
961
+
962
+ end
963
+ end