msfabricpysdkcore 0.0.3__py3-none-any.whl → 0.0.5__py3-none-any.whl

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.
@@ -0,0 +1,125 @@
1
+ import unittest
2
+ from dotenv import load_dotenv
3
+ from datetime import datetime
4
+ from msfabricpysdkcore import FabricClientCore, FabricClientAdmin
5
+
6
+ load_dotenv()
7
+
8
+ class TestFabricClientCore(unittest.TestCase):
9
+
10
+ def __init__(self, *args, **kwargs):
11
+ super(TestFabricClientCore, self).__init__(*args, **kwargs)
12
+
13
+
14
+ def test_domains(self):
15
+ fcc = FabricClientCore()
16
+ fca = FabricClientAdmin()
17
+
18
+ ws = fcc.get_workspace_by_name("sdktestdomains")
19
+ cap = fcc.get_capacity(capacity_id=ws.capacity_id)
20
+ principal = {'id': 'b4f4e299-e6e1-4667-886c-57e4a8dde1c2', 'type': 'User'}
21
+
22
+ # Delete if exists
23
+ try:
24
+ domain = fca.get_domain_by_name("sdktestdomains")
25
+ domain.delete()
26
+ except:
27
+ pass
28
+ try:
29
+ domain = fca.get_domain_by_name("sdktestdomains2")
30
+ domain.delete()
31
+ except:
32
+ pass
33
+
34
+ # Create domain
35
+ domain_name = "sdktestdomains"
36
+ domain = fca.create_domain(display_name=domain_name)
37
+ self.assertIsNotNone(domain.id)
38
+ self.assertEqual(domain.display_name, domain_name)
39
+
40
+ # Get domain by name
41
+ domain_clone = fca.get_domain_by_name(domain_name)
42
+ self.assertIsNotNone(domain_clone.id)
43
+ self.assertEqual(domain_clone.display_name, domain_name)
44
+
45
+ # Get domain by id
46
+ domain_clone = fca.get_domain_by_id(domain.id)
47
+ self.assertIsNotNone(domain_clone.id)
48
+ self.assertEqual(domain_clone.display_name, domain_name)
49
+
50
+ # List domains
51
+ domains = fca.list_domains()
52
+ self.assertGreater(len(domains), 0)
53
+ domains_ids = [d.id for d in domains]
54
+ self.assertIn(domain.id, domains_ids)
55
+
56
+ # Update domain
57
+ domain_new_name = "sdktestdomains2"
58
+ domain_clone = fca.update_domain(domain.id, display_name=domain_new_name)
59
+ self.assertEqual(domain_clone.display_name, domain_new_name)
60
+
61
+ # Assign domain workspaces by Ids
62
+ status_code = fca.assign_domain_workspaces_by_ids(domain.id, [ws.id])
63
+ self.assertEqual(status_code, 200)
64
+
65
+ # List domain workspaces
66
+ workspaces = fca.list_domain_workspaces(domain.id, workspace_objects=True)
67
+ self.assertGreater(len(workspaces), 0)
68
+ workspaces_ids = [w.id for w in workspaces]
69
+ self.assertIn(ws.id, workspaces_ids)
70
+
71
+ # Unassign domain workspaces by ids
72
+ status_code = fca.unassign_domain_workspaces_by_ids(domain.id, [ws.id])
73
+ self.assertEqual(status_code, 200)
74
+
75
+ workspaces = fca.list_domain_workspaces(domain.id)
76
+ self.assertEqual(len(workspaces), 0)
77
+
78
+ # Assign domain workspaces by capacities
79
+ status_code = fca.assign_domain_workspaces_by_capacities(domain.id, [cap.id])
80
+ self.assertEqual(status_code, 202)
81
+
82
+ workspaces = fca.list_domain_workspaces(domain.id, workspace_objects=True)
83
+ self.assertGreater(len(workspaces), 0)
84
+ workspaces_ids = [w.id for w in workspaces]
85
+ self.assertIn(ws.id, workspaces_ids)
86
+
87
+ # Unassign all domain workspaces
88
+ status_code = fca.unassign_all_domain_workspaces(domain.id)
89
+ self.assertEqual(status_code, 200)
90
+
91
+ workspaces = fca.list_domain_workspaces(domain.id)
92
+ self.assertEqual(len(workspaces), 0)
93
+
94
+ # Assign domain workspaces by principals
95
+ status_code = fca.assign_domains_workspaces_by_principals(domain.id, [principal], wait_for_completion=True)
96
+
97
+ self.assertEqual(status_code, 202)
98
+
99
+ workspaces = fca.list_domain_workspaces(domain.id, workspace_objects=True)
100
+ self.assertGreater(len(workspaces), 0)
101
+ workspaces_ids = [w.id for w in workspaces]
102
+ self.assertIn(ws.id, workspaces_ids)
103
+
104
+ # Role assignments bulk assign
105
+
106
+ principal_2 = {'id': '6edbc444-16cd-43f4-ae48-cbe734b89657', 'type': 'User'}
107
+ principals = [principal, principal_2]
108
+
109
+ status_code = fca.role_assignments_bulk_assign(domain.id, "Contributors", principals)
110
+
111
+ self.assertEqual(status_code, 200)
112
+
113
+ # Role assignments bulk unassign
114
+ status_code = fca.role_assignments_bulk_unassign(domain.id, "Contributors", [principal_2])
115
+
116
+ self.assertEqual(status_code, 200)
117
+
118
+ # Delete domain
119
+ status_code = fca.delete_domain(domain.id)
120
+
121
+ self.assertEqual(status_code, 200)
122
+
123
+ domains = fca.list_domains()
124
+ domains_ids = [d.id for d in domains]
125
+ self.assertNotIn(domain.id, domains_ids)
@@ -1,5 +1,5 @@
1
1
  import unittest
