azure_mgmt_kusto 0.17.0 → 0.17.1

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