msfabricpysdkcore 0.2.8__py3-none-any.whl → 0.2.10__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 +52 -14
- msfabricpysdkcore/client.py +2 -0
- msfabricpysdkcore/coreapi.py +906 -40
- msfabricpysdkcore/domain.py +36 -5
- msfabricpysdkcore/item.py +5 -0
- msfabricpysdkcore/lakehouse.py +45 -1
- msfabricpysdkcore/otheritems.py +216 -1
- msfabricpysdkcore/tests/test_anomaly_detector.py +60 -0
- msfabricpysdkcore/tests/test_dataflows.py +13 -0
- msfabricpysdkcore/tests/test_maps.py +60 -0
- msfabricpysdkcore/tests/test_sql_endpoint.py +12 -6
- msfabricpysdkcore/tests/test_warehouses.py +55 -0
- msfabricpysdkcore/tests/test_workspaces_capacities.py +12 -0
- msfabricpysdkcore/workspace.py +482 -9
- {msfabricpysdkcore-0.2.8.dist-info → msfabricpysdkcore-0.2.10.dist-info}/METADATA +81 -5
- {msfabricpysdkcore-0.2.8.dist-info → msfabricpysdkcore-0.2.10.dist-info}/RECORD +19 -17
- {msfabricpysdkcore-0.2.8.dist-info → msfabricpysdkcore-0.2.10.dist-info}/WHEEL +0 -0
- {msfabricpysdkcore-0.2.8.dist-info → msfabricpysdkcore-0.2.10.dist-info}/licenses/LICENSE +0 -0
- {msfabricpysdkcore-0.2.8.dist-info → msfabricpysdkcore-0.2.10.dist-info}/top_level.txt +0 -0
msfabricpysdkcore/coreapi.py
CHANGED
@@ -1128,11 +1128,13 @@ class FabricClientCore(FabricClient):
|
|
1128
1128
|
|
1129
1129
|
return response.status_code
|
1130
1130
|
|
1131
|
-
|
1131
|
+
|
1132
|
+
def git_connect(self, workspace_id, git_provider_details, my_git_credentials = None):
|
1132
1133
|
"""Connect git
|
1133
1134
|
Args:
|
1134
1135
|
workspace_id (str): The ID of the workspace
|
1135
1136
|
git_provider_details (dict): The git provider details
|
1137
|
+
my_git_credentials (dict): The git credentials
|
1136
1138
|
Returns:
|
1137
1139
|
int: The status code of the response
|
1138
1140
|
"""
|
@@ -1140,8 +1142,11 @@ class FabricClientCore(FabricClient):
|
|
1140
1142
|
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/git/connect"
|
1141
1143
|
|
1142
1144
|
payload = {
|
1143
|
-
'gitProviderDetails': git_provider_details
|
1145
|
+
'gitProviderDetails': git_provider_details,
|
1146
|
+
|
1144
1147
|
}
|
1148
|
+
if my_git_credentials:
|
1149
|
+
payload['myGitCredentials'] = my_git_credentials
|
1145
1150
|
|
1146
1151
|
response = self.calling_routine(url=url, operation="POST", body=payload,
|
1147
1152
|
response_codes=[200, 202, 429],
|
@@ -1248,17 +1253,21 @@ class FabricClientCore(FabricClient):
|
|
1248
1253
|
|
1249
1254
|
return response.status_code
|
1250
1255
|
|
1251
|
-
def update_my_git_credentials(self, workspace_id,
|
1256
|
+
def update_my_git_credentials(self, workspace_id, source, connection_id = None):
|
1252
1257
|
#PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/git/myGitCredentials
|
1253
1258
|
"""Update my git credentials
|
1254
1259
|
Args:
|
1255
|
-
|
1260
|
+
source (str): The git provider source
|
1261
|
+
connection_id (str): The connection ID
|
1256
1262
|
Returns:
|
1257
1263
|
dict: The response object
|
1258
1264
|
"""
|
1259
1265
|
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/git/myGitCredentials"
|
1260
1266
|
|
1261
|
-
body =
|
1267
|
+
body = {"source": source}
|
1268
|
+
|
1269
|
+
if connection_id:
|
1270
|
+
body['connectionId'] = connection_id
|
1262
1271
|
|
1263
1272
|
response = self.calling_routine(url=url, operation="PATCH", body=body,
|
1264
1273
|
response_codes=[200, 429],
|
@@ -1296,6 +1305,8 @@ class FabricClientCore(FabricClient):
|
|
1296
1305
|
"""
|
1297
1306
|
from msfabricpysdkcore.item import Item
|
1298
1307
|
|
1308
|
+
if item_dict["type"] == "AnomalyDetector":
|
1309
|
+
return self.get_anomaly_detector(workspace_id, item_dict["id"])
|
1299
1310
|
if item_dict["type"] == "ApacheAirflowJob":
|
1300
1311
|
return self.get_apache_airflow_job(workspace_id, item_dict["id"])
|
1301
1312
|
if item_dict["type"] == "CopyJob":
|
@@ -1322,6 +1333,8 @@ class FabricClientCore(FabricClient):
|
|
1322
1333
|
return self.get_kql_queryset(workspace_id, item_dict["id"])
|
1323
1334
|
if item_dict["type"] == "Lakehouse":
|
1324
1335
|
return self.get_lakehouse(workspace_id, item_dict["id"])
|
1336
|
+
if item_dict["type"] == "Map":
|
1337
|
+
return self.get_map(workspace_id, item_dict["id"])
|
1325
1338
|
if item_dict["type"] == "MirroredAzureDatabricksCatalog":
|
1326
1339
|
return self.get_mirrored_azure_databricks_catalog(workspace_id, item_dict["id"])
|
1327
1340
|
if item_dict["type"] == "MirroredDatabase":
|
@@ -1392,7 +1405,8 @@ class FabricClientCore(FabricClient):
|
|
1392
1405
|
if folder_id:
|
1393
1406
|
body['folderId'] = folder_id
|
1394
1407
|
|
1395
|
-
if type in ["
|
1408
|
+
if type in ["anomalydetectors",
|
1409
|
+
"ApacheAirflowJobs",
|
1396
1410
|
"copyJobs",
|
1397
1411
|
"VariableLibraries",
|
1398
1412
|
"dataflows",
|
@@ -1407,6 +1421,7 @@ class FabricClientCore(FabricClient):
|
|
1407
1421
|
"kqlDashboards",
|
1408
1422
|
"kqlQuerysets",
|
1409
1423
|
"lakehouses",
|
1424
|
+
"Maps",
|
1410
1425
|
"mirroredAzureDatabricksCatalogs",
|
1411
1426
|
"mirroredDatabases",
|
1412
1427
|
"mlExperiments",
|
@@ -1441,7 +1456,8 @@ class FabricClientCore(FabricClient):
|
|
1441
1456
|
item = None
|
1442
1457
|
i = 0
|
1443
1458
|
|
1444
|
-
type_mapping = {"
|
1459
|
+
type_mapping = {"anomalydetectors": "AnomalyDetector",
|
1460
|
+
"ApacheAirflowJobs": "ApacheAirflowJob",
|
1445
1461
|
"copyJobs": "CopyJob",
|
1446
1462
|
"VariableLibraries": "VariableLibrary",
|
1447
1463
|
"dataflows": "Dataflow",
|
@@ -1456,6 +1472,7 @@ class FabricClientCore(FabricClient):
|
|
1456
1472
|
"kqlDatabases": "KQLDatabase",
|
1457
1473
|
"kqlQuerysets": "KQLQueryset",
|
1458
1474
|
"lakehouses": "Lakehouse",
|
1475
|
+
"Maps": "Map",
|
1459
1476
|
"mirroredAzureDatabricksCatalogs": "MirroredAzureDatabricksCatalog",
|
1460
1477
|
"mirroredDatabases": "MirroredDatabase",
|
1461
1478
|
"mlExperiments": "MLExperiment",
|
@@ -1501,33 +1518,6 @@ class FabricClientCore(FabricClient):
|
|
1501
1518
|
Raises:
|
1502
1519
|
Exception: If item_id or the combination item_name + item_type is required
|
1503
1520
|
"""
|
1504
|
-
if item_type:
|
1505
|
-
if item_type.lower() == "datapipeline":
|
1506
|
-
return self.get_data_pipeline(workspace_id, item_id, item_name)
|
1507
|
-
if item_type.lower() == "eventstream":
|
1508
|
-
return self.get_eventstream(workspace_id, item_id, item_name)
|
1509
|
-
if item_type.lower() == "kqldashboard":
|
1510
|
-
return self.get_kql_dashboard(workspace_id, item_id, item_name)
|
1511
|
-
if item_type.lower() == "kqldatabase":
|
1512
|
-
return self.get_kql_database(workspace_id, item_id, item_name)
|
1513
|
-
if item_type.lower() == "kqlqueryset":
|
1514
|
-
return self.get_kql_queryset(workspace_id, item_id, item_name)
|
1515
|
-
if item_type.lower() == "lakehouse":
|
1516
|
-
return self.get_lakehouse(workspace_id, item_id, item_name)
|
1517
|
-
if item_type.lower() == "mlmodel":
|
1518
|
-
return self.get_ml_model(workspace_id, item_id, item_name)
|
1519
|
-
if item_type.lower() == "mlexperiment":
|
1520
|
-
return self.get_ml_experiment(workspace_id, item_id, item_name)
|
1521
|
-
if item_type.lower() == "notebook":
|
1522
|
-
return self.get_notebook(workspace_id, item_id, item_name)
|
1523
|
-
if item_type.lower() == "report":
|
1524
|
-
return self.get_report(workspace_id, item_id, item_name)
|
1525
|
-
if item_type.lower() == "semanticmodel":
|
1526
|
-
return self.get_semantic_model(workspace_id, item_id, item_name)
|
1527
|
-
if item_type.lower() == "sparkjobdefinition":
|
1528
|
-
return self.get_spark_job_definition(workspace_id, item_id, item_name)
|
1529
|
-
if item_type.lower() == "warehouse":
|
1530
|
-
return self.get_warehouse(workspace_id, item_id, item_name)
|
1531
1521
|
|
1532
1522
|
if item_id is None and item_name is not None and item_type is not None:
|
1533
1523
|
return self.get_item_by_name(workspace_id, item_name, item_type)
|
@@ -2005,7 +1995,46 @@ class FabricClientCore(FabricClient):
|
|
2005
1995
|
shortcut_dict['itemId'] = item_id
|
2006
1996
|
return OneLakeShortcut.from_dict(shortcut_dict,
|
2007
1997
|
core_client = self)
|
2008
|
-
|
1998
|
+
|
1999
|
+
|
2000
|
+
def create_shortcuts_bulk(self, workspace_id, item_id, create_shortcut_requests):
|
2001
|
+
"""
|
2002
|
+
Bulk create OneLake shortcuts.
|
2003
|
+
|
2004
|
+
Args:
|
2005
|
+
workspace_id (str)
|
2006
|
+
item_id (str)
|
2007
|
+
create_shortcut_requests (list[dict]): Each dict must have:
|
2008
|
+
path, name, target (target has 'oneLake' OR 'adlsGen2' child object)
|
2009
|
+
|
2010
|
+
Returns:
|
2011
|
+
dict: The results of the operation
|
2012
|
+
"""
|
2013
|
+
if not isinstance(create_shortcut_requests, list) or len(create_shortcut_requests) == 0:
|
2014
|
+
raise Exception("create_shortcut_requests must be a non-empty list.")
|
2015
|
+
|
2016
|
+
required_keys = {"path", "name", "target"}
|
2017
|
+
for idx, req in enumerate(create_shortcut_requests):
|
2018
|
+
if not isinstance(req, dict):
|
2019
|
+
raise Exception(f"Shortcut request at index {idx} is not a dict.")
|
2020
|
+
missing = required_keys - set(req.keys())
|
2021
|
+
if missing:
|
2022
|
+
raise Exception(f"Shortcut request at index {idx} missing keys: {missing}")
|
2023
|
+
|
2024
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/shortcuts/bulkCreate"
|
2025
|
+
body = {
|
2026
|
+
"createShortcutRequests": create_shortcut_requests
|
2027
|
+
}
|
2028
|
+
|
2029
|
+
return self.calling_routine(
|
2030
|
+
url=url,
|
2031
|
+
operation="POST",
|
2032
|
+
body=body,
|
2033
|
+
response_codes=[200, 202, 429],
|
2034
|
+
error_message="Error creating shortcuts in bulk",
|
2035
|
+
return_format="value_json+operation_result",
|
2036
|
+
wait_for_completion=True
|
2037
|
+
)
|
2009
2038
|
|
2010
2039
|
def get_shortcut(self, workspace_id, item_id, path, name):
|
2011
2040
|
"""Get the shortcut in the item
|
@@ -2028,7 +2057,8 @@ class FabricClientCore(FabricClient):
|
|
2028
2057
|
shortcut_dict['itemId'] = id
|
2029
2058
|
return OneLakeShortcut.from_dict(shortcut_dict,
|
2030
2059
|
core_client = self)
|
2031
|
-
|
2060
|
+
|
2061
|
+
|
2032
2062
|
def delete_shortcut(self, workspace_id, item_id, path, name):
|
2033
2063
|
"""Delete the shortcut
|
2034
2064
|
Args:
|
@@ -2266,6 +2296,21 @@ class FabricClientCore(FabricClient):
|
|
2266
2296
|
response = self.calling_routine(url, operation="POST", response_codes=[200, 201, 202, 429], error_message="Error deprovisioning identity", return_format="response")
|
2267
2297
|
|
2268
2298
|
return response
|
2299
|
+
|
2300
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/networking/communicationPolicy
|
2301
|
+
def get_network_communication_policy(self, workspace_id):
|
2302
|
+
"""Get the network communication policy for a workspace
|
2303
|
+
Args:
|
2304
|
+
workspace_id (str): The ID of the workspace
|
2305
|
+
Returns:
|
2306
|
+
dict: The network communication policy
|
2307
|
+
"""
|
2308
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/networking/communicationPolicy"
|
2309
|
+
|
2310
|
+
response_json = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
2311
|
+
error_message="Error getting network communication policy", return_format="json")
|
2312
|
+
|
2313
|
+
return response_json
|
2269
2314
|
|
2270
2315
|
def get_workspace(self, id = None, name = None, return_item=True):
|
2271
2316
|
"""Get workspace by id or name
|
@@ -2368,6 +2413,35 @@ class FabricClientCore(FabricClient):
|
|
2368
2413
|
response = self.calling_routine(url, operation="POST", response_codes=[200, 201, 202, 429], error_message="Error provisioning identity", return_format="response")
|
2369
2414
|
return response
|
2370
2415
|
|
2416
|
+
# PUT https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/networking/communicationPolicy
|
2417
|
+
def set_network_communication_policy(self, workspace_id, inbound, outbound, if_match = None):
|
2418
|
+
"""Set the network communication policy for a workspace to allow all traffic
|
2419
|
+
Args:
|
2420
|
+
workspace_id (str): The ID of the workspace
|
2421
|
+
inbound (list): The list of inbound rules
|
2422
|
+
outbound (list): The list of outbound rules
|
2423
|
+
if_match (str): The ETag value to match
|
2424
|
+
Returns:
|
2425
|
+
dict: The updated network communication policy
|
2426
|
+
"""
|
2427
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/networking/communicationPolicy"
|
2428
|
+
|
2429
|
+
headers = self.auth.get_headers()
|
2430
|
+
if if_match:
|
2431
|
+
headers['If-Match'] = if_match
|
2432
|
+
|
2433
|
+
body = {
|
2434
|
+
"inbound": inbound,
|
2435
|
+
"outbound": outbound,
|
2436
|
+
}
|
2437
|
+
|
2438
|
+
response = self.calling_routine(url, operation="PUT", body=body, headers=headers,
|
2439
|
+
response_codes=[200, 429], error_message="Error setting network communication policy",
|
2440
|
+
return_format="response")
|
2441
|
+
|
2442
|
+
return response
|
2443
|
+
|
2444
|
+
|
2371
2445
|
def unassign_from_capacity(self, workspace_id, wait_for_completion = True):
|
2372
2446
|
"""Unassign a workspace from a capacity
|
2373
2447
|
Args:
|
@@ -2436,10 +2510,6 @@ class FabricClientCore(FabricClient):
|
|
2436
2510
|
"""List datamarts in a workspace"""
|
2437
2511
|
return self.list_items(workspace_id, type="datamarts")
|
2438
2512
|
|
2439
|
-
def list_sql_endpoints(self, workspace_id):
|
2440
|
-
"""List sql endpoints in a workspace"""
|
2441
|
-
return self.list_items(workspace_id, type="sqlEndpoints")
|
2442
|
-
|
2443
2513
|
def list_mirrored_warehouses(self, workspace_id):
|
2444
2514
|
"""List mirrored warehouses in a workspace"""
|
2445
2515
|
return self.list_items(workspace_id, type="mirroredWarehouses")
|
@@ -2553,6 +2623,115 @@ class FabricClientCore(FabricClient):
|
|
2553
2623
|
"""
|
2554
2624
|
return self.update_item_definition(workspace_id, apache_airflow_job_id, type="ApacheAirflowJobs", definition=definition, update_metadata=update_metadata)
|
2555
2625
|
|
2626
|
+
# Anomaly Detectors
|
2627
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/anomalydetectors
|
2628
|
+
def create_anomaly_detector(self, workspace_id, display_name, definition = None, description = None, folder_id = None):
|
2629
|
+
"""Create an anomaly detector in a workspace
|
2630
|
+
Args:
|
2631
|
+
workspace_id (str): The ID of the workspace
|
2632
|
+
display_name (str): The display name of the anomaly detector
|
2633
|
+
definition (dict): The definition of the anomaly detector
|
2634
|
+
description (str): The description of the anomaly detector
|
2635
|
+
folder_id (str): The ID of the folder to create the anomaly detector in
|
2636
|
+
Returns:
|
2637
|
+
AnomalyDetector: The created anomaly detector object
|
2638
|
+
"""
|
2639
|
+
return self.create_item(workspace_id=workspace_id,
|
2640
|
+
display_name = display_name,
|
2641
|
+
type = "anomalydetectors",
|
2642
|
+
definition = definition,
|
2643
|
+
description = description, folder_id=folder_id)
|
2644
|
+
|
2645
|
+
# DELETE https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/anomalydetectors/{anomalyDetectorId}
|
2646
|
+
def delete_anomaly_detector(self, workspace_id, anomaly_detector_id):
|
2647
|
+
"""Delete an anomaly detector from a workspace
|
2648
|
+
Args:
|
2649
|
+
workspace_id (str): The ID of the workspace
|
2650
|
+
anomaly_detector_id (str): The ID of the anomaly detector
|
2651
|
+
Returns:
|
2652
|
+
int: The status code of the response
|
2653
|
+
"""
|
2654
|
+
return self.delete_item(workspace_id, item_id=anomaly_detector_id, type="anomalydetectors")
|
2655
|
+
|
2656
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/anomalydetectors/{anomalyDetectorId}
|
2657
|
+
def get_anomaly_detector(self, workspace_id, anomaly_detector_id = None, anomaly_detector_name = None):
|
2658
|
+
"""Get an anomaly detector from a workspace
|
2659
|
+
Args:
|
2660
|
+
workspace_id (str): The ID of the workspace
|
2661
|
+
anomaly_detector_id (str): The ID of the anomaly detector
|
2662
|
+
anomaly_detector_name (str): The name of the anomaly detector
|
2663
|
+
Returns:
|
2664
|
+
AnomalyDetector: The anomaly detector object
|
2665
|
+
"""
|
2666
|
+
from msfabricpysdkcore.otheritems import AnomalyDetector
|
2667
|
+
|
2668
|
+
if anomaly_detector_id is None and anomaly_detector_name is not None:
|
2669
|
+
anomaly_detectors = self.list_anomaly_detectors(workspace_id)
|
2670
|
+
ads = [ad for ad in anomaly_detectors if ad.display_name == anomaly_detector_name]
|
2671
|
+
if len(ads) == 0:
|
2672
|
+
raise Exception(f"Anomaly detector with name {anomaly_detector_name} not found")
|
2673
|
+
anomaly_detector_id = ads[0].id
|
2674
|
+
elif anomaly_detector_id is None:
|
2675
|
+
raise Exception("anomaly_detector_id or the anomaly_detector_name is required")
|
2676
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/anomalydetectors/{anomaly_detector_id}"
|
2677
|
+
item_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
2678
|
+
error_message="Error getting anomaly detector", return_format="json")
|
2679
|
+
ad = AnomalyDetector.from_dict(item_dict, core_client=self)
|
2680
|
+
ad.get_definition()
|
2681
|
+
return ad
|
2682
|
+
|
2683
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/anomalydetectors/{anomalyDetectorId}/getDefinition
|
2684
|
+
def get_anomaly_detector_definition(self, workspace_id, anomaly_detector_id, format = None):
|
2685
|
+
"""Get the definition of an anomaly detector
|
2686
|
+
Args:
|
2687
|
+
workspace_id (str): The ID of the workspace
|
2688
|
+
anomaly_detector_id (str): The ID of the anomaly detector
|
2689
|
+
format (str): The format of the definition
|
2690
|
+
Returns:
|
2691
|
+
dict: The anomaly detector definition
|
2692
|
+
"""
|
2693
|
+
return self.get_item_definition(workspace_id, anomaly_detector_id, type="anomalydetectors", format=format)
|
2694
|
+
|
2695
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/anomalydetectors
|
2696
|
+
def list_anomaly_detectors(self, workspace_id, with_properties = False):
|
2697
|
+
"""List anomaly detectors in a workspace
|
2698
|
+
Args:
|
2699
|
+
workspace_id (str): The ID of the workspace
|
2700
|
+
with_properties (bool): Whether to get the item object with properties
|
2701
|
+
Returns:
|
2702
|
+
list: The list of anomaly detectors
|
2703
|
+
"""
|
2704
|
+
return self.list_items(workspace_id, type="anomalydetectors", with_properties=with_properties)
|
2705
|
+
|
2706
|
+
# PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/anomalydetectors/{anomalyDetectorId}
|
2707
|
+
def update_anomaly_detector(self, workspace_id, anomaly_detector_id,
|
2708
|
+
display_name = None, description = None, return_item=False):
|
2709
|
+
"""Update an anomaly detector in a workspace
|
2710
|
+
Args:
|
2711
|
+
workspace_id (str): The ID of the workspace
|
2712
|
+
anomaly_detector_id (str): The ID of the anomaly detector
|
2713
|
+
display_name (str): The display name of the anomaly detector
|
2714
|
+
description (str): The description of the anomaly detector
|
2715
|
+
return_item (bool): Whether to return the item object
|
2716
|
+
Returns:
|
2717
|
+
dict: The updated anomaly detector or AnomalyDetector object if return_item is True
|
2718
|
+
"""
|
2719
|
+
return self.update_item(workspace_id, item_id=anomaly_detector_id, display_name=display_name, description=description, type="anomalydetectors",
|
2720
|
+
return_item=return_item)
|
2721
|
+
|
2722
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/anomalydetectors/{anomalyDetectorId}/updateDefinition
|
2723
|
+
def update_anomaly_detector_definition(self, workspace_id, anomaly_detector_id, definition, update_metadata = None):
|
2724
|
+
"""Update the definition of an anomaly detector
|
2725
|
+
Args:
|
2726
|
+
workspace_id (str): The ID of the workspace
|
2727
|
+
anomaly_detector_id (str): The ID of the anomaly detector
|
2728
|
+
definition (dict): The definition of the anomaly detector
|
2729
|
+
update_metadata (bool): Whether to update the metadata
|
2730
|
+
Returns:
|
2731
|
+
dict: The updated anomaly detector definition
|
2732
|
+
"""
|
2733
|
+
return self.update_item_definition(workspace_id, anomaly_detector_id, type="anomalydetectors", definition=definition, update_metadata=update_metadata)
|
2734
|
+
|
2556
2735
|
# copyJobs
|
2557
2736
|
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/copyJobs
|
2558
2737
|
def create_copy_job(self, workspace_id, display_name, definition = None, description = None):
|
@@ -2789,6 +2968,24 @@ class FabricClientCore(FabricClient):
|
|
2789
2968
|
"""
|
2790
2969
|
return self.delete_item(workspace_id, item_id=dataflow_id, type="dataflows")
|
2791
2970
|
|
2971
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/dataflows/{dataflowId}/parameters?continuationToken={continuationToken}
|
2972
|
+
def discover_dataflow_parameters(self, workspace_id, dataflow_id):
|
2973
|
+
"""List parameters for a dataflow in a workspace
|
2974
|
+
Args:
|
2975
|
+
workspace_id (str): The ID of the workspace
|
2976
|
+
dataflow_id (str): The ID of the dataflow
|
2977
|
+
Returns:
|
2978
|
+
list: The list of dataflow parameters
|
2979
|
+
"""
|
2980
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/dataflows/{dataflow_id}/parameters"
|
2981
|
+
|
2982
|
+
parameters = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
2983
|
+
error_message="Error listing dataflow parameters", return_format = "value_json",
|
2984
|
+
paging = True)
|
2985
|
+
|
2986
|
+
return parameters
|
2987
|
+
|
2988
|
+
|
2792
2989
|
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/dataflows/{dataflowId}
|
2793
2990
|
def get_dataflow(self, workspace_id, dataflow_id = None, dataflow_name = None):
|
2794
2991
|
"""Get a dataflow from a workspace
|
@@ -4743,6 +4940,89 @@ class FabricClientCore(FabricClient):
|
|
4743
4940
|
|
4744
4941
|
return items
|
4745
4942
|
|
4943
|
+
# Materialized view
|
4944
|
+
|
4945
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/lakehouses/{lakehouseId}/jobs/RefreshMaterializedLakeViews/schedules
|
4946
|
+
def create_refresh_materialized_lake_view_schedule(self, workspace_id, lakehouse_id, enabled, configuration):
|
4947
|
+
"""Create a refresh materialized lake view schedule
|
4948
|
+
Args:
|
4949
|
+
workspace_id (str): The ID of the workspace
|
4950
|
+
lakehouse_id (str): The ID of the lakehouse
|
4951
|
+
enabled (bool): Whether the schedule is enabled
|
4952
|
+
configuration (dict): The configuration of the schedule
|
4953
|
+
Returns:
|
4954
|
+
dict: The created schedule
|
4955
|
+
"""
|
4956
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/lakehouses/{lakehouse_id}/jobs/RefreshMaterializedLakeViews/schedules"
|
4957
|
+
|
4958
|
+
body = {
|
4959
|
+
"enabled": enabled,
|
4960
|
+
"configuration": configuration
|
4961
|
+
}
|
4962
|
+
|
4963
|
+
item_dict = self.calling_routine(url, operation="POST", body=body, response_codes=[200, 201, 429],
|
4964
|
+
error_message="Error creating refresh materialized lake view schedule", return_format="json")
|
4965
|
+
|
4966
|
+
return item_dict
|
4967
|
+
|
4968
|
+
# DELETE https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/lakehouses/{lakehouseId}/jobs/RefreshMaterializedLakeViews/schedules/{scheduleId}
|
4969
|
+
def delete_refresh_materialized_lake_view_schedule(self, workspace_id, lakehouse_id, schedule_id):
|
4970
|
+
"""Delete a refresh materialized lake view schedule
|
4971
|
+
Args:
|
4972
|
+
workspace_id (str): The ID of the workspace
|
4973
|
+
lakehouse_id (str): The ID of the lakehouse
|
4974
|
+
schedule_id (str): The ID of the schedule
|
4975
|
+
Returns:
|
4976
|
+
int: The status code of the response
|
4977
|
+
"""
|
4978
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/lakehouses/{lakehouse_id}/jobs/RefreshMaterializedLakeViews/schedules/{schedule_id}"
|
4979
|
+
|
4980
|
+
response = self.calling_routine(url, operation="DELETE", response_codes=[200, 204, 429],
|
4981
|
+
error_message="Error deleting refresh materialized lake view schedule", return_format="response")
|
4982
|
+
|
4983
|
+
return response.status_code
|
4984
|
+
|
4985
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/lakehouses/{lakehouseId}/jobs/instances?jobType={jobType}
|
4986
|
+
def run_on_demand_refresh_materialized_lake_view(self, workspace_id, lakehouse_id, job_type="RefreshMaterializedLakeViews"):
|
4987
|
+
"""Run refresh materialized lake view
|
4988
|
+
Args:
|
4989
|
+
workspace_id (str): The ID of the workspace
|
4990
|
+
lakehouse_id (str): The ID of the lakehouse
|
4991
|
+
job_type (str): The job type
|
4992
|
+
Returns:
|
4993
|
+
dict: The operation result or response value
|
4994
|
+
"""
|
4995
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/lakehouses/{lakehouse_id}/jobs/instances?jobType={job_type}"
|
4996
|
+
|
4997
|
+
|
4998
|
+
response = self.calling_routine(url, operation="POST", response_codes=[200, 202, 429],
|
4999
|
+
error_message="Error running refresh materialized lake view",
|
5000
|
+
return_format="response")
|
5001
|
+
|
5002
|
+
return response
|
5003
|
+
|
5004
|
+
# PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/lakehouses/{lakehouseId}/jobs/RefreshMaterializedLakeViews/schedules/{scheduleId}
|
5005
|
+
def update_refresh_materialized_lake_view_schedule(self, workspace_id, lakehouse_id, schedule_id, enabled, configuration):
|
5006
|
+
"""Update a refresh materialized lake view schedule
|
5007
|
+
Args:
|
5008
|
+
workspace_id (str): The ID of the workspace
|
5009
|
+
lakehouse_id (str): The ID of the lakehouse
|
5010
|
+
schedule_id (str): The ID of the schedule
|
5011
|
+
enabled (bool): Whether the schedule is enabled
|
5012
|
+
configuration (dict): The configuration of the schedule
|
5013
|
+
Returns:
|
5014
|
+
dict: The updated schedule
|
5015
|
+
"""
|
5016
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/lakehouses/{lakehouse_id}/jobs/RefreshMaterializedLakeViews/schedules/{schedule_id}"
|
5017
|
+
|
5018
|
+
body = {}
|
5019
|
+
body["enabled"] = enabled
|
5020
|
+
body["configuration"] = configuration
|
5021
|
+
|
5022
|
+
item_dict = self.calling_routine(url, operation="PATCH", body=body, response_codes=[200, 429],
|
5023
|
+
error_message="Error updating refresh materialized lake view schedule", return_format="json")
|
5024
|
+
|
5025
|
+
return item_dict
|
4746
5026
|
|
4747
5027
|
# mirrored_database
|
4748
5028
|
|
@@ -5045,6 +5325,295 @@ class FabricClientCore(FabricClient):
|
|
5045
5325
|
return self.update_item(workspace_id, ml_model_id, display_name = display_name, description = description,
|
5046
5326
|
type="mlModels", return_item=return_item)
|
5047
5327
|
|
5328
|
+
# MLmodel endpoint
|
5329
|
+
|
5330
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/mlmodels/{modelId}/endpoint/versions/{name}/activate
|
5331
|
+
def activate_ml_model_endpoint_version(self, workspace_id, model_id, name, wait_for_completion = False):
|
5332
|
+
"""Activate an ml model endpoint version
|
5333
|
+
Args:
|
5334
|
+
workspace_id (str): The ID of the workspace
|
5335
|
+
model_id (str): The ID of the ml model
|
5336
|
+
name (str): The name of the endpoint version
|
5337
|
+
Returns:
|
5338
|
+
dict: The activated endpoint version
|
5339
|
+
"""
|
5340
|
+
|
5341
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mlmodels/{model_id}/endpoint/versions/{name}/activate"
|
5342
|
+
return self.calling_routine(url, operation="POST", response_codes=[200, 202, 429],
|
5343
|
+
error_message="Error activating ml model endpoint version", return_format="json", wait_for_completion=wait_for_completion)
|
5344
|
+
|
5345
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/mlmodels/{modelId}/endpoint/versions/deactivateAll
|
5346
|
+
def deactivate_all_ml_model_endpoint_versions(self, workspace_id, model_id, wait_for_completion = False):
|
5347
|
+
"""Deactivate all ml model endpoint versions
|
5348
|
+
Args:
|
5349
|
+
workspace_id (str): The ID of the workspace
|
5350
|
+
model_id (str): The ID of the ml model
|
5351
|
+
Returns:
|
5352
|
+
Response: The operation result
|
5353
|
+
"""
|
5354
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mlmodels/{model_id}/endpoint/versions/deactivateAll"
|
5355
|
+
return self.calling_routine(url, operation="POST", response_codes=[200, 202, 429],
|
5356
|
+
error_message="Error deactivating all ml model endpoint versions", return_format="response", wait_for_completion=wait_for_completion)
|
5357
|
+
|
5358
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/mlmodels/{modelId}/endpoint/versions/{name}/deactivate
|
5359
|
+
def deactivate_ml_model_endpoint_version(self, workspace_id, model_id, name, wait_for_completion = False):
|
5360
|
+
"""Deactivate an ml model endpoint version
|
5361
|
+
Args:
|
5362
|
+
workspace_id (str): The ID of the workspace
|
5363
|
+
model_id (str): The ID of the ml model
|
5364
|
+
name (str): The name of the endpoint version
|
5365
|
+
Returns:
|
5366
|
+
Response: The operation result
|
5367
|
+
"""
|
5368
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mlmodels/{model_id}/endpoint/versions/{name}/deactivate"
|
5369
|
+
return self.calling_routine(url, operation="POST", response_codes=[200, 202, 429],
|
5370
|
+
error_message="Error deactivating ml model endpoint version", return_format="response", wait_for_completion=wait_for_completion)
|
5371
|
+
|
5372
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/mlmodels/{modelId}/endpoint
|
5373
|
+
def get_ml_model_endpoint(self, workspace_id, model_id):
|
5374
|
+
"""Get the ml model endpoint
|
5375
|
+
Args:
|
5376
|
+
workspace_id (str): The ID of the workspace
|
5377
|
+
model_id (str): The ID of the ml model
|
5378
|
+
Returns:
|
5379
|
+
dict: The ml model endpoint
|
5380
|
+
"""
|
5381
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mlmodels/{model_id}/endpoint"
|
5382
|
+
return self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
5383
|
+
error_message="Error getting ml model endpoint", return_format="json")
|
5384
|
+
|
5385
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/mlmodels/{modelId}/endpoint/versions/{name}
|
5386
|
+
def get_ml_model_endpoint_version(self, workspace_id, model_id, name):
|
5387
|
+
"""Get an ml model endpoint version
|
5388
|
+
Args:
|
5389
|
+
workspace_id (str): The ID of the workspace
|
5390
|
+
model_id (str): The ID of the ml model
|
5391
|
+
name (str): The name of the endpoint version
|
5392
|
+
Returns:
|
5393
|
+
dict: The ml model endpoint version
|
5394
|
+
"""
|
5395
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mlmodels/{model_id}/endpoint/versions/{name}"
|
5396
|
+
return self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
5397
|
+
error_message="Error getting ml model endpoint version", return_format="json")
|
5398
|
+
|
5399
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/mlmodels/{modelId}/endpoint/versions?continuationToken={continuationToken}
|
5400
|
+
def list_ml_model_endpoint_versions(self, workspace_id, model_id):
|
5401
|
+
"""List all ml model endpoint versions
|
5402
|
+
Args:
|
5403
|
+
workspace_id (str): The ID of the workspace
|
5404
|
+
model_id (str): The ID of the ml model
|
5405
|
+
Returns:
|
5406
|
+
list: The list of ml model endpoint versions
|
5407
|
+
"""
|
5408
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mlmodels/{model_id}/endpoint/versions"
|
5409
|
+
return self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
5410
|
+
error_message="Error listing ml model endpoint versions", return_format="value_json", paging=True)
|
5411
|
+
|
5412
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/mlModels/{modelId}/endpoint/score
|
5413
|
+
def score_ml_model_endpoint(self, workspace_id, model_id, inputs, format_type = None, orientation = None):
|
5414
|
+
"""Score an ml model endpoint
|
5415
|
+
Args:
|
5416
|
+
workspace_id (str): The ID of the workspace
|
5417
|
+
model_id (str): The ID of the ml model
|
5418
|
+
inputs (list): The inputs to score
|
5419
|
+
format_type (str): The format type
|
5420
|
+
orientation (str): The orientation
|
5421
|
+
Returns:
|
5422
|
+
dict: The scoring result
|
5423
|
+
"""
|
5424
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mlModels/{model_id}/endpoint/score"
|
5425
|
+
|
5426
|
+
body = {
|
5427
|
+
"inputs": inputs
|
5428
|
+
}
|
5429
|
+
|
5430
|
+
if format_type:
|
5431
|
+
body["formatType"] = format_type
|
5432
|
+
if orientation:
|
5433
|
+
body["orientation"] = orientation
|
5434
|
+
|
5435
|
+
return self.calling_routine(url, operation="POST", body=body, response_codes=[200, 429],
|
5436
|
+
error_message="Error scoring ml model endpoint", return_format="json")
|
5437
|
+
|
5438
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/mlmodels/{modelId}/endpoint/versions/{name}/score
|
5439
|
+
def score_ml_model_endpoint_version(self, workspace_id, model_id, name, inputs, format_type = None, orientation = None):
|
5440
|
+
"""Score an ml model endpoint version
|
5441
|
+
Args:
|
5442
|
+
workspace_id (str): The ID of the workspace
|
5443
|
+
model_id (str): The ID of the ml model
|
5444
|
+
name (str): The name of the endpoint version
|
5445
|
+
inputs (list): The inputs to score
|
5446
|
+
format_type (str): The format type
|
5447
|
+
orientation (str): The orientation
|
5448
|
+
Returns:
|
5449
|
+
dict: The scoring result
|
5450
|
+
"""
|
5451
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mlmodels/{model_id}/endpoint/versions/{name}/score"
|
5452
|
+
|
5453
|
+
body = {
|
5454
|
+
"inputs": inputs
|
5455
|
+
}
|
5456
|
+
|
5457
|
+
if format_type:
|
5458
|
+
body["formatType"] = format_type
|
5459
|
+
if orientation:
|
5460
|
+
body["orientation"] = orientation
|
5461
|
+
|
5462
|
+
return self.calling_routine(url, operation="POST", body=body, response_codes=[200, 429],
|
5463
|
+
error_message="Error scoring ml model endpoint version", return_format="json")
|
5464
|
+
|
5465
|
+
# PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/mlmodels/{modelId}/endpoint
|
5466
|
+
def update_ml_model_endpoint(self, workspace_id, model_id, default_version_assignment_behavior, default_version_name):
|
5467
|
+
"""Update an ml model endpoint
|
5468
|
+
Args:
|
5469
|
+
workspace_id (str): The ID of the workspace
|
5470
|
+
model_id (str): The ID of the ml model
|
5471
|
+
default_version_assignment_behavior (str): The default version assignment behavior
|
5472
|
+
default_version_name (str): The default version name
|
5473
|
+
Returns:
|
5474
|
+
dict: The updated endpoint
|
5475
|
+
"""
|
5476
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mlmodels/{model_id}/endpoint"
|
5477
|
+
|
5478
|
+
body = {
|
5479
|
+
"defaultVersionAssignmentBehavior": default_version_assignment_behavior,
|
5480
|
+
"defaultVersionName": default_version_name
|
5481
|
+
}
|
5482
|
+
|
5483
|
+
return self.calling_routine(url, operation="PATCH", body=body, response_codes=[200, 429],
|
5484
|
+
error_message="Error updating ml model endpoint", return_format="json")
|
5485
|
+
|
5486
|
+
|
5487
|
+
# PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/mlmodels/{modelId}/endpoint/versions/{name}
|
5488
|
+
def update_ml_model_endpoint_version(self, workspace_id, model_id, name, scale_rule):
|
5489
|
+
"""Update an ml model endpoint version
|
5490
|
+
Args:
|
5491
|
+
workspace_id (str): The ID of the workspace
|
5492
|
+
model_id (str): The ID of the ml model
|
5493
|
+
name (str): The name of the endpoint version
|
5494
|
+
scale_rule (str): The scale rule
|
5495
|
+
Returns:
|
5496
|
+
dict: The updated endpoint version
|
5497
|
+
"""
|
5498
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mlmodels/{model_id}/endpoint/versions/{name}"
|
5499
|
+
|
5500
|
+
body = {
|
5501
|
+
"scaleRule": scale_rule
|
5502
|
+
}
|
5503
|
+
|
5504
|
+
return self.calling_routine(url, operation="PATCH", body=body, response_codes=[200, 429],
|
5505
|
+
error_message="Error updating ml model endpoint version", return_format="json")
|
5506
|
+
|
5507
|
+
|
5508
|
+
|
5509
|
+
# Maps
|
5510
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/Maps
|
5511
|
+
def create_map(self, workspace_id, display_name, definition = None, description = None, folder_id = None):
|
5512
|
+
"""Create a map in a workspace
|
5513
|
+
Args:
|
5514
|
+
workspace_id (str): The ID of the workspace
|
5515
|
+
display_name (str): The display name of the map
|
5516
|
+
definition (dict): The definition of the map
|
5517
|
+
description (str): The description of the map
|
5518
|
+
folder_id (str): The ID of the folder to create the map in
|
5519
|
+
Returns:
|
5520
|
+
Map: The created map object
|
5521
|
+
"""
|
5522
|
+
return self.create_item(workspace_id=workspace_id,
|
5523
|
+
display_name = display_name,
|
5524
|
+
type = "Maps",
|
5525
|
+
definition = definition,
|
5526
|
+
description = description, folder_id=folder_id)
|
5527
|
+
|
5528
|
+
# DELETE https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/Maps/{MapId}
|
5529
|
+
def delete_map(self, workspace_id, map_id):
|
5530
|
+
"""Delete a map from a workspace
|
5531
|
+
Args:
|
5532
|
+
workspace_id (str): The ID of the workspace
|
5533
|
+
map_id (str): The ID of the map
|
5534
|
+
Returns:
|
5535
|
+
int: The status code of the response
|
5536
|
+
"""
|
5537
|
+
return self.delete_item(workspace_id, item_id=map_id, type="Maps")
|
5538
|
+
|
5539
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/Maps/{MapId}
|
5540
|
+
def get_map(self, workspace_id, map_id = None, map_name = None):
|
5541
|
+
"""Get a map from a workspace
|
5542
|
+
Args:
|
5543
|
+
workspace_id (str): The ID of the workspace
|
5544
|
+
map_id (str): The ID of the map
|
5545
|
+
map_name (str): The name of the map
|
5546
|
+
Returns:
|
5547
|
+
Map: The map object
|
5548
|
+
"""
|
5549
|
+
from msfabricpysdkcore.otheritems import Map
|
5550
|
+
|
5551
|
+
if map_id is None and map_name is not None:
|
5552
|
+
maps = self.list_maps(workspace_id)
|
5553
|
+
maps_filtered = [m for m in maps if m.display_name == map_name]
|
5554
|
+
if len(maps_filtered) == 0:
|
5555
|
+
raise Exception(f"Map with name {map_name} not found")
|
5556
|
+
map_id = maps_filtered[0].id
|
5557
|
+
elif map_id is None:
|
5558
|
+
raise Exception("map_id or the map_name is required")
|
5559
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/Maps/{map_id}"
|
5560
|
+
item_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
5561
|
+
error_message="Error getting map", return_format="json")
|
5562
|
+
map_obj = Map.from_dict(item_dict, core_client=self)
|
5563
|
+
map_obj.get_definition()
|
5564
|
+
return map_obj
|
5565
|
+
|
5566
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/Maps/{MapId}/getDefinition
|
5567
|
+
def get_map_definition(self, workspace_id, map_id, format = None):
|
5568
|
+
"""Get the definition of a map
|
5569
|
+
Args:
|
5570
|
+
workspace_id (str): The ID of the workspace
|
5571
|
+
map_id (str): The ID of the map
|
5572
|
+
format (str): The format of the definition
|
5573
|
+
Returns:
|
5574
|
+
dict: The map definition
|
5575
|
+
"""
|
5576
|
+
return self.get_item_definition(workspace_id, map_id, type="Maps", format=format)
|
5577
|
+
|
5578
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/Maps
|
5579
|
+
def list_maps(self, workspace_id, with_properties = False):
|
5580
|
+
"""List maps in a workspace
|
5581
|
+
Args:
|
5582
|
+
workspace_id (str): The ID of the workspace
|
5583
|
+
with_properties (bool): Whether to get the item object with properties
|
5584
|
+
Returns:
|
5585
|
+
list: The list of maps
|
5586
|
+
"""
|
5587
|
+
return self.list_items(workspace_id, type="Maps", with_properties=with_properties)
|
5588
|
+
|
5589
|
+
# PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/Maps/{MapId}
|
5590
|
+
def update_map(self, workspace_id, map_id, display_name = None, description = None, return_item=False):
|
5591
|
+
"""Update a map in a workspace
|
5592
|
+
Args:
|
5593
|
+
workspace_id (str): The ID of the workspace
|
5594
|
+
map_id (str): The ID of the map
|
5595
|
+
display_name (str): The display name of the map
|
5596
|
+
description (str): The description of the map
|
5597
|
+
return_item (bool): Whether to return the item object
|
5598
|
+
Returns:
|
5599
|
+
dict: The updated map or Map object if return_item is True
|
5600
|
+
"""
|
5601
|
+
return self.update_item(workspace_id, item_id=map_id, display_name=display_name, description=description, type="Maps",
|
5602
|
+
return_item=return_item)
|
5603
|
+
|
5604
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/Maps/{MapId}/updateDefinition
|
5605
|
+
def update_map_definition(self, workspace_id, map_id, definition, update_metadata = None):
|
5606
|
+
"""Update the definition of a map
|
5607
|
+
Args:
|
5608
|
+
workspace_id (str): The ID of the workspace
|
5609
|
+
map_id (str): The ID of the map
|
5610
|
+
definition (dict): The definition of the map
|
5611
|
+
update_metadata (bool): Whether to update the metadata
|
5612
|
+
Returns:
|
5613
|
+
dict: The updated map definition
|
5614
|
+
"""
|
5615
|
+
return self.update_item_definition(workspace_id, map_id, type="Maps", definition=definition, update_metadata=update_metadata)
|
5616
|
+
|
5048
5617
|
# mounted data factory
|
5049
5618
|
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/mountedDataFactories
|
5050
5619
|
|
@@ -5479,6 +6048,25 @@ class FabricClientCore(FabricClient):
|
|
5479
6048
|
|
5480
6049
|
# semanticModels
|
5481
6050
|
|
6051
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/semanticModels/{semanticModelId}/bindConnection
|
6052
|
+
def bind_semantic_model_connection(self, workspace_id, semantic_model_id, connection_binding):
|
6053
|
+
"""Bind a connection to a semantic model
|
6054
|
+
Args:
|
6055
|
+
workspace_id (str): The ID of the workspace
|
6056
|
+
semantic_model_id (str): The ID of the semantic model
|
6057
|
+
connection_binding (dict): The connection binding
|
6058
|
+
Returns:
|
6059
|
+
dict: The updated semantic model
|
6060
|
+
"""
|
6061
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/semanticModels/{semantic_model_id}/bindConnection"
|
6062
|
+
|
6063
|
+
body = {
|
6064
|
+
"connectionBinding": connection_binding
|
6065
|
+
}
|
6066
|
+
|
6067
|
+
return self.calling_routine(url, operation="POST", body=body, response_codes=[200, 429],
|
6068
|
+
error_message="Error binding connection to semantic model", return_format="response")
|
6069
|
+
|
5482
6070
|
def create_semantic_model(self, workspace_id, display_name, definition = None, description = None):
|
5483
6071
|
"""Create a semantic model in a workspace
|
5484
6072
|
Args:
|
@@ -5955,6 +6543,37 @@ class FabricClientCore(FabricClient):
|
|
5955
6543
|
type="SQLDatabases", return_item=return_item)
|
5956
6544
|
|
5957
6545
|
# SQL endpoints
|
6546
|
+
|
6547
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/sqlEndpoints/{sqlEndpointId}/connectionString?guestTenantId={guestTenantId}&privateLinkType={privateLinkType}
|
6548
|
+
def get_sql_endpoint_connection_string(self, workspace_id, sql_endpoint_id, guest_tenant_id = None, private_link_type = None):
|
6549
|
+
"""Get the connection string of a SQL endpoint
|
6550
|
+
Args:
|
6551
|
+
workspace_id (str): The ID of the workspace
|
6552
|
+
sql_endpoint_id (str): The ID of the SQL endpoint
|
6553
|
+
guest_tenant_id (str): The guest tenant ID
|
6554
|
+
private_link_type (str): The private link type
|
6555
|
+
Returns:
|
6556
|
+
dict: The connection string of the SQL endpoint
|
6557
|
+
"""
|
6558
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/sqlEndpoints/{sql_endpoint_id}/connectionString"
|
6559
|
+
params = ""
|
6560
|
+
if guest_tenant_id is not None:
|
6561
|
+
params += f"?guestTenantId={guest_tenant_id}"
|
6562
|
+
if private_link_type is not None:
|
6563
|
+
if params:
|
6564
|
+
params += f"&privateLinkType={private_link_type}"
|
6565
|
+
else:
|
6566
|
+
params += f"?privateLinkType={private_link_type}"
|
6567
|
+
|
6568
|
+
response_dict = self.calling_routine(url, operation="GET", params=params, response_codes=[200, 429],
|
6569
|
+
error_message="Error getting SQL endpoint connection string", return_format="json")
|
6570
|
+
|
6571
|
+
return response_dict
|
6572
|
+
|
6573
|
+
def list_sql_endpoints(self, workspace_id):
|
6574
|
+
"""List sql endpoints in a workspace"""
|
6575
|
+
return self.list_items(workspace_id, type="sqlEndpoints")
|
6576
|
+
|
5958
6577
|
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/sqlEndpoints/{sqlEndpointId}/refreshMetadata?preview={preview}
|
5959
6578
|
def refresh_sql_endpoint_metadata(self, workspace_id, sql_endpoint_id, preview = True, timeout = None, wait_for_completion = False):
|
5960
6579
|
"""Refresh the metadata of a SQL endpoint
|
@@ -5977,6 +6596,64 @@ class FabricClientCore(FabricClient):
|
|
5977
6596
|
|
5978
6597
|
return response
|
5979
6598
|
|
6599
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/sqlEndpoints/{itemId}/settings/sqlAudit
|
6600
|
+
def get_sql_endpoint_audit_settings(self, workspace_id, sql_endpoint_id):
|
6601
|
+
"""Get the audit settings of a SQL endpoint
|
6602
|
+
Args:
|
6603
|
+
workspace_id (str): The ID of the workspace
|
6604
|
+
sql_endpoint_id (str): The ID of the SQL endpoint
|
6605
|
+
Returns:
|
6606
|
+
dict: The audit settings of the SQL endpoint
|
6607
|
+
"""
|
6608
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/sqlEndpoints/{sql_endpoint_id}/settings/sqlAudit"
|
6609
|
+
|
6610
|
+
response_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
6611
|
+
error_message="Error getting SQL endpoint audit settings", return_format="json")
|
6612
|
+
|
6613
|
+
return response_dict
|
6614
|
+
|
6615
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/sqlEndpoints/{itemId}/settings/sqlAudit/setAuditActionsAndGroups
|
6616
|
+
def set_sql_endpoint_audit_actions_and_groups(self, workspace_id, sql_endpoint_id, set_audit_actions_and_groups_request):
|
6617
|
+
"""Set the audit actions and groups of a SQL endpoint
|
6618
|
+
Args:
|
6619
|
+
workspace_id (str): The ID of the workspace
|
6620
|
+
sql_endpoint_id (str): The ID of the SQL endpoint
|
6621
|
+
set_audit_actions_and_groups_request (list): The list of audit actions and groups
|
6622
|
+
Returns:
|
6623
|
+
dict: The updated audit settings of the SQL endpoint
|
6624
|
+
"""
|
6625
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/sqlEndpoints/{sql_endpoint_id}/settings/sqlAudit/setAuditActionsAndGroups"
|
6626
|
+
|
6627
|
+
body = set_audit_actions_and_groups_request
|
6628
|
+
|
6629
|
+
response = self.calling_routine(url, operation="POST", body=body, response_codes=[200, 429],
|
6630
|
+
error_message="Error setting SQL endpoint audit actions and groups", return_format="response")
|
6631
|
+
|
6632
|
+
return response
|
6633
|
+
|
6634
|
+
# PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/sqlEndpoints/{itemId}/settings/sqlAudit
|
6635
|
+
def update_sql_endpoint_audit_settings(self, workspace_id, sql_endpoint_id, retention_days, state):
|
6636
|
+
"""Update the audit settings of a SQL endpoint
|
6637
|
+
Args:
|
6638
|
+
workspace_id (str): The ID of the workspace
|
6639
|
+
sql_endpoint_id (str): The ID of the SQL endpoint
|
6640
|
+
retention_days (int): The number of days to retain the audit logs
|
6641
|
+
state (str): The state of the audit settings
|
6642
|
+
Returns:
|
6643
|
+
dict: The updated audit settings of the SQL endpoint
|
6644
|
+
"""
|
6645
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/sqlEndpoints/{sql_endpoint_id}/settings/sqlAudit"
|
6646
|
+
|
6647
|
+
body = {
|
6648
|
+
"retentionDays": retention_days,
|
6649
|
+
"state": state
|
6650
|
+
}
|
6651
|
+
|
6652
|
+
response = self.calling_routine(url, operation="PATCH", body=body, response_codes=[200, 429],
|
6653
|
+
error_message="Error updating SQL endpoint audit settings", return_format="response")
|
6654
|
+
|
6655
|
+
return response
|
6656
|
+
|
5980
6657
|
# warehouses
|
5981
6658
|
|
5982
6659
|
def create_warehouse(self, workspace_id, display_name, description = None):
|
@@ -6000,6 +6677,34 @@ class FabricClientCore(FabricClient):
|
|
6000
6677
|
"""
|
6001
6678
|
return self.delete_item(workspace_id, warehouse_id, type="warehouses")
|
6002
6679
|
|
6680
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/warehouses/{warehouseId}/connectionString?guestTenantId={guestTenantId}&privateLinkType={privateLinkType}
|
6681
|
+
def get_warehouse_connection_string(self, workspace_id, warehouse_id, guest_tenant_id=None, private_link_type=None):
|
6682
|
+
"""Get the connection string of a warehouse
|
6683
|
+
Args:
|
6684
|
+
workspace_id (str): The ID of the workspace
|
6685
|
+
warehouse_id (str): The ID of the warehouse
|
6686
|
+
guest_tenant_id (str): The guest tenant ID
|
6687
|
+
private_link_type (str): The private link type
|
6688
|
+
Returns:
|
6689
|
+
dict: The connection string of the warehouse
|
6690
|
+
"""
|
6691
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/warehouses/{warehouse_id}/connectionString"
|
6692
|
+
params = ""
|
6693
|
+
if guest_tenant_id is not None:
|
6694
|
+
params += f"?guestTenantId={guest_tenant_id}"
|
6695
|
+
if private_link_type is not None:
|
6696
|
+
if params:
|
6697
|
+
params += f"&privateLinkType={private_link_type}"
|
6698
|
+
else:
|
6699
|
+
params += f"?privateLinkType={private_link_type}"
|
6700
|
+
|
6701
|
+
url += params
|
6702
|
+
|
6703
|
+
response_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
6704
|
+
error_message="Error getting warehouse connection string", return_format="json")
|
6705
|
+
|
6706
|
+
return response_dict
|
6707
|
+
|
6003
6708
|
def get_warehouse(self, workspace_id, warehouse_id = None, warehouse_name = None):
|
6004
6709
|
"""Get a warehouse from a workspace
|
6005
6710
|
Args:
|
@@ -6049,6 +6754,167 @@ class FabricClientCore(FabricClient):
|
|
6049
6754
|
return self.update_item(workspace_id, warehouse_id, display_name = display_name, description = description,
|
6050
6755
|
type="warehouses", return_item=return_item)
|
6051
6756
|
|
6757
|
+
# warehouse restore points
|
6758
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/warehouses/{warehouseId}/restorePoints
|
6759
|
+
def create_warehouse_restore_point(self, workspace_id, warehouse_id, display_name = None, description = None, wait_for_completion = False):
|
6760
|
+
"""Create a restore point for a warehouse
|
6761
|
+
Args:
|
6762
|
+
workspace_id (str): The ID of the workspace
|
6763
|
+
warehouse_id (str): The ID of the warehouse
|
6764
|
+
display_name (str): The display name of the restore point
|
6765
|
+
description (str): The description of the restore point
|
6766
|
+
wait_for_completion (bool): Whether to wait for the restore point creation to complete
|
6767
|
+
Returns:
|
6768
|
+
dict: The created restore point
|
6769
|
+
"""
|
6770
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/warehouses/{warehouse_id}/restorePoints"
|
6771
|
+
|
6772
|
+
body = {}
|
6773
|
+
if display_name is not None:
|
6774
|
+
body["displayName"] = display_name
|
6775
|
+
if description is not None:
|
6776
|
+
body["description"] = description
|
6777
|
+
|
6778
|
+
response = self.calling_routine(url, operation="POST", body=body, response_codes=[201,202, 429],
|
6779
|
+
error_message="Error creating warehouse restore point", return_format="json"
|
6780
|
+
, wait_for_completion=wait_for_completion)
|
6781
|
+
|
6782
|
+
return response
|
6783
|
+
|
6784
|
+
# DELETE https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/warehouses/{warehouseId}/restorePoints/{restorePointId}
|
6785
|
+
def delete_warehouse_restore_point(self, workspace_id, warehouse_id, restore_point_id):
|
6786
|
+
"""Delete a restore point for a warehouse
|
6787
|
+
Args:
|
6788
|
+
workspace_id (str): The ID of the workspace
|
6789
|
+
warehouse_id (str): The ID of the warehouse
|
6790
|
+
restore_point_id (str): The ID of the restore point
|
6791
|
+
Returns:
|
6792
|
+
int: The status code of the response
|
6793
|
+
"""
|
6794
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/warehouses/{warehouse_id}/restorePoints/{restore_point_id}"
|
6795
|
+
|
6796
|
+
response = self.calling_routine(url, operation="DELETE", response_codes=[200, 429],
|
6797
|
+
error_message="Error deleting warehouse restore point", return_format="response")
|
6798
|
+
|
6799
|
+
return response.status_code
|
6800
|
+
|
6801
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/warehouses/{warehouseId}/restorePoints/{restorePointId}
|
6802
|
+
def get_warehouse_restore_point(self, workspace_id, warehouse_id, restore_point_id):
|
6803
|
+
"""Get a restore point for a warehouse
|
6804
|
+
Args:
|
6805
|
+
workspace_id (str): The ID of the workspace
|
6806
|
+
warehouse_id (str): The ID of the warehouse
|
6807
|
+
restore_point_id (str): The ID of the restore point
|
6808
|
+
Returns:
|
6809
|
+
dict: The restore point
|
6810
|
+
"""
|
6811
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/warehouses/{warehouse_id}/restorePoints/{restore_point_id}"
|
6812
|
+
|
6813
|
+
response_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
6814
|
+
error_message="Error getting warehouse restore point", return_format="json")
|
6815
|
+
|
6816
|
+
return response_dict
|
6817
|
+
|
6818
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/warehouses/{warehouseId}/restorePoints?continuationToken={continuationToken}
|
6819
|
+
def list_warehouse_restore_points(self, workspace_id, warehouse_id):
|
6820
|
+
"""List restore points for a warehouse
|
6821
|
+
Args:
|
6822
|
+
workspace_id (str): The ID of the workspace
|
6823
|
+
warehouse_id (str): The ID of the warehouse
|
6824
|
+
Returns:
|
6825
|
+
list: The list of restore points
|
6826
|
+
"""
|
6827
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/warehouses/{warehouse_id}/restorePoints"
|
6828
|
+
|
6829
|
+
items = self.calling_routine(url, operation="GET", response_codes=[200, 429],
|
6830
|
+
error_message="Error listing warehouse restore points", return_format="value_json", paging=True)
|
6831
|
+
|
6832
|
+
return items
|
6833
|
+
|
6834
|
+
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/warehouses/{warehouseId}/restorePoints/{restorePointId}/restore
|
6835
|
+
def restore_warehouse_to_restore_point(self, workspace_id, warehouse_id, restore_point_id, wait_for_completion = False):
|
6836
|
+
"""Restore a warehouse to a restore point
|
6837
|
+
Args:
|
6838
|
+
workspace_id (str): The ID of the workspace
|
6839
|
+
warehouse_id (str): The ID of the warehouse
|
6840
|
+
restore_point_id (str): The ID of the restore point
|
6841
|
+
wait_for_completion (bool): Whether to wait for the restore operation to complete
|
6842
|
+
Returns:
|
6843
|
+
response: The response of the restore operation
|
6844
|
+
"""
|
6845
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/warehouses/{warehouse_id}/restorePoints/{restore_point_id}/restore"
|
6846
|
+
|
6847
|
+
response = self.calling_routine(url, operation="POST", response_codes=[200, 202, 429],
|
6848
|
+
error_message="Error restoring warehouse to restore point", return_format="response",
|
6849
|
+
wait_for_completion=wait_for_completion)
|
6850
|
+
|
6851
|
+
return response
|
6852
|
+
|
6853
|
+
# PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/warehouses/{warehouseId}/restorePoints/{restorePointId}
|
6854
|
+
def update_warehouse_restore_point(self, workspace_id, warehouse_id, restore_point_id, display_name = None, description = None):
|
6855
|
+
"""Update a restore point for a warehouse
|
6856
|
+
Args:
|
6857
|
+
workspace_id (str): The ID of the workspace
|
6858
|
+
warehouse_id (str): The ID of the warehouse
|
6859
|
+
restore_point_id (str): The ID of the restore point
|
6860
|
+
display_name (str): The display name of the restore point
|
6861
|
+
description (str): The description of the restore point
|
6862
|
+
Returns:
|
6863
|
+
dict: The updated restore point
|
6864
|
+
"""
|
6865
|
+
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/warehouses/{warehouse_id}/restorePoints/{restore_point_id}"
|
6866
|
+
|
6867
|
+
body = {}
|
6868
|
+
if display_name is not None:
|
6869
|
+
body["displayName"] = display_name
|
6870
|
+
if description is not None:
|
6871
|
+
body["description"] = description
|
6872
|
+
|
6873
|
+
if not body:
|
6874
|
+
return None
|
6875
|
+
|
6876
|
+
response_dict = self.calling_routine(url, operation="PATCH", body=body, response_codes=[200, 429],
|
6877
|
+
error_message="Error updating warehouse restore point", return_format="json")
|
6878
|
+
|
6879
|
+
return response_dict
|
6880
|
+
|
6881
|
+
# warehouse sql audit settings
|
6882
|
+
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/warehouses/{itemId}/settings/sqlAudit
|
6883
|
+
def get_warehouse_sql_audit_settings(self, workspace_id, warehouse_id):
|
6884
|
+
"""Get the audit settings of a warehouse
|
6885
|
+
Args:
|
6886
|
+
workspace_id (str): The ID of the workspace
|
6887
|
+
warehouse_id (str): The ID of the warehouse
|
6888
|
+
Returns:
|
6889
|
+
dict: The audit settings of the warehouse
|
6890
|
+
"""
|
6891
|
+
|
6892
|
+
return self.get_sql_endpoint_audit_settings(workspace_id, warehouse_id)
|
6893
|
+
|
6894
|
+
def set_warehouse_audit_actions_and_groups(self, workspace_id, warehouse_id, set_audit_actions_and_groups_request):
|
6895
|
+
"""Set the audit actions and groups of a warehouse
|
6896
|
+
Args:
|
6897
|
+
workspace_id (str): The ID of the workspace
|
6898
|
+
warehouse_id (str): The ID of the warehouse
|
6899
|
+
set_audit_actions_and_groups_request (list): The list of audit actions and groups
|
6900
|
+
Returns:
|
6901
|
+
dict: The updated audit settings of the warehouse
|
6902
|
+
"""
|
6903
|
+
return self.set_sql_endpoint_audit_actions_and_groups(workspace_id, warehouse_id, set_audit_actions_and_groups_request)
|
6904
|
+
|
6905
|
+
def update_warehouse_sql_audit_settings(self, workspace_id, warehouse_id, retention_days, state):
|
6906
|
+
"""Update the audit settings of a warehouse
|
6907
|
+
Args:
|
6908
|
+
workspace_id (str): The ID of the workspace
|
6909
|
+
warehouse_id (str): The ID of the warehouse
|
6910
|
+
retention_days (int): The number of days to retain the audit logs
|
6911
|
+
state (str): The state of the audit settings
|
6912
|
+
Returns:
|
6913
|
+
dict: The updated audit settings of the warehouse
|
6914
|
+
"""
|
6915
|
+
return self.update_sql_endpoint_audit_settings(workspace_id, warehouse_id, retention_days, state)
|
6916
|
+
|
6917
|
+
|
6052
6918
|
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/warehousesnapshots
|
6053
6919
|
def create_warehouse_snapshot(self, workspace_id, display_name, creation_payload, description = None, folder_id = None):
|
6054
6920
|
"""Create a snapshot of a warehouse
|