2
- from msfabricpysdkcore.client import FabricClientCore
2
+ from msfabricpysdkcore.coreapi import FabricClientCore
3
3
  from datetime import datetime
4
4
  from dotenv import load_dotenv
5
5
 
@@ -2,7 +2,7 @@ import unittest
2
2
  from datetime import datetime
3
3
  from dotenv import load_dotenv
4
4
  from time import sleep
5
- from msfabricpysdkcore.client import FabricClientCore
5
+ from msfabricpysdkcore.coreapi import FabricClientCore
6
6
 
7
7
  class TestFabricClientCore(unittest.TestCase):
8
8
 
@@ -47,9 +47,43 @@ class TestFabricClientCore(unittest.TestCase):
47
47
 
48
48
  self.assertAlmostEqual(status_code, 200)
49
49
 
50
+ def test_item_definition(self):
51
+
52
+ sjd = self.fc.get_item(workspace_id=self.workspace_id, item_name="blubb", item_type="SparkJobDefinition")
53
+ self.assertIsNotNone(sjd.definition)
54
+ datetime_str = datetime.now().strftime("%Y%m%d%H%M%S")
55
+ blubb2 = "blubb2" + datetime_str
56
+ blubb3 = "blubb3" + datetime_str
57
+ blubb2 = self.fc.create_item(display_name=blubb2, type="SparkJobDefinition", workspace_id=self.workspace_id,
58
+ definition=sjd.definition)
59
+
60
+ blubb3 = self.fc.create_item(display_name=blubb3, type="SparkJobDefinition", workspace_id=self.workspace_id)
61
+
62
+ blubb3 = self.fc.update_item_definition(workspace_id=self.workspace_id,
63
+ item_id=blubb3.id, definition=sjd.definition)
64
+
65
+ self.assertEqual(blubb3.definition, sjd.definition)
66
+
67
+ self.assertNotEqual(blubb2.id, sjd.id)
68
+ self.assertEqual(blubb2.definition, sjd.definition)
69
+ self.assertNotEqual(blubb2.id, blubb3.id)
70
+
71
+ blubb2.delete()
72
+ blubb3.delete()
73
+
74
+ def test_warehouse(self):
75
+ warehouse = self.fc.get_item(workspace_id=self.workspace_id, item_name="testitem20240404134030", item_type="Warehouse")
76
+ self.assertIsNotNone(warehouse.properties)
77
+
78
+ def test_spark_job_definition(self):
79
+ spark_job_definition = self.fc.get_item(workspace_id=self.workspace_id,
80
+ item_name="blubb", item_type="SparkJobDefinition")
81
+ self.assertIsNotNone(spark_job_definition.properties)
82
+
50
83
  def test_lakehouse(self):
51
84
 
52
85
  lakehouse = self.fc.get_item(workspace_id=self.workspace_id, item_name="lakehouse1", item_type="Lakehouse")
86
+ self.assertIsNotNone(lakehouse.properties)
53
87
  item_id = lakehouse.id
54
88
  date_str = datetime.now().strftime("%Y%m%d%H%M%S")
55
89
  table_name = f"table{date_str}"
