msfabricpysdkcore 0.2.9__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/coreapi.py +857 -36
- msfabricpysdkcore/domain.py +36 -5
- 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 +476 -6
- {msfabricpysdkcore-0.2.9.dist-info → msfabricpysdkcore-0.2.10.dist-info}/METADATA +45 -3
- {msfabricpysdkcore-0.2.9.dist-info → msfabricpysdkcore-0.2.10.dist-info}/RECORD +17 -15
- {msfabricpysdkcore-0.2.9.dist-info → msfabricpysdkcore-0.2.10.dist-info}/WHEEL +0 -0
- {msfabricpysdkcore-0.2.9.dist-info → msfabricpysdkcore-0.2.10.dist-info}/licenses/LICENSE +0 -0
- {msfabricpysdkcore-0.2.9.dist-info → msfabricpysdkcore-0.2.10.dist-info}/top_level.txt +0 -0
msfabricpysdkcore/coreapi.py
CHANGED
@@ -1253,17 +1253,21 @@ class FabricClientCore(FabricClient):
|
|
1253
1253
|
|
1254
1254
|
return response.status_code
|
1255
1255
|
|
1256
|
-
def update_my_git_credentials(self, workspace_id,
|
1256
|
+
def update_my_git_credentials(self, workspace_id, source, connection_id = None):
|
1257
1257
|
#PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/git/myGitCredentials
|
1258
1258
|
"""Update my git credentials
|
1259
1259
|
Args:
|
1260
|
-
|
1260
|
+
source (str): The git provider source
|
1261
|
+
connection_id (str): The connection ID
|
1261
1262
|
Returns:
|
1262
1263
|
dict: The response object
|
1263
1264
|
"""
|
1264
1265
|
url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/git/myGitCredentials"
|
1265
1266
|
|
1266
|
-
body =
|
1267
|
+
body = {"source": source}
|
1268
|
+
|
1269
|
+
if connection_id:
|
1270
|
+
body['connectionId'] = connection_id
|
1267
1271
|
|
1268
1272
|
response = self.calling_routine(url=url, operation="PATCH", body=body,
|
1269
1273
|
response_codes=[200, 429],
|
@@ -1301,6 +1305,8 @@ class FabricClientCore(FabricClient):
|
|
1301
1305
|
"""
|
1302
1306
|
from msfabricpysdkcore.item import Item
|
1303
1307
|
|
1308
|
+
if item_dict["type"] == "AnomalyDetector":
|
1309
|
+
return self.get_anomaly_detector(workspace_id, item_dict["id"])
|
1304
1310
|
if item_dict["type"] == "ApacheAirflowJob":
|
1305
1311
|
return self.get_apache_airflow_job(workspace_id, item_dict["id"])
|
1306
1312
|
if item_dict["type"] == "CopyJob":
|
@@ -1327,6 +1333,8 @@ class FabricClientCore(FabricClient):
|
|
1327
1333
|
return self.get_kql_queryset(workspace_id, item_dict["id"])
|
1328
1334
|
if item_dict["type"] == "Lakehouse":
|
1329
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"])
|
1330
1338
|
if item_dict["type"] == "MirroredAzureDatabricksCatalog":
|
1331
1339
|
return self.get_mirrored_azure_databricks_catalog(workspace_id, item_dict["id"])
|
1332
1340
|
if item_dict["type"] == "MirroredDatabase":
|
@@ -1397,7 +1405,8 @@ class FabricClientCore(FabricClient):
|
|
1397
1405
|
if folder_id:
|
1398
1406
|
body['folderId'] = folder_id
|
1399
1407
|
|
1400
|
-
if type in ["
|
1408
|
+
if type in ["anomalydetectors",
|
1409
|
+
"ApacheAirflowJobs",
|
1401
1410
|
"copyJobs",
|
1402
1411
|
"VariableLibraries",
|
1403
1412
|
"dataflows",
|
@@ -1412,6 +1421,7 @@ class FabricClientCore(FabricClient):
|
|
1412
1421
|
"kqlDashboards",
|
1413
1422
|
"kqlQuerysets",
|
1414
1423
|
"lakehouses",
|
1424
|
+
"Maps",
|
1415
1425
|
"mirroredAzureDatabricksCatalogs",
|
1416
1426
|
"mirroredDatabases",
|
1417
1427
|
"mlExperiments",
|
@@ -1446,7 +1456,8 @@ class FabricClientCore(FabricClient):
|
|
1446
1456
|
item = None
|
1447
1457
|
i = 0
|
1448
1458
|
|
1449
|
-
type_mapping = {"
|
1459
|
+
type_mapping = {"anomalydetectors": "AnomalyDetector",
|
1460
|
+
"ApacheAirflowJobs": "ApacheAirflowJob",
|
1450
1461
|
"copyJobs": "CopyJob",
|
1451
1462
|
"VariableLibraries": "VariableLibrary",
|
1452
1463
|
"dataflows": "Dataflow",
|
@@ -1461,6 +1472,7 @@ class FabricClientCore(FabricClient):
|
|
1461
1472
|
"kqlDatabases": "KQLDatabase",
|
1462
1473
|
"kqlQuerysets": "KQLQueryset",
|
1463
1474
|
"lakehouses": "Lakehouse",
|
1475
|
+
"Maps": "Map",
|
1464
1476
|
"mirroredAzureDatabricksCatalogs": "MirroredAzureDatabricksCatalog",
|
1465
1477
|
"mirroredDatabases": "MirroredDatabase",
|
1466
1478
|
"mlExperiments": "MLExperiment",
|
@@ -1506,33 +1518,6 @@ class FabricClientCore(FabricClient):
|
|
1506
1518
|
Raises:
|
1507
1519
|
Exception: If item_id or the combination item_name + item_type is required
|
1508
1520
|
"""
|
1509
|
-
if item_type:
|
1510
|
-
if item_type.lower() == "datapipeline":
|
1511
|
-
return self.get_data_pipeline(workspace_id, item_id, item_name)
|
1512
|
-
if item_type.lower() == "eventstream":
|
1513
|
-
return self.get_eventstream(workspace_id, item_id, item_name)
|
1514
|
-
if item_type.lower() == "kqldashboard":
|
1515
|
-
return self.get_kql_dashboard(workspace_id, item_id, item_name)
|
1516
|
-
if item_type.lower() == "kqldatabase":
|
1517
|
-
return self.get_kql_database(workspace_id, item_id, item_name)
|
1518
|
-
if item_type.lower() == "kqlqueryset":
|
1519
|
-
return self.get_kql_queryset(workspace_id, item_id, item_name)
|
1520
|
-
if item_type.lower() == "lakehouse":
|
1521
|
-
return self.get_lakehouse(workspace_id, item_id, item_name)
|
1522
|
-
if item_type.lower() == "mlmodel":
|
1523
|
-
return self.get_ml_model(workspace_id, item_id, item_name)
|
1524
|
-
if item_type.lower() == "mlexperiment":
|
1525
|
-
return self.get_ml_experiment(workspace_id, item_id, item_name)
|
1526
|
-
if item_type.lower() == "notebook":
|
1527
|
-
return self.get_notebook(workspace_id, item_id, item_name)
|
1528
|
-
if item_type.lower() == "report":
|
1529
|
-
return self.get_report(workspace_id, item_id, item_name)
|
1530
|
-
if item_type.lower() == "semanticmodel":
|
1531
|
-
return self.get_semantic_model(workspace_id, item_id, item_name)
|
1532
|
-
if item_type.lower() == "sparkjobdefinition":
|
1533
|
-
return self.get_spark_job_definition(workspace_id, item_id, item_name)
|
1534
|
-
if item_type.lower() == "warehouse":
|
1535
|
-
return self.get_warehouse(workspace_id, item_id, item_name)
|
1536
1521
|
|
1537
1522
|
if item_id is None and item_name is not None and item_type is not None:
|
1538
1523
|
return self.get_item_by_name(workspace_id, item_name, item_type)
|
@@ -2311,6 +2296,21 @@ class FabricClientCore(FabricClient):
|
|
2311
2296
|
response = self.calling_routine(url, operation="POST", response_codes=[200, 201, 202, 429], error_message="Error deprovisioning identity", return_format="response")
|
2312
2297
|
|
2313
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
|
2314
2314
|
|
2315
2315
|
def get_workspace(self, id = None, name = None, return_item=True):
|
2316
2316
|
"""Get workspace by id or name
|
@@ -2413,6 +2413,35 @@ class FabricClientCore(FabricClient):
|
|
2413
2413
|
response = self.calling_routine(url, operation="POST", response_codes=[200, 201, 202, 429], error_message="Error provisioning identity", return_format="response")
|
2414
2414
|
return response
|
2415
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
|
+
|
2416
2445
|
def unassign_from_capacity(self, workspace_id, wait_for_completion = True):
|
2417
2446
|
"""Unassign a workspace from a capacity
|
2418
2447
|
Args:
|
@@ -2481,10 +2510,6 @@ class FabricClientCore(FabricClient):
|
|
2481
2510
|
"""List datamarts in a workspace"""
|
2482
2511
|
return self.list_items(workspace_id, type="datamarts")
|
2483
2512
|
|
2484
|
-
def list_sql_endpoints(self, workspace_id):
|
2485
|
-
"""List sql endpoints in a workspace"""
|
2486
|
-
return self.list_items(workspace_id, type="sqlEndpoints")
|
2487
|
-
|
2488
2513
|
def list_mirrored_warehouses(self, workspace_id):
|
2489
2514
|
"""List mirrored warehouses in a workspace"""
|
2490
2515
|
return self.list_items(workspace_id, type="mirroredWarehouses")
|
@@ -2598,6 +2623,115 @@ class FabricClientCore(FabricClient):
|
|
2598
2623
|
"""
|
2599
2624
|
return self.update_item_definition(workspace_id, apache_airflow_job_id, type="ApacheAirflowJobs", definition=definition, update_metadata=update_metadata)
|
2600
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
|
+
|
2601
2735
|
# copyJobs
|
2602
2736
|
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/copyJobs
|
2603
2737
|
def create_copy_job(self, workspace_id, display_name, definition = None, description = None):
|
@@ -2834,6 +2968,24 @@ class FabricClientCore(FabricClient):
|
|
2834
2968
|
"""
|
2835
2969
|
return self.delete_item(workspace_id, item_id=dataflow_id, type="dataflows")
|
2836
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
|
+
|
2837
2989
|
# GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/dataflows/{dataflowId}
|
2838
2990
|
def get_dataflow(self, workspace_id, dataflow_id = None, dataflow_name = None):
|
2839
2991
|
"""Get a dataflow from a workspace
|
@@ -4788,6 +4940,89 @@ class FabricClientCore(FabricClient):
|
|
4788
4940
|
|
4789
4941
|
return items
|
4790
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
|
4791
5026
|
|
4792
5027
|
# mirrored_database
|
4793
5028
|
|
@@ -5090,6 +5325,295 @@ class FabricClientCore(FabricClient):
|
|
5090
5325
|
return self.update_item(workspace_id, ml_model_id, display_name = display_name, description = description,
|
5091
5326
|
type="mlModels", return_item=return_item)
|
5092
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
|
+
|
5093
5617
|
# mounted data factory
|
5094
5618
|
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/mountedDataFactories
|
5095
5619
|
|
@@ -5524,6 +6048,25 @@ class FabricClientCore(FabricClient):
|
|
5524
6048
|
|
5525
6049
|
# semanticModels
|
5526
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
|
+
|
5527
6070
|
def create_semantic_model(self, workspace_id, display_name, definition = None, description = None):
|
5528
6071
|
"""Create a semantic model in a workspace
|
5529
6072
|
Args:
|
@@ -6000,6 +6543,37 @@ class FabricClientCore(FabricClient):
|
|
6000
6543
|
type="SQLDatabases", return_item=return_item)
|
6001
6544
|
|
6002
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
|
+
|
6003
6577
|
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/sqlEndpoints/{sqlEndpointId}/refreshMetadata?preview={preview}
|
6004
6578
|
def refresh_sql_endpoint_metadata(self, workspace_id, sql_endpoint_id, preview = True, timeout = None, wait_for_completion = False):
|
6005
6579
|
"""Refresh the metadata of a SQL endpoint
|
@@ -6022,6 +6596,64 @@ class FabricClientCore(FabricClient):
|
|
6022
6596
|
|
6023
6597
|
return response
|
6024
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
|
+
|
6025
6657
|
# warehouses
|
6026
6658
|
|
6027
6659
|
def create_warehouse(self, workspace_id, display_name, description = None):
|
@@ -6045,6 +6677,34 @@ class FabricClientCore(FabricClient):
|
|
6045
6677
|
"""
|
6046
6678
|
return self.delete_item(workspace_id, warehouse_id, type="warehouses")
|
6047
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
|
+
|
6048
6708
|
def get_warehouse(self, workspace_id, warehouse_id = None, warehouse_name = None):
|
6049
6709
|
"""Get a warehouse from a workspace
|
6050
6710
|
Args:
|
@@ -6094,6 +6754,167 @@ class FabricClientCore(FabricClient):
|
|
6094
6754
|
return self.update_item(workspace_id, warehouse_id, display_name = display_name, description = description,
|
6095
6755
|
type="warehouses", return_item=return_item)
|
6096
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
|
+
|
6097
6918
|
# POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/warehousesnapshots
|
6098
6919
|
def create_warehouse_snapshot(self, workspace_id, display_name, creation_payload, description = None, folder_id = None):
|
6099
6920
|
"""Create a snapshot of a warehouse
|