azure_mgmt_kusto 0.19.3 → 0.20.0

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