@@ -1,7 +1,5 @@
1
1
  import unittest
2
- from msfabricpysdkcore.client import FabricClientCore
3
- from datetime import datetime
4
- from dotenv import load_dotenv
2
+ from msfabricpysdkcore.coreapi import FabricClientCore
5
3
 
6
4
  class TestFabricClientCore(unittest.TestCase):
7
5
 
@@ -1,5 +1,5 @@
1
1
  import unittest
2
- from msfabricpysdkcore.client import FabricClientCore
2
+ from msfabricpysdkcore.coreapi import FabricClientCore
3
3
  from datetime import datetime
4
4
  from dotenv import load_dotenv
5
5
 
@@ -1,7 +1,7 @@
1
1
  import unittest
2
2
  from dotenv import load_dotenv
3
3
  from datetime import datetime
4
- from msfabricpysdkcore.client import FabricClientCore
4
+ from msfabricpysdkcore.coreapi import FabricClientCore
5
5
 
6
6
  load_dotenv()
7
7
 
@@ -2,7 +2,10 @@ import json
2
2
  import requests
3
3
  from time import sleep
4
4
  from msfabricpysdkcore.item import Item
5
+ from msfabricpysdkcore.lakehouse import Lakehouse
5
6
  from msfabricpysdkcore.long_running_operation import check_long_running_operation
7
+ from msfabricpysdkcore.otheritems import SparkJobDefinition
8
+ from msfabricpysdkcore.otheritems import Warehouse
6
9
 
7
10
  class Workspace:
8
11
  """Class to represent a workspace in Microsoft Fabric"""
@@ -33,6 +36,9 @@ class Workspace:
33
36
  }
34
37
  return json.dumps(dict_, indent=2)
35
38
 
39
+ def __repr__(self) -> str:
40
+ return self.__str__()
41
+
36
42
  def get_role_assignments(self):
37
43
  """Get role assignments for the workspace"""
38
44
  url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.id}/roleAssignments"
@@ -244,26 +250,29 @@ class Workspace:
244
250
  item_dict = json.loads(response.text)
245
251
  if item_dict is None:
246
252
  print("Item not returned by API, trying to get it by name")
247
- return self.get_item_by_name(display_name, type)
248
- return Item.from_dict(item_dict, auth=self.auth)
253
+ return self.get_item_by_name(display_name, type)
254
+
255
+ if item_dict["type"] == "Lakehouse":
256
+ return self.get_lakehouse(item_dict["id"])
257
+ if item_dict["type"] == "Warehouse":
258
+ return self.get_warehouse(item_dict["id"])
259
+ if item_dict["type"] == "SparkJobDefinition":
260
+ return self.get_spark_job_definition(item_dict["id"])
249
261
 
262
+ item_obj = Item.from_dict(item_dict, auth=self.auth)
263
+ if item_obj.type in ["Notebook", "Report", "SemanticModel"]:
264
+ item_obj.get_definition()
265
+ return item_obj
250
266
 
251
267
  def get_item_by_name(self, item_name, item_type):
252
268
  """Get an item from a workspace by name"""
253
- ws_items = self.list_items()
269
+ ws_items = self.list_items(with_properties=False)
254
270
  for item in ws_items:
255
271
  if item.display_name == item_name and item.type == item_type:
256
- return item
272
+ return self.get_item(item.id, item_type)
257
273
 
258
- def get_item(self, item_id = None, item_name = None, item_type = None):
259
- # GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/items/{itemId}
260
- """Get an item from a workspace"""
261
- if item_id is None and item_name is not None and item_type is not None:
262
- return self.get_item_by_name(item_name, item_type)
263
- elif item_id is None:
264
- raise Exception("item_id or the combination item_name + item_type is required")
265
-
266
- url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.id}/items/{item_id}"
274
+
275
+ def get_item_internal(self, url):
267
276
 
268
277
  for _ in range(10):
269
278
  response = requests.get(url=url, headers=self.auth.get_headers())
@@ -278,14 +287,103 @@ class Workspace:
278
287
  break
279
288
 
280
289
  item_dict = json.loads(response.text)
