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