msfabricpysdkcore 0.1.8__py3-none-any.whl → 0.2.2__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.
- msfabricpysdkcore/adminapi.py +178 -12
- msfabricpysdkcore/coreapi.py +1479 -99
- msfabricpysdkcore/item.py +45 -6
- msfabricpysdkcore/job_instance.py +2 -1
- msfabricpysdkcore/otheritems.py +159 -10
- msfabricpysdkcore/tests/__init__.py +0 -0
- msfabricpysdkcore/tests/test_admin_apis.py +174 -0
- msfabricpysdkcore/tests/test_connection.py +111 -0
- msfabricpysdkcore/tests/test_datapipelines.py +45 -0
- msfabricpysdkcore/tests/test_deployment_pipeline.py +63 -0
- msfabricpysdkcore/tests/test_domains.py +126 -0
- msfabricpysdkcore/tests/test_environments.py +114 -0
- msfabricpysdkcore/tests/test_evenhouses.py +56 -0
- msfabricpysdkcore/tests/test_evenstreams.py +52 -0
- msfabricpysdkcore/tests/test_external_data_shares.py +51 -0
- msfabricpysdkcore/tests/test_fabric_azure_client.py +80 -0
- msfabricpysdkcore/tests/test_gateways.py +99 -0
- msfabricpysdkcore/tests/test_git.py +66 -0
- msfabricpysdkcore/tests/test_graphqlapi.py +44 -0
- msfabricpysdkcore/tests/test_items.py +97 -0
- msfabricpysdkcore/tests/test_jobs.py +96 -0
- msfabricpysdkcore/tests/test_kql_dashboards.py +63 -0
- msfabricpysdkcore/tests/test_kql_queryset.py +64 -0
- msfabricpysdkcore/tests/test_kqldatabases.py +56 -0
- msfabricpysdkcore/tests/test_lakehouse.py +93 -0
- msfabricpysdkcore/tests/test_managed_private_endpoints.py +61 -0
- msfabricpysdkcore/tests/test_mirroreddatabases.py +80 -0
- msfabricpysdkcore/tests/test_ml_experiments.py +47 -0
- msfabricpysdkcore/tests/test_ml_models.py +47 -0
- msfabricpysdkcore/tests/test_mounted_adf.py +64 -0
- msfabricpysdkcore/tests/test_notebooks.py +57 -0
- msfabricpysdkcore/tests/test_one_lake_data_access_security.py +63 -0
- msfabricpysdkcore/tests/test_other_items.py +45 -0
- msfabricpysdkcore/tests/test_reflex.py +57 -0
- msfabricpysdkcore/tests/test_reports.py +56 -0
- msfabricpysdkcore/tests/test_semantic_model.py +56 -0
- msfabricpysdkcore/tests/test_shortcuts.py +60 -0
- msfabricpysdkcore/tests/test_spark.py +91 -0
- msfabricpysdkcore/tests/test_sparkjobdefinition.py +55 -0
- msfabricpysdkcore/tests/test_sqldatabases.py +45 -0
- msfabricpysdkcore/tests/test_warehouses.py +50 -0
- msfabricpysdkcore/tests/test_workspaces_capacities.py +159 -0
- msfabricpysdkcore/workspace.py +295 -16
- {msfabricpysdkcore-0.1.8.dist-info → msfabricpysdkcore-0.2.2.dist-info}/METADATA +261 -16
- msfabricpysdkcore-0.2.2.dist-info/RECORD +65 -0
- {msfabricpysdkcore-0.1.8.dist-info → msfabricpysdkcore-0.2.2.dist-info}/WHEEL +1 -1
- msfabricpysdkcore-0.1.8.dist-info/RECORD +0 -28
- {msfabricpysdkcore-0.1.8.dist-info → msfabricpysdkcore-0.2.2.dist-info}/LICENSE +0 -0
- {msfabricpysdkcore-0.1.8.dist-info → msfabricpysdkcore-0.2.2.dist-info}/top_level.txt +0 -0
msfabricpysdkcore/coreapi.py
CHANGED
@@ -65,6 +65,193 @@ class FabricClientCore(FabricClient):
|
|
65
65
|
items = [Capacity.from_dict(i) for i in items]
|
66
66
|
return items
|
67
67
|
|
68
|
+
# Connections
|
69
|
+
|
70
|
+
# POST https://api.fabric.microsoft.com/v1/connections/{connectionId}/roleAssignments
|
71
|
+
|
72
|
+
def add_connection_role_assignment(self, connection_id, principal, role):
|
73
|
+
"""Add a role assignment to a connection
|
74
|
+
Args:
|
75
|
+
connection_id (str): The ID of the connection
|
76
|
+
principal (str): The principal
|
77
|
+
role (str): The role
|
78
|
+
Returns:
|
79
|
+
dict: The role assignment
|
80
|
+
"""
|
81
|
+
url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}/roleAssignments"
|
82
|
+
|
83
|
+
body = {
|
84
|
+
'principal': principal,
|
85
|
+
'role': role
|
86
|
+
}
|
87
|
+
|
88
|
+
response_json = self.calling_routine(url, operation="POST", body=body, response_codes=[201, 429],
|
89
|
+
error_message="Error adding connection role assignment", return_format="json")
|
90
|
+
return response_json
|
91
|
+
|
92
|
+
def create_connection(self, connection_request):
|
93
|
+
"""Create a connection
|
94
|
+
Args:
|
95
|
+
connection_request (dict): The connection request
|
96
|
+
Returns:
|
97
|
+
dict: The connection
|
98
|
+
"""
|
99
|
+
url = "https://api.fabric.microsoft.com/v1/connections"
|
100
|
+
|
101
|
+
response_json = self.calling_routine(url, operation="POST", body=connection_request, response_codes=[201, 429],
|
102
|
+
error_message="Error creating connection", return_format="json")
|
103
|
+
return response_json
|
104
|
+
|
105
|
+
def delete_connection(self, connection_id):
|
106
|
+
"""Delete a connection
|
107
|
+
Args:
|
108
|
+
connection_id (str): The ID of the connection
|
109
|
+
Returns:
|
110
|
+
int: The status code of the response
|
111
|
+
"""
|
112
|
+
url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}"
|
113
|
+
|
114
|
+
response = self.calling_routine(url, operation="DELETE", response_codes=[200, 429], return_format="response",
|
115
|
+
error_message="Error deleting connection")
|
116
|
+
return response.status_code
|
117
|
+
|
118
|
+
def delete_connection_role_assignment(self, connection_id, connection_role_assignment_id):
|
119
|
+
"""Delete a role assignment for a connection
|
120
|
+
Args:
|
121
|
+
connection_id (str): The ID of the connection
|
122
|
+
connection_role_assignment_id (str): The ID of the role assignment
|
123
|
+
Returns:
|
124
|
+
int: The status code of the response
|
125
|
+
"""
|
126
|
+
url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}/roleAssignments/{connection_role_assignment_id}"
|
127
|
+
|
128
|
+
response = self.calling_routine(url, operation="DELETE", response_codes=[200, 429], return_format="response",
|
129
|
+
error_message="Error deleting connection role assignment")
|
130
|
+
return response.status_code
|
131
|
+
|
132
|
+
|
133
|
+
def get_connection(self, connection_id = None, connection_name = None):
|
134
|
+
"""Get a connection
|
135
|
+
Args:
|
136
|
+
connection_id (str): The ID of the connection
|
137
|
+
Returns:
|
138
|
+
dict: The connection
|
139
|
+
"""
|
140
|
+
if connection_id is None and connection_name is not None:
|
141
|
+
connections = self.list_connections()
|
142
|
+
for connection in connections:
|
143
|
+
if connection["displayName"] == connection_name:
|
144
|
+
connection_id = connection["id"]
|
145
|
+
break
|
146
|
+
if connection_id is None:
|
147
|
+
raise Exception("Please provide either connection_id or connection_name")
|
148
|
+
|
149
|
+
url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}"
|
150
|
+
response_json = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
151
|
+
error_message="Error getting connection", return_format="json")
|
152
|
+
return response_json
|
153
|
+
|
154
|
+
# GET https://api.fabric.microsoft.com/v1/connections/{connectionId}/roleAssignments/{connectionRoleAssignmentId}
|
155
|
+
def get_connection_role_assignment(self, connection_id, connection_role_assignment_id):
|
156
|
+
"""Get a role assignment for a connection
|
157
|
+
Args:
|
158
|
+
connection_id (str): The ID of the connection
|
159
|
+
connection_role_assignment_id (str): The ID of the role assignment
|
160
|
+
Returns:
|
161
|
+
dict: The role assignment
|
162
|
+
"""
|
163
|
+
url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}/roleAssignments/{connection_role_assignment_id}"
|
164
|
+
|
165
|
+
response_json = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
166
|
+
error_message="Error getting connection role assignment", return_format="json")
|
167
|
+
return response_json
|
168
|
+
|
169
|
+
def list_connection_role_assignments(self, connection_id):
|
170
|
+
"""List role assignments for a connection
|
171
|
+
Args:
|
172
|
+
connection_id (str): The ID of the connection
|
173
|
+
Returns:
|
174
|
+
list: The list of role assignments
|
175
|
+
"""
|
176
|
+
url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}/roleAssignments"
|
177
|
+
|
178
|
+
items = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
179
|
+
error_message="Error listing connection role assignments", return_format="value_json", paging=True)
|
180
|
+
return items
|
181
|
+
|
182
|
+
def list_connections(self):
|
183
|
+
"""Returns a list of on-premises, virtual network and cloud connections the user has permission for.
|
184
|
+
Returns:
|
185
|
+
list: The list of connections
|
186
|
+
"""
|
187
|
+
# GET https://api.fabric.microsoft.com/v1/connections
|
188
|
+
|
189
|
+
url = "https://api.fabric.microsoft.com/v1/connections"
|
190
|
+
|
191
|
+
items = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
192
|
+
error_message="Error listing connections", return_format="value_json", paging=True)
|
193
|
+
|
194
|
+
return items
|
195
|
+
|
196
|
+
def list_supported_connection_types(self, gateway_id = None, show_all_creation_methods = None):
|
197
|
+
"""List supported connection types
|
198
|
+
Args:
|
199
|
+
gateway_id (str): The ID of the gateway
|
200
|
+
show_all_creation_methods (bool): Whether to show all creation methods
|
201
|
+
Returns:
|
202
|
+
list: The list of supported connection types
|
203
|
+
"""
|
204
|
+
url = "https://api.fabric.microsoft.com/v1/connections/supportedConnectionTypes"
|
205
|
+
|
206
|
+
if gateway_id:
|
207
|
+
url += f"?gatewayId={gateway_id}"
|
208
|
+
if show_all_creation_methods:
|
209
|
+
if "?" in url:
|
210
|
+
url += "&"
|
211
|
+
else:
|
212
|
+
url += "?"
|
213
|
+
url += "showAllCreationMethods=" + str(show_all_creation_methods)
|
214
|
+
|
215
|
+
items = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
216
|
+
error_message="Error listing supported connection types", return_format="value_json", paging=True)
|
217
|
+
|
218
|
+
return items
|
219
|
+
|
220
|
+
def update_connection(self, connection_id, connection_request):
|
221
|
+
"""Update a connection
|
222
|
+
Args:
|
223
|
+
connection_id (str): The ID of the connection
|
224
|
+
connection_request (dict): The connection request
|
225
|
+
Returns:
|
226
|
+
dict: The updated connection
|
227
|
+
"""
|
228
|
+
url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}"
|
229
|
+
|
230
|
+
response_json = self.calling_routine(url, operation="PATCH", body=connection_request, response_codes=[200, 429],
|
231
|
+
error_message="Error updating connection", return_format="json")
|
232
|
+
return response_json
|
233
|
+
|
234
|
+
# PATCH https://api.fabric.microsoft.com/v1/connections/{connectionId}/roleAssignments/{connectionRoleAssignmentId}
|
235
|
+
|
236
|
+
def update_connection_role_assignment(self, connection_id, connection_role_assignment_id, role):
|
237
|
+
"""Update a role assignment for a connection
|
238
|
+
Args:
|
239
|
+
connection_id (str): The ID of the connection
|
240
|
+
connection_role_assignment_id (str): The ID of the role assignment
|
241
|
+
role (str): The role
|
242
|
+
Returns:
|
243
|
+
dict: The role assignment
|
244
|
+
"""
|
245
|
+
url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}/roleAssignments/{connection_role_assignment_id}"
|
246
|
+
|
247
|
+
body = {
|
248
|
+
'role': role
|
249
|
+
}
|
250
|
+
|
251
|
+
response_json = self.calling_routine(url, operation="PATCH", body=body, response_codes=[200, 429],
|
252
|
+
error_message="Error updating connection role assignment", return_format="json")
|
253
|
+
return response_json
|
254
|
+
|
68
255
|
# Deployment Pipelines
|
69
256
|
|
70
257
|
def deploy_stage_content(self, deployment_pipeline_id, source_stage_id, target_stage_id, created_workspace_details = None,
|
@@ -268,6 +455,211 @@ class FabricClientCore(FabricClient):
|
|
268
455
|
response = self.calling_routine(url, operation="POST", response_codes=[200, 429], error_message="Error revoking external data share", return_format="response")
|
269
456
|
return response.status_code
|
270
457
|
|
458
|
+
# Gateways
|
459
|
+
|
460
|
+
def add_gateway_role_assignment(self, gateway_id, principal, role):
|
461
|
+
"""Add a role assignment to a gateway
|
462
|
+
Args:
|
463
|
+
gateway_id (str): The ID of the gateway
|
464
|
+
principal (str): The principal
|
465
|
+
role (str): The role
|
466
|
+
Returns:
|
467
|
+
dict: The role assignment
|
468
|
+
"""
|
469
|
+
url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/roleAssignments"
|
470
|
+
|
471
|
+
body = {
|
472
|
+
'principal': principal,
|
473
|
+
'role': role
|
474
|
+
}
|
475
|
+
|
476
|
+
response_json = self.calling_routine(url, operation="POST", body=body, response_codes=[201, 429],
|
477
|
+
error_message="Error adding gateway role assignment", return_format="json")
|
478
|
+
return response_json
|
479
|
+
|
480
|
+
def create_gateway(self, gateway_request):
|
481
|
+
"""Create a gateway
|
482
|
+
Args:
|
483
|
+
gateway_request (dict): The gateway request
|
484
|
+
Returns:
|
485
|
+
dict: The gateway
|
486
|
+
"""
|
487
|
+
url = "https://api.fabric.microsoft.com/v1/gateways"
|
488
|
+
|
489
|
+
response_json = self.calling_routine(url, operation="POST", body=gateway_request, response_codes=[200, 201, 429],
|
490
|
+
error_message="Error creating gateway", return_format="json")
|
491
|
+
return response_json
|
492
|
+
|
493
|
+
def delete_gateway(self, gateway_id):
|
494
|
+
"""Delete a gateway
|
495
|
+
Args:
|
496
|
+
gateway_id (str): The ID of the gateway
|
497
|
+
Returns:
|
498
|
+
int: The status code of the response
|
499
|
+
"""
|
500
|
+
url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}"
|
501
|
+
|
502
|
+
response = self.calling_routine(url, operation="DELETE", response_codes=[200, 429], return_format="response",
|
503
|
+
error_message="Error deleting gateway")
|
504
|
+
return response.status_code
|
505
|
+
|
506
|
+
def delete_gateway_member(self, gateway_id, gateway_member_id):
|
507
|
+
"""Delete a gateway member
|
508
|
+
Args:
|
509
|
+
gateway_id (str): The ID of the gateway
|
510
|
+
gateway_member_id (str): The ID of the gateway member
|
511
|
+
Returns:
|
512
|
+
int: The status code of the response
|
513
|
+
"""
|
514
|
+
url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/members/{gateway_member_id}"
|
515
|
+
|
516
|
+
response = self.calling_routine(url, operation="DELETE", response_codes=[200, 429], return_format="response",
|
517
|
+
error_message="Error deleting gateway member")
|
518
|
+
return response.status_code
|
519
|
+
|
520
|
+
def delete_gateway_role_assignment(self, gateway_id, gateway_role_assignment_id):
|
521
|
+
"""Delete a gateway role assignment
|
522
|
+
Args:
|
523
|
+
gateway_id (str): The ID of the gateway
|
524
|
+
gateway_role_assignment_id (str): The ID of the gateway role assignment
|
525
|
+
Returns:
|
526
|
+
int: The status code of the response
|
527
|
+
"""
|
528
|
+
url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/roleAssignments/{gateway_role_assignment_id}"
|
529
|
+
|
530
|
+
response = self.calling_routine(url, operation="DELETE", response_codes=[200, 429], return_format="response",
|
531
|
+
error_message="Error deleting gateway role assignment")
|
532
|
+
return response.status_code
|
533
|
+
|
534
|
+
def get_gateway(self, gateway_id = None, gateway_name = None):
|
535
|
+
"""Get a gateway
|
536
|
+
Args:
|
537
|
+
gateway_id (str): The ID of the gateway
|
538
|
+
gateway_name (str): The name of the gateway
|
539
|
+
Returns:
|
540
|
+
dict: The gateway
|
541
|
+
"""
|
542
|
+
if gateway_id is None and gateway_name is not None:
|
543
|
+
gateways = self.list_gateways()
|
544
|
+
for gateway in gateways:
|
545
|
+
if gateway["displayName"] == gateway_name:
|
546
|
+
gateway_id = gateway["id"]
|
547
|
+
break
|
548
|
+
if gateway_id is None:
|
549
|
+
raise Exception("Please provide either gateway_id or gateway_name")
|
550
|
+
|
551
|
+
url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}"
|
552
|
+
response_json = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
553
|
+
error_message="Error getting gateway", return_format="json")
|
554
|
+
return response_json
|
555
|
+
|
556
|
+
def get_gateway_role_assignment(self, gateway_id, gateway_role_assignment_id):
|
557
|
+
"""Get a gateway role assignment
|
558
|
+
Args:
|
559
|
+
gateway_id (str): The
|
560
|
+
gateway_role_assignment_id (str): The ID of the gateway role assignment
|
561
|
+
Returns:
|
562
|
+
dict: The gateway role assignment
|
563
|
+
"""
|
564
|
+
url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/roleAssignments/{gateway_role_assignment_id}"
|
565
|
+
|
566
|
+
response_json = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
567
|
+
error_message="Error getting gateway role assignment", return_format="json")
|
568
|
+
return response_json
|
569
|
+
|
570
|
+
def list_gateway_members(self, gateway_id):
|
571
|
+
"""List gateway members
|
572
|
+
Args:
|
573
|
+
gateway_id (str): The ID of the gateway
|
574
|
+
Returns:
|
575
|
+
list: The list of gateway members
|
576
|
+
"""
|
577
|
+
url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/members"
|
578
|
+
|
579
|
+
items = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
580
|
+
error_message="Error listing gateway members", return_format="value_json", paging=True)
|
581
|
+
return items
|
582
|
+
|
583
|
+
def list_gateway_role_assignments(self, gateway_id):
|
584
|
+
"""List gateway role assignments
|
585
|
+
Args:
|
586
|
+
gateway_id (str): The ID of the gateway
|
587
|
+
Returns:
|
588
|
+
list: The list of gateway role assignments
|
589
|
+
"""
|
590
|
+
url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/roleAssignments"
|
591
|
+
|
592
|
+
items = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
593
|
+
error_message="Error listing gateway role assignments", return_format="value_json", paging=True)
|
594
|
+
return items
|
595
|
+
|
596
|
+
def list_gateways(self):
|
597
|
+
"""List gateways
|
598
|
+
Returns:
|
599
|
+
list: The list of gateways
|
600
|
+
"""
|
601
|
+
url = "https://api.fabric.microsoft.com/v1/gateways"
|
602
|
+
|
603
|
+
items = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
604
|
+
error_message="Error listing gateways", return_format="value_json", paging=True)
|
605
|
+
return items
|
606
|
+
|
607
|
+
def update_gateway(self, gateway_id, gateway_request):
|
608
|
+
"""Update a gateway
|
609
|
+
Args:
|
610
|
+
gateway_id (str): The ID of the gateway
|
611
|
+
gateway_request (dict): The gateway request
|
612
|
+
Returns:
|
613
|
+
dict: The updated gateway
|
614
|
+
"""
|
615
|
+
|
616
|
+
url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}"
|
617
|
+
|
618
|
+
response_json = self.calling_routine(url, operation="PATCH", body=gateway_request, response_codes=[200, 429],
|
619
|
+
error_message="Error updating gateway", return_format="json")
|
620
|
+
return response_json
|
621
|
+
|
622
|
+
def update_gateway_member(self, gateway_id, gateway_member_id, display_name, enabled):
|
623
|
+
"""Update a gateway member
|
624
|
+
Args:
|
625
|
+
gateway_id (str): The ID of the gateway
|
626
|
+
gateway_member_id (str): The ID of the gateway member
|
627
|
+
display_name (str): The display name of the gateway member
|
628
|
+
enabled (bool): Whether the gateway member is enabled
|
629
|
+
Returns:
|
630
|
+
dict: The updated gateway member
|
631
|
+
"""
|
632
|
+
url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/members/{gateway_member_id}"
|
633
|
+
|
634
|
+
body = {
|
635
|
+
'displayName': display_name,
|
636
|
+
'enabled': enabled
|
637
|
+
}
|
638
|
+
|
639
|
+
response_json = self.calling_routine(url, operation="PATCH", body=body, response_codes=[200, 429],
|
640
|
+
error_message="Error updating gateway member", return_format="json")
|
641
|
+
return response_json
|
642
|
+
|
643
|
+
def update_gateway_role_assignment(self, gateway_id, gateway_role_assignment_id, role):
|
644
|
+
"""Update a gateway role assignment
|
645
|
+
Args:
|
646
|
+
gateway_id (str): The ID of the gateway
|
647
|
+
gateway_role_assignment_id (str): The ID of the gateway role assignment
|
648
|
+
role (str): The role
|
649
|
+
Returns:
|
650
|
+
dict: The updated gateway role assignment
|
651
|
+
"""
|
652
|
+
|
653
|
+
url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/roleAssignments/{gateway_role_assignment_id}"
|
654
|
+
|
655
|
+
body = {
|
656
|
+
'role': role
|
657
|
+
}
|
658
|
+
|
659
|
+
response_json = self.calling_routine(url, operation="PATCH", body=body, response_codes=[200, 429],
|
660
|
+
error_message="Error updating gateway role assignment", return_format="json")
|
661
|
+
return response_json
|
662
|
+
|
271
663
|
# Git
|
272
664
|
|
273
665
|
def commit_to_git(self, workspace_id, mode, comment=None, items=None, workspace_head=None):
|
@@ -348,6 +740,22 @@ class FabricClientCore(FabricClient):
|
|
348
740
|
error_message="Error getting git connection info", return_format="json")
|
349
741
|
|
350
742
|
return response_json
|
743
|
+
|
744
|
+
def get_my_git_credentials(self, workspace_id):
|
745
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/git/myGitCredentials
|
746
|
+
"""Get my git credentials
|
747
|
+
Args:
|
748
|
+
workspace_id (str): The ID of the workspace
|
749
|
+
Returns:
|
750
|
+
dict: The git credentials
|
751
|
+
"""
|
752
|
+
|
753
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/git/myGitCredentials"
|
754
|
+
|
755
|
+
response_json = self.calling_routine(url=url, operation="GET", response_codes=[200, 429],
|
756
|
+
error_message="Error getting git credentials", return_format="json")
|
757
|
+
|
758
|
+
return response_json
|
351
759
|
|
352
760
|
def git_get_status(self, workspace_id):
|
353
761
|
"""Get git connection status
|
@@ -405,6 +813,23 @@ class FabricClientCore(FabricClient):
|
|
405
813
|
|
406
814
|
return response.status_code
|
407
815
|
|
816
|
+
def update_my_git_credentials(self, workspace_id, git_credentials):
|
817
|
+
#PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/git/myGitCredentials
|
818
|
+
"""Update my git credentials
|
819
|
+
Args:
|
820
|
+
git_credentials (dict): The git provider details
|
821
|
+
Returns:
|
822
|
+
dict: The response object
|
823
|
+
"""
|
824
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/git/myGitCredentials"
|
825
|
+
|
826
|
+
body = git_credentials
|
827
|
+
|
828
|
+
response = self.calling_routine(url=url, operation="PATCH", body=body,
|
829
|
+
response_codes=[200, 429],
|
830
|
+
error_message="Error updating git credentials", return_format="json")
|
831
|
+
|
832
|
+
return response
|
408
833
|
|
409
834
|
# Items
|
410
835
|
|
@@ -442,12 +867,16 @@ class FabricClientCore(FabricClient):
|
|
442
867
|
return self.get_eventstream(workspace_id, item_dict["id"])
|
443
868
|
if item_dict["type"] == "Eventhouse":
|
444
869
|
return self.get_eventhouse(workspace_id, item_dict["id"])
|
870
|
+
if item_dict["type"] == "KQLDashboard":
|
871
|
+
return self.get_kql_dashboard(workspace_id, item_dict["id"])
|
445
872
|
if item_dict["type"] == "KQLDatabase":
|
446
873
|
return self.get_kql_database(workspace_id, item_dict["id"])
|
447
874
|
if item_dict["type"] == "KQLQueryset":
|
448
875
|
return self.get_kql_queryset(workspace_id, item_dict["id"])
|
449
876
|
if item_dict["type"] == "Lakehouse":
|
450
877
|
return self.get_lakehouse(workspace_id, item_dict["id"])
|
878
|
+
if item_dict["type"] == "MirroredDatabase":
|
879
|
+
return self.get_mirrored_database(workspace_id, item_dict["id"])
|
451
880
|
if item_dict["type"] == "MLExperiment":
|
452
881
|
return self.get_ml_experiment(workspace_id, item_dict["id"])
|
453
882
|
if item_dict["type"] == "MLModel":
|
@@ -510,14 +939,21 @@ class FabricClientCore(FabricClient):
|
|
510
939
|
"environments",
|
511
940
|
"eventhouses",
|
512
941
|
"eventstreams",
|
942
|
+
"GraphQLApis",
|
513
943
|
"kqlDatabases",
|
944
|
+
"kqlDashboards",
|
945
|
+
"kqlQuerysets",
|
514
946
|
"lakehouses",
|
947
|
+
"mirroredDatabases",
|
515
948
|
"mlExperiments",
|
516
|
-
"mlModels",
|
517
|
-
"
|
949
|
+
"mlModels",
|
950
|
+
"mountedDataFactories",
|
951
|
+
"notebooks",
|
952
|
+
"reflexes",
|
518
953
|
"reports",
|
519
954
|
"semanticModels",
|
520
|
-
"sparkJobDefinitions",
|
955
|
+
"sparkJobDefinitions",
|
956
|
+
"SQLDatabases",
|
521
957
|
"warehouses"]:
|
522
958
|
|
523
959
|
if type == "kqlDatabases":
|
@@ -528,7 +964,6 @@ class FabricClientCore(FabricClient):
|
|
528
964
|
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/{type}"
|
529
965
|
body.pop('type')
|
530
966
|
|
531
|
-
|
532
967
|
item_dict = self.calling_routine(url, operation="POST",
|
533
968
|
body=body, response_codes=[201, 202, 429],
|
534
969
|
error_message="Error creating item", return_format="json+operation_result",
|
@@ -544,14 +979,21 @@ class FabricClientCore(FabricClient):
|
|
544
979
|
"environments": "Environment",
|
545
980
|
"eventhouses": "Eventhouse",
|
546
981
|
"eventstreams": "Eventstream",
|
982
|
+
"GraphQLApis": "GraphQLApi",
|
983
|
+
"kqlDashboards": "KQLDashboard",
|
547
984
|
"kqlDatabases": "KQLDatabase",
|
548
|
-
"
|
985
|
+
"kqlQuerysets": "KQLQueryset",
|
986
|
+
"lakehouses": "Lakehouse",
|
987
|
+
"mirroredDatabases": "MirroredDatabase",
|
549
988
|
"mlExperiments": "MLExperiment",
|
550
989
|
"mlModels": "MLModel",
|
551
|
-
"
|
990
|
+
"mountedDataFactories": "MountedDataFactory",
|
991
|
+
"notebooks": "Notebook",
|
992
|
+
"reflexes": "Reflex",
|
552
993
|
"reports": "Report",
|
553
994
|
"semanticModels": "SemanticModel",
|
554
|
-
"sparkJobDefinitions": "SparkJobDefinition",
|
995
|
+
"sparkJobDefinitions": "SparkJobDefinition",
|
996
|
+
"SQLDatabases": "SQLDatabase",
|
555
997
|
"warehouses": "Warehouse"
|
556
998
|
}
|
557
999
|
|
@@ -590,6 +1032,8 @@ class FabricClientCore(FabricClient):
|
|
590
1032
|
return self.get_data_pipeline(workspace_id, item_id, item_name)
|
591
1033
|
if item_type.lower() == "eventstream":
|
592
1034
|
return self.get_eventstream(workspace_id, item_id, item_name)
|
1035
|
+
if item_type.lower() == "kqldashboard":
|
1036
|
+
return self.get_kql_dashboard(workspace_id, item_id, item_name)
|
593
1037
|
if item_type.lower() == "kqldatabase":
|
594
1038
|
return self.get_kql_database(workspace_id, item_id, item_name)
|
595
1039
|
if item_type.lower() == "kqlqueryset":
|
@@ -643,6 +1087,22 @@ class FabricClientCore(FabricClient):
|
|
643
1087
|
return response.status_code
|
644
1088
|
|
645
1089
|
# List
|
1090
|
+
|
1091
|
+
def list_item_connections(self, workspace_id, item_id):
|
1092
|
+
"""List item connections
|
1093
|
+
Args:
|
1094
|
+
workspace_id (str): The ID of the workspace
|
1095
|
+
item_id (str): The ID of the item
|
1096
|
+
Returns:
|
1097
|
+
dict: The item connections
|
1098
|
+
"""
|
1099
|
+
#GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/items/{itemId}/connections
|
1100
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/connections"
|
1101
|
+
|
1102
|
+
response_json = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
1103
|
+
error_message="Error listing item connections", return_format="value_json", paging=True)
|
1104
|
+
|
1105
|
+
return response_json
|
646
1106
|
|
647
1107
|
def list_items(self, workspace_id, with_properties = False, type = None):
|
648
1108
|
"""List items in a workspace
|
@@ -692,7 +1152,7 @@ class FabricClientCore(FabricClient):
|
|
692
1152
|
return_format="json+operation_result")
|
693
1153
|
|
694
1154
|
|
695
|
-
def update_item(self, workspace_id, item_id, display_name = None, description = None, type = None, return_item=
|
1155
|
+
def update_item(self, workspace_id, item_id, display_name = None, description = None, type = None, return_item=False):
|
696
1156
|
"""Update the item
|
697
1157
|
Args:
|
698
1158
|
workspace_id (str): The ID of the workspace
|
@@ -716,19 +1176,12 @@ class FabricClientCore(FabricClient):
|
|
716
1176
|
resp_dict = self.calling_routine(url, operation="PATCH", body=payload,
|
717
1177
|
response_codes=[200, 429], error_message="Error updating item",
|
718
1178
|
return_format="json")
|
719
|
-
|
720
|
-
warn(
|
721
|
-
message="Updating an item currently will make invoke an additional API call to get the item object. "
|
722
|
-
"The default behaviour of returning the item object will change in newer versions of the SDK. "
|
723
|
-
"To keep this behaviour, set return_item=True in the function call.",
|
724
|
-
category=FutureWarning,
|
725
|
-
stacklevel=2
|
726
|
-
)
|
1179
|
+
|
727
1180
|
if return_item:
|
728
1181
|
return self.get_item_specific(workspace_id, resp_dict)
|
729
1182
|
return resp_dict
|
730
1183
|
|
731
|
-
def update_item_definition(self, workspace_id, item_id, definition, type = None, wait_for_completion=True):
|
1184
|
+
def update_item_definition(self, workspace_id, item_id, definition, type = None, wait_for_completion=True, **kwargs):
|
732
1185
|
"""Update the item definition
|
733
1186
|
Args:
|
734
1187
|
workspace_id (str): The ID of the workspace
|
@@ -738,11 +1191,15 @@ class FabricClientCore(FabricClient):
|
|
738
1191
|
Returns:
|
739
1192
|
requests.Response: The response object
|
740
1193
|
"""
|
1194
|
+
|
741
1195
|
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/updateDefinition"
|
742
1196
|
|
743
1197
|
if type:
|
744
1198
|
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/{type}/{item_id}/updateDefinition"
|
745
|
-
|
1199
|
+
|
1200
|
+
if "update_metadata" in kwargs and kwargs["update_metadata"]:
|
1201
|
+
url = f"{url}?updateMetadata={kwargs['update_metadata']}"
|
1202
|
+
|
746
1203
|
payload = {
|
747
1204
|
'definition': definition
|
748
1205
|
}
|
@@ -792,38 +1249,116 @@ class FabricClientCore(FabricClient):
|
|
792
1249
|
job_dict['itemId'] = item_id
|
793
1250
|
return JobInstance.from_dict(job_dict, core_client=self)
|
794
1251
|
|
795
|
-
|
796
|
-
|
797
|
-
"""Run an on demand job on the item
|
1252
|
+
def create_item_schedule(self, workspace_id, item_id, job_type, configuration, enabled):
|
1253
|
+
"""Create a job schedule for the item
|
798
1254
|
Args:
|
799
1255
|
workspace_id (str): The ID of the workspace
|
800
1256
|
item_id (str): The ID of the item
|
801
1257
|
job_type (str): The type of the job
|
802
|
-
execution_data (dict): The execution data of the job
|
803
1258
|
Returns:
|
804
|
-
|
1259
|
+
dict: The job schedule
|
805
1260
|
"""
|
1261
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/jobs/{job_type}/schedules"
|
806
1262
|
|
807
|
-
|
808
|
-
|
809
|
-
payload = {
|
810
|
-
'executionData': execution_data
|
811
|
-
}
|
812
|
-
|
813
|
-
response = self.calling_routine(url, operation="POST", body=payload, response_codes=[202, 429],
|
814
|
-
error_message="Error running on demand job",
|
815
|
-
wait_for_completion=False, return_format="response")
|
1263
|
+
payload = {"configuration": configuration,
|
1264
|
+
"enabled": enabled}
|
816
1265
|
|
817
|
-
|
818
|
-
|
819
|
-
return job_instance
|
1266
|
+
return self.calling_routine(url=url, operation="POST", body=payload, response_codes=[201, 429],
|
1267
|
+
error_message="Error creating job schedule", return_format="json")
|
820
1268
|
|
821
|
-
|
822
|
-
|
823
|
-
def get_operation_results(self, operation_id):
|
824
|
-
"""Get the results of an operation
|
1269
|
+
def get_item_schedule(self, workspace_id, item_id, job_type, schedule_id):
|
1270
|
+
"""Get the job schedule of the item
|
825
1271
|
Args:
|
826
|
-
|
1272
|
+
workspace_id (str): The ID of the workspace
|
1273
|
+
item_id (str): The ID of the item
|
1274
|
+
job_type (str): The type of the job
|
1275
|
+
schedule_id (str): The ID of the schedule
|
1276
|
+
Returns:
|
1277
|
+
dict: The job schedule
|
1278
|
+
"""
|
1279
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/jobs/{job_type}/schedules/{schedule_id}"
|
1280
|
+
|
1281
|
+
return self.calling_routine(url=url, operation="GET", response_codes=[200, 429],
|
1282
|
+
error_message="Error getting job schedule", return_format="json")
|
1283
|
+
|
1284
|
+
def list_item_job_instances(self, workspace_id, item_id):
|
1285
|
+
"""List the job instances of the item
|
1286
|
+
Args:
|
1287
|
+
workspace_id (str): The ID of the workspace
|
1288
|
+
item_id (str): The ID of the item
|
1289
|
+
job_type (str): The type of the job
|
1290
|
+
Returns:
|
1291
|
+
list: The list of job instances
|
1292
|
+
"""
|
1293
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/jobs/instances"
|
1294
|
+
|
1295
|
+
return self.calling_routine(url=url, operation="GET", response_codes=[200, 429],
|
1296
|
+
error_message="Error listing job instances", return_format="value_json", paging=True)
|
1297
|
+
|
1298
|
+
def list_item_schedules(self, workspace_id, item_id, job_type):
|
1299
|
+
"""List the job schedules of the item
|
1300
|
+
Args:
|
1301
|
+
workspace_id (str): The ID of the workspace
|
1302
|
+
item_id (str): The ID of the item
|
1303
|
+
job_type (str): The type of the job
|
1304
|
+
Returns:
|
1305
|
+
list: The list of job schedules
|
1306
|
+
"""
|
1307
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/jobs/{job_type}/schedules"
|
1308
|
+
|
1309
|
+
return self.calling_routine(url=url, operation="GET", response_codes=[200, 429],
|
1310
|
+
error_message="Error listing job schedules", return_format="value_json", paging=True)
|
1311
|
+
|
1312
|
+
def run_on_demand_item_job(self, workspace_id, item_id, job_type, execution_data = None):
|
1313
|
+
"""Run an on demand job on the item
|
1314
|
+
Args:
|
1315
|
+
workspace_id (str): The ID of the workspace
|
1316
|
+
item_id (str): The ID of the item
|
1317
|
+
job_type (str): The type of the job
|
1318
|
+
execution_data (dict): The execution data of the job
|
1319
|
+
Returns:
|
1320
|
+
JobInstance: The job instance object
|
1321
|
+
"""
|
1322
|
+
|
1323
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/items/{itemId}/jobs/instances?jobType={jobType}
|
1324
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/jobs/instances?jobType={job_type}"
|
1325
|
+
payload = {
|
1326
|
+
'executionData': execution_data
|
1327
|
+
}
|
1328
|
+
|
1329
|
+
response = self.calling_routine(url, operation="POST", body=payload, response_codes=[202, 429],
|
1330
|
+
error_message="Error running on demand job",
|
1331
|
+
wait_for_completion=False, return_format="response")
|
1332
|
+
|
1333
|
+
job_instance_id = response.headers["Location"].split("/")[-1]
|
1334
|
+
job_instance = self.get_item_job_instance(workspace_id, item_id, job_instance_id=job_instance_id)
|
1335
|
+
return job_instance
|
1336
|
+
|
1337
|
+
def update_item_schedule(self, workspace_id, item_id, job_type, schedule_id, configuration, enabled):
|
1338
|
+
"""Update the job schedule of the item
|
1339
|
+
Args:
|
1340
|
+
workspace_id (str): The ID of the workspace
|
1341
|
+
item_id (str): The ID of the item
|
1342
|
+
job_type (str): The type of the job
|
1343
|
+
schedule_id (str): The ID of the schedule
|
1344
|
+
configuration (dict): The configuration of the schedule
|
1345
|
+
Returns:
|
1346
|
+
dict: The updated job schedule
|
1347
|
+
"""
|
1348
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/jobs/{job_type}/schedules/{schedule_id}"
|
1349
|
+
|
1350
|
+
payload = {"configuration": configuration,
|
1351
|
+
"enabled": enabled}
|
1352
|
+
|
1353
|
+
return self.calling_routine(url=url, operation="PATCH", body=payload, response_codes=[200, 429],
|
1354
|
+
error_message="Error updating job schedule", return_format="json")
|
1355
|
+
|
1356
|
+
# long running operations
|
1357
|
+
|
1358
|
+
def get_operation_results(self, operation_id):
|
1359
|
+
"""Get the results of an operation
|
1360
|
+
Args:
|
1361
|
+
operation_id (str): The ID of the operation
|
827
1362
|
Returns:
|
828
1363
|
dict: The results of the operation
|
829
1364
|
"""
|
@@ -850,6 +1385,82 @@ class FabricClientCore(FabricClient):
|
|
850
1385
|
|
851
1386
|
return response_json
|
852
1387
|
|
1388
|
+
# Managed Private Endpoints:
|
1389
|
+
|
1390
|
+
def create_workspace_managed_private_endpoint(self, workspace_id, name, target_private_link_resource_id,
|
1391
|
+
target_subresource_type, request_message = None):
|
1392
|
+
|
1393
|
+
"""Create a managed private endpoint in a workspace
|
1394
|
+
Args:
|
1395
|
+
workspace_id (str): The ID of the workspace
|
1396
|
+
name (str): The name of the managed private endpoint
|
1397
|
+
target_private_link_resource_id (str): The target private link resource ID
|
1398
|
+
target_subresource_type (str): The target subresource type
|
1399
|
+
request_message (str): The request message
|
1400
|
+
Returns:
|
1401
|
+
dict: The created managed private endpoint
|
1402
|
+
"""
|
1403
|
+
|
1404
|
+
body = {
|
1405
|
+
"name": name,
|
1406
|
+
"targetPrivateLinkResourceId": target_private_link_resource_id,
|
1407
|
+
"targetSubresourceType": target_subresource_type
|
1408
|
+
}
|
1409
|
+
if request_message:
|
1410
|
+
body["requestMessage"] = request_message
|
1411
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/managedPrivateEndpoints"
|
1412
|
+
|
1413
|
+
response = self.calling_routine(url, operation="POST", body=body,
|
1414
|
+
response_codes=[201, 429], error_message="Error creating managed private endpoint",
|
1415
|
+
return_format="json")
|
1416
|
+
|
1417
|
+
return response
|
1418
|
+
|
1419
|
+
def delete_workspace_managed_private_endpoint(self, workspace_id, managed_private_endpoint_id):
|
1420
|
+
"""Delete a managed private endpoint in a workspace
|
1421
|
+
Args:
|
1422
|
+
workspace_id (str): The ID of the workspace
|
1423
|
+
managed_private_endpoint_id (str): The ID of the managed private endpoint
|
1424
|
+
Returns:
|
1425
|
+
int: The status code of the response
|
1426
|
+
"""
|
1427
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/managedPrivateEndpoints/{managed_private_endpoint_id}"
|
1428
|
+
|
1429
|
+
response = self.calling_routine(url, operation="DELETE", response_codes=[200, 429], return_format="response",
|
1430
|
+
error_message="Error deleting managed private endpoint")
|
1431
|
+
|
1432
|
+
return response.status_code
|
1433
|
+
|
1434
|
+
def get_workspace_managed_private_endpoint(self, workspace_id, managed_private_endpoint_id):
|
1435
|
+
"""Get a managed private endpoint in a workspace
|
1436
|
+
Args:
|
1437
|
+
workspace_id (str): The ID of the workspace
|
1438
|
+
managed_private_endpoint_id (str): The ID of the managed private endpoint
|
1439
|
+
Returns:
|
1440
|
+
dict: The managed private endpoint
|
1441
|
+
"""
|
1442
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/managedPrivateEndpoints/{managed_private_endpoint_id}"
|
1443
|
+
|
1444
|
+
response_json = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
1445
|
+
error_message="Error getting managed private endpoint", return_format="json")
|
1446
|
+
|
1447
|
+
return response_json
|
1448
|
+
|
1449
|
+
def list_workspace_managed_private_endpoints(self, workspace_id):
|
1450
|
+
"""List managed private endpoints in a workspace
|
1451
|
+
Args:
|
1452
|
+
workspace_id (str): The ID of the workspace
|
1453
|
+
Returns:
|
1454
|
+
list: The list of managed private endpoints
|
1455
|
+
"""
|
1456
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/managedPrivateEndpoints"
|
1457
|
+
|
1458
|
+
response_json = self.calling_routine(url, operation="GET", response_codes=[200, 429], paging=True,
|
1459
|
+
error_message="Error listing managed private endpoints", return_format="json")
|
1460
|
+
|
1461
|
+
return response_json
|
1462
|
+
|
1463
|
+
|
853
1464
|
# One Lake Data Access Security
|
854
1465
|
|
855
1466
|
# create and update
|
@@ -985,6 +1596,24 @@ class FabricClientCore(FabricClient):
|
|
985
1596
|
shortcut['itemId'] = item_id
|
986
1597
|
return [OneLakeShortcut.from_dict(shortcut, core_client=self) for shortcut in shortcuts]
|
987
1598
|
|
1599
|
+
|
1600
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/onelake/resetShortcutCache
|
1601
|
+
def reset_shortcut_cache(self, workspace_id, wait_for_completion = False):
|
1602
|
+
"""Reset the shortcut cache
|
1603
|
+
|
1604
|
+
Args:
|
1605
|
+
workspace_id (str): The ID of the workspace
|
1606
|
+
|
1607
|
+
Returns:
|
1608
|
+
int: The status code of the response
|
1609
|
+
"""
|
1610
|
+
|
1611
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/onelake/resetShortcutCache"
|
1612
|
+
response = self.calling_routine(url=url, operation="POST", response_codes=[200, 202, 429], error_message="Error resetting shortcut cache",
|
1613
|
+
return_format="response", wait_for_completion = wait_for_completion)
|
1614
|
+
|
1615
|
+
return response.status_code
|
1616
|
+
|
988
1617
|
### Workspaces
|
989
1618
|
|
990
1619
|
def add_workspace_role_assignment(self, workspace_id, role, principal):
|
@@ -1274,10 +1903,6 @@ class FabricClientCore(FabricClient):
|
|
1274
1903
|
def list_datamarts(self, workspace_id):
|
1275
1904
|
"""List datamarts in a workspace"""
|
1276
1905
|
return self.list_items(workspace_id, type="datamarts")
|
1277
|
-
|
1278
|
-
def list_paginated_reports(self, workspace_id):
|
1279
|
-
"""List paginated reports in a workspace"""
|
1280
|
-
return self.list_items(workspace_id, type="paginatedReports")
|
1281
1906
|
|
1282
1907
|
def list_sql_endpoints(self, workspace_id):
|
1283
1908
|
"""List sql endpoints in a workspace"""
|
@@ -1346,7 +1971,7 @@ class FabricClientCore(FabricClient):
|
|
1346
1971
|
"""
|
1347
1972
|
return self.list_items(workspace_id, type="dataPipelines", with_properties=with_properties)
|
1348
1973
|
|
1349
|
-
def update_data_pipeline(self, workspace_id, data_pipeline_id, display_name = None, description = None, return_item=
|
1974
|
+
def update_data_pipeline(self, workspace_id, data_pipeline_id, display_name = None, description = None, return_item=False):
|
1350
1975
|
"""Update a data pipeline in a workspace
|
1351
1976
|
Args:
|
1352
1977
|
workspace_id (str): The ID of the workspace
|
@@ -1422,7 +2047,7 @@ class FabricClientCore(FabricClient):
|
|
1422
2047
|
"""
|
1423
2048
|
return self.list_items(workspace_id, type="environments", with_properties=with_properties)
|
1424
2049
|
|
1425
|
-
def update_environment(self, workspace_id, environment_id, display_name = None, description = None, return_item=
|
2050
|
+
def update_environment(self, workspace_id, environment_id, display_name = None, description = None, return_item=False):
|
1426
2051
|
"""Update an environment in a workspace
|
1427
2052
|
Args:
|
1428
2053
|
workspace_id (str): The ID of the workspace
|
@@ -1644,8 +2269,23 @@ class FabricClientCore(FabricClient):
|
|
1644
2269
|
|
1645
2270
|
item_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
1646
2271
|
error_message="Error getting eventhouse", return_format="json")
|
1647
|
-
|
2272
|
+
ev = Eventhouse.from_dict(item_dict, core_client=self)
|
2273
|
+
ev.get_definition()
|
2274
|
+
return ev
|
1648
2275
|
|
2276
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/eventhouses/{eventhouseId}/getDefinition
|
2277
|
+
|
2278
|
+
def get_eventhouse_definition(self, workspace_id, eventhouse_id, format = None):
|
2279
|
+
"""Get the definition of an eventhouse
|
2280
|
+
Args:
|
2281
|
+
workspace_id (str): The ID of the workspace
|
2282
|
+
eventhouse_id (str): The ID of the eventhouse
|
2283
|
+
format (str): The format of the definition
|
2284
|
+
Returns:
|
2285
|
+
dict: The eventhouse definition
|
2286
|
+
"""
|
2287
|
+
return self.get_item_definition(workspace_id, eventhouse_id, type="eventhouses", format=format)
|
2288
|
+
|
1649
2289
|
def list_eventhouses(self, workspace_id, with_properties = False):
|
1650
2290
|
"""List eventhouses in a workspace
|
1651
2291
|
Args:
|
@@ -1656,7 +2296,7 @@ class FabricClientCore(FabricClient):
|
|
1656
2296
|
"""
|
1657
2297
|
return self.list_items(workspace_id=workspace_id, type="eventhouses", with_properties=with_properties)
|
1658
2298
|
|
1659
|
-
def update_eventhouse(self, workspace_id, eventhouse_id, display_name = None, description = None, return_item=
|
2299
|
+
def update_eventhouse(self, workspace_id, eventhouse_id, display_name = None, description = None, return_item=False):
|
1660
2300
|
"""Update an eventhouse in a workspace
|
1661
2301
|
Args:
|
1662
2302
|
workspace_id (str): The ID of the workspace
|
@@ -1669,6 +2309,19 @@ class FabricClientCore(FabricClient):
|
|
1669
2309
|
return self.update_item(workspace_id=workspace_id, item_id=eventhouse_id,
|
1670
2310
|
display_name=display_name, description=description, type="eventhouses", return_item=return_item)
|
1671
2311
|
|
2312
|
+
def update_eventhouse_definition(self, workspace_id, eventhouse_id, definition, update_metadata = None):
|
2313
|
+
"""Update the definition of an eventhouse
|
2314
|
+
Args:
|
2315
|
+
workspace_id (str): The ID of the workspace
|
2316
|
+
eventhouse_id (str): The ID of the eventhouse
|
2317
|
+
definition (dict): The definition of the eventhouse
|
2318
|
+
update_metadata (bool): Whether to update the metadata
|
2319
|
+
Returns:
|
2320
|
+
dict: The updated eventhouse definition
|
2321
|
+
"""
|
2322
|
+
return self.update_item_definition(workspace_id, eventhouse_id, type="eventhouses", definition=definition, update_metadata=update_metadata)
|
2323
|
+
|
2324
|
+
|
1672
2325
|
# eventstreams
|
1673
2326
|
|
1674
2327
|
def create_eventstream(self, workspace_id, display_name, description = None):
|
@@ -1710,8 +2363,24 @@ class FabricClientCore(FabricClient):
|
|
1710
2363
|
|
1711
2364
|
item_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
1712
2365
|
error_message="Error getting eventstream", return_format="json")
|
1713
|
-
|
2366
|
+
es = Eventstream.from_dict(item_dict, core_client=self)
|
2367
|
+
es.get_definition()
|
2368
|
+
return es
|
1714
2369
|
|
2370
|
+
def get_eventstream_definition(self, workspace_id, eventstream_id, format = None):
|
2371
|
+
"""Get the definition of an eventstream
|
2372
|
+
|
2373
|
+
Args:
|
2374
|
+
workspace_id (str): The ID of the workspace
|
2375
|
+
eventstream_id (str): The ID of the eventstream
|
2376
|
+
format (str): The format of the definition
|
2377
|
+
Returns:
|
2378
|
+
dict: The eventstream definition
|
2379
|
+
"""
|
2380
|
+
|
2381
|
+
return self.get_item_definition(workspace_id, eventstream_id, type="eventstreams", format=format)
|
2382
|
+
|
2383
|
+
|
1715
2384
|
def delete_eventstream(self, workspace_id, eventstream_id):
|
1716
2385
|
"""Delete an eventstream from a workspace
|
1717
2386
|
Args:
|
@@ -1732,7 +2401,7 @@ class FabricClientCore(FabricClient):
|
|
1732
2401
|
"""
|
1733
2402
|
return self.list_items(workspace_id=workspace_id, type="eventstreams", with_properties=with_properties)
|
1734
2403
|
|
1735
|
-
def update_eventstream(self, workspace_id, eventstream_id, display_name = None, description = None, return_item=
|
2404
|
+
def update_eventstream(self, workspace_id, eventstream_id, display_name = None, description = None, return_item=False):
|
1736
2405
|
"""Update an eventstream in a workspace
|
1737
2406
|
Args:
|
1738
2407
|
workspace_id (str): The ID of the workspace
|
@@ -1744,6 +2413,194 @@ class FabricClientCore(FabricClient):
|
|
1744
2413
|
"""
|
1745
2414
|
return self.update_item(workspace_id, eventstream_id, display_name = display_name, description = description,
|
1746
2415
|
type= "eventstreams", return_item=return_item)
|
2416
|
+
|
2417
|
+
def update_eventstream_definition(self, workspace_id, eventstream_id, definition, update_metadata = None):
|
2418
|
+
"""Update the definition of an eventstream
|
2419
|
+
Args:
|
2420
|
+
workspace_id (str): The ID of the workspace
|
2421
|
+
eventstream_id (str): The ID of the eventstream
|
2422
|
+
definition (dict): The definition of the eventstream
|
2423
|
+
update_metadata (bool): Whether to update the metadata
|
2424
|
+
Returns:
|
2425
|
+
dict: The updated definition of the eventstream
|
2426
|
+
"""
|
2427
|
+
return self.update_item_definition(workspace_id, eventstream_id, type="eventstreams", definition=definition, update_metadata=update_metadata)
|
2428
|
+
|
2429
|
+
# graphqlapis
|
2430
|
+
|
2431
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/GraphQLApis
|
2432
|
+
def create_graphql_api(self, workspace_id, display_name, description = None):
|
2433
|
+
"""Create a graphql api in a workspace
|
2434
|
+
Args:
|
2435
|
+
workspace_id (str): The ID of the workspace
|
2436
|
+
display_name (str): The display name of the graphql api
|
2437
|
+
description (str): The description of the graphql api
|
2438
|
+
Returns:
|
2439
|
+
dict: The created graphql api
|
2440
|
+
"""
|
2441
|
+
return self.create_item(workspace_id = workspace_id,
|
2442
|
+
display_name = display_name,
|
2443
|
+
type = "GraphQLApis",
|
2444
|
+
description = description)
|
2445
|
+
|
2446
|
+
def delete_graphql_api(self, workspace_id, graphql_api_id):
|
2447
|
+
"""Delete a graphql api from a workspace
|
2448
|
+
Args:
|
2449
|
+
workspace_id (str): The ID of the workspace
|
2450
|
+
graphql_api_id (str): The ID of the graphql api
|
2451
|
+
Returns:
|
2452
|
+
int: The status code of the response
|
2453
|
+
"""
|
2454
|
+
return self.delete_item(workspace_id, graphql_api_id, type="GraphQLApis")
|
2455
|
+
|
2456
|
+
def get_graphql_api(self, workspace_id, graphql_api_id = None, graphql_api_name = None):
|
2457
|
+
"""Get a graphql api from a workspace
|
2458
|
+
Args:
|
2459
|
+
workspace_id (str): The ID of the workspace
|
2460
|
+
graphql_api_id (str): The ID of the graphql api
|
2461
|
+
graphql_api_name (str): The name of the graphql api
|
2462
|
+
Returns:
|
2463
|
+
dict: The graphql api
|
2464
|
+
"""
|
2465
|
+
from msfabricpysdkcore.otheritems import GraphQLApi
|
2466
|
+
if graphql_api_id is None and graphql_api_name is not None:
|
2467
|
+
graphql_apis = self.list_graphql_apis(workspace_id)
|
2468
|
+
graphql_apis = [ga for ga in graphql_apis if ga.display_name == graphql_api_name]
|
2469
|
+
if len(graphql_apis) == 0:
|
2470
|
+
raise Exception(f"Graphql api with name {graphql_api_name} not found")
|
2471
|
+
graphql_api_id = graphql_apis[0].id
|
2472
|
+
if graphql_api_id is None:
|
2473
|
+
raise Exception("graphql_api_id or the graphql_api_name is required")
|
2474
|
+
|
2475
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/GraphQLApis/{graphql_api_id}"
|
2476
|
+
|
2477
|
+
item_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
2478
|
+
error_message="Error getting graphql api", return_format="json")
|
2479
|
+
graphql = GraphQLApi.from_dict(item_dict, core_client=self)
|
2480
|
+
return graphql
|
2481
|
+
|
2482
|
+
def list_graphql_apis(self, workspace_id, with_properties = False):
|
2483
|
+
"""List graphql apis in a workspace
|
2484
|
+
Args:
|
2485
|
+
workspace_id (str): The ID of the workspace
|
2486
|
+
with_properties (bool): Whether to get the item object with properties
|
2487
|
+
Returns:
|
2488
|
+
list: The list of graphql apis
|
2489
|
+
"""
|
2490
|
+
return self.list_items(workspace_id=workspace_id, type="GraphQLApis", with_properties=with_properties)
|
2491
|
+
|
2492
|
+
def update_graphql_api(self, workspace_id, graphql_api_id, display_name = None, description = None, return_item=False):
|
2493
|
+
"""Update a graphql api in a workspace
|
2494
|
+
Args:
|
2495
|
+
workspace_id (str): The ID of the workspace
|
2496
|
+
graphql_api_id (str): The ID of the graphql api
|
2497
|
+
display_name (str): The display name of the graphql api
|
2498
|
+
description (str): The description of the graphql api
|
2499
|
+
Returns:
|
2500
|
+
dict: The updated graphql api
|
2501
|
+
"""
|
2502
|
+
return self.update_item(workspace_id, graphql_api_id, display_name = display_name, description = description,
|
2503
|
+
type= "GraphQLApis", return_item=return_item)
|
2504
|
+
|
2505
|
+
# kqlDashboard
|
2506
|
+
def create_kql_dashboard(self, workspace_id, display_name, description = None):
|
2507
|
+
"""Create a kql dashboard in a workspace
|
2508
|
+
Args:
|
2509
|
+
workspace_id (str): The ID of the workspace
|
2510
|
+
display_name (str): The display name of the kql dashboard
|
2511
|
+
description (str): The description of the kql dashboard
|
2512
|
+
Returns:
|
2513
|
+
dict: The created kql dashboard
|
2514
|
+
"""
|
2515
|
+
return self.create_item(workspace_id = workspace_id,
|
2516
|
+
display_name = display_name,
|
2517
|
+
type = "kqlDashboards",
|
2518
|
+
description = description)
|
2519
|
+
|
2520
|
+
def delete_kql_dashboard(self, workspace_id, kql_dashboard_id):
|
2521
|
+
"""Delete a kql dashboard from a workspace
|
2522
|
+
Args:
|
2523
|
+
workspace_id (str): The ID of the workspace
|
2524
|
+
kql_dashboard_id (str): The ID of the kql dashboard
|
2525
|
+
Returns:
|
2526
|
+
int: The status code of the response
|
2527
|
+
"""
|
2528
|
+
return self.delete_item(workspace_id, kql_dashboard_id, type="kqlDashboards")
|
2529
|
+
|
2530
|
+
def get_kql_dashboard(self, workspace_id, kql_dashboard_id = None, kql_dashboard_name = None):
|
2531
|
+
"""Get a kql dashboard from a workspace
|
2532
|
+
Args:
|
2533
|
+
workspace_id (str): The ID of the workspace
|
2534
|
+
kql_dashboard_id (str): The ID of the kql dashboard
|
2535
|
+
kql_dashboard_name (str): The name of the kql dashboard
|
2536
|
+
Returns:
|
2537
|
+
KQLDashboard: The kql dashboard object
|
2538
|
+
"""
|
2539
|
+
|
2540
|
+
from msfabricpysdkcore.otheritems import KQLDashboard
|
2541
|
+
if kql_dashboard_id is None and kql_dashboard_name is not None:
|
2542
|
+
kql_dashboards = self.list_kql_dashboards(workspace_id)
|
2543
|
+
kql_dashboards = [kd for kd in kql_dashboards if kd.display_name == kql_dashboard_name]
|
2544
|
+
if len(kql_dashboards) == 0:
|
2545
|
+
raise Exception(f"Kql dashboard with name {kql_dashboard_name} not found")
|
2546
|
+
kql_dashboard_id = kql_dashboards[0].id
|
2547
|
+
if kql_dashboard_id is None:
|
2548
|
+
raise Exception("kql_dashboard_id or the kql_dashboard_name is required")
|
2549
|
+
|
2550
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/kqlDashboards/{kql_dashboard_id}"
|
2551
|
+
|
2552
|
+
item_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
2553
|
+
error_message="Error getting kql dashboard", return_format="json")
|
2554
|
+
kqldashboard = KQLDashboard.from_dict(item_dict, core_client=self)
|
2555
|
+
kqldashboard.get_definition()
|
2556
|
+
return kqldashboard
|
2557
|
+
|
2558
|
+
def get_kql_dashboard_definition(self, workspace_id, kql_dashboard_id, format=None):
|
2559
|
+
"""Get the definition of a kql dashboard
|
2560
|
+
Args:
|
2561
|
+
workspace_id (str): The ID of the workspace
|
2562
|
+
kql_dashboard_id (str): The ID of the kql dashboard
|
2563
|
+
Returns:
|
2564
|
+
dict: The definition of the kql dashboard
|
2565
|
+
"""
|
2566
|
+
return self.get_item_definition(workspace_id, kql_dashboard_id, type="kqlDashboards", format=format)
|
2567
|
+
|
2568
|
+
|
2569
|
+
def list_kql_dashboards(self, workspace_id, with_properties = False):
|
2570
|
+
"""List kql dashboards in a workspace
|
2571
|
+
Args:
|
2572
|
+
workspace_id (str): The ID of the workspace
|
2573
|
+
with_properties (bool): Whether to get the item object with properties
|
2574
|
+
Returns:
|
2575
|
+
list: The list of kql dashboards
|
2576
|
+
"""
|
2577
|
+
return self.list_items(workspace_id=workspace_id, type="kqlDashboards", with_properties=with_properties)
|
2578
|
+
|
2579
|
+
def update_kql_dashboard(self, workspace_id, kql_dashboard_id, display_name = None, description = None, return_item=False):
|
2580
|
+
"""Update a kql dashboard in a workspace
|
2581
|
+
Args:
|
2582
|
+
workspace_id (str): The ID of the workspace
|
2583
|
+
kql_dashboard_id (str): The ID of the kql dashboard
|
2584
|
+
display_name (str): The display name of the kql dashboard
|
2585
|
+
description (str): The description of the kql dashboard
|
2586
|
+
Returns:
|
2587
|
+
dict: The updated kql dashboard
|
2588
|
+
"""
|
2589
|
+
return self.update_item(workspace_id, kql_dashboard_id, display_name = display_name,
|
2590
|
+
description = description, type= "kqlDashboards", return_item=return_item)
|
2591
|
+
|
2592
|
+
def update_kql_dashboard_definition(self, workspace_id, kql_dashboard_id, definition, update_metadata = None):
|
2593
|
+
"""Update the definition of a kql dashboard
|
2594
|
+
Args:
|
2595
|
+
workspace_id (str): The ID of the workspace
|
2596
|
+
kql_dashboard_id (str): The ID of the kql dashboard
|
2597
|
+
definition (dict): The definition of the kql dashboard
|
2598
|
+
update_metadata (bool): Whether to update the metadata
|
2599
|
+
Returns:
|
2600
|
+
dict: The updated definition of the kql dashboard
|
2601
|
+
"""
|
2602
|
+
return self.update_item_definition(workspace_id, kql_dashboard_id,
|
2603
|
+
type="kqlDashboards", definition=definition, update_metadata=update_metadata)
|
1747
2604
|
|
1748
2605
|
# kqlDatabases
|
1749
2606
|
|
@@ -1796,7 +2653,20 @@ class FabricClientCore(FabricClient):
|
|
1796
2653
|
|
1797
2654
|
item_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
1798
2655
|
error_message="Error getting kql database", return_format="json")
|
1799
|
-
|
2656
|
+
kqldb = KQLDatabase.from_dict(item_dict, core_client=self)
|
2657
|
+
kqldb.get_definition()
|
2658
|
+
return kqldb
|
2659
|
+
|
2660
|
+
def get_kql_database_definition(self, workspace_id, kql_database_id, format=None):
|
2661
|
+
"""Get the definition of a kql database
|
2662
|
+
Args:
|
2663
|
+
workspace_id (str): The ID of the workspace
|
2664
|
+
kql_database_id (str): The ID of the kql database
|
2665
|
+
format (str): The format of the definition
|
2666
|
+
Returns:
|
2667
|
+
dict: The definition of the kql database
|
2668
|
+
"""
|
2669
|
+
return self.get_item_definition(workspace_id, kql_database_id, type="kqlDatabases", format=format)
|
1800
2670
|
|
1801
2671
|
def list_kql_databases(self, workspace_id, with_properties = False):
|
1802
2672
|
"""List kql databases in a workspace
|
@@ -1807,7 +2677,7 @@ class FabricClientCore(FabricClient):
|
|
1807
2677
|
list: The list of kql databases"""
|
1808
2678
|
return self.list_items(workspace_id=workspace_id, type="kqlDatabases", with_properties=with_properties)
|
1809
2679
|
|
1810
|
-
def update_kql_database(self, workspace_id, kql_database_id, display_name = None, description = None, return_item=
|
2680
|
+
def update_kql_database(self, workspace_id, kql_database_id, display_name = None, description = None, return_item=False):
|
1811
2681
|
"""Update a kql database in a workspace
|
1812
2682
|
Args:
|
1813
2683
|
workspace_id (str): The ID of the workspace
|
@@ -1820,8 +2690,38 @@ class FabricClientCore(FabricClient):
|
|
1820
2690
|
return self.update_item(workspace_id, kql_database_id, display_name = display_name,
|
1821
2691
|
description = description, type= "kqlDatabases", return_item=return_item)
|
1822
2692
|
|
2693
|
+
def update_kql_database_definition(self, workspace_id, kql_database_id, definition, update_metadata = None):
|
2694
|
+
"""Update the definition of a kql database
|
2695
|
+
Args:
|
2696
|
+
workspace_id (str): The ID of the workspace
|
2697
|
+
kql_database_id (str): The ID of the kql database
|
2698
|
+
definition (dict): The definition of the kql database
|
2699
|
+
update_metadata (bool): Whether to update the metadata
|
2700
|
+
Returns:
|
2701
|
+
dict: The updated definition of the kql database
|
2702
|
+
"""
|
2703
|
+
return self.update_item_definition(workspace_id, kql_database_id,
|
2704
|
+
type="kqlDatabases", definition=definition, update_metadata=update_metadata)
|
2705
|
+
|
1823
2706
|
# kqlQuerysets
|
1824
2707
|
|
2708
|
+
def create_kql_queryset(self, workspace_id, display_name, description = None, definition = None):
|
2709
|
+
"""Create a kql queryset in a workspace
|
2710
|
+
Args:
|
2711
|
+
workspace_id (str): The ID of the workspace
|
2712
|
+
display_name (str): The display name of the kql queryset
|
2713
|
+
description (str): The description of the kql queryset
|
2714
|
+
definition (dict): The definition of the kql queryset
|
2715
|
+
Returns:
|
2716
|
+
dict: The created kql queryset
|
2717
|
+
"""
|
2718
|
+
return self.create_item(workspace_id = workspace_id,
|
2719
|
+
display_name = display_name,
|
2720
|
+
type = "kqlQuerysets",
|
2721
|
+
description = description,
|
2722
|
+
definition = definition)
|
2723
|
+
|
2724
|
+
|
1825
2725
|
|
1826
2726
|
def delete_kql_queryset(self, workspace_id, kql_queryset_id):
|
1827
2727
|
"""Delete a kql queryset from a workspace
|
@@ -1857,9 +2757,31 @@ class FabricClientCore(FabricClient):
|
|
1857
2757
|
item_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
1858
2758
|
error_message="Error getting kql queryset", return_format="json")
|
1859
2759
|
|
1860
|
-
|
2760
|
+
kql = KQLQueryset.from_dict(item_dict, core_client=self)
|
2761
|
+
kql.get_definition()
|
2762
|
+
return kql
|
2763
|
+
|
2764
|
+
def get_kql_queryset_definition(self, workspace_id, kql_queryset_id, format=None):
|
2765
|
+
"""Get the definition of a kql queryset
|
2766
|
+
Args:
|
2767
|
+
workspace_id (str): The ID of the workspace
|
2768
|
+
kql_queryset_id (str): The ID of the kql queryset
|
2769
|
+
Returns:
|
2770
|
+
dict: The definition of the kql queryset
|
2771
|
+
"""
|
2772
|
+
return self.get_item_definition(workspace_id, kql_queryset_id, type="kqlQuerysets", format=format)
|
1861
2773
|
|
1862
|
-
def
|
2774
|
+
def list_kql_querysets(self, workspace_id, with_properties = False):
|
2775
|
+
"""List kql querysets in a workspace
|
2776
|
+
Args:
|
2777
|
+
workspace_id (str): The ID of the workspace
|
2778
|
+
with_properties (bool): Whether to get the item object with properties
|
2779
|
+
Returns:
|
2780
|
+
list: The list of kql querysets
|
2781
|
+
"""
|
2782
|
+
return self.list_items(workspace_id=workspace_id, type="kqlQuerysets", with_properties=with_properties)
|
2783
|
+
|
2784
|
+
def update_kql_queryset(self, workspace_id, kql_queryset_id, display_name = None, description = None, return_item=False):
|
1863
2785
|
"""Update a kql queryset in a workspace
|
1864
2786
|
Args:
|
1865
2787
|
workspace_id (str): The ID of the workspace
|
@@ -1872,15 +2794,18 @@ class FabricClientCore(FabricClient):
|
|
1872
2794
|
return self.update_item(workspace_id, kql_queryset_id, display_name = display_name,
|
1873
2795
|
description = description, type= "kqlQuerysets", return_item=return_item)
|
1874
2796
|
|
1875
|
-
def
|
1876
|
-
"""
|
2797
|
+
def update_kql_queryset_definition(self, workspace_id, kql_queryset_id, definition, update_metadata = None):
|
2798
|
+
"""Update the definition of a kql queryset
|
1877
2799
|
Args:
|
1878
2800
|
workspace_id (str): The ID of the workspace
|
1879
|
-
|
2801
|
+
kql_queryset_id (str): The ID of the kql queryset
|
2802
|
+
definition (dict): The definition of the kql queryset
|
2803
|
+
update_metadata (bool): Whether to update the metadata
|
1880
2804
|
Returns:
|
1881
|
-
|
2805
|
+
dict: The updated definition of the kql queryset
|
1882
2806
|
"""
|
1883
|
-
return self.
|
2807
|
+
return self.update_item_definition(workspace_id, kql_queryset_id,
|
2808
|
+
type="kqlQuerysets", definition=definition, update_metadata=update_metadata)
|
1884
2809
|
|
1885
2810
|
|
1886
2811
|
# lakehouses
|
@@ -1969,7 +2894,7 @@ class FabricClientCore(FabricClient):
|
|
1969
2894
|
"""
|
1970
2895
|
return self.list_items(workspace_id, type="lakehouses", with_properties = with_properties)
|
1971
2896
|
|
1972
|
-
def update_lakehouse(self, workspace_id, lakehouse_id, display_name = None, description = None, return_item=
|
2897
|
+
def update_lakehouse(self, workspace_id, lakehouse_id, display_name = None, description = None, return_item=False):
|
1973
2898
|
"""Update a lakehouse in a workspace
|
1974
2899
|
Args:
|
1975
2900
|
workspace_id (str): The ID of the workspace
|
@@ -2065,8 +2990,161 @@ class FabricClientCore(FabricClient):
|
|
2065
2990
|
self._logger.info("Table created")
|
2066
2991
|
return response.status_code
|
2067
2992
|
|
2068
|
-
#
|
2993
|
+
# mirrored_database
|
2994
|
+
|
2995
|
+
def create_mirrored_database(self, workspace_id, display_name, description = None, definition = None):
|
2996
|
+
"""Create a mirrored database in a workspace
|
2997
|
+
Args:
|
2998
|
+
workspace_id (str): The ID of the workspace
|
2999
|
+
display_name (str): The display name of the mirrored database
|
3000
|
+
description (str): The description of the mirrored database
|
3001
|
+
Returns:
|
3002
|
+
dict: The created mirrored database
|
3003
|
+
"""
|
3004
|
+
return self.create_item(workspace_id = workspace_id,
|
3005
|
+
display_name = display_name,
|
3006
|
+
type = "mirroredDatabases",
|
3007
|
+
description = description,
|
3008
|
+
definition=definition)
|
3009
|
+
|
3010
|
+
def delete_mirrored_database(self, workspace_id, mirrored_database_id):
|
3011
|
+
"""Delete a mirrored database from a workspace
|
3012
|
+
Args:
|
3013
|
+
workspace_id (str): The ID of the workspace
|
3014
|
+
mirrored_database_id (str): The ID of the mirrored database
|
3015
|
+
Returns:
|
3016
|
+
int: The status code of the response
|
3017
|
+
"""
|
3018
|
+
return self.delete_item(workspace_id, mirrored_database_id, type="mirroredDatabases")
|
3019
|
+
|
3020
|
+
def get_mirrored_database(self, workspace_id, mirrored_database_id = None, mirrored_database_name = None):
|
3021
|
+
"""Get a mirrored database from a workspace
|
3022
|
+
Args:
|
3023
|
+
workspace_id (str): The ID of the workspace
|
3024
|
+
mirrored_database_id (str): The ID of the mirrored database
|
3025
|
+
mirrored_database_name (str): The name of the mirrored database
|
3026
|
+
Returns:
|
3027
|
+
MirroredDatabase: The mirrored database object
|
3028
|
+
"""
|
3029
|
+
from msfabricpysdkcore.otheritems import MirroredDatabase
|
3030
|
+
|
3031
|
+
if mirrored_database_id is None and mirrored_database_name is not None:
|
3032
|
+
mirrored_databases = self.list_mirrored_databases(workspace_id)
|
3033
|
+
mirrored_databases = [md for md in mirrored_databases if md.display_name == mirrored_database_name]
|
3034
|
+
if len(mirrored_databases) == 0:
|
3035
|
+
raise Exception(f"Mirrored database with name {mirrored_database_name} not found")
|
3036
|
+
mirrored_database_id = mirrored_databases[0].id
|
3037
|
+
|
3038
|
+
if mirrored_database_id is None:
|
3039
|
+
raise Exception("mirrored_database_id or the mirrored_database_name is required")
|
3040
|
+
|
3041
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mirroredDatabases/{mirrored_database_id}"
|
3042
|
+
|
3043
|
+
item_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
3044
|
+
error_message="Error getting mirrored database", return_format="json")
|
3045
|
+
mirrored_db = MirroredDatabase.from_dict(item_dict, core_client=self)
|
3046
|
+
return mirrored_db
|
3047
|
+
|
3048
|
+
def get_mirrored_database_definition(self, workspace_id, mirrored_database_id):
|
3049
|
+
"""Get the definition of a mirrored database
|
3050
|
+
Args:
|
3051
|
+
workspace_id (str): The ID of the workspace
|
3052
|
+
mirrored_database_id (str): The ID of the mirrored database
|
3053
|
+
Returns:
|
3054
|
+
dict: The definition of the mirrored database
|
3055
|
+
"""
|
3056
|
+
return self.get_item_definition(workspace_id, mirrored_database_id, type="mirroredDatabases")
|
3057
|
+
|
3058
|
+
def list_mirrored_databases(self, workspace_id, with_properties = False):
|
3059
|
+
"""List mirrored databases in a workspace
|
3060
|
+
Args:
|
3061
|
+
workspace_id (str): The ID of the workspace
|
3062
|
+
with_properties (bool): Whether to get the item object with properties
|
3063
|
+
Returns:
|
3064
|
+
list: The list of mirrored databases
|
3065
|
+
"""
|
3066
|
+
return self.list_items(workspace_id=workspace_id, type="mirroredDatabases", with_properties=with_properties)
|
3067
|
+
|
3068
|
+
def update_mirrored_database(self, workspace_id, mirrored_database_id, display_name = None, description = None, return_item=False):
|
3069
|
+
"""Update a mirrored database in a workspace
|
3070
|
+
Args:
|
3071
|
+
workspace_id (str): The ID of the workspace
|
3072
|
+
mirrored_database_id (str): The ID of the mirrored database
|
3073
|
+
display_name (str): The display name of the mirrored database
|
3074
|
+
description (str): The description of the mirrored database
|
3075
|
+
Returns:
|
3076
|
+
dict: The updated mirrored database
|
3077
|
+
"""
|
3078
|
+
return self.update_item(workspace_id, mirrored_database_id, display_name = display_name, description = description,
|
3079
|
+
type="mirroredDatabases", return_item=return_item)
|
3080
|
+
|
3081
|
+
def update_mirrored_database_definition(self, workspace_id, mirrored_database_id, definition):
|
3082
|
+
"""Update the definition of a mirrored database
|
3083
|
+
Args:
|
3084
|
+
workspace_id (str): The ID of the workspace
|
3085
|
+
mirrored_database_id (str): The ID of the mirrored database
|
3086
|
+
definition (dict): The definition of the mirrored database
|
3087
|
+
Returns:
|
3088
|
+
dict: The updated definition of the mirrored database
|
3089
|
+
"""
|
3090
|
+
return self.update_item_definition(workspace_id, mirrored_database_id,
|
3091
|
+
type="mirroredDatabases", definition=definition)
|
3092
|
+
|
3093
|
+
|
3094
|
+
def get_mirroring_status(self, workspace_id, mirrored_database_id):
|
3095
|
+
"""Get the mirroring status of a mirrored database
|
3096
|
+
Args:
|
3097
|
+
workspace_id (str): The ID of the workspace
|
3098
|
+
mirrored_database_id (str): The ID of the mirrored database
|
3099
|
+
Returns:
|
3100
|
+
dict: The mirroring status of the mirrored database
|
3101
|
+
"""
|
3102
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mirroredDatabases/{mirrored_database_id}/getMirroringStatus"
|
3103
|
+
|
3104
|
+
return self.calling_routine(url, operation="POST", response_codes=[200, 429],
|
3105
|
+
error_message="Error getting mirroring status", return_format="json")
|
3106
|
+
|
3107
|
+
def get_tables_mirroring_status(self, workspace_id, mirrored_database_id):
|
3108
|
+
"""Get the tables mirroring status of a mirrored database
|
3109
|
+
Args:
|
3110
|
+
workspace_id (str): The ID of the workspace
|
3111
|
+
mirrored_database_id (str): The ID of the mirrored database
|
3112
|
+
Returns:
|
3113
|
+
dict: The tables mirroring status of the mirrored database
|
3114
|
+
"""
|
3115
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mirroredDatabases/{mirrored_database_id}/getTablesMirroringStatus"
|
2069
3116
|
|
3117
|
+
return self.calling_routine(url, operation="POST", response_codes=[200, 429],
|
3118
|
+
error_message="Error getting tables mirroring status", return_format="json")
|
3119
|
+
|
3120
|
+
def start_mirroring(self, workspace_id, mirrored_database_id):
|
3121
|
+
"""Start mirroring of a mirrored database
|
3122
|
+
Args:
|
3123
|
+
workspace_id (str): The ID of the workspace
|
3124
|
+
mirrored_database_id (str): The ID of the mirrored database
|
3125
|
+
Returns:
|
3126
|
+
dict: The operation result
|
3127
|
+
"""
|
3128
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mirroredDatabases/{mirrored_database_id}/startMirroring"
|
3129
|
+
|
3130
|
+
return self.calling_routine(url, operation="POST", response_codes=[200, 429],
|
3131
|
+
error_message="Error starting mirroring", return_format="response")
|
3132
|
+
|
3133
|
+
def stop_mirroring(self, workspace_id, mirrored_database_id):
|
3134
|
+
"""Stop mirroring of a mirrored database
|
3135
|
+
Args:
|
3136
|
+
workspace_id (str): The ID of the workspace
|
3137
|
+
mirrored_database_id (str): The ID of the mirrored database
|
3138
|
+
Returns:
|
3139
|
+
dict: The operation result
|
3140
|
+
"""
|
3141
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mirroredDatabases/{mirrored_database_id}/stopMirroring"
|
3142
|
+
|
3143
|
+
return self.calling_routine(url, operation="POST", response_codes=[200, 429],
|
3144
|
+
error_message="Error stopping mirroring", return_format="response")
|
3145
|
+
|
3146
|
+
|
3147
|
+
# mlExperiments
|
2070
3148
|
|
2071
3149
|
def create_ml_experiment(self, workspace_id, display_name, description = None):
|
2072
3150
|
"""Create an ml experiment in a workspace
|
@@ -2127,7 +3205,7 @@ class FabricClientCore(FabricClient):
|
|
2127
3205
|
"""
|
2128
3206
|
return self.list_items(workspace_id=workspace_id, type="mlExperiments", with_properties = with_properties)
|
2129
3207
|
|
2130
|
-
def update_ml_experiment(self, workspace_id, ml_experiment_id, display_name = None, description = None, return_item=
|
3208
|
+
def update_ml_experiment(self, workspace_id, ml_experiment_id, display_name = None, description = None, return_item=False):
|
2131
3209
|
"""Update an ml experiment in a workspace
|
2132
3210
|
Args:
|
2133
3211
|
workspace_id (str): The ID of the workspace
|
@@ -2200,7 +3278,7 @@ class FabricClientCore(FabricClient):
|
|
2200
3278
|
"""
|
2201
3279
|
return self.list_items(workspace_id=workspace_id, type="mlModels", with_properties = with_properties)
|
2202
3280
|
|
2203
|
-
def update_ml_model(self, workspace_id, ml_model_id, display_name = None, description = None, return_item=
|
3281
|
+
def update_ml_model(self, workspace_id, ml_model_id, display_name = None, description = None, return_item=False):
|
2204
3282
|
"""Update an ml model in a workspace
|
2205
3283
|
Args:
|
2206
3284
|
workspace_id (str): The ID of the workspace
|
@@ -2212,7 +3290,106 @@ class FabricClientCore(FabricClient):
|
|
2212
3290
|
"""
|
2213
3291
|
return self.update_item(workspace_id, ml_model_id, display_name = display_name, description = description,
|
2214
3292
|
type="mlModels", return_item=return_item)
|
3293
|
+
|
3294
|
+
# mounted data factory
|
3295
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/mountedDataFactories
|
3296
|
+
|
3297
|
+
def create_mounted_data_factory(self, workspace_id, display_name, description = None, definition = None):
|
3298
|
+
"""Create a mounted data factory in a workspace
|
3299
|
+
Args:
|
3300
|
+
workspace_id (str): The ID of the workspace
|
3301
|
+
display_name (str): The display name of the mounted data factory
|
3302
|
+
description (str): The description of the mounted data factory
|
3303
|
+
definition (dict): The definition of the mounted data factory
|
3304
|
+
Returns:
|
3305
|
+
dict: The created mounted data factory
|
3306
|
+
"""
|
3307
|
+
return self.create_item(workspace_id = workspace_id, display_name = display_name, type = "mountedDataFactories",
|
3308
|
+
description = description, definition = definition)
|
3309
|
+
|
3310
|
+
def delete_mounted_data_factory(self, workspace_id, mounted_data_factory_id):
|
3311
|
+
"""Delete a mounted data factory from a workspace
|
3312
|
+
Args:
|
3313
|
+
workspace_id (str): The ID of the workspace
|
3314
|
+
mounted_data_factory_id (str): The ID of the mounted data factory
|
3315
|
+
Returns:
|
3316
|
+
int: The status code of the response
|
3317
|
+
"""
|
3318
|
+
return self.delete_item(workspace_id, mounted_data_factory_id, type="mountedDataFactories")
|
3319
|
+
|
3320
|
+
def get_mounted_data_factory(self, workspace_id, mounted_data_factory_id = None, mounted_data_factory_name = None):
|
3321
|
+
"""Get a mounted data factory from a workspace
|
3322
|
+
Args:
|
3323
|
+
workspace_id (str): The ID of the workspace
|
3324
|
+
mounted_data_factory_id (str): The ID of the mounted data factory
|
3325
|
+
mounted_data_factory_name (str): The name of the mounted data factory
|
3326
|
+
Returns:
|
3327
|
+
MountedDataFactory: The mounted data factory object
|
3328
|
+
"""
|
3329
|
+
from msfabricpysdkcore.otheritems import MountedDataFactory
|
3330
|
+
if mounted_data_factory_id is None and mounted_data_factory_name is not None:
|
3331
|
+
mounted_data_factories = self.list_mounted_data_factories(workspace_id)
|
3332
|
+
mounted_data_factories = [mdf for mdf in mounted_data_factories if mdf.display_name == mounted_data_factory_name]
|
3333
|
+
if len(mounted_data_factories) == 0:
|
3334
|
+
raise Exception(f"Mounted data factory with name {mounted_data_factory_name} not found")
|
3335
|
+
mounted_data_factory_id = mounted_data_factories[0].id
|
3336
|
+
if mounted_data_factory_id is None:
|
3337
|
+
raise Exception("mounted_data_factory_id or the mounted_data_factory_name is required")
|
3338
|
+
|
3339
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mountedDataFactories/{mounted_data_factory_id}"
|
3340
|
+
|
3341
|
+
item_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
3342
|
+
error_message="Error getting mounted data factory", return_format="json")
|
3343
|
+
|
3344
|
+
mdf = MountedDataFactory.from_dict(item_dict, core_client=self)
|
3345
|
+
mdf.get_definition()
|
3346
|
+
return mdf
|
2215
3347
|
|
3348
|
+
def get_mounted_data_factory_definition(self, workspace_id, mounted_data_factory_id, format = None):
|
3349
|
+
"""Get the definition of a mounted data factory
|
3350
|
+
Args:
|
3351
|
+
workspace_id (str): The ID of the workspace
|
3352
|
+
mounted_data_factory_id (str): The ID of the mounted data factory
|
3353
|
+
format (str): The format of the definition
|
3354
|
+
Returns:
|
3355
|
+
dict: The definition of the mounted data factory
|
3356
|
+
"""
|
3357
|
+
return self.get_item_definition(workspace_id, mounted_data_factory_id, type="mountedDataFactories", format=format)
|
3358
|
+
|
3359
|
+
def list_mounted_data_factories(self, workspace_id, with_properties = False):
|
3360
|
+
"""List mounted data factories in a workspace
|
3361
|
+
Args:
|
3362
|
+
workspace_id (str): The ID of the workspace
|
3363
|
+
with_properties (bool): Whether to get the item object with properties
|
3364
|
+
Returns:
|
3365
|
+
list: The list of mounted data factories
|
3366
|
+
"""
|
3367
|
+
return self.list_items(workspace_id=workspace_id, type="mountedDataFactories", with_properties = with_properties)
|
3368
|
+
|
3369
|
+
def update_mounted_data_factory(self, workspace_id, mounted_data_factory_id, display_name = None, description = None, return_item=False):
|
3370
|
+
"""Update a mounted data factory in a workspace
|
3371
|
+
Args:
|
3372
|
+
workspace_id (str): The ID of the workspace
|
3373
|
+
mounted_data_factory_id (str): The ID of the mounted data factory
|
3374
|
+
display_name (str): The display name of the mounted data factory
|
3375
|
+
description (str): The description of the mounted data factory
|
3376
|
+
Returns:
|
3377
|
+
dict: The updated mounted data factory
|
3378
|
+
"""
|
3379
|
+
return self.update_item(workspace_id, mounted_data_factory_id, display_name = display_name, description = description,
|
3380
|
+
type="mountedDataFactories", return_item=return_item)
|
3381
|
+
|
3382
|
+
def update_mounted_data_factory_definition(self, workspace_id, mounted_data_factory_id, definition, update_metadata = None):
|
3383
|
+
"""Update the definition of a mounted data factory
|
3384
|
+
Args:
|
3385
|
+
workspace_id (str): The ID of the workspace
|
3386
|
+
mounted_data_factory_id (str): The ID of the mounted data factory
|
3387
|
+
definition (dict): The definition of the mounted data factory
|
3388
|
+
Returns:
|
3389
|
+
dict: The updated definition of the mounted data factory
|
3390
|
+
"""
|
3391
|
+
return self.update_item_definition(workspace_id, mounted_data_factory_id, definition, type="mountedDataFactories", update_metadata=update_metadata)
|
3392
|
+
|
2216
3393
|
# notebooks
|
2217
3394
|
|
2218
3395
|
def create_notebook(self, workspace_id, display_name, definition = None, description = None):
|
@@ -2286,7 +3463,7 @@ class FabricClientCore(FabricClient):
|
|
2286
3463
|
"""
|
2287
3464
|
return self.list_items(workspace_id = workspace_id, type = "notebooks", with_properties = with_properties)
|
2288
3465
|
|
2289
|
-
def update_notebook(self, workspace_id, notebook_id, display_name = None, description = None, return_item=
|
3466
|
+
def update_notebook(self, workspace_id, notebook_id, display_name = None, description = None, return_item=False):
|
2290
3467
|
"""Update a notebook in a workspace
|
2291
3468
|
Args:
|
2292
3469
|
workspace_id (str): The ID of the workspace
|
@@ -2310,6 +3487,122 @@ class FabricClientCore(FabricClient):
|
|
2310
3487
|
"""
|
2311
3488
|
return self.update_item_definition(workspace_id, notebook_id, definition, type="notebooks")
|
2312
3489
|
|
3490
|
+
# paginatedReports
|
3491
|
+
|
3492
|
+
def list_paginated_reports(self, workspace_id):
|
3493
|
+
"""List paginated reports in a workspace"""
|
3494
|
+
return self.list_items(workspace_id, type="paginatedReports")
|
3495
|
+
|
3496
|
+
def update_paginated_report(self, workspace_id, paginated_report_id, display_name = None, description = None, return_item=False):
|
3497
|
+
"""Update a paginated report in a workspace
|
3498
|
+
Args:
|
3499
|
+
workspace_id (str): The ID of the workspace
|
3500
|
+
paginated_report_id (str): The ID of the paginated report
|
3501
|
+
display_name (str): The display name of the paginated report
|
3502
|
+
description (str): The description of the paginated report
|
3503
|
+
Returns:
|
3504
|
+
dict: The updated paginated report
|
3505
|
+
"""
|
3506
|
+
return self.update_item(workspace_id, paginated_report_id, display_name = display_name, description = description,
|
3507
|
+
type="paginatedReports", return_item=return_item)
|
3508
|
+
|
3509
|
+
# reflex
|
3510
|
+
|
3511
|
+
def create_reflex(self, workspace_id, display_name, description = None, definition = None):
|
3512
|
+
"""Create a reflex in a workspace
|
3513
|
+
Args:
|
3514
|
+
workspace_id (str): The ID of the workspace
|
3515
|
+
display_name (str): The display name of the reflex
|
3516
|
+
description (str): The description of the reflex
|
3517
|
+
definition (dict): The definition of the reflex
|
3518
|
+
Returns:
|
3519
|
+
dict: The created reflex
|
3520
|
+
"""
|
3521
|
+
return self.create_item(workspace_id = workspace_id, display_name = display_name, type = "reflexes", description = description, definition = definition)
|
3522
|
+
|
3523
|
+
def delete_reflex(self, workspace_id, reflex_id):
|
3524
|
+
"""Delete a reflex from a workspace
|
3525
|
+
Args:
|
3526
|
+
workspace_id (str): The ID of the workspace
|
3527
|
+
reflex_id (str): The ID of the reflex
|
3528
|
+
Returns:
|
3529
|
+
int: The status code of the response
|
3530
|
+
"""
|
3531
|
+
return self.delete_item(workspace_id, reflex_id, type="reflexes")
|
3532
|
+
|
3533
|
+
def get_reflex(self, workspace_id, reflex_id = None, reflex_name = None):
|
3534
|
+
"""Get a reflex from a workspace
|
3535
|
+
Args:
|
3536
|
+
workspace_id (str): The ID of the workspace
|
3537
|
+
reflex_id (str): The ID of the reflex
|
3538
|
+
reflex_name (str): The name of the reflex
|
3539
|
+
Returns:
|
3540
|
+
Reflex: The reflex object
|
3541
|
+
"""
|
3542
|
+
from msfabricpysdkcore.otheritems import Reflex
|
3543
|
+
if reflex_id is None and reflex_name is not None:
|
3544
|
+
reflexes = self.list_reflexes(workspace_id)
|
3545
|
+
reflexes = [rf for rf in reflexes if rf.display_name == reflex_name]
|
3546
|
+
if len(reflexes) == 0:
|
3547
|
+
raise Exception(f"Reflex with name {reflex_name} not found")
|
3548
|
+
reflex_id = reflexes[0].id
|
3549
|
+
if reflex_id is None:
|
3550
|
+
raise Exception("reflex_id or the reflex_name is required")
|
3551
|
+
|
3552
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/reflexes/{reflex_id}"
|
3553
|
+
|
3554
|
+
item_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
3555
|
+
error_message="Error getting reflex", return_format="json")
|
3556
|
+
|
3557
|
+
refl = Reflex.from_dict(item_dict, core_client=self)
|
3558
|
+
refl.get_definition()
|
3559
|
+
return refl
|
3560
|
+
|
3561
|
+
def get_reflex_definition(self, workspace_id, reflex_id, format = None):
|
3562
|
+
"""Get the definition of a reflex
|
3563
|
+
Args:
|
3564
|
+
workspace_id (str): The ID of the workspace
|
3565
|
+
reflex_id (str): The ID of the reflex
|
3566
|
+
format (str): The format of the definition
|
3567
|
+
Returns:
|
3568
|
+
dict: The definition of the reflex
|
3569
|
+
"""
|
3570
|
+
return self.get_item_definition(workspace_id, reflex_id, type="reflexes", format=format)
|
3571
|
+
|
3572
|
+
def list_reflexes(self, workspace_id, with_properties = False):
|
3573
|
+
"""List reflexes in a workspace
|
3574
|
+
Args:
|
3575
|
+
workspace_id (str): The ID of the workspace
|
3576
|
+
with_properties (bool): Whether to get the item object with properties
|
3577
|
+
Returns:
|
3578
|
+
list: The list of reflexes
|
3579
|
+
"""
|
3580
|
+
return self.list_items(workspace_id = workspace_id, type = "reflexes", with_properties = with_properties)
|
3581
|
+
|
3582
|
+
def update_reflex(self, workspace_id, reflex_id, display_name = None, description = None, return_item=False):
|
3583
|
+
"""Update a reflex in a workspace
|
3584
|
+
Args:
|
3585
|
+
workspace_id (str): The ID of the workspace
|
3586
|
+
reflex_id (str): The ID of the reflex
|
3587
|
+
display_name (str): The display name of the reflex
|
3588
|
+
description (str): The description of the reflex
|
3589
|
+
Returns:
|
3590
|
+
dict: The updated reflex
|
3591
|
+
"""
|
3592
|
+
return self.update_item(workspace_id, reflex_id, display_name = display_name, description = description,
|
3593
|
+
type="reflexes", return_item=return_item)
|
3594
|
+
|
3595
|
+
def update_reflex_definition(self, workspace_id, reflex_id, definition, update_metadata = None):
|
3596
|
+
"""Update the definition of a reflex
|
3597
|
+
Args:
|
3598
|
+
workspace_id (str): The ID of the workspace
|
3599
|
+
reflex_id (str): The ID of the reflex
|
3600
|
+
definition (dict): The definition of the reflex
|
3601
|
+
Returns:
|
3602
|
+
dict: The updated reflex
|
3603
|
+
"""
|
3604
|
+
return self.update_item_definition(workspace_id, reflex_id, definition, type="reflexes", update_metadata=update_metadata)
|
3605
|
+
|
2313
3606
|
# reports
|
2314
3607
|
|
2315
3608
|
def create_report(self, workspace_id, display_name, definition = None, description = None):
|
@@ -2384,6 +3677,19 @@ class FabricClientCore(FabricClient):
|
|
2384
3677
|
"""
|
2385
3678
|
return self.list_items(workspace_id = workspace_id, type = "reports", with_properties = with_properties)
|
2386
3679
|
|
3680
|
+
def update_report(self, workspace_id, report_id, display_name = None, description = None, return_item=False):
|
3681
|
+
"""Update a report in a workspace
|
3682
|
+
Args:
|
3683
|
+
workspace_id (str): The ID of the workspace
|
3684
|
+
report_id (str): The ID of the report
|
3685
|
+
display_name (str): The display name of the report
|
3686
|
+
description (str): The description of the report
|
3687
|
+
Returns:
|
3688
|
+
dict: The updated report
|
3689
|
+
"""
|
3690
|
+
return self.update_item(workspace_id, report_id, display_name = display_name, description = description,
|
3691
|
+
type="reports", return_item=return_item)
|
3692
|
+
|
2387
3693
|
def update_report_definition(self, workspace_id, report_id, definition):
|
2388
3694
|
"""Update the definition of a report
|
2389
3695
|
Args:
|
@@ -2397,16 +3703,6 @@ class FabricClientCore(FabricClient):
|
|
2397
3703
|
|
2398
3704
|
# semanticModels
|
2399
3705
|
|
2400
|
-
def list_semantic_models(self, workspace_id, with_properties = False):
|
2401
|
-
"""List semantic models in a workspace
|
2402
|
-
Args:
|
2403
|
-
workspace_id (str): The ID of the workspace
|
2404
|
-
with_properties (bool): Whether to get the item object with properties
|
2405
|
-
Returns:
|
2406
|
-
list: The list of semantic models
|
2407
|
-
"""
|
2408
|
-
return self.list_items(workspace_id = workspace_id, type = "semanticModels", with_properties = with_properties)
|
2409
|
-
|
2410
3706
|
def create_semantic_model(self, workspace_id, display_name, definition = None, description = None):
|
2411
3707
|
"""Create a semantic model in a workspace
|
2412
3708
|
Args:
|
@@ -2418,6 +3714,16 @@ class FabricClientCore(FabricClient):
|
|
2418
3714
|
dict: The created semantic model
|
2419
3715
|
"""
|
2420
3716
|
return self.create_item(workspace_id = workspace_id, display_name = display_name, type = "semanticModels", definition = definition, description = description)
|
3717
|
+
|
3718
|
+
def delete_semantic_model(self, workspace_id, semantic_model_id):
|
3719
|
+
"""Delete a semantic model from a workspace
|
3720
|
+
Args:
|
3721
|
+
workspace_id (str): The ID of the workspace
|
3722
|
+
semantic_model_id (str): The ID of the semantic model
|
3723
|
+
Returns:
|
3724
|
+
int: The status code of the response
|
3725
|
+
"""
|
3726
|
+
return self.delete_item(workspace_id, semantic_model_id, type="semanticModels")
|
2421
3727
|
|
2422
3728
|
def get_semantic_model(self, workspace_id, semantic_model_id = None, semantic_model_name = None):
|
2423
3729
|
"""Get a semantic model from a workspace
|
@@ -2447,31 +3753,39 @@ class FabricClientCore(FabricClient):
|
|
2447
3753
|
|
2448
3754
|
return semmodel
|
2449
3755
|
|
2450
|
-
def
|
2451
|
-
"""
|
3756
|
+
def get_semantic_model_definition(self, workspace_id, semantic_model_id, format = None):
|
3757
|
+
"""Get the definition of a semantic model
|
2452
3758
|
Args:
|
2453
3759
|
workspace_id (str): The ID of the workspace
|
2454
3760
|
semantic_model_id (str): The ID of the semantic model
|
3761
|
+
format (str): The format of the definition
|
2455
3762
|
Returns:
|
2456
|
-
|
3763
|
+
dict: The definition of the semantic model
|
2457
3764
|
"""
|
2458
|
-
return self.
|
3765
|
+
return self.get_item_definition(workspace_id, semantic_model_id, type="semanticModels", format=format)
|
2459
3766
|
|
2460
|
-
|
2461
|
-
|
2462
|
-
|
2463
|
-
|
3767
|
+
def list_semantic_models(self, workspace_id, with_properties = False):
|
3768
|
+
"""List semantic models in a workspace
|
3769
|
+
Args:
|
3770
|
+
workspace_id (str): The ID of the workspace
|
3771
|
+
with_properties (bool): Whether to get the item object with properties
|
3772
|
+
Returns:
|
3773
|
+
list: The list of semantic models
|
3774
|
+
"""
|
3775
|
+
return self.list_items(workspace_id = workspace_id, type = "semanticModels", with_properties = with_properties)
|
2464
3776
|
|
2465
|
-
def
|
2466
|
-
"""
|
3777
|
+
def update_semantic_model(self, workspace_id, semantic_model_id, display_name = None, description = None, return_item=False):
|
3778
|
+
"""Update a semantic model in a workspace
|
2467
3779
|
Args:
|
2468
3780
|
workspace_id (str): The ID of the workspace
|
2469
3781
|
semantic_model_id (str): The ID of the semantic model
|
2470
|
-
|
3782
|
+
display_name (str): The display name of the semantic model
|
3783
|
+
description (str): The description of the semantic model
|
2471
3784
|
Returns:
|
2472
|
-
dict: The
|
3785
|
+
dict: The updated semantic model
|
2473
3786
|
"""
|
2474
|
-
return self.
|
3787
|
+
return self.update_item(workspace_id, semantic_model_id, display_name = display_name, description = description,
|
3788
|
+
type="semanticModels", return_item=return_item)
|
2475
3789
|
|
2476
3790
|
def update_semantic_model_definition(self, workspace_id, semantic_model_id, definition):
|
2477
3791
|
"""Update the definition of a semantic model
|
@@ -2483,6 +3797,7 @@ class FabricClientCore(FabricClient):
|
|
2483
3797
|
dict: The updated semantic model
|
2484
3798
|
"""
|
2485
3799
|
return self.update_item_definition(workspace_id, semantic_model_id, definition, type="semanticModels", wait_for_completion=False)
|
3800
|
+
|
2486
3801
|
# spark workspace custom pools
|
2487
3802
|
|
2488
3803
|
def create_workspace_custom_pool(self, workspace_id, name, node_family, node_size, auto_scale, dynamic_executor_allocation):
|
@@ -2566,7 +3881,7 @@ class FabricClientCore(FabricClient):
|
|
2566
3881
|
return sppools
|
2567
3882
|
|
2568
3883
|
def update_workspace_custom_pool(self, workspace_id, pool_id, name = None, node_family = None, node_size = None, auto_scale = None, dynamic_executor_allocation = None,
|
2569
|
-
return_item =
|
3884
|
+
return_item = False):
|
2570
3885
|
"""Update a workspace custom pool
|
2571
3886
|
Args:
|
2572
3887
|
workspace_id (str): The ID of the workspace
|
@@ -2600,14 +3915,6 @@ class FabricClientCore(FabricClient):
|
|
2600
3915
|
response_json = self.calling_routine(url, operation="PATCH", body=body, response_codes=[200, 429],
|
2601
3916
|
error_message="Error updating workspace custom pool", return_format="json")
|
2602
3917
|
|
2603
|
-
if return_item == "Default":
|
2604
|
-
warn(
|
2605
|
-
message="Warning: Updating an item currently will make invoke an additional API call to get the item "
|
2606
|
-
"object. This default behaviour will change in newer versions of the SDK. To keep this "
|
2607
|
-
"behaviour, set return_item=True in the function call.",
|
2608
|
-
category=FutureWarning,
|
2609
|
-
stacklevel=2
|
2610
|
-
)
|
2611
3918
|
if return_item:
|
2612
3919
|
return self.get_workspace_custom_pool(workspace_id, pool_id)
|
2613
3920
|
return response_json
|
@@ -2721,7 +4028,7 @@ class FabricClientCore(FabricClient):
|
|
2721
4028
|
"""
|
2722
4029
|
return self.list_items(workspace_id = workspace_id, type = "sparkJobDefinitions", with_properties = with_properties)
|
2723
4030
|
|
2724
|
-
def update_spark_job_definition(self, workspace_id, spark_job_definition_id, display_name = None, description = None, return_item=
|
4031
|
+
def update_spark_job_definition(self, workspace_id, spark_job_definition_id, display_name = None, description = None, return_item=False):
|
2725
4032
|
"""Update a spark job definition in a workspace
|
2726
4033
|
Args:
|
2727
4034
|
workspace_id (str): The ID of the workspace
|
@@ -2744,7 +4051,7 @@ class FabricClientCore(FabricClient):
|
|
2744
4051
|
dict: The definition of the spark job definition
|
2745
4052
|
"""
|
2746
4053
|
return self.get_item_definition(workspace_id, spark_job_definition_id, type="sparkJobDefinitions", format=format)
|
2747
|
-
|
4054
|
+
|
2748
4055
|
def update_spark_job_definition_definition(self, workspace_id, spark_job_definition_id, definition):
|
2749
4056
|
"""Update the definition of a spark job definition
|
2750
4057
|
Args:
|
@@ -2777,7 +4084,80 @@ class FabricClientCore(FabricClient):
|
|
2777
4084
|
item_id = spark_job_definition_id,
|
2778
4085
|
job_instance_id = job_instance_id)
|
2779
4086
|
|
4087
|
+
# sql database
|
4088
|
+
|
4089
|
+
def create_sql_database(self, workspace_id, display_name, description = None, definition = None):
|
4090
|
+
"""Create a SQL database in a workspace
|
4091
|
+
Args:
|
4092
|
+
workspace_id (str): The ID of the workspace
|
4093
|
+
display_name (str): The display name of the SQL database
|
4094
|
+
description (str): The description of the SQL database
|
4095
|
+
definition (dict): The definition of the SQL database
|
4096
|
+
Returns:
|
4097
|
+
dict: The created SQL database
|
4098
|
+
"""
|
4099
|
+
return self.create_item(workspace_id = workspace_id, display_name = display_name, type = "SQLDatabases", definition = definition, description = description)
|
4100
|
+
|
4101
|
+
def delete_sql_database(self, workspace_id, sql_database_id):
|
4102
|
+
"""Delete a SQL database from a workspace
|
4103
|
+
Args:
|
4104
|
+
workspace_id (str): The ID of the workspace
|
4105
|
+
sql_database_id (str): The ID of the SQL database
|
4106
|
+
Returns:
|
4107
|
+
int: The status code of the response
|
4108
|
+
"""
|
4109
|
+
return self.delete_item(workspace_id, sql_database_id, type="SQLDatabases")
|
2780
4110
|
|
4111
|
+
def get_sql_database(self, workspace_id, sql_database_id = None, sql_database_name = None):
|
4112
|
+
"""Get a SQL database from a workspace
|
4113
|
+
Args:
|
4114
|
+
workspace_id (str): The ID of the workspace
|
4115
|
+
sql_database_id (str): The ID of the SQL database
|
4116
|
+
sql_database_name (str): The name of the SQL database
|
4117
|
+
Returns:
|
4118
|
+
SQLDatabase: The SQL database object
|
4119
|
+
"""
|
4120
|
+
from msfabricpysdkcore.otheritems import SQLDatabase
|
4121
|
+
if sql_database_id is None and sql_database_name is not None:
|
4122
|
+
sql_databases = self.list_sql_databases(workspace_id)
|
4123
|
+
sql_databases = [sd for sd in sql_databases if sd.display_name == sql_database_name]
|
4124
|
+
if len(sql_databases) == 0:
|
4125
|
+
raise Exception(f"SQL database with name {sql_database_name} not found")
|
4126
|
+
sql_database_id = sql_databases[0].id
|
4127
|
+
elif sql_database_id is None:
|
4128
|
+
raise Exception("sql_database_id or the sql_database_name is required")
|
4129
|
+
|
4130
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/SQLDatabases/{sql_database_id}"
|
4131
|
+
|
4132
|
+
item_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
4133
|
+
error_message="Error getting SQL database", return_format="json")
|
4134
|
+
|
4135
|
+
return SQLDatabase.from_dict(item_dict, core_client=self)
|
4136
|
+
|
4137
|
+
def list_sql_databases(self, workspace_id, with_properties = False):
|
4138
|
+
"""List SQL databases in a workspace
|
4139
|
+
Args:
|
4140
|
+
workspace_id (str): The ID of the workspace
|
4141
|
+
with_properties (bool): Whether to get the item object with properties
|
4142
|
+
Returns:
|
4143
|
+
list: The list of SQL databases
|
4144
|
+
"""
|
4145
|
+
return self.list_items(workspace_id = workspace_id, type = "SQLDatabases", with_properties = with_properties)
|
4146
|
+
|
4147
|
+
def update_sql_database(self, workspace_id, sql_database_id, display_name = None, description = None, return_item=False):
|
4148
|
+
"""Update a SQL database in a workspace
|
4149
|
+
Args:
|
4150
|
+
workspace_id (str): The ID of the workspace
|
4151
|
+
sql_database_id (str): The ID of the SQL database
|
4152
|
+
display_name (str): The display name of the SQL database
|
4153
|
+
description (str): The description of the SQL database
|
4154
|
+
Returns:
|
4155
|
+
dict: The updated SQL database
|
4156
|
+
"""
|
4157
|
+
return self.update_item(workspace_id, sql_database_id, display_name = display_name, description = description,
|
4158
|
+
type="SQLDatabases", return_item=return_item)
|
4159
|
+
|
4160
|
+
|
2781
4161
|
# warehouses
|
2782
4162
|
|
2783
4163
|
def create_warehouse(self, workspace_id, display_name, description = None):
|
@@ -2837,7 +4217,7 @@ class FabricClientCore(FabricClient):
|
|
2837
4217
|
"""
|
2838
4218
|
return self.list_items(workspace_id = workspace_id, type = "warehouses", with_properties = with_properties)
|
2839
4219
|
|
2840
|
-
def update_warehouse(self, workspace_id, warehouse_id, display_name = None, description = None, return_item=
|
4220
|
+
def update_warehouse(self, workspace_id, warehouse_id, display_name = None, description = None, return_item=False):
|
2841
4221
|
"""Update a warehouse in a workspace
|
2842
4222
|
Args:
|
2843
4223
|
workspace_id (str): The ID of the workspace
|