azure_mgmt_kusto 0.19.3 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) 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/kusto_management_client.rb +1 -1
  5. data/lib/2019-05-15/generated/azure_mgmt_kusto/kusto_management_client.rb +1 -1
  6. data/lib/2019-09-07/generated/azure_mgmt_kusto/kusto_management_client.rb +1 -1
  7. data/lib/2019-11-09/generated/azure_mgmt_kusto/kusto_management_client.rb +1 -1
  8. data/lib/2020-02-15/generated/azure_mgmt_kusto/kusto_management_client.rb +1 -1
  9. data/lib/2020-06-14/generated/azure_mgmt_kusto/kusto_management_client.rb +1 -1
  10. data/lib/2020-09-18/generated/azure_mgmt_kusto.rb +111 -0
  11. data/lib/2020-09-18/generated/azure_mgmt_kusto/attached_database_configurations.rb +558 -0
  12. data/lib/2020-09-18/generated/azure_mgmt_kusto/cluster_principal_assignments.rb +656 -0
  13. data/lib/2020-09-18/generated/azure_mgmt_kusto/clusters.rb +2087 -0
  14. data/lib/2020-09-18/generated/azure_mgmt_kusto/data_connections.rb +1033 -0
  15. data/lib/2020-09-18/generated/azure_mgmt_kusto/database_principal_assignments.rb +683 -0
  16. data/lib/2020-09-18/generated/azure_mgmt_kusto/databases.rb +1169 -0
  17. data/lib/2020-09-18/generated/azure_mgmt_kusto/kusto_management_client.rb +157 -0
  18. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/attached_database_configuration.rb +144 -0
  19. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/attached_database_configuration_list_result.rb +56 -0
  20. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/azure_capacity.rb +80 -0
  21. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/azure_entity_resource.rb +75 -0
  22. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/azure_resource_sku.rb +70 -0
  23. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/azure_scale_type.rb +17 -0
  24. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/azure_sku.rb +78 -0
  25. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/azure_sku_name.rb +36 -0
  26. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/azure_sku_tier.rb +16 -0
  27. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/blob_storage_event_type.rb +16 -0
  28. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/check_name_request.rb +61 -0
  29. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/check_name_result.rb +82 -0
  30. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/cluster.rb +327 -0
  31. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/cluster_check_name_request.rb +60 -0
  32. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/cluster_list_result.rb +55 -0
  33. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/cluster_principal_assignment.rb +147 -0
  34. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/cluster_principal_assignment_check_name_request.rb +62 -0
  35. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/cluster_principal_assignment_list_result.rb +56 -0
  36. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/cluster_principal_role.rb +16 -0
  37. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/cluster_update.rb +314 -0
  38. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/compression.rb +16 -0
  39. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/data_connection.rb +82 -0
  40. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/data_connection_check_name_request.rb +61 -0
  41. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/data_connection_list_result.rb +57 -0
  42. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/data_connection_validation.rb +60 -0
  43. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/data_connection_validation_list_result.rb +56 -0
  44. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/data_connection_validation_result.rb +47 -0
  45. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/database.rb +82 -0
  46. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/database_list_result.rb +57 -0
  47. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/database_principal.rb +117 -0
  48. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/database_principal_assignment.rb +148 -0
  49. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/database_principal_assignment_check_name_request.rb +62 -0
  50. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/database_principal_assignment_list_result.rb +56 -0
  51. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/database_principal_list_request.rb +56 -0
  52. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/database_principal_list_result.rb +56 -0
  53. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/database_principal_role.rb +20 -0
  54. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/database_principal_type.rb +17 -0
  55. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/database_statistics.rb +47 -0
  56. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/default_principals_modification_kind.rb +17 -0
  57. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/diagnose_virtual_network_result.rb +56 -0
  58. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/engine_type.rb +16 -0
  59. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/event_grid_data_connection.rb +198 -0
  60. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/event_grid_data_format.rb +30 -0
  61. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/event_hub_data_connection.rb +192 -0
  62. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/event_hub_data_format.rb +30 -0
  63. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/follower_database_definition.rb +72 -0
  64. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/follower_database_list_result.rb +56 -0
  65. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/identity.rb +97 -0
  66. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/identity_type.rb +18 -0
  67. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/identity_user_assigned_identities_value.rb +60 -0
  68. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/iot_hub_data_connection.rb +191 -0
  69. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/iot_hub_data_format.rb +30 -0
  70. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/key_vault_properties.rb +80 -0
  71. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/language_extension.rb +47 -0
  72. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/language_extension_name.rb +16 -0
  73. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/language_extensions_list.rb +55 -0
  74. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/list_resource_skus_result.rb +56 -0
  75. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/operation.rb +82 -0
  76. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/operation_display.rb +80 -0
  77. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/operation_list_result.rb +98 -0
  78. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/optimized_autoscale.rb +80 -0
  79. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/principal_type.rb +17 -0
  80. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/principals_modification_kind.rb +17 -0
  81. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/provisioning_state.rb +20 -0
  82. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/proxy_resource.rb +63 -0
  83. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/read_only_following_database.rb +174 -0
  84. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/read_write_database.rb +147 -0
  85. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/reason.rb +16 -0
  86. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/resource.rb +83 -0
  87. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/sku_description.rb +132 -0
  88. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/sku_description_list.rb +56 -0
  89. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/sku_location_info_item.rb +65 -0
  90. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/state.rb +23 -0
  91. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/tracked_resource.rb +92 -0
  92. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/trusted_external_tenant.rb +46 -0
  93. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/type.rb +16 -0
  94. data/lib/2020-09-18/generated/azure_mgmt_kusto/models/virtual_network_configuration.rb +69 -0
  95. data/lib/2020-09-18/generated/azure_mgmt_kusto/module_definition.rb +9 -0
  96. data/lib/2020-09-18/generated/azure_mgmt_kusto/operations.rb +221 -0
  97. data/lib/azure_mgmt_kusto.rb +4 -3
  98. data/lib/profiles/latest/modules/kusto_profile_module.rb +164 -160
  99. data/lib/version.rb +1 -1
  100. metadata +90 -3