281
- return Item.from_dict(item_dict, auth=self.auth)
290
+ return item_dict
291
+
292
+ def get_lakehouse(self, lakehouse_id = None, lakehouse_name = None):
293
+ """Get a lakehouse from a workspace"""
294
+
295
+ if lakehouse_id is None and lakehouse_name is not None:
296
+ return self.get_item_by_name(lakehouse_name, "Lakehouse")
297
+ elif lakehouse_id is None:
298
+ raise Exception("lakehouse_id or the lakehouse_name is required")
299
+
300
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.id}/lakehouses/{lakehouse_id}"
301
+
302
+ item_dict = self.get_item_internal(url)
303
+ return Lakehouse.from_dict(item_dict, auth=self.auth)
304
+
305
+ def get_warehouse(self, warehouse_id = None, warehouse_name = None):
306
+ """Get a warehouse from a workspace"""
307
+ if warehouse_id is None and warehouse_name is not None:
308
+ return self.get_item_by_name(warehouse_name, "Warehouse")
309
+ elif warehouse_id is None:
310
+ raise Exception("warehouse_id or the warehouse_name is required")
311
+
312
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.id}/warehouses/{warehouse_id}"
313
+
314
+ item_dict = self.get_item_internal(url)
315
+ return Warehouse.from_dict(item_dict, auth=self.auth)
316
+
317
+ def get_spark_job_definition(self, spark_job_definition_id = None, spark_job_definition_name = None):
318
+ """Get a spark job definition from a workspace"""
319
+ if spark_job_definition_id is None and spark_job_definition_name is not None:
320
+ return self.get_item_by_name(spark_job_definition_name, "SparkJobDefinition")
321
+ elif spark_job_definition_id is None:
322
+ raise Exception("spark_job_definition_id or the spark_job_definition_name is required")
323
+
324
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.id}/sparkjobdefinitions/{spark_job_definition_id}"
325
+
326
+ item_dict = self.get_item_internal(url)
327
+ sjd_obj = SparkJobDefinition.from_dict(item_dict, auth=self.auth)
328
+ sjd_obj.get_definition()
329
+ return sjd_obj
330
+
331
+ def get_item(self, item_id = None, item_name = None, item_type = None):
332
+ # GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/items/{itemId}
333
+ """Get an item from a workspace"""
334
+ if item_type:
335
+ if item_type.lower() == "lakehouse":
336
+ return self.get_lakehouse(item_id, item_name)
337
+ if item_type.lower() == "warehouse":
338
+ return self.get_warehouse(item_id, item_name)
339
+ if item_type.lower() == "sparkjobdefinition":
340
+ return self.get_spark_job_definition(item_id, item_name)
341
+
342
+ if item_id is None and item_name is not None and item_type is not None:
343
+ return self.get_item_by_name(item_name, item_type)
344
+ elif item_id is None:
345
+ raise Exception("item_id or the combination item_name + item_type is required")
346
+
347
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.id}/items/{item_id}"
348
+
349
+ item_dict = self.get_item_internal(url)
350
+ if item_dict["type"] == "Lakehouse":
351
+ return self.get_lakehouse(item_dict["id"])
352
+ if item_dict["type"] == "Warehouse":
353
+ return self.get_warehouse(item_dict["id"])
354
+ if item_dict["type"] == "SparkJobDefinition":
355
+ return self.get_spark_job_definition(item_dict["id"])
356
+
357
+
358
+ item_obj = Item.from_dict(item_dict, auth=self.auth)
359
+ if item_obj.type in ["Notebook", "Report", "SemanticModel"]:
360
+ item_obj.get_definition()
361
+ return item_obj
362
+
282
363
 
283
364
  def delete_item(self, item_id):
284
365
  """Delete an item from a workspace"""
285
366
  return self.get_item(item_id).delete()
286
367
 
287
368
 
288
- def list_items(self, continuationToken = None):
369
+ def get_item_object_w_properties(self, item_list):
370
+
371
+ new_item_list = []
372
+ for item in item_list:
373
+ if item["type"] == "Lakehouse":
374
+ item = self.get_lakehouse(item["id"])
375
+ elif item["type"] == "Warehouse":
376
+ item = self.get_warehouse(item["id"])
377
+ elif item["type"] == "SparkJobDefinition":
378
+ item = self.get_spark_job_definition(item["id"])
379
+ else:
380
+ item = Item.from_dict(item, auth=self.auth)
381
+ if item.type in ["Notebook", "Report", "SemanticModel"]:
382
+ item.get_definition()
383
+ new_item_list.append(item)
384
+ return new_item_list
385
+
386
+ def list_items(self, with_properties = False, continuationToken = None):
289
387
  """List items in a workspace"""
290
388
  url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.id}/items"
291
389
 
@@ -306,10 +404,14 @@ class Workspace:
306
404
 
