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,656 @@
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 ClusterPrincipalAssignments
13
+ include MsRestAzure
14
+
15
+ #
16
+ # Creates and initializes a new instance of the ClusterPrincipalAssignments 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 principal assignment 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 principal_assignment_name [ClusterPrincipalAssignmentCheckNameRequest]
33
+ # The name of the principal assignment.
34
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [CheckNameResult] operation results.
38
+ #
39
+ def check_name_availability(resource_group_name, cluster_name, principal_assignment_name, custom_headers:nil)
40
+ response = check_name_availability_async(resource_group_name, cluster_name, principal_assignment_name, custom_headers:custom_headers).value!
41
+ response.body unless response.nil?
42
+ end
43
+
44
+ #
45
+ # Checks that the principal assignment name is valid and is not already in use.
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group containing
48
+ # the Kusto cluster.
49
+ # @param cluster_name [String] The name of the Kusto cluster.
50
+ # @param principal_assignment_name [ClusterPrincipalAssignmentCheckNameRequest]
51
+ # The name of the principal assignment.
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
56
+ #
57
+ def check_name_availability_with_http_info(resource_group_name, cluster_name, principal_assignment_name, custom_headers:nil)
58
+ check_name_availability_async(resource_group_name, cluster_name, principal_assignment_name, custom_headers:custom_headers).value!
59
+ end
60
+
61
+ #
62
+ # Checks that the principal assignment name is valid and is not already in use.
63
+ #
64
+ # @param resource_group_name [String] The name of the resource group containing
65
+ # the Kusto cluster.
66
+ # @param cluster_name [String] The name of the Kusto cluster.
67
+ # @param principal_assignment_name [ClusterPrincipalAssignmentCheckNameRequest]
68
+ # The name of the principal assignment.
69
+ # @param [Hash{String => String}] A hash of custom headers that will be added
70
+ # to the HTTP request.
71
+ #
72
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
73
+ #
74
+ def check_name_availability_async(resource_group_name, cluster_name, principal_assignment_name, custom_headers:nil)
75
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
76
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
77
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
78
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
79
+ fail ArgumentError, 'principal_assignment_name is nil' if principal_assignment_name.nil?
80
+
81
+
82
+ request_headers = {}
83
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
84
+
85
+ # Set Headers
86
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
87
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
88
+
89
+ # Serialize Request
90
+ request_mapper = Azure::Kusto::Mgmt::V2020_09_18::Models::ClusterPrincipalAssignmentCheckNameRequest.mapper()
91
+ request_content = @client.serialize(request_mapper, principal_assignment_name)
92
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
93
+
94
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkPrincipalAssignmentNameAvailability'
95
+
96
+ request_url = @base_url || @client.base_url
97
+
98
+ options = {
99
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
100
+ path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'subscriptionId' => @client.subscription_id},
101
+ query_params: {'api-version' => @client.api_version},
102
+ body: request_content,
103
+ headers: request_headers.merge(custom_headers || {}),
104
+ base_url: request_url
105
+ }
106
+ promise = @client.make_request_async(:post, path_template, options)
107
+
108
+ promise = promise.then do |result|
109
+ http_response = result.response
110
+ status_code = http_response.status
111
+ response_content = http_response.body
112
+ unless status_code == 200
113
+ error_model = JSON.load(response_content)
114
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
115
+ end
116
+
117
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
118
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
119
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
120
+ # Deserialize Response
121
+ if status_code == 200
122
+ begin
123
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
124
+ result_mapper = Azure::Kusto::Mgmt::V2020_09_18::Models::CheckNameResult.mapper()
125
+ result.body = @client.deserialize(result_mapper, parsed_response)
126
+ rescue Exception => e
127
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
128
+ end
129
+ end
130
+
131
+ result
132
+ end
133
+
134
+ promise.execute
135
+ end
136
+
137
+ #
138
+ # Gets a Kusto cluster principalAssignment.
139
+ #
140
+ # @param resource_group_name [String] The name of the resource group containing
141
+ # the Kusto cluster.
142
+ # @param cluster_name [String] The name of the Kusto cluster.
143
+ # @param principal_assignment_name [String] The name of the Kusto
144
+ # principalAssignment.
145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
146
+ # will be added to the HTTP request.
147
+ #
148
+ # @return [ClusterPrincipalAssignment] operation results.
149
+ #
150
+ def get(resource_group_name, cluster_name, principal_assignment_name, custom_headers:nil)
151
+ response = get_async(resource_group_name, cluster_name, principal_assignment_name, custom_headers:custom_headers).value!
152
+ response.body unless response.nil?
153
+ end
154
+
155
+ #
156
+ # Gets a Kusto cluster principalAssignment.
157
+ #
158
+ # @param resource_group_name [String] The name of the resource group containing
159
+ # the Kusto cluster.
160
+ # @param cluster_name [String] The name of the Kusto cluster.
161
+ # @param principal_assignment_name [String] The name of the Kusto
162
+ # principalAssignment.
163
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
164
+ # will be added to the HTTP request.
165
+ #
166
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
167
+ #
168
+ def get_with_http_info(resource_group_name, cluster_name, principal_assignment_name, custom_headers:nil)
169
+ get_async(resource_group_name, cluster_name, principal_assignment_name, custom_headers:custom_headers).value!
170
+ end
171
+
172
+ #
173
+ # Gets a Kusto cluster principalAssignment.
174
+ #
175
+ # @param resource_group_name [String] The name of the resource group containing
176
+ # the Kusto cluster.
177
+ # @param cluster_name [String] The name of the Kusto cluster.
178
+ # @param principal_assignment_name [String] The name of the Kusto
179
+ # principalAssignment.
180
+ # @param [Hash{String => String}] A hash of custom headers that will be added
181
+ # to the HTTP request.
182
+ #
183
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
184
+ #
185
+ def get_async(resource_group_name, cluster_name, principal_assignment_name, custom_headers:nil)
186
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
187
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
188
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
189
+ fail ArgumentError, 'principal_assignment_name is nil' if principal_assignment_name.nil?
190
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
191
+
192
+
193
+ request_headers = {}
194
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
195
+
196
+ # Set Headers
197
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
198
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
199
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'
200
+
201
+ request_url = @base_url || @client.base_url
202
+
203
+ options = {
204
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
205
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'principalAssignmentName' => principal_assignment_name},
206
+ query_params: {'api-version' => @client.api_version},
207
+ headers: request_headers.merge(custom_headers || {}),
208
+ base_url: request_url
209
+ }
210
+ promise = @client.make_request_async(:get, path_template, options)
211
+
212
+ promise = promise.then do |result|
213
+ http_response = result.response
214
+ status_code = http_response.status
215
+ response_content = http_response.body
216
+ unless status_code == 200
217
+ error_model = JSON.load(response_content)
218
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
219
+ end
220
+
221
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
222
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
223
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
224
+ # Deserialize Response
225
+ if status_code == 200
226
+ begin
227
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
228
+ result_mapper = Azure::Kusto::Mgmt::V2020_09_18::Models::ClusterPrincipalAssignment.mapper()
229
+ result.body = @client.deserialize(result_mapper, parsed_response)
230
+ rescue Exception => e
231
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
232
+ end
233
+ end
234
+
235
+ result
236
+ end
237
+
238
+ promise.execute
239
+ end
240
+
241
+ #
242
+ # Create a Kusto cluster principalAssignment.
243
+ #
244
+ # @param resource_group_name [String] The name of the resource group containing
245
+ # the Kusto cluster.
246
+ # @param cluster_name [String] The name of the Kusto cluster.
247
+ # @param principal_assignment_name [String] The name of the Kusto
248
+ # principalAssignment.
249
+ # @param parameters [ClusterPrincipalAssignment] The Kusto cluster
250
+ # principalAssignment's parameters supplied for the operation.
251
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
252
+ # will be added to the HTTP request.
253
+ #
254
+ # @return [ClusterPrincipalAssignment] operation results.
255
+ #
256
+ def create_or_update(resource_group_name, cluster_name, principal_assignment_name, parameters, custom_headers:nil)
257
+ response = create_or_update_async(resource_group_name, cluster_name, principal_assignment_name, parameters, custom_headers:custom_headers).value!
258
+ response.body unless response.nil?
259
+ end
260
+
261
+ #
262
+ # @param resource_group_name [String] The name of the resource group containing
263
+ # the Kusto cluster.
264
+ # @param cluster_name [String] The name of the Kusto cluster.
265
+ # @param principal_assignment_name [String] The name of the Kusto
266
+ # principalAssignment.
267
+ # @param parameters [ClusterPrincipalAssignment] The Kusto cluster
268
+ # principalAssignment's parameters supplied for the operation.
269
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
270
+ # will be added to the HTTP request.
271
+ #
272
+ # @return [Concurrent::Promise] promise which provides async access to http
273
+ # response.
274
+ #
275
+ def create_or_update_async(resource_group_name, cluster_name, principal_assignment_name, parameters, custom_headers:nil)
276
+ # Send request
277
+ promise = begin_create_or_update_async(resource_group_name, cluster_name, principal_assignment_name, parameters, custom_headers:custom_headers)
278
+
279
+ promise = promise.then do |response|
280
+ # Defining deserialization method.
281
+ deserialize_method = lambda do |parsed_response|
282
+ result_mapper = Azure::Kusto::Mgmt::V2020_09_18::Models::ClusterPrincipalAssignment.mapper()
283
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
284
+ end
285
+
286
+ # Waiting for response.
287
+ @client.get_long_running_operation_result(response, deserialize_method)
288
+ end
289
+
290
+ promise
291
+ end
292
+
293
+ #
294
+ # Deletes a Kusto cluster principalAssignment.
295
+ #
296
+ # @param resource_group_name [String] The name of the resource group containing
297
+ # the Kusto cluster.
298
+ # @param cluster_name [String] The name of the Kusto cluster.
299
+ # @param principal_assignment_name [String] The name of the Kusto
300
+ # principalAssignment.
301
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
302
+ # will be added to the HTTP request.
303
+ #
304
+ def delete(resource_group_name, cluster_name, principal_assignment_name, custom_headers:nil)
305
+ response = delete_async(resource_group_name, cluster_name, principal_assignment_name, custom_headers:custom_headers).value!
306
+ nil
307
+ end
308
+
309
+ #
310
+ # @param resource_group_name [String] The name of the resource group containing
311
+ # the Kusto cluster.
312
+ # @param cluster_name [String] The name of the Kusto cluster.
313
+ # @param principal_assignment_name [String] The name of the Kusto
314
+ # principalAssignment.
315
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
316
+ # will be added to the HTTP request.
317
+ #
318
+ # @return [Concurrent::Promise] promise which provides async access to http
319
+ # response.
320
+ #
321
+ def delete_async(resource_group_name, cluster_name, principal_assignment_name, custom_headers:nil)
322
+ # Send request
323
+ promise = begin_delete_async(resource_group_name, cluster_name, principal_assignment_name, custom_headers:custom_headers)
324
+
325
+ promise = promise.then do |response|
326
+ # Defining deserialization method.
327
+ deserialize_method = lambda do |parsed_response|
328
+ end
329
+
330
+ # Waiting for response.
331
+ @client.get_long_running_operation_result(response, deserialize_method)
332
+ end
333
+
334
+ promise
335
+ end
336
+
337
+ #
338
+ # Lists all Kusto cluster principalAssignments.
339
+ #
340
+ # @param resource_group_name [String] The name of the resource group containing
341
+ # the Kusto cluster.
342
+ # @param cluster_name [String] The name of the Kusto cluster.
343
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
344
+ # will be added to the HTTP request.
345
+ #
346
+ # @return [ClusterPrincipalAssignmentListResult] operation results.
347
+ #
348
+ def list(resource_group_name, cluster_name, custom_headers:nil)
349
+ response = list_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
350
+ response.body unless response.nil?
351
+ end
352
+
353
+ #
354
+ # Lists all Kusto cluster principalAssignments.
355
+ #
356
+ # @param resource_group_name [String] The name of the resource group containing
357
+ # the Kusto cluster.
358
+ # @param cluster_name [String] The name of the Kusto cluster.
359
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
360
+ # will be added to the HTTP request.
361
+ #
362
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
363
+ #
364
+ def list_with_http_info(resource_group_name, cluster_name, custom_headers:nil)
365
+ list_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
366
+ end
367
+
368
+ #
369
+ # Lists all Kusto cluster principalAssignments.
370
+ #
371
+ # @param resource_group_name [String] The name of the resource group containing
372
+ # the Kusto cluster.
373
+ # @param cluster_name [String] The name of the Kusto cluster.
374
+ # @param [Hash{String => String}] A hash of custom headers that will be added
375
+ # to the HTTP request.
376
+ #
377
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
378
+ #
379
+ def list_async(resource_group_name, cluster_name, custom_headers:nil)
380
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
381
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
382
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
383
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
384
+
385
+
386
+ request_headers = {}
387
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
388
+
389
+ # Set Headers
390
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
391
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
392
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments'
393
+
394
+ request_url = @base_url || @client.base_url
395
+
396
+ options = {
397
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
398
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'clusterName' => cluster_name},
399
+ query_params: {'api-version' => @client.api_version},
400
+ headers: request_headers.merge(custom_headers || {}),
401
+ base_url: request_url
402
+ }
403
+ promise = @client.make_request_async(:get, path_template, options)
404
+
405
+ promise = promise.then do |result|
406
+ http_response = result.response
407
+ status_code = http_response.status
408
+ response_content = http_response.body
409
+ unless status_code == 200
410
+ error_model = JSON.load(response_content)
411
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
412
+ end
413
+
414
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
415
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
416
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
417
+ # Deserialize Response
418
+ if status_code == 200
419
+ begin
420
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
421
+ result_mapper = Azure::Kusto::Mgmt::V2020_09_18::Models::ClusterPrincipalAssignmentListResult.mapper()
422
+ result.body = @client.deserialize(result_mapper, parsed_response)
423
+ rescue Exception => e
424
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
425
+ end
426
+ end
427
+
428
+ result
429
+ end
430
+
431
+ promise.execute
432
+ end
433
+
434
+ #
435
+ # Create a Kusto cluster principalAssignment.
436
+ #
437
+ # @param resource_group_name [String] The name of the resource group containing
438
+ # the Kusto cluster.
439
+ # @param cluster_name [String] The name of the Kusto cluster.
440
+ # @param principal_assignment_name [String] The name of the Kusto
441
+ # principalAssignment.
442
+ # @param parameters [ClusterPrincipalAssignment] The Kusto cluster
443
+ # principalAssignment's parameters supplied for the operation.
444
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
445
+ # will be added to the HTTP request.
446
+ #
447
+ # @return [ClusterPrincipalAssignment] operation results.
448
+ #
449
+ def begin_create_or_update(resource_group_name, cluster_name, principal_assignment_name, parameters, custom_headers:nil)
450
+ response = begin_create_or_update_async(resource_group_name, cluster_name, principal_assignment_name, parameters, custom_headers:custom_headers).value!
451
+ response.body unless response.nil?
452
+ end
453
+
454
+ #
455
+ # Create a Kusto cluster principalAssignment.
456
+ #
457
+ # @param resource_group_name [String] The name of the resource group containing
458
+ # the Kusto cluster.
459
+ # @param cluster_name [String] The name of the Kusto cluster.
460
+ # @param principal_assignment_name [String] The name of the Kusto
461
+ # principalAssignment.
462
+ # @param parameters [ClusterPrincipalAssignment] The Kusto cluster
463
+ # principalAssignment's parameters supplied for the operation.
464
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
465
+ # will be added to the HTTP request.
466
+ #
467
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
468
+ #
469
+ def begin_create_or_update_with_http_info(resource_group_name, cluster_name, principal_assignment_name, parameters, custom_headers:nil)
470
+ begin_create_or_update_async(resource_group_name, cluster_name, principal_assignment_name, parameters, custom_headers:custom_headers).value!
471
+ end
472
+
473
+ #
474
+ # Create a Kusto cluster principalAssignment.
475
+ #
476
+ # @param resource_group_name [String] The name of the resource group containing
477
+ # the Kusto cluster.
478
+ # @param cluster_name [String] The name of the Kusto cluster.
479
+ # @param principal_assignment_name [String] The name of the Kusto
480
+ # principalAssignment.
481
+ # @param parameters [ClusterPrincipalAssignment] The Kusto cluster
482
+ # principalAssignment's parameters supplied for the operation.
483
+ # @param [Hash{String => String}] A hash of custom headers that will be added
484
+ # to the HTTP request.
485
+ #
486
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
487
+ #
488
+ def begin_create_or_update_async(resource_group_name, cluster_name, principal_assignment_name, parameters, custom_headers:nil)
489
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
490
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
491
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
492
+ fail ArgumentError, 'principal_assignment_name is nil' if principal_assignment_name.nil?
493
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
494
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
495
+
496
+
497
+ request_headers = {}
498
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
499
+
500
+ # Set Headers
501
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
502
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
503
+
504
+ # Serialize Request
505
+ request_mapper = Azure::Kusto::Mgmt::V2020_09_18::Models::ClusterPrincipalAssignment.mapper()
506
+ request_content = @client.serialize(request_mapper, parameters)
507
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
508
+
509
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'
510
+
511
+ request_url = @base_url || @client.base_url
512
+
513
+ options = {
514
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
515
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'principalAssignmentName' => principal_assignment_name},
516
+ query_params: {'api-version' => @client.api_version},
517
+ body: request_content,
518
+ headers: request_headers.merge(custom_headers || {}),
519
+ base_url: request_url
520
+ }
521
+ promise = @client.make_request_async(:put, path_template, options)
522
+
523
+ promise = promise.then do |result|
524
+ http_response = result.response
525
+ status_code = http_response.status
526
+ response_content = http_response.body
527
+ unless status_code == 200 || status_code == 201
528
+ error_model = JSON.load(response_content)
529
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
530
+ end
531
+
532
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
533
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
534
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
535
+ # Deserialize Response
536
+ if status_code == 200
537
+ begin
538
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
539
+ result_mapper = Azure::Kusto::Mgmt::V2020_09_18::Models::ClusterPrincipalAssignment.mapper()
540
+ result.body = @client.deserialize(result_mapper, parsed_response)
541
+ rescue Exception => e
542
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
543
+ end
544
+ end
545
+ # Deserialize Response
546
+ if status_code == 201
547
+ begin
548
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
549
+ result_mapper = Azure::Kusto::Mgmt::V2020_09_18::Models::ClusterPrincipalAssignment.mapper()
550
+ result.body = @client.deserialize(result_mapper, parsed_response)
551
+ rescue Exception => e
552
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
553
+ end
554
+ end
555
+
556
+ result
557
+ end
558
+
559
+ promise.execute
560
+ end
561
+
562
+ #
563
+ # Deletes a Kusto cluster principalAssignment.
564
+ #
565
+ # @param resource_group_name [String] The name of the resource group containing
566
+ # the Kusto cluster.
567
+ # @param cluster_name [String] The name of the Kusto cluster.
568
+ # @param principal_assignment_name [String] The name of the Kusto
569
+ # principalAssignment.
570
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
571
+ # will be added to the HTTP request.
572
+ #
573
+ #
574
+ def begin_delete(resource_group_name, cluster_name, principal_assignment_name, custom_headers:nil)
575
+ response = begin_delete_async(resource_group_name, cluster_name, principal_assignment_name, custom_headers:custom_headers).value!
576
+ nil
577
+ end
578
+
579
+ #
580
+ # Deletes a Kusto cluster principalAssignment.
581
+ #
582
+ # @param resource_group_name [String] The name of the resource group containing
583
+ # the Kusto cluster.
584
+ # @param cluster_name [String] The name of the Kusto cluster.
585
+ # @param principal_assignment_name [String] The name of the Kusto
586
+ # principalAssignment.
587
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
588
+ # will be added to the HTTP request.
589
+ #
590
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
591
+ #
592
+ def begin_delete_with_http_info(resource_group_name, cluster_name, principal_assignment_name, custom_headers:nil)
593
+ begin_delete_async(resource_group_name, cluster_name, principal_assignment_name, custom_headers:custom_headers).value!
594
+ end
595
+
596
+ #
597
+ # Deletes a Kusto cluster principalAssignment.
598
+ #
599
+ # @param resource_group_name [String] The name of the resource group containing
600
+ # the Kusto cluster.
601
+ # @param cluster_name [String] The name of the Kusto cluster.
602
+ # @param principal_assignment_name [String] The name of the Kusto
603
+ # principalAssignment.
604
+ # @param [Hash{String => String}] A hash of custom headers that will be added
605
+ # to the HTTP request.
606
+ #
607
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
608
+ #
609
+ def begin_delete_async(resource_group_name, cluster_name, principal_assignment_name, custom_headers:nil)
610
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
611
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
612
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
613
+ fail ArgumentError, 'principal_assignment_name is nil' if principal_assignment_name.nil?
614
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
615
+
616
+
617
+ request_headers = {}
618
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
619
+
620
+ # Set Headers
621
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
622
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
623
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'
624
+
625
+ request_url = @base_url || @client.base_url
626
+
627
+ options = {
628
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
629
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'principalAssignmentName' => principal_assignment_name},
630
+ query_params: {'api-version' => @client.api_version},
631
+ headers: request_headers.merge(custom_headers || {}),
632
+ base_url: request_url
633
+ }
634
+ promise = @client.make_request_async(:delete, path_template, options)
635
+
636
+ promise = promise.then do |result|
637
+ http_response = result.response
638
+ status_code = http_response.status
639
+ response_content = http_response.body
640
+ unless status_code == 200 || status_code == 202 || status_code == 204
641
+ error_model = JSON.load(response_content)
642
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
643
+ end
644
+
645
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
646
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
647
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
648
+
649
+ result
650
+ end
651
+
652
+ promise.execute
653
+ end
654
+
655
+ end
656
+ end