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