307
405
  resp_dict = json.loads(response.text)
308
406
  items = resp_dict["value"]
309
- items = [Item.from_dict(item, auth=self.auth) for item in items]
407
+ if with_properties:
408
+ items = self.get_item_object_w_properties(items)
409
+ else:
410
+ items = [Item.from_dict(item, auth=self.auth) for item in items]
310
411
 
311
412
  if "continuationToken" in resp_dict:
312
- item_list_next = self.list_items(continuationToken=resp_dict["continuationToken"])
413
+ item_list_next = self.list_items(with_properties=with_properties,
414
+ continuationToken=resp_dict["continuationToken"])
313
415
  items.extend(item_list_next)
314
416
 
315
417
  return items
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: msfabricpysdkcore
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: A Python SDK for Microsoft Fabric
5
5
  Author: Andreas Rederer
6
6
  Project-URL: Homepage, https://github.com/DaSenf1860/ms-fabric-sdk-core
@@ -13,7 +13,7 @@ License-File: LICENSE
13
13
  Requires-Dist: requests >=2.30.0
14
14
  Requires-Dist: azure-identity >=1.15.0
15
15
 
16
- # A Python SDK for Microsoft Fabric
16
+ # Python SDK for Microsoft Fabric
17
17
 
18
18
  This is a Python SDK for Microsoft Fabric. It is a wrapper around the REST APIs (v1) of Fabric*.
19
19
 
@@ -34,17 +34,26 @@ Additionally it brings some extra features like:
34
34
 
35
35
  See the latest release notes [here](releasenotes/release_notes.md).
36
36
 
