msfabricpysdkcore 0.0.11__tar.gz → 0.0.12__tar.gz
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.
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/PKG-INFO +22 -8
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/README.md +21 -7
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/coreapi.py +26 -6
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/long_running_operation.py +9 -4
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/otheritems.py +29 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_deployment_pipeline.py +1 -2
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_git.py +2 -2
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_items_incl_lakehouse.py +14 -52
- msfabricpysdkcore-0.0.12/msfabricpysdkcore/tests/test_sparkjobdefinition.py +55 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_workspaces_capacities.py +57 -47
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/workspace.py +81 -8
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore.egg-info/PKG-INFO +22 -8
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore.egg-info/SOURCES.txt +1 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/pyproject.toml +1 -1
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/setup.py +1 -1
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/LICENSE +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/__init__.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/admin_item.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/admin_workspace.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/adminapi.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/auth.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/capacity.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/client.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/deployment_pipeline.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/domain.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/environment.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/item.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/job_instance.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/lakehouse.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/onelakeshortcut.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/spark_custom_pool.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/__init__.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_admin_apis.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_datapipelines.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_domains.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_environments.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_evenstreams.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_jobs.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_kqldatabases.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_shortcuts.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_spark.py +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore.egg-info/dependency_links.txt +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore.egg-info/requires.txt +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore.egg-info/top_level.txt +0 -0
- {msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: msfabricpysdkcore
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.12
|
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
|
@@ -148,26 +148,40 @@ ws.add_role_assignment(principal = {"id" : "abadfbafb",
|
|
148
148
|
role = 'Member')
|
149
149
|
|
150
150
|
|
151
|
-
#
|
152
|
-
fc.
|
151
|
+
# List workspace role assignments
|
152
|
+
fc.list_workspace_role_assignments(workspace_id = ws.id)
|
153
153
|
# or
|
154
|
-
ws.
|
154
|
+
ws.list_role_assignments()
|
155
155
|
|
156
156
|
|
157
|
+
# Get workspace role assignment
|
158
|
+
fc.get_workspace_role_assignment(workspace_id = ws.id,
|
159
|
+
workspace_role_assignment_id = "dagdasf")
|
160
|
+
# or
|
161
|
+
ws.get_role_assignment(workspace_role_assignment_id = "fsgdg")
|
162
|
+
|
157
163
|
# Update workspace role assignment
|
158
164
|
fc.update_workspace_role_assignment(workspace_id = ws.id,
|
159
165
|
role = "Contributor",
|
160
|
-
|
166
|
+
workspace_role_assignment_id = "abadfbafb")
|
161
167
|
# or
|
162
168
|
ws.update_role_assignment(role = "Contributor",
|
163
|
-
|
169
|
+
workspace_role_assignment_id = "abadfbafb")
|
164
170
|
|
165
171
|
|
166
172
|
# Delete workspace role assignment
|
167
173
|
fc.delete_workspace_role_assignment(workspace_id = ws.id,
|
168
|
-
|
174
|
+
workspace_role_assignment_id = "abadfbafb")
|
169
175
|
# or
|
170
|
-
ws.delete_role_assignment(
|
176
|
+
ws.delete_role_assignment(workspace_role_assignment_id = "abadfbafb")
|
177
|
+
|
178
|
+
|
179
|
+
# Provision Identity
|
180
|
+
result = fc.provision_identity(workspace_id=ws.id)
|
181
|
+
print(result["applicationId"]))
|
182
|
+
|
183
|
+
# Deprovision Identity
|
184
|
+
fc.deprovision_identity(workspace_id=ws.id)
|
171
185
|
|
172
186
|
```
|
173
187
|
|
@@ -133,26 +133,40 @@ ws.add_role_assignment(principal = {"id" : "abadfbafb",
|
|
133
133
|
role = 'Member')
|
134
134
|
|
135
135
|
|
136
|
-
#
|
137
|
-
fc.
|
136
|
+
# List workspace role assignments
|
137
|
+
fc.list_workspace_role_assignments(workspace_id = ws.id)
|
138
138
|
# or
|
139
|
-
ws.
|
139
|
+
ws.list_role_assignments()
|
140
140
|
|
141
141
|
|
142
|
+
# Get workspace role assignment
|
143
|
+
fc.get_workspace_role_assignment(workspace_id = ws.id,
|
144
|
+
workspace_role_assignment_id = "dagdasf")
|
145
|
+
# or
|
146
|
+
ws.get_role_assignment(workspace_role_assignment_id = "fsgdg")
|
147
|
+
|
142
148
|
# Update workspace role assignment
|
143
149
|
fc.update_workspace_role_assignment(workspace_id = ws.id,
|
144
150
|
role = "Contributor",
|
145
|
-
|
151
|
+
workspace_role_assignment_id = "abadfbafb")
|
146
152
|
# or
|
147
153
|
ws.update_role_assignment(role = "Contributor",
|
148
|
-
|
154
|
+
workspace_role_assignment_id = "abadfbafb")
|
149
155
|
|
150
156
|
|
151
157
|
# Delete workspace role assignment
|
152
158
|
fc.delete_workspace_role_assignment(workspace_id = ws.id,
|
153
|
-
|
159
|
+
workspace_role_assignment_id = "abadfbafb")
|
154
160
|
# or
|
155
|
-
ws.delete_role_assignment(
|
161
|
+
ws.delete_role_assignment(workspace_role_assignment_id = "abadfbafb")
|
162
|
+
|
163
|
+
|
164
|
+
# Provision Identity
|
165
|
+
result = fc.provision_identity(workspace_id=ws.id)
|
166
|
+
print(result["applicationId"]))
|
167
|
+
|
168
|
+
# Deprovision Identity
|
169
|
+
fc.deprovision_identity(workspace_id=ws.id)
|
156
170
|
|
157
171
|
```
|
158
172
|
|
@@ -81,10 +81,10 @@ class FabricClientCore(FabricClient):
|
|
81
81
|
return self.get_workspace_by_name(name)
|
82
82
|
raise ValueError("Either id or name must be provided")
|
83
83
|
|
84
|
-
def
|
84
|
+
def list_workspace_role_assignments(self, workspace_id):
|
85
85
|
"""Get role assignments for a workspace"""
|
86
86
|
ws = self.get_workspace_by_id(workspace_id)
|
87
|
-
return ws.
|
87
|
+
return ws.list_role_assignments()
|
88
88
|
|
89
89
|
def create_workspace(self, display_name, capacity_id = None, description = None, exists_ok = True):
|
90
90
|
"""Create a workspace"""
|
@@ -129,20 +129,25 @@ class FabricClientCore(FabricClient):
|
|
129
129
|
ws = self.get_workspace_by_id(workspace_id)
|
130
130
|
return ws.add_role_assignment(role, principal)
|
131
131
|
|
132
|
-
def delete_workspace_role_assignment(self, workspace_id,
|
132
|
+
def delete_workspace_role_assignment(self, workspace_id, workspace_role_assignment_id):
|
133
133
|
"""Delete a role assignment from a workspace"""
|
134
134
|
ws = self.get_workspace_by_id(workspace_id)
|
135
|
-
return ws.delete_role_assignment(
|
135
|
+
return ws.delete_role_assignment(workspace_role_assignment_id)
|
136
136
|
|
137
137
|
def update_workspace(self, workspace_id, display_name = None, description = None):
|
138
138
|
"""Update a workspace"""
|
139
139
|
ws = self.get_workspace_by_id(workspace_id)
|
140
140
|
return ws.update(display_name, description)
|
141
|
+
|
142
|
+
def get_workspace_role_assignment(self, workspace_id, workspace_role_assignment_id):
|
143
|
+
"""Get a role assignment for a workspace"""
|
144
|
+
ws = self.get_workspace_by_id(workspace_id)
|
145
|
+
return ws.get_role_assignment(workspace_role_assignment_id)
|
141
146
|
|
142
|
-
def update_workspace_role_assignment(self, workspace_id, role,
|
147
|
+
def update_workspace_role_assignment(self, workspace_id, role, workspace_role_assignment_id):
|
143
148
|
"""Update a role assignment for a workspace"""
|
144
149
|
ws = self.get_workspace_by_id(workspace_id)
|
145
|
-
return ws.update_role_assignment(role,
|
150
|
+
return ws.update_role_assignment(role, workspace_role_assignment_id)
|
146
151
|
|
147
152
|
def assign_to_capacity(self, workspace_id, capacity_id):
|
148
153
|
"""Assign a workspace to a capacity"""
|
@@ -153,6 +158,16 @@ class FabricClientCore(FabricClient):
|
|
153
158
|
"""Unassign a workspace from a capacity"""
|
154
159
|
ws = self.get_workspace_by_id(workspace_id)
|
155
160
|
return ws.unassign_from_capacity()
|
161
|
+
|
162
|
+
def provision_identity(self, workspace_id):
|
163
|
+
"""Provision an identity for a workspace"""
|
164
|
+
ws = self.get_workspace_by_id(workspace_id)
|
165
|
+
return ws.provision_identity()
|
166
|
+
|
167
|
+
def deprovision_identity(self, workspace_id):
|
168
|
+
"""Deprovision an identity for a workspace"""
|
169
|
+
ws = self.get_workspace_by_id(workspace_id)
|
170
|
+
return ws.deprovision_identity()
|
156
171
|
|
157
172
|
def list_capacities(self, continuationToken = None):
|
158
173
|
"""List all capacities in the tenant"""
|
@@ -809,6 +824,11 @@ class FabricClientCore(FabricClient):
|
|
809
824
|
ws = self.get_workspace_by_id(workspace_id)
|
810
825
|
return ws.update_spark_job_definition_definition(spark_job_definition_id, definition)
|
811
826
|
|
827
|
+
def run_on_demand_spark_job_definition(self, workspace_id, spark_job_definition_id, job_type = "sparkjob"):
|
828
|
+
"""Run an on demand spark job definition"""
|
829
|
+
ws = self.get_workspace_by_id(workspace_id)
|
830
|
+
return ws.run_on_demand_spark_job_definition(spark_job_definition_id, job_type)
|
831
|
+
|
812
832
|
# warehouses
|
813
833
|
|
814
834
|
def list_warehouses(self, workspace_id, with_properties = False):
|
{msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/long_running_operation.py
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
import json
|
2
2
|
import requests
|
3
|
-
from time import sleep
|
3
|
+
from time import sleep, time
|
4
4
|
|
5
5
|
class LongRunningOperation:
|
6
6
|
"""Class to represent a workspace in Microsoft Fabric"""
|
@@ -49,12 +49,17 @@ class LongRunningOperation:
|
|
49
49
|
def wait_for_completion(self):
|
50
50
|
"""Wait for the operation to complete"""
|
51
51
|
max_iter = 20
|
52
|
+
start_time = time()
|
52
53
|
while self.state not in ('Succeeded', 'Failed'):
|
53
54
|
self.state = self.get_operation_state()["status"]
|
55
|
+
duration = int(time() - start_time)
|
56
|
+
if duration > 60:
|
57
|
+
|
58
|
+
if self.state == "Running":
|
59
|
+
print(f"Operation did not complete after {duration} seconds")
|
60
|
+
return "Running"
|
61
|
+
raise Exception(f"Operation did not complete after {duration} seconds")
|
54
62
|
sleep(3)
|
55
|
-
if max_iter == 0:
|
56
|
-
raise Exception("Operation did not complete after 60 seconds")
|
57
|
-
max_iter -= 1
|
58
63
|
return self.state
|
59
64
|
|
60
65
|
|
@@ -2,6 +2,7 @@ import json
|
|
2
2
|
from time import sleep
|
3
3
|
import requests
|
4
4
|
from msfabricpysdkcore.item import Item
|
5
|
+
from msfabricpysdkcore.long_running_operation import check_long_running_operation
|
5
6
|
|
6
7
|
|
7
8
|
class Eventhouse(Item):
|
@@ -52,6 +53,34 @@ class SparkJobDefinition(Item):
|
|
52
53
|
def update_definition(self, definition):
|
53
54
|
return super().update_definition(definition=definition, type="sparkJobDefinitions")
|
54
55
|
|
56
|
+
def run_on_demand_spark_job_definition(self, job_type = "sparkjob"):
|
57
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/sparkJobDefinitions/{sparkJobDefinitionId}/jobs/instances?jobType={jobType}
|
58
|
+
"""Method to run a spark job definition on demand"""
|
59
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.workspace_id}/sparkJobDefinitions/{self.id}/jobs/instances?jobType={job_type}"
|
60
|
+
|
61
|
+
for _ in range(10):
|
62
|
+
response = requests.post(url=url, headers=self.auth.get_headers())
|
63
|
+
if response.status_code == 429:
|
64
|
+
print("Too many requests, waiting 10 seconds")
|
65
|
+
sleep(10)
|
66
|
+
continue
|
67
|
+
if response.status_code == 202:
|
68
|
+
location = response.headers['Location']
|
69
|
+
job_instance_id = location.split('/')[-1]
|
70
|
+
|
71
|
+
from msfabricpysdkcore import FabricClientCore
|
72
|
+
fc = FabricClientCore(silent=True)
|
73
|
+
fc.auth = self.auth
|
74
|
+
return fc.get_item_job_instance(workspace_id = self.workspace_id,
|
75
|
+
item_id = self.id,
|
76
|
+
job_instance_id = job_instance_id)
|
77
|
+
if response.status_code not in (200, 201, 202, 429):
|
78
|
+
raise Exception(f"Error running on demand spark job definition: {response.status_code}, {response.text}")
|
79
|
+
break
|
80
|
+
|
81
|
+
return response
|
82
|
+
|
83
|
+
|
55
84
|
class Warehouse(Item):
|
56
85
|
"""Class to represent a warehouse in Microsoft Fabric"""
|
57
86
|
|
@@ -53,8 +53,7 @@ class TestFabricClientCore(unittest.TestCase):
|
|
53
53
|
"itemType": item["itemType"]}
|
54
54
|
items = [item]
|
55
55
|
|
56
|
-
|
57
|
-
response = pipe.deploy(source_stage_id=dev_stage.id,target_stage_id=prod_stage.id, items=items)
|
56
|
+
response = fc.deploy_stage_content(deployment_pipeline_id=pipe_id, source_stage_id=dev_stage.id,target_stage_id=prod_stage.id, items=items)
|
58
57
|
|
59
58
|
self.assertEqual(response["status"], "Succeeded")
|
60
59
|
|
@@ -30,7 +30,7 @@ class TestFabricClientCore(unittest.TestCase):
|
|
30
30
|
|
31
31
|
status_code = self.fc.git_connect(workspace_id=ws2.id, git_provider_details=git_provider_details)
|
32
32
|
|
33
|
-
self.assertEqual(status_code,
|
33
|
+
self.assertEqual(status_code, 200)
|
34
34
|
|
35
35
|
initialization_strategy = "PreferWorkspace"
|
36
36
|
|
@@ -56,7 +56,7 @@ class TestFabricClientCore(unittest.TestCase):
|
|
56
56
|
|
57
57
|
status_code = self.fc.git_disconnect(workspace_id=ws2.id)
|
58
58
|
|
59
|
-
self.assertEqual(status_code,
|
59
|
+
self.assertEqual(status_code, 200)
|
60
60
|
|
61
61
|
ws2.delete()
|
62
62
|
|
@@ -173,23 +173,24 @@ class TestFabricClientCore(unittest.TestCase):
|
|
173
173
|
|
174
174
|
fc = self.fc
|
175
175
|
workspace_id = 'd8a5abe0-9eed-406d-ab46-343bc57ddbe5'
|
176
|
-
|
177
|
-
|
178
|
-
|
176
|
+
datetime_str = datetime.now().strftime("%Y%m%d%H%M%S")
|
177
|
+
eventhouse_name = "evh" + datetime_str
|
178
|
+
eventhouse1 = fc.create_eventhouse(workspace_id, display_name=eventhouse_name)
|
179
|
+
self.assertEqual(eventhouse1.display_name, eventhouse_name)
|
179
180
|
|
180
181
|
eventhouses = fc.list_eventhouses(workspace_id)
|
181
182
|
eventhouse_names = [eh.display_name for eh in eventhouses]
|
182
183
|
self.assertGreater(len(eventhouses), 0)
|
183
|
-
self.assertIn(
|
184
|
+
self.assertIn(eventhouse_name, eventhouse_names)
|
184
185
|
|
185
|
-
eh = fc.get_eventhouse(workspace_id, eventhouse_name=
|
186
|
+
eh = fc.get_eventhouse(workspace_id, eventhouse_name=eventhouse_name)
|
186
187
|
self.assertIsNotNone(eh.id)
|
187
|
-
self.assertEqual(eh.display_name,
|
188
|
-
|
189
|
-
eh2 = fc.update_eventhouse(workspace_id, eh.id, display_name=
|
188
|
+
self.assertEqual(eh.display_name, eventhouse_name)
|
189
|
+
new_display_name = eventhouse_name + "2"
|
190
|
+
eh2 = fc.update_eventhouse(workspace_id, eh.id, display_name=new_display_name)
|
190
191
|
|
191
192
|
eh = fc.get_eventhouse(workspace_id, eventhouse_id=eh.id)
|
192
|
-
self.assertEqual(eh.display_name,
|
193
|
+
self.assertEqual(eh.display_name, new_display_name)
|
193
194
|
self.assertEqual(eh.id, eh2.id)
|
194
195
|
|
195
196
|
status_code = fc.delete_eventhouse(workspace_id, eh.id)
|
@@ -273,11 +274,11 @@ class TestFabricClientCore(unittest.TestCase):
|
|
273
274
|
self.assertIsNotNone(mlm.id)
|
274
275
|
self.assertEqual(mlm.display_name, model_name)
|
275
276
|
|
276
|
-
|
277
|
+
mlm2 = fc.update_ml_model(workspace_id=workspace_id,ml_model_id= mlm.id, description=model_name)
|
277
278
|
|
278
|
-
|
279
|
-
|
280
|
-
|
279
|
+
mlm = fc.get_ml_model(workspace_id, ml_model_id=mlm.id)
|
280
|
+
self.assertEqual(mlm.description, model_name)
|
281
|
+
self.assertEqual(mlm.id, mlm2.id)
|
281
282
|
|
282
283
|
status_code = fc.delete_ml_model(workspace_id, mlm.id)
|
283
284
|
self.assertEqual(status_code, 200)
|
@@ -385,45 +386,6 @@ class TestFabricClientCore(unittest.TestCase):
|
|
385
386
|
status_code = fc.delete_semantic_model(workspace_id, sm.id)
|
386
387
|
self.assertEqual(status_code, 200)
|
387
388
|
|
388
|
-
|
389
|
-
def test_spark_job_definitions(self):
|
390
|
-
|
391
|
-
fc = self.fc
|
392
|
-
workspace_id = 'd8a5abe0-9eed-406d-ab46-343bc57ddbe5'
|
393
|
-
|
394
|
-
datetime_str = datetime.now().strftime("%Y%m%d%H%M%S")
|
395
|
-
spark_job_definition_name = f"sjd{datetime_str}"
|
396
|
-
|
397
|
-
spark_job_definition_w_content = fc.get_spark_job_definition(workspace_id, spark_job_definition_name="helloworld")
|
398
|
-
|
399
|
-
definition = fc.get_spark_job_definition_definition(workspace_id, spark_job_definition_w_content.id)
|
400
|
-
|
401
|
-
self.assertIsNotNone(definition)
|
402
|
-
self.assertIn("definition", definition)
|
403
|
-
definition = definition["definition"]
|
404
|
-
|
405
|
-
spark_job_definition = fc.create_spark_job_definition(workspace_id, display_name=spark_job_definition_name)
|
406
|
-
fc.update_spark_job_definition_definition(workspace_id, spark_job_definition.id, definition=definition)
|
407
|
-
spark_job_definition = fc.get_spark_job_definition(workspace_id, spark_job_definition_id=spark_job_definition.id)
|
408
|
-
self.assertEqual(spark_job_definition.display_name, spark_job_definition_name)
|
409
|
-
self.assertIsNotNone(spark_job_definition.definition)
|
410
|
-
|
411
|
-
spark_job_definitions = fc.list_spark_job_definitions(workspace_id)
|
412
|
-
spark_job_definition_names = [sjd.display_name for sjd in spark_job_definitions]
|
413
|
-
self.assertGreater(len(spark_job_definitions), 0)
|
414
|
-
self.assertIn(spark_job_definition_name, spark_job_definition_names)
|
415
|
-
|
416
|
-
sjd = fc.get_spark_job_definition(workspace_id, spark_job_definition_name=spark_job_definition_name)
|
417
|
-
self.assertIsNotNone(sjd.id)
|
418
|
-
self.assertEqual(sjd.display_name, spark_job_definition_name)
|
419
|
-
|
420
|
-
sjd = fc.update_spark_job_definition(workspace_id, sjd.id, display_name=f"{spark_job_definition_name}2")
|
421
|
-
sjd = fc.get_spark_job_definition(workspace_id, spark_job_definition_id=sjd.id)
|
422
|
-
self.assertEqual(sjd.display_name, f"{spark_job_definition_name}2")
|
423
|
-
|
424
|
-
status_code = fc.delete_spark_job_definition(workspace_id, sjd.id)
|
425
|
-
self.assertEqual(status_code, 200)
|
426
|
-
|
427
389
|
def test_warehouses(self):
|
428
390
|
|
429
391
|
fc = self.fc
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import unittest
|
2
|
+
from datetime import datetime
|
3
|
+
from dotenv import load_dotenv
|
4
|
+
from msfabricpysdkcore.coreapi import FabricClientCore
|
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
|
+
self.fc = FabricClientCore()
|
13
|
+
|
14
|
+
def test_spark_job_definitions(self):
|
15
|
+
|
16
|
+
fc = self.fc
|
17
|
+
workspace_id = 'd8a5abe0-9eed-406d-ab46-343bc57ddbe5'
|
18
|
+
|
19
|
+
datetime_str = datetime.now().strftime("%Y%m%d%H%M%S")
|
20
|
+
spark_job_definition_name = f"sjd{datetime_str}"
|
21
|
+
|
22
|
+
spark_job_definition_w_content = fc.get_spark_job_definition(workspace_id, spark_job_definition_name="helloworld")
|
23
|
+
|
24
|
+
result = fc.run_on_demand_spark_job_definition(workspace_id=workspace_id,
|
25
|
+
spark_job_definition_id=spark_job_definition_w_content.id,
|
26
|
+
job_type="sparkjob")
|
27
|
+
self.assertIsNotNone(result)
|
28
|
+
self.assertEqual(result.job_type, "sparkjob")
|
29
|
+
definition = fc.get_spark_job_definition_definition(workspace_id, spark_job_definition_w_content.id)
|
30
|
+
|
31
|
+
self.assertIsNotNone(definition)
|
32
|
+
self.assertIn("definition", definition)
|
33
|
+
definition = definition["definition"]
|
34
|
+
|
35
|
+
spark_job_definition = fc.create_spark_job_definition(workspace_id, display_name=spark_job_definition_name)
|
36
|
+
fc.update_spark_job_definition_definition(workspace_id, spark_job_definition.id, definition=definition)
|
37
|
+
spark_job_definition = fc.get_spark_job_definition(workspace_id, spark_job_definition_id=spark_job_definition.id)
|
38
|
+
self.assertEqual(spark_job_definition.display_name, spark_job_definition_name)
|
39
|
+
self.assertIsNotNone(spark_job_definition.definition)
|
40
|
+
|
41
|
+
spark_job_definitions = fc.list_spark_job_definitions(workspace_id)
|
42
|
+
spark_job_definition_names = [sjd.display_name for sjd in spark_job_definitions]
|
43
|
+
self.assertGreater(len(spark_job_definitions), 0)
|
44
|
+
self.assertIn(spark_job_definition_name, spark_job_definition_names)
|
45
|
+
|
46
|
+
sjd = fc.get_spark_job_definition(workspace_id, spark_job_definition_name=spark_job_definition_name)
|
47
|
+
self.assertIsNotNone(sjd.id)
|
48
|
+
self.assertEqual(sjd.display_name, spark_job_definition_name)
|
49
|
+
|
50
|
+
sjd = fc.update_spark_job_definition(workspace_id, sjd.id, display_name=f"{spark_job_definition_name}2")
|
51
|
+
sjd = fc.get_spark_job_definition(workspace_id, spark_job_definition_id=sjd.id)
|
52
|
+
self.assertEqual(sjd.display_name, f"{spark_job_definition_name}2")
|
53
|
+
|
54
|
+
status_code = fc.delete_spark_job_definition(workspace_id, sjd.id)
|
55
|
+
self.assertEqual(status_code, 200)
|
@@ -10,118 +10,128 @@ class TestFabricClientCore(unittest.TestCase):
|
|
10
10
|
def __init__(self, *args, **kwargs):
|
11
11
|
super(TestFabricClientCore, self).__init__(*args, **kwargs)
|
12
12
|
self.fc = FabricClientCore()
|
13
|
-
|
14
|
-
self.display_name = "testws" + datetime_str
|
15
|
-
self.workspace_id = None
|
13
|
+
|
16
14
|
|
17
15
|
def test_end_to_end_workspace(self):
|
18
|
-
|
19
|
-
|
16
|
+
fc = self.fc
|
17
|
+
datetime_str = datetime.now().strftime("%Y%m%d%H%M%S")
|
18
|
+
display_name = "testws" + datetime_str
|
19
|
+
ws_created = fc.create_workspace(display_name=display_name,
|
20
20
|
description="test workspace",
|
21
21
|
exists_ok=False)
|
22
22
|
# Add assertions here to verify the result
|
23
|
-
self.assertEqual(ws_created.display_name,
|
24
|
-
|
25
|
-
ws =
|
26
|
-
self.assertEqual(ws.display_name,
|
23
|
+
self.assertEqual(ws_created.display_name, display_name)
|
24
|
+
workspace_id = ws_created.id
|
25
|
+
ws = fc.get_workspace_by_id(id = workspace_id)
|
26
|
+
self.assertEqual(ws.display_name, display_name)
|
27
27
|
self.assertEqual(ws.description, "test workspace")
|
28
28
|
|
29
29
|
# def test_assign_to_capacity(self):
|
30
30
|
|
31
|
-
result_status_code =
|
31
|
+
result_status_code = fc.assign_to_capacity(workspace_id=ws.id,
|
32
32
|
capacity_id="41cb829c-c231-4e9f-b4fc-f9042a6f9840")
|
33
33
|
self.assertEqual(result_status_code, 202)
|
34
34
|
|
35
35
|
|
36
36
|
# def test_list_workspaces(self):
|
37
37
|
|
38
|
-
result =
|
38
|
+
result = fc.list_workspaces()
|
39
39
|
display_names = [ws.display_name for ws in result]
|
40
|
-
self.assertIn(
|
40
|
+
self.assertIn(display_name, display_names)
|
41
41
|
|
42
42
|
for ws in result:
|
43
|
-
if ws.display_name ==
|
43
|
+
if ws.display_name == display_name:
|
44
44
|
self.assertEqual(ws.capacity_id, "41cb829c-c231-4e9f-b4fc-f9042a6f9840")
|
45
45
|
|
46
46
|
|
47
47
|
# def test_get_workspace_by_name(self):
|
48
48
|
|
49
|
-
workspace_name =
|
50
|
-
ws =
|
51
|
-
self.assertEqual(ws.display_name,
|
49
|
+
workspace_name = display_name
|
50
|
+
ws = fc.get_workspace_by_name(name = workspace_name)
|
51
|
+
self.assertEqual(ws.display_name, display_name)
|
52
52
|
|
53
53
|
# def test_get_workspace_by_id(self):
|
54
|
-
ws =
|
55
|
-
self.assertEqual(
|
54
|
+
ws = fc.get_workspace_by_id(id = workspace_id)
|
55
|
+
self.assertEqual(display_name, ws.display_name)
|
56
56
|
|
57
57
|
|
58
58
|
# def test_get_workspace(self):
|
59
|
-
result =
|
60
|
-
self.assertEqual(result.display_name,
|
59
|
+
result = fc.get_workspace_by_id(id = workspace_id)
|
60
|
+
self.assertEqual(result.display_name, display_name)
|
61
61
|
|
62
62
|
# def test_add_role_assignment(self):
|
63
|
-
result_status =
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
result_status = fc.add_workspace_role_assignment(workspace_id = ws.id,
|
64
|
+
principal = {"id" : "fe9dee5d-d244-4c93-8ea1-d5e6a2225c69",
|
65
|
+
"type" : "ServicePrincipal"},
|
66
|
+
role = 'Member')
|
67
67
|
|
68
|
-
self.assertEqual(result_status,
|
68
|
+
self.assertEqual(result_status, 201)
|
69
69
|
|
70
70
|
# def test_get_workspace_role_assignments(self):
|
71
|
-
result =
|
72
|
-
self.assertTrue(
|
73
|
-
|
74
|
-
for user in result["value"]:
|
71
|
+
result = fc.list_workspace_role_assignments(workspace_id = ws.id)
|
72
|
+
self.assertTrue(len(result) == 2)
|
73
|
+
for user in result:
|
75
74
|
if user["principal"]["displayName"] == "fabrictestuser":
|
76
|
-
self.
|
75
|
+
self.assertEqual(user["role"], "Member")
|
76
|
+
|
77
|
+
# Get get_workspace_role_assignment
|
78
|
+
|
79
|
+
result = fc.get_workspace_role_assignment(workspace_id = ws.id,
|
80
|
+
workspace_role_assignment_id = "fe9dee5d-d244-4c93-8ea1-d5e6a2225c69")
|
81
|
+
|
82
|
+
self.assertEqual(result["role"], "Member")
|
77
83
|
|
78
84
|
# def test_update_workspace_role_assignment(self):
|
79
85
|
|
80
|
-
result_status_code =
|
86
|
+
result_status_code = fc.update_workspace_role_assignment(workspace_id = ws.id,
|
81
87
|
role = "Contributor",
|
82
|
-
|
88
|
+
workspace_role_assignment_id= "fe9dee5d-d244-4c93-8ea1-d5e6a2225c69")
|
83
89
|
|
84
90
|
self.assertEqual(result_status_code, 200)
|
85
91
|
|
86
|
-
result =
|
87
|
-
self.assertTrue(
|
88
|
-
|
89
|
-
for user in result["value"]:
|
92
|
+
result = fc.list_workspace_role_assignments(workspace_id = ws.id)
|
93
|
+
self.assertTrue(len(result) == 2)
|
94
|
+
for user in result:
|
90
95
|
if user["principal"]["displayName"] == "fabrictestuser":
|
91
96
|
self.assertTrue(user["role"] == "Contributor")
|
92
97
|
|
93
98
|
# def test_delete_role_assignment(self):
|
94
|
-
result_status_code =
|
95
|
-
|
99
|
+
result_status_code = fc.delete_workspace_role_assignment(workspace_id = ws.id,
|
100
|
+
workspace_role_assignment_id = "fe9dee5d-d244-4c93-8ea1-d5e6a2225c69")
|
96
101
|
self.assertEqual(result_status_code, 200)
|
97
102
|
|
98
103
|
# def test_get_workspace_role_assignments(self):
|
99
|
-
result =
|
100
|
-
self.assertTrue(
|
101
|
-
|
102
|
-
user = result["value"][0]
|
104
|
+
result = fc.list_workspace_role_assignments(workspace_id = ws.id)
|
105
|
+
self.assertTrue(len(result) == 1)
|
106
|
+
user = result[0]
|
103
107
|
# self.assertTrue(user["principal"]["displayName"] == "fabricapi")
|
104
108
|
self.assertTrue(user["role"] == "Admin")
|
105
109
|
|
106
110
|
# def test_update_workspace(self):
|
107
|
-
ws_updated =
|
111
|
+
ws_updated = fc.update_workspace(workspace_id=ws.id,
|
108
112
|
display_name="newn912389u8293",
|
109
113
|
description="new description")
|
110
114
|
self.assertEqual(ws_updated.display_name, "newn912389u8293")
|
111
115
|
self.assertEqual(ws_updated.description, "new description")
|
112
|
-
ws =
|
116
|
+
ws = fc.get_workspace_by_id(id = ws.id)
|
113
117
|
self.assertEqual(ws.display_name, "newn912389u8293")
|
114
118
|
self.assertEqual(ws.description, "new description")
|
115
119
|
|
116
120
|
# def test_unassign_from_capacity(self):
|
117
121
|
|
118
|
-
result_status_code =
|
122
|
+
result_status_code = fc.unassign_from_capacity(workspace_id=ws.id)
|
119
123
|
self.assertEqual(result_status_code, 202)
|
120
|
-
ws =
|
124
|
+
ws = fc.get_workspace_by_id(ws.id)
|
121
125
|
self.assertEqual(ws.capacity_id, None)
|
122
126
|
|
127
|
+
# result = fc.provision_identity(workspace_id=ws.id)
|
128
|
+
# self.assertIsNotNone(result["applicationId"])
|
129
|
+
# fc.deprovision_identity(workspace_id=ws.id)
|
130
|
+
|
131
|
+
|
132
|
+
|
123
133
|
# def test_delete_workspace(self):
|
124
|
-
result_status =
|
134
|
+
result_status = fc.delete_workspace(display_name="newn912389u8293")
|
125
135
|
self.assertEqual(result_status, 200)
|
126
136
|
|
127
137
|
def test_list_capacities(self):
|
@@ -42,10 +42,13 @@ class Workspace:
|
|
42
42
|
def __repr__(self) -> str:
|
43
43
|
return self.__str__()
|
44
44
|
|
45
|
-
def
|
46
|
-
"""
|
45
|
+
def list_role_assignments(self, continuationToken = None):
|
46
|
+
"""List role assignments for the workspace"""
|
47
47
|
url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.id}/roleAssignments"
|
48
48
|
|
49
|
+
if continuationToken:
|
50
|
+
url = f"{url}?continuationToken={continuationToken}"
|
51
|
+
|
49
52
|
for _ in range(10):
|
50
53
|
response = requests.get(url=url, headers=self.auth.get_headers())
|
51
54
|
if response.status_code == 429:
|
@@ -58,7 +61,14 @@ class Workspace:
|
|
58
61
|
raise Exception(f"Error getting role assignments: {response.text}")
|
59
62
|
break
|
60
63
|
|
61
|
-
|
64
|
+
resp_dict = json.loads(response.text)
|
65
|
+
role_assignments = resp_dict["value"]
|
66
|
+
|
67
|
+
if "continuationToken" in resp_dict:
|
68
|
+
role_assignments_next = self.list_role_assignments(continuationToken=resp_dict["continuationToken"])
|
69
|
+
role_assignments.extend(role_assignments_next)
|
70
|
+
|
71
|
+
return role_assignments
|
62
72
|
|
63
73
|
def delete(self):
|
64
74
|
"""Delete the workspace"""
|
@@ -94,7 +104,7 @@ class Workspace:
|
|
94
104
|
print("Too many requests, waiting 10 seconds")
|
95
105
|
sleep(10)
|
96
106
|
continue
|
97
|
-
if response.status_code not in (
|
107
|
+
if response.status_code not in (201, 429):
|
98
108
|
print(response.status_code)
|
99
109
|
print(response.text)
|
100
110
|
raise Exception(f"Error adding role assignments: {response.text}")
|
@@ -103,9 +113,9 @@ class Workspace:
|
|
103
113
|
return response.status_code
|
104
114
|
|
105
115
|
|
106
|
-
def delete_role_assignment(self,
|
116
|
+
def delete_role_assignment(self, workspace_role_assignment_id):
|
107
117
|
"""Delete a role assignment from the workspace"""
|
108
|
-
url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.id}/roleAssignments/{
|
118
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.id}/roleAssignments/{workspace_role_assignment_id}"
|
109
119
|
|
110
120
|
for _ in range(10):
|
111
121
|
response = requests.delete(url=url, headers=self.auth.get_headers())
|
@@ -150,10 +160,29 @@ class Workspace:
|
|
150
160
|
self.description = description
|
151
161
|
|
152
162
|
return self
|
163
|
+
|
164
|
+
def get_role_assignment(self, workspace_role_assignment_id):
|
165
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/roleAssignments/{workspaceRoleAssignmentId}
|
166
|
+
|
167
|
+
"""Get a role assignment from the workspace"""
|
168
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.id}/roleAssignments/{workspace_role_assignment_id}"
|
169
|
+
|
170
|
+
for _ in range(10):
|
171
|
+
response = requests.get(url=url, headers=self.auth.get_headers())
|
172
|
+
|
173
|
+
if response.status_code == 429:
|
174
|
+
print("Too many requests, waiting 10 seconds")
|
175
|
+
sleep(10)
|
176
|
+
continue
|
177
|
+
if response.status_code not in (200, 429):
|
178
|
+
raise Exception(f"Error getting role assignments: {response.status_code}, {response.text}")
|
179
|
+
break
|
153
180
|
|
154
|
-
|
181
|
+
return json.loads(response.text)
|
182
|
+
|
183
|
+
def update_role_assignment(self, role, workspace_role_assignment_id):
|
155
184
|
"""Update a role assignment in the workspace"""
|
156
|
-
url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.id}/roleAssignments/{
|
185
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.id}/roleAssignments/{workspace_role_assignment_id}"
|
157
186
|
body = {
|
158
187
|
'role': role
|
159
188
|
}
|
@@ -222,6 +251,45 @@ class Workspace:
|
|
222
251
|
self.capacity_id = None
|
223
252
|
return response.status_code
|
224
253
|
|
254
|
+
def provision_identity(self):
|
255
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/provisionIdentity
|
256
|
+
"""Provision identity for the workspace"""
|
257
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.id}/provisionIdentity"
|
258
|
+
|
259
|
+
for _ in range(10):
|
260
|
+
response = requests.post(url=url, headers=self.auth.get_headers())
|
261
|
+
if response.status_code == 429:
|
262
|
+
print("Too many requests, waiting 10 seconds")
|
263
|
+
sleep(10)
|
264
|
+
continue
|
265
|
+
if response.status_code == 202:
|
266
|
+
return check_long_running_operation( response.headers, self.auth)
|
267
|
+
if response.status_code not in (200, 201, 202, 429):
|
268
|
+
raise Exception(f"Error provisioning identity: {response.status_code}, {response.text}")
|
269
|
+
break
|
270
|
+
|
271
|
+
return response
|
272
|
+
|
273
|
+
def deprovision_identity(self):
|
274
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/deprovisionIdentity
|
275
|
+
"""Deprovision identity for the workspace"""
|
276
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{self.id}/deprovisionIdentity"
|
277
|
+
|
278
|
+
for _ in range(10):
|
279
|
+
response = requests.post(url=url, headers=self.auth.get_headers())
|
280
|
+
if response.status_code == 429:
|
281
|
+
print("Too many requests, waiting 10 seconds")
|
282
|
+
sleep(10)
|
283
|
+
continue
|
284
|
+
if response.status_code == 202:
|
285
|
+
return check_long_running_operation( response.headers, self.auth)
|
286
|
+
if response.status_code not in (200, 201, 202, 429):
|
287
|
+
raise Exception(f"Error deprovisioning identity: {response.status_code}, {response.text}")
|
288
|
+
break
|
289
|
+
|
290
|
+
return response
|
291
|
+
|
292
|
+
|
225
293
|
def get_item_specific(self, item_dict):
|
226
294
|
if item_dict["type"] == "DataPipeline":
|
227
295
|
return self.get_data_pipeline(item_dict["id"])
|
@@ -1218,6 +1286,11 @@ class Workspace:
|
|
1218
1286
|
"""Update the definition of a spark job definition in a workspace"""
|
1219
1287
|
return self.get_spark_job_definition(spark_job_definition_id=spark_job_definition_id).update_definition(definition=definition)
|
1220
1288
|
|
1289
|
+
def run_on_demand_spark_job_definition(self, spark_job_definition_id, job_type = "sparkjob"):
|
1290
|
+
"""Run on demand spark job definition"""
|
1291
|
+
sjd = self.get_spark_job_definition(spark_job_definition_id=spark_job_definition_id)
|
1292
|
+
return sjd.run_on_demand_spark_job_definition(job_type=job_type)
|
1293
|
+
|
1221
1294
|
# warehouses
|
1222
1295
|
|
1223
1296
|
def list_warehouses(self, with_properties = False):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: msfabricpysdkcore
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.12
|
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
|
@@ -148,26 +148,40 @@ ws.add_role_assignment(principal = {"id" : "abadfbafb",
|
|
148
148
|
role = 'Member')
|
149
149
|
|
150
150
|
|
151
|
-
#
|
152
|
-
fc.
|
151
|
+
# List workspace role assignments
|
152
|
+
fc.list_workspace_role_assignments(workspace_id = ws.id)
|
153
153
|
# or
|
154
|
-
ws.
|
154
|
+
ws.list_role_assignments()
|
155
155
|
|
156
156
|
|
157
|
+
# Get workspace role assignment
|
158
|
+
fc.get_workspace_role_assignment(workspace_id = ws.id,
|
159
|
+
workspace_role_assignment_id = "dagdasf")
|
160
|
+
# or
|
161
|
+
ws.get_role_assignment(workspace_role_assignment_id = "fsgdg")
|
162
|
+
|
157
163
|
# Update workspace role assignment
|
158
164
|
fc.update_workspace_role_assignment(workspace_id = ws.id,
|
159
165
|
role = "Contributor",
|
160
|
-
|
166
|
+
workspace_role_assignment_id = "abadfbafb")
|
161
167
|
# or
|
162
168
|
ws.update_role_assignment(role = "Contributor",
|
163
|
-
|
169
|
+
workspace_role_assignment_id = "abadfbafb")
|
164
170
|
|
165
171
|
|
166
172
|
# Delete workspace role assignment
|
167
173
|
fc.delete_workspace_role_assignment(workspace_id = ws.id,
|
168
|
-
|
174
|
+
workspace_role_assignment_id = "abadfbafb")
|
169
175
|
# or
|
170
|
-
ws.delete_role_assignment(
|
176
|
+
ws.delete_role_assignment(workspace_role_assignment_id = "abadfbafb")
|
177
|
+
|
178
|
+
|
179
|
+
# Provision Identity
|
180
|
+
result = fc.provision_identity(workspace_id=ws.id)
|
181
|
+
print(result["applicationId"]))
|
182
|
+
|
183
|
+
# Deprovision Identity
|
184
|
+
fc.deprovision_identity(workspace_id=ws.id)
|
171
185
|
|
172
186
|
```
|
173
187
|
|
{msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore.egg-info/SOURCES.txt
RENAMED
@@ -39,4 +39,5 @@ msfabricpysdkcore/tests/test_jobs.py
|
|
39
39
|
msfabricpysdkcore/tests/test_kqldatabases.py
|
40
40
|
msfabricpysdkcore/tests/test_shortcuts.py
|
41
41
|
msfabricpysdkcore/tests/test_spark.py
|
42
|
+
msfabricpysdkcore/tests/test_sparkjobdefinition.py
|
42
43
|
msfabricpysdkcore/tests/test_workspaces_capacities.py
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/deployment_pipeline.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/spark_custom_pool.py
RENAMED
File without changes
|
File without changes
|
{msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_admin_apis.py
RENAMED
File without changes
|
{msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_datapipelines.py
RENAMED
File without changes
|
{msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_domains.py
RENAMED
File without changes
|
{msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_environments.py
RENAMED
File without changes
|
{msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_evenstreams.py
RENAMED
File without changes
|
File without changes
|
{msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_kqldatabases.py
RENAMED
File without changes
|
{msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore/tests/test_shortcuts.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore.egg-info/requires.txt
RENAMED
File without changes
|
{msfabricpysdkcore-0.0.11 → msfabricpysdkcore-0.0.12}/msfabricpysdkcore.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|