@@ -0,0 +1,1169 @@
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::V2020_09_18
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 resource_name [CheckNameRequest] The name of the resource.
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, resource_name, custom_headers:nil)
39
+ response = check_name_availability_async(resource_group_name, cluster_name, resource_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 resource_name [CheckNameRequest] The name of the resource.
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, resource_name, custom_headers:nil)
56
+ check_name_availability_async(resource_group_name, cluster_name, resource_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 resource_name [CheckNameRequest] The name of the resource.
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, resource_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, 'resource_name is nil' if resource_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::V2020_09_18::Models::CheckNameRequest.mapper()
88
+ request_content = @client.serialize(request_mapper, resource_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::V2020_09_18::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::V2020_09_18::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::V2020_09_18::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::V2020_09_18::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 [Database] The database parameters supplied to the Update
390
+ # 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 [Database] The database parameters supplied to the Update
407
+ # 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::V2020_09_18::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::V2020_09_18::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::V2020_09_18::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::V2020_09_18::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::V2020_09_18::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::V2020_09_18::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::V2020_09_18::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::V2020_09_18::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::V2020_09_18::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
+ # Deserialize Response
927
+ if status_code == 202
928
+ begin
929
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
930
+ result_mapper = Azure::Kusto::Mgmt::V2020_09_18::Models::Database.mapper()
931
+ result.body = @client.deserialize(result_mapper, parsed_response)
932
+ rescue Exception => e
933
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
934
+ end
935
+ end
936
+
937
+ result
938
+ end
939
+
940
+ promise.execute
941
+ end
942
+
943
+ #
944
+ # Updates a database.
945
+ #
946
+ # @param resource_group_name [String] The name of the resource group containing
947
+ # the Kusto cluster.
948
+ # @param cluster_name [String] The name of the Kusto cluster.
949
+ # @param database_name [String] The name of the database in the Kusto cluster.
950
+ # @param parameters [Database] The database parameters supplied to the Update
951
+ # operation.
952
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
953
+ # will be added to the HTTP request.
954
+ #
955
+ # @return [Database] operation results.
956
+ #
957
+ def begin_update(resource_group_name, cluster_name, database_name, parameters, custom_headers:nil)
958
+ response = begin_update_async(resource_group_name, cluster_name, database_name, parameters, custom_headers:custom_headers).value!
959
+ response.body unless response.nil?
960
+ end
961
+
962
+ #
963
+ # Updates a database.
964
+ #
965
+ # @param resource_group_name [String] The name of the resource group containing
966
+ # the Kusto cluster.
967
+ # @param cluster_name [String] The name of the Kusto cluster.
968
+ # @param database_name [String] The name of the database in the Kusto cluster.
969
+ # @param parameters [Database] The database parameters supplied to the Update
970
+ # operation.
971
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
972
+ # will be added to the HTTP request.
973
+ #
974
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
975
+ #
976
+ def begin_update_with_http_info(resource_group_name, cluster_name, database_name, parameters, custom_headers:nil)
977
+ begin_update_async(resource_group_name, cluster_name, database_name, parameters, custom_headers:custom_headers).value!
978
+ end
979
+
980
+ #
981
+ # Updates a database.
982
+ #
983
+ # @param resource_group_name [String] The name of the resource group containing
984
+ # the Kusto cluster.
985
+ # @param cluster_name [String] The name of the Kusto cluster.
986
+ # @param database_name [String] The name of the database in the Kusto cluster.
987
+ # @param parameters [Database] The database parameters supplied to the Update
988
+ # operation.
989
+ # @param [Hash{String => String}] A hash of custom headers that will be added
990
+ # to the HTTP request.
991
+ #
992
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
993
+ #
994
+ def begin_update_async(resource_group_name, cluster_name, database_name, parameters, custom_headers:nil)
995
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
996
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
997
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
998
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
999
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1000
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1001
+
1002
+
1003
+ request_headers = {}
1004
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1005
+
1006
+ # Set Headers
1007
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1008
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1009
+
1010
+ # Serialize Request
1011
+ request_mapper = Azure::Kusto::Mgmt::V2020_09_18::Models::Database.mapper()
1012
+ request_content = @client.serialize(request_mapper, parameters)
1013
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1014
+
1015
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'
1016
+
1017
+ request_url = @base_url || @client.base_url
1018
+
1019
+ options = {
1020
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1021
+ path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
1022
+ query_params: {'api-version' => @client.api_version},
1023
+ body: request_content,
1024
+ headers: request_headers.merge(custom_headers || {}),
1025
+ base_url: request_url
1026
+ }
1027
+ promise = @client.make_request_async(:patch, path_template, options)
1028
+
1029
+ promise = promise.then do |result|
1030
+ http_response = result.response
1031
+ status_code = http_response.status
1032
+ response_content = http_response.body
1033
+ unless status_code == 200 || status_code == 201 || status_code == 202
1034
+ error_model = JSON.load(response_content)
1035
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1036
+ end
1037
+
1038
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1039
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1040
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1041
+ # Deserialize Response
1042
+ if status_code == 200
1043
+ begin
1044
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1045
+ result_mapper = Azure::Kusto::Mgmt::V2020_09_18::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
+ # Deserialize Response
1052
+ if status_code == 201
1053
+ begin
1054
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1055
+ result_mapper = Azure::Kusto::Mgmt::V2020_09_18::Models::Database.mapper()
1056
+ result.body = @client.deserialize(result_mapper, parsed_response)
1057
+ rescue Exception => e
1058
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1059
+ end
1060
+ end
1061
+ # Deserialize Response
1062
+ if status_code == 202
1063
+ begin
1064
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1065
+ result_mapper = Azure::Kusto::Mgmt::V2020_09_18::Models::Database.mapper()
1066
+ result.body = @client.deserialize(result_mapper, parsed_response)
1067
+ rescue Exception => e
1068
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1069
+ end
1070
+ end
1071
+
1072
+ result
1073
+ end
1074
+
1075
+ promise.execute
1076
+ end
1077
+
1078
+ #
1079
+ # Deletes the database with the given name.
1080
+ #
1081
+ # @param resource_group_name [String] The name of the resource group containing
1082
+ # the Kusto cluster.
1083
+ # @param cluster_name [String] The name of the Kusto cluster.
1084
+ # @param database_name [String] The name of the database in the Kusto cluster.
1085
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1086
+ # will be added to the HTTP request.
1087
+ #
1088
+ #
1089
+ def begin_delete(resource_group_name, cluster_name, database_name, custom_headers:nil)
1090
+ response = begin_delete_async(resource_group_name, cluster_name, database_name, custom_headers:custom_headers).value!
1091
+ nil
1092
+ end
1093
+
1094
+ #
1095
+ # Deletes the database with the given name.
1096
+ #
1097
+ # @param resource_group_name [String] The name of the resource group containing
1098
+ # the Kusto cluster.
1099
+ # @param cluster_name [String] The name of the Kusto cluster.
1100
+ # @param database_name [String] The name of the database in the Kusto cluster.
1101
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1102
+ # will be added to the HTTP request.
1103
+ #
1104
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1105
+ #
1106
+ def begin_delete_with_http_info(resource_group_name, cluster_name, database_name, custom_headers:nil)
1107
+ begin_delete_async(resource_group_name, cluster_name, database_name, custom_headers:custom_headers).value!
1108
+ end
1109
+
1110
+ #
1111
+ # Deletes the database with the given name.
1112
+ #
1113
+ # @param resource_group_name [String] The name of the resource group containing
1114
+ # the Kusto cluster.
1115
+ # @param cluster_name [String] The name of the Kusto cluster.
1116
+ # @param database_name [String] The name of the database in the Kusto cluster.
1117
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1118
+ # to the HTTP request.
1119
+ #
1120
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1121
+ #
1122
+ def begin_delete_async(resource_group_name, cluster_name, database_name, custom_headers:nil)
1123
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1124
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
1125
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1126
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1127
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1128
+
1129
+
1130
+ request_headers = {}
1131
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1132
+
1133
+ # Set Headers
1134
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1135
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1136
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'
1137
+
1138
+ request_url = @base_url || @client.base_url
1139
+
1140
+ options = {
1141
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1142
+ path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
1143
+ query_params: {'api-version' => @client.api_version},
1144
+ headers: request_headers.merge(custom_headers || {}),
1145
+ base_url: request_url
1146
+ }
1147
+ promise = @client.make_request_async(:delete, path_template, options)
1148
+
1149
+ promise = promise.then do |result|
1150
+ http_response = result.response
1151
+ status_code = http_response.status
1152
+ response_content = http_response.body
1153
+ unless status_code == 200 || status_code == 202 || status_code == 204
1154
+ error_model = JSON.load(response_content)
1155
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1156
+ end
1157
+
1158
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1159
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1160
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1161
+
1162
+ result
1163
+ end
1164
+
1165
+ promise.execute
1166
+ end
1167
+
1168
+ end
1169
+ end