37
- Currently it supports all Core APIs and Lakehouse APIs, i.e.:
38
- - [Capacities](#working-with-capacities)
39
- - [Git](#working-with-git)
40
- - [Items](#working-with-items)
41
- - [Job Scheduler](#working-with-job-scheduler)
42
- - Long Running Operations
43
- - [OneLakeShortcuts](#working-with-one-lake-shortcuts)
44
- - [Workspaces](#working-with-workspaces)
45
- - [Lakehouse APIs](#lakehouse-apis)
46
-
47
- It is planned to support also the Admin APIs and new APIs which are not released yet.
37
+ Currently it supports all Core APIs, Admin APIs and Lakehouse APIs, i.e.:
38
+ - Core APIs
39
+ - [Capacities](#working-with-capacities)
40
+ - [Git](#working-with-git)
41
+ - [Items](#working-with-items)
42
+ - [Job Scheduler](#working-with-job-scheduler)
43
+ - Long Running Operations
44
+ - [OneLakeShortcuts](#working-with-one-lake-shortcuts)
45
+ - [Workspaces](#working-with-workspaces)
46
+ - Lakehouse APIs
47
+ - [Tables](#tables)
48
+ - Admin APIs
49
+ - [Domains](#admin-api-for-domains)
50
+ - [Items](#admin-api-for-items)
51
+ - [Tenants](#admin-api-for-tenants)
52
+ - [Users](#admin-api-for-users)
53
+ - [Workspaces](#admin-api-for-workspaces)
54
+
55
+ It is planned to support also the APIs of the user experiences and new APIs which are not released yet.
56
+ Also we have plans to support APIs to interact with Fabric capacities on the Azure Side.
48
57
  Eventually Power BI APIs like the Scanner API will be covered as well.
49
58
 
50
59
  *Because this SDK uses the API in the background, all limitations and restrictions of the API apply to this SDK as well. This includes rate limits, permissions, etc.
@@ -366,11 +375,13 @@ item.cancel_item_job_instance(job_instance_id="job_instance_id")
366
375
 
367
376
  ```
368
377
 
369
- ## Lakehouse APIs
378
+ ### Tables
379
+
370
380
 
371
- # List tables in a Lakehouse
372
381
 
373
382
  ```python
383
+ # List tables in a Lakehouse
384
+
374
385
  from msfabricpysdkcore import FabricClientCore
375
386
 
376
387
  fc = FabricClientCore()
@@ -395,5 +406,142 @@ fc.load_table(workspace_id = "someworkspaceid", item_id = "someitemid", table_na
395
406
 
396
407
  ```
397
408
 
409
+ ### Admin API for Workspaces
410
+
411
+ ```python
412
+ from msfabricpysdkcore import FabricClientAdmin
413
+
414
+ fca = FabricClientAdmin()
415
+
416
+
417
+ # List workspaces
418
+ ws = fca.list_workspaces(name="testworkspace")[0]
419
+
420
+ # Get workspace
421
+ ws = fca.get_workspace(workspace_id="workspace_id")
422
+
423
+ # Get workspace access details
424
+
425
+ ws_access = fca.get_workspace_access_details("workspace_id")
426
+ # or
427
+ ws_access = ws.get_access_details()
428
+ ```
429
+
430
+ ### Admin API for Users
431
+
432
+ ```python
433
+ from msfabricpysdkcore import FabricClientAdmin
434
+
435
+ fca = FabricClientAdmin()
436
+
437
+ # Get access entities
438
+
439
+ user_id = 'b4fuhaidc2'
440
+ access_entities = fca.get_access_entities(user_id, type="Notebook")
441
+
442
+ ```
443
+
444
+ ### Admin API for Tenants
445
+
446
+ ```python
447
+ from msfabricpysdkcore import FabricClientAdmin
448
+
449
+ fca = FabricClientAdmin()
450
+
451
+ # Get tenant settings
452
+
453
+ tenant_settings = fca.get_tenant_settings()
454
+
455
+ # Get capacity tenant settings overrides
456
+
457
+ overrides = fca.get_capacities_tenant_settings_overrides()
458
+
459
+ ```
460
+
461
+ ### Admin API for Items
462
+
463
+ ```python
464
+ from msfabricpysdkcore import FabricClientAdmin
465
+
466
+ fca = FabricClientAdmin()
467
+
468
+ # List items
469
+
470
+ item_list = fca.list_items(workspace_id="wsid")
471
+
472
+ # Get item
473
+
474
+ item = fca.get_item(workspace_id="wsid", item_id=item_list[0].id)
475
+ # or
476
+ item = ws.get_item(item_id=item_list[0].id)
477
+
478
+ # Get item access details
479
+
480
+ item_access = fca.get_item_access_details(workspace_id="wsid", item_id=item_list[0].id)
481
+ #or
482
+ item_access = ws.get_item_access_details(item_id=item_list[0].id)
483
+ # or
484
+ item_access = item.get_access_details()
485
+
486
+ ```
487
+
488
+ ### Admin API for Domains
489
+
490
+ ```python
491
+ from msfabricpysdkcore import FabricClientAdmin
492
+
493
+ fca = FabricClientAdmin()
494
+
495
+ # Create domain
496
+ domain_name = "sdktestdomains"
497
+ domain = fca.create_domain(display_name=domain_name)
498
+
499
+ # Get domain by name
500
+ domain_clone = fca.get_domain_by_name(domain_name)
501
+
502
+ # Get domain by id
503
+ domain_clone = fca.get_domain_by_id(domain.id)
504
+
505
+ # List domains
506
+ domains = fca.list_domains()
507
+
508
+ # Update domain
509
+ domain_new_name = "sdktestdomains2"
510
+ domain_clone = fca.update_domain(domain.id, display_name=domain_new_name)
511
+
512
+ # Assign domain workspaces by Ids
513
+ fca.assign_domain_workspaces_by_ids(domain.id, ["workspace_id_1", "workspace_id_2"])
514
+
515
+ # List domain workspaces
516
+ workspaces = fca.list_domain_workspaces(domain.id, workspace_objects=True)
517
+
518
+ # Unassign domain workspaces by ids
519
+ status_code = fca.unassign_domain_workspaces_by_ids(domain.id, ["workspace_id_1", "workspace_id_2"])
520
+
521
+ # Assign domain workspaces by capacities
522
+ status_code = fca.assign_domain_workspaces_by_capacities(domain.id, ["cap_id1", "cap_id2"])
523
+
524
+ # Unassign all domain workspaces
525
+ status_code = fca.unassign_all_domain_workspaces(domain.id)
526
+
527
+ # Assign domain workspaces by principals
528
+ principal1 = {'id': '6edbsdfbfdgdf656', 'type': 'User'}
529
+ principal2 = {'id': '6eyxcbyyxc57', 'type': 'User'}
530
+
531
+ status_code = fca.assign_domains_workspaces_by_principals(domain.id, [principal1, principal2], wait_for_completion=True)
532
+
533
+ # Role assignments bulk assign
534
+
535
+ principals = [principal, principal_2]
536
+ status_code = fca.role_assignments_bulk_assign(domain.id, "Contributors", principals)
537
+
538
+ # Role assignments bulk unassign
539
+ status_code = fca.role_assignments_bulk_unassign(domain.id, "Contributors", [principal_2])
540
+
541
+ # Delete domain
542
+ status_code = fca.delete_domain(domain.id)
543
+ ```
544
+
545
+
398
546
  Note: This SDK is not an official SDK from Microsoft. It is a community project and not supported by Microsoft. Use it at your own risk.
399
547
  Also the API is still in preview and might change. This SDK is not yet feature complete and might not cover all APIs yet. Feel free to contribute to this project to make it better.
@@ -0,0 +1,29 @@
1
+ msfabricpysdkcore/__init__.py,sha256=nh8-lxdMBWYSbQpbRxWkn3ZRpGipmQplTudjskN2l88,78
2
+ msfabricpysdkcore/admin_item.py,sha256=YfZiNAwqojwxSLsHXmYG_uO6_ILIQqLsOVh79HeWsuw,3778
3
+ msfabricpysdkcore/admin_workspace.py,sha256=OtBI7EWOa44rgIdIDG9dU2l-nMRYpOeIaoP5BPHKUPA,4248
4
+ msfabricpysdkcore/adminapi.py,sha256=YzK3s-CoFkzwOXrWPxoUeXFpv16ZwNujieaZI63bhqI,21039
5
+ msfabricpysdkcore/auth.py,sha256=1t5prgSg2hK7vMutif2lxHOQk_qTo3152h3FMof3y_4,1929
6
+ msfabricpysdkcore/capacity.py,sha256=Q_2-XrZtdf9F67fY0qU3D0ocEOGQq4KtIXAv9dXjQhI,1761
7
+ msfabricpysdkcore/client.py,sha256=XVa9xndx-b2f7rA8zR-9fXyon1Ig1MmSwIMNXDfUdhw,1060
8
+ msfabricpysdkcore/coreapi.py,sha256=ICZzDgfI-iiT8yVwiuK3zi8hJfK6-0w7zDqqmAKHWR4,14423
9
+ msfabricpysdkcore/domain.py,sha256=i8jMJEutDRL5XuQ69woCVQEzLS_lm9uUxl4Kp3xtxHc,14722
10
+ msfabricpysdkcore/item.py,sha256=qXmcqSSKSF443sSfAAU3Yhemr6FVlDJXsEy95ThMvVg,11296
11
+ msfabricpysdkcore/job_instance.py,sha256=C9kKsV-BIJSeU6DfoTnLlg4DLp-8RYpovs0A-mKwi4o,2745
12
+ msfabricpysdkcore/lakehouse.py,sha256=7LXYNoN5kfiaUkoXOMVsa5fgDgFf-6qTHsld3OKHLDs,3928
13
+ msfabricpysdkcore/long_running_operation.py,sha256=Vy2ESejnTIt66AtSUhMDlNRb5i_E92V8lHKKjl6Xosk,2848
14
+ msfabricpysdkcore/onelakeshortcut.py,sha256=EYZfP-rl60HdCqJD1O1NXrQTgrYTIw-EWisF4hs4bTU,2102
15
+ msfabricpysdkcore/otheritems.py,sha256=K7cGb5xDppRfbfAo7CF1LoiKAB1XmD6v2769wnCAwgY,737
16
+ msfabricpysdkcore/workspace.py,sha256=_xHyi0_AddFc0SjvZ5tPdi1NE6i9MHaWNr7rrclXq8E,26160
17
+ msfabricpysdkcore/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ msfabricpysdkcore/tests/test_admin_apis.py,sha256=M-WWQBgOG03hobCEH3dTu9VkJzyFLLN-yE9A9sdsi_8,2062
19
+ msfabricpysdkcore/tests/test_domains.py,sha256=GJX5WA_pEMYzeOGB-GAml0vnnj5AZqa7akSZB-yeBeA,4649
20
+ msfabricpysdkcore/tests/test_git.py,sha256=6OERflBSYfJbdPYuHeTEtUl2ZVqiJERVY0Z1APt94_g,2398
21
+ msfabricpysdkcore/tests/test_items_incl_lakehouse.py,sha256=ctb4t6RmcamuoWhrplgQwMa_577USupO_As7yuoy5QA,4627
22
+ msfabricpysdkcore/tests/test_jobs.py,sha256=G3edmNO9FpRgaVnG3RR_MTtxfSTLhp05-HBKWsRNJF8,1581
23
+ msfabricpysdkcore/tests/test_shortcuts.py,sha256=2Y4R-PfzpqaD3fEsZ7gMYGCnMPZSlgsw7V4jxZHewdU,2390
24
+ msfabricpysdkcore/tests/test_workspaces_capacities.py,sha256=2VHPvZ8GnpFStgUoZ-Al3kVVVimjkAs9YG47NsFl-zo,6563
25
+ msfabricpysdkcore-0.0.5.dist-info/LICENSE,sha256=1NrGuF-zOmzbwzk3iI6lsP9koyDeKO1B0-8OD_tTvOQ,1156
26
+ msfabricpysdkcore-0.0.5.dist-info/METADATA,sha256=3FxCakoOXWzGQ9sH1Fg1-35oNj6IRynnIbifosBEDoA,16186
27
+ msfabricpysdkcore-0.0.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
28
+ msfabricpysdkcore-0.0.5.dist-info/top_level.txt,sha256=3iRonu6ptDGQN4Yl6G76XGM7xbFNsskiEHW-P2gMQGY,18
29
+ msfabricpysdkcore-0.0.5.dist-info/RECORD,,
@@ -1,21 +0,0 @@
1
- msfabricpysdkcore/__init__.py,sha256=HJeyM1aLgf9AvUGkU4Olky90YyySletA281VbSa0Q2c,36
2
- msfabricpysdkcore/auth.py,sha256=1t5prgSg2hK7vMutif2lxHOQk_qTo3152h3FMof3y_4,1929
3
- msfabricpysdkcore/capacity.py,sha256=PD089m34I0BEXGTzLsF0VfLVDp6sixyDR_uUfQvwV8k,1696
4
- msfabricpysdkcore/client.py,sha256=j2X3VO44mbB2YW0UNPHoArHl6GE54KS7LsFWFD_F0o0,15047
5
- msfabricpysdkcore/item.py,sha256=654cssmSKmhCF-scNH8J8TQLB_fVP2oRU8aAAU7zJF0,11086
6
- msfabricpysdkcore/job_instance.py,sha256=Rjv2u1XXMPVew-9gGFQLrnhzXmYfzlO9SeUvA19DDTI,2759
7
- msfabricpysdkcore/lakehouse.py,sha256=phXIuKdW0khJMJx_BK2X3TJRPXSJ_9B1QKFnt2k7WH4,4011
8
- msfabricpysdkcore/long_running_operation.py,sha256=PvrVEuasD9lwdJZ6ElsNwBE1G8xW5uDQ8zXcKqpOpXc,3021
9
- msfabricpysdkcore/onelakeshortcut.py,sha256=20AZJ79v7FvgKLYbJi0BIaawi6qMjnhqUTIlniwnVBI,2033
10
- msfabricpysdkcore/workspace.py,sha256=8LJeKwKetm9ASsN19a5C5AU3O2cjR1kWtigxdBKGu0E,21475
11
- msfabricpysdkcore/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- msfabricpysdkcore/tests/test_git.py,sha256=jrbPu5CNdwbnnbLIQv7Z7hdwXzsZuv3tYG92qBy6_U4,2397
13
- msfabricpysdkcore/tests/test_items_incl_lakehouse.py,sha256=QT-4saUpIN5AXhY3_A1uIGytlQ6yLcTzPoT11L6IhyE,2940
14
- msfabricpysdkcore/tests/test_jobs.py,sha256=ee6Dsi1YsBQpF0jESY6yNBbjwB-5OOhIcBGG_d4rId4,1643
15
- msfabricpysdkcore/tests/test_shortcuts.py,sha256=A7KxKXIRVVavzz9CPcNMJg3SWlnfozYOBZuI1u4GVIg,2389
16
- msfabricpysdkcore/tests/test_workspaces_capacities.py,sha256=-IeQ6trY2lkgfzuQhoTGtrj07tFlxkStJKN_xaHCJT0,6562
17
- msfabricpysdkcore-0.0.3.dist-info/LICENSE,sha256=1NrGuF-zOmzbwzk3iI6lsP9koyDeKO1B0-8OD_tTvOQ,1156
18
- msfabricpysdkcore-0.0.3.dist-info/METADATA,sha256=WsTSN8Gd8zVGsrBiN5CI9VWx-SWOLBIutvuOSuUMZJg,12513
19
- msfabricpysdkcore-0.0.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
20
- msfabricpysdkcore-0.0.3.dist-info/top_level.txt,sha256=3iRonu6ptDGQN4Yl6G76XGM7xbFNsskiEHW-P2gMQGY,18
21
- msfabricpysdkcore-0.0.3.dist-info/RECORD,,