msfabricpysdkcore 0.1.8__py3-none-any.whl → 0.2.1__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.
@@ -65,6 +65,193 @@ class FabricClientCore(FabricClient):
65
65
  items = [Capacity.from_dict(i) for i in items]
66
66
  return items
67
67
 
68
+ # Connections
69
+
70
+ # POST https://api.fabric.microsoft.com/v1/connections/{connectionId}/roleAssignments
71
+
72
+ def add_connection_role_assignment(self, connection_id, principal, role):
73
+ """Add a role assignment to a connection
74
+ Args:
75
+ connection_id (str): The ID of the connection
76
+ principal (str): The principal
77
+ role (str): The role
78
+ Returns:
79
+ dict: The role assignment
80
+ """
81
+ url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}/roleAssignments"
82
+
83
+ body = {
84
+ 'principal': principal,
85
+ 'role': role
86
+ }
87
+
88
+ response_json = self.calling_routine(url, operation="POST", body=body, response_codes=[201, 429],
89
+ error_message="Error adding connection role assignment", return_format="json")
90
+ return response_json
91
+
92
+ def create_connection(self, connection_request):
93
+ """Create a connection
94
+ Args:
95
+ connection_request (dict): The connection request
96
+ Returns:
97
+ dict: The connection
98
+ """
99
+ url = "https://api.fabric.microsoft.com/v1/connections"
100
+
101
+ response_json = self.calling_routine(url, operation="POST", body=connection_request, response_codes=[201, 429],
102
+ error_message="Error creating connection", return_format="json")
103
+ return response_json
104
+
105
+ def delete_connection(self, connection_id):
106
+ """Delete a connection
107
+ Args:
108
+ connection_id (str): The ID of the connection
109
+ Returns:
110
+ int: The status code of the response
111
+ """
112
+ url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}"
113
+
114
+ response = self.calling_routine(url, operation="DELETE", response_codes=[200, 429], return_format="response",
115
+ error_message="Error deleting connection")
116
+ return response.status_code
117
+
118
+ def delete_connection_role_assignment(self, connection_id, connection_role_assignment_id):
119
+ """Delete a role assignment for a connection
120
+ Args:
121
+ connection_id (str): The ID of the connection
122
+ connection_role_assignment_id (str): The ID of the role assignment
123
+ Returns:
124
+ int: The status code of the response
125
+ """
126
+ url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}/roleAssignments/{connection_role_assignment_id}"
127
+
128
+ response = self.calling_routine(url, operation="DELETE", response_codes=[200, 429], return_format="response",
129
+ error_message="Error deleting connection role assignment")
130
+ return response.status_code
131
+
132
+
133
+ def get_connection(self, connection_id = None, connection_name = None):
134
+ """Get a connection
135
+ Args:
136
+ connection_id (str): The ID of the connection
137
+ Returns:
138
+ dict: The connection
139
+ """
140
+ if connection_id is None and connection_name is not None:
141
+ connections = self.list_connections()
142
+ for connection in connections:
143
+ if connection["displayName"] == connection_name:
144
+ connection_id = connection["id"]
145
+ break
146
+ if connection_id is None:
147
+ raise Exception("Please provide either connection_id or connection_name")
148
+
149
+ url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}"
150
+ response_json = self.calling_routine(url, operation="GET", response_codes=[200, 429],
151
+ error_message="Error getting connection", return_format="json")
152
+ return response_json
153
+
154
+ # GET https://api.fabric.microsoft.com/v1/connections/{connectionId}/roleAssignments/{connectionRoleAssignmentId}
155
+ def get_connection_role_assignment(self, connection_id, connection_role_assignment_id):
156
+ """Get a role assignment for a connection
157
+ Args:
158
+ connection_id (str): The ID of the connection
159
+ connection_role_assignment_id (str): The ID of the role assignment
160
+ Returns:
161
+ dict: The role assignment
162
+ """
163
+ url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}/roleAssignments/{connection_role_assignment_id}"
164
+
165
+ response_json = self.calling_routine(url, operation="GET", response_codes=[200, 429],
166
+ error_message="Error getting connection role assignment", return_format="json")
167
+ return response_json
168
+
169
+ def list_connection_role_assignments(self, connection_id):
170
+ """List role assignments for a connection
171
+ Args:
172
+ connection_id (str): The ID of the connection
173
+ Returns:
174
+ list: The list of role assignments
175
+ """
176
+ url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}/roleAssignments"
177
+
178
+ items = self.calling_routine(url, operation="GET", response_codes=[200, 429],
179
+ error_message="Error listing connection role assignments", return_format="value_json", paging=True)
180
+ return items
181
+
182
+ def list_connections(self):
183
+ """Returns a list of on-premises, virtual network and cloud connections the user has permission for.
184
+ Returns:
185
+ list: The list of connections
186
+ """
187
+ # GET https://api.fabric.microsoft.com/v1/connections
188
+
189
+ url = "https://api.fabric.microsoft.com/v1/connections"
190
+
191
+ items = self.calling_routine(url, operation="GET", response_codes=[200, 429],
192
+ error_message="Error listing connections", return_format="value_json", paging=True)
193
+
194
+ return items
195
+
196
+ def list_supported_connection_types(self, gateway_id = None, show_all_creation_methods = None):
197
+ """List supported connection types
198
+ Args:
199
+ gateway_id (str): The ID of the gateway
200
+ show_all_creation_methods (bool): Whether to show all creation methods
201
+ Returns:
202
+ list: The list of supported connection types
203
+ """
204
+ url = "https://api.fabric.microsoft.com/v1/connections/supportedConnectionTypes"
205
+
206
+ if gateway_id:
207
+ url += f"?gatewayId={gateway_id}"
208
+ if show_all_creation_methods:
209
+ if "?" in url:
210
+ url += "&"
211
+ else:
212
+ url += "?"
213
+ url += "showAllCreationMethods=" + str(show_all_creation_methods)
214
+
215
+ items = self.calling_routine(url, operation="GET", response_codes=[200, 429],
216
+ error_message="Error listing supported connection types", return_format="value_json", paging=True)
217
+
218
+ return items
219
+
220
+ def update_connection(self, connection_id, connection_request):
221
+ """Update a connection
222
+ Args:
223
+ connection_id (str): The ID of the connection
224
+ connection_request (dict): The connection request
225
+ Returns:
226
+ dict: The updated connection
227
+ """
228
+ url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}"
229
+
230
+ response_json = self.calling_routine(url, operation="PATCH", body=connection_request, response_codes=[200, 429],
231
+ error_message="Error updating connection", return_format="json")
232
+ return response_json
233
+
234
+ # PATCH https://api.fabric.microsoft.com/v1/connections/{connectionId}/roleAssignments/{connectionRoleAssignmentId}
235
+
236
+ def update_connection_role_assignment(self, connection_id, connection_role_assignment_id, role):
237
+ """Update a role assignment for a connection
238
+ Args:
239
+ connection_id (str): The ID of the connection
240
+ connection_role_assignment_id (str): The ID of the role assignment
241
+ role (str): The role
242
+ Returns:
243
+ dict: The role assignment
244
+ """
245
+ url = f"https://api.fabric.microsoft.com/v1/connections/{connection_id}/roleAssignments/{connection_role_assignment_id}"
246
+
247
+ body = {
248
+ 'role': role
249
+ }
250
+
251
+ response_json = self.calling_routine(url, operation="PATCH", body=body, response_codes=[200, 429],
252
+ error_message="Error updating connection role assignment", return_format="json")
253
+ return response_json
254
+
68
255
  # Deployment Pipelines
69
256
 
70
257
  def deploy_stage_content(self, deployment_pipeline_id, source_stage_id, target_stage_id, created_workspace_details = None,
@@ -268,6 +455,211 @@ class FabricClientCore(FabricClient):
268
455
  response = self.calling_routine(url, operation="POST", response_codes=[200, 429], error_message="Error revoking external data share", return_format="response")
269
456
  return response.status_code
270
457
 
458
+ # Gateways
459
+
460
+ def add_gateway_role_assignment(self, gateway_id, principal, role):
461
+ """Add a role assignment to a gateway
462
+ Args:
463
+ gateway_id (str): The ID of the gateway
464
+ principal (str): The principal
465
+ role (str): The role
466
+ Returns:
467
+ dict: The role assignment
468
+ """
469
+ url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/roleAssignments"
470
+
471
+ body = {
472
+ 'principal': principal,
473
+ 'role': role
474
+ }
475
+
476
+ response_json = self.calling_routine(url, operation="POST", body=body, response_codes=[201, 429],
477
+ error_message="Error adding gateway role assignment", return_format="json")
478
+ return response_json
479
+
480
+ def create_gateway(self, gateway_request):
481
+ """Create a gateway
482
+ Args:
483
+ gateway_request (dict): The gateway request
484
+ Returns:
485
+ dict: The gateway
486
+ """
487
+ url = "https://api.fabric.microsoft.com/v1/gateways"
488
+
489
+ response_json = self.calling_routine(url, operation="POST", body=gateway_request, response_codes=[200, 201, 429],
490
+ error_message="Error creating gateway", return_format="json")
491
+ return response_json
492
+
493
+ def delete_gateway(self, gateway_id):
494
+ """Delete a gateway
495
+ Args:
496
+ gateway_id (str): The ID of the gateway
497
+ Returns:
498
+ int: The status code of the response
499
+ """
500
+ url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}"
501
+
502
+ response = self.calling_routine(url, operation="DELETE", response_codes=[200, 429], return_format="response",
503
+ error_message="Error deleting gateway")
504
+ return response.status_code
505
+
506
+ def delete_gateway_member(self, gateway_id, gateway_member_id):
507
+ """Delete a gateway member
508
+ Args:
509
+ gateway_id (str): The ID of the gateway
510
+ gateway_member_id (str): The ID of the gateway member
511
+ Returns:
512
+ int: The status code of the response
513
+ """
514
+ url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/members/{gateway_member_id}"
515
+
516
+ response = self.calling_routine(url, operation="DELETE", response_codes=[200, 429], return_format="response",
517
+ error_message="Error deleting gateway member")
518
+ return response.status_code
519
+
520
+ def delete_gateway_role_assignment(self, gateway_id, gateway_role_assignment_id):
521
+ """Delete a gateway role assignment
522
+ Args:
523
+ gateway_id (str): The ID of the gateway
524
+ gateway_role_assignment_id (str): The ID of the gateway role assignment
525
+ Returns:
526
+ int: The status code of the response
527
+ """
528
+ url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/roleAssignments/{gateway_role_assignment_id}"
529
+
530
+ response = self.calling_routine(url, operation="DELETE", response_codes=[200, 429], return_format="response",
531
+ error_message="Error deleting gateway role assignment")
532
+ return response.status_code
533
+
534
+ def get_gateway(self, gateway_id = None, gateway_name = None):
535
+ """Get a gateway
536
+ Args:
537
+ gateway_id (str): The ID of the gateway
538
+ gateway_name (str): The name of the gateway
539
+ Returns:
540
+ dict: The gateway
541
+ """
542
+ if gateway_id is None and gateway_name is not None:
543
+ gateways = self.list_gateways()
544
+ for gateway in gateways:
545
+ if gateway["displayName"] == gateway_name:
546
+ gateway_id = gateway["id"]
547
+ break
548
+ if gateway_id is None:
549
+ raise Exception("Please provide either gateway_id or gateway_name")
550
+
551
+ url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}"
552
+ response_json = self.calling_routine(url, operation="GET", response_codes=[200, 429],
553
+ error_message="Error getting gateway", return_format="json")
554
+ return response_json
555
+
556
+ def get_gateway_role_assignment(self, gateway_id, gateway_role_assignment_id):
557
+ """Get a gateway role assignment
558
+ Args:
559
+ gateway_id (str): The
560
+ gateway_role_assignment_id (str): The ID of the gateway role assignment
561
+ Returns:
562
+ dict: The gateway role assignment
563
+ """
564
+ url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/roleAssignments/{gateway_role_assignment_id}"
565
+
566
+ response_json = self.calling_routine(url, operation="GET", response_codes=[200, 429],
567
+ error_message="Error getting gateway role assignment", return_format="json")
568
+ return response_json
569
+
570
+ def list_gateway_members(self, gateway_id):
571
+ """List gateway members
572
+ Args:
573
+ gateway_id (str): The ID of the gateway
574
+ Returns:
575
+ list: The list of gateway members
576
+ """
577
+ url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/members"
578
+
579
+ items = self.calling_routine(url, operation="GET", response_codes=[200, 429],
580
+ error_message="Error listing gateway members", return_format="value_json", paging=True)
581
+ return items
582
+
583
+ def list_gateway_role_assignments(self, gateway_id):
584
+ """List gateway role assignments
585
+ Args:
586
+ gateway_id (str): The ID of the gateway
587
+ Returns:
588
+ list: The list of gateway role assignments
589
+ """
590
+ url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/roleAssignments"
591
+
592
+ items = self.calling_routine(url, operation="GET", response_codes=[200, 429],
593
+ error_message="Error listing gateway role assignments", return_format="value_json", paging=True)
594
+ return items
595
+
596
+ def list_gateways(self):
597
+ """List gateways
598
+ Returns:
599
+ list: The list of gateways
600
+ """
601
+ url = "https://api.fabric.microsoft.com/v1/gateways"
602
+
603
+ items = self.calling_routine(url, operation="GET", response_codes=[200, 429],
604
+ error_message="Error listing gateways", return_format="value_json", paging=True)
605
+ return items
606
+
607
+ def update_gateway(self, gateway_id, gateway_request):
608
+ """Update a gateway
609
+ Args:
610
+ gateway_id (str): The ID of the gateway
611
+ gateway_request (dict): The gateway request
612
+ Returns:
613
+ dict: The updated gateway
614
+ """
615
+
616
+ url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}"
617
+
618
+ response_json = self.calling_routine(url, operation="PATCH", body=gateway_request, response_codes=[200, 429],
619
+ error_message="Error updating gateway", return_format="json")
620
+ return response_json
621
+
622
+ def update_gateway_member(self, gateway_id, gateway_member_id, display_name, enabled):
623
+ """Update a gateway member
624
+ Args:
625
+ gateway_id (str): The ID of the gateway
626
+ gateway_member_id (str): The ID of the gateway member
627
+ display_name (str): The display name of the gateway member
628
+ enabled (bool): Whether the gateway member is enabled
629
+ Returns:
630
+ dict: The updated gateway member
631
+ """
632
+ url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/members/{gateway_member_id}"
633
+
634
+ body = {
635
+ 'displayName': display_name,
636
+ 'enabled': enabled
637
+ }
638
+
639
+ response_json = self.calling_routine(url, operation="PATCH", body=body, response_codes=[200, 429],
640
+ error_message="Error updating gateway member", return_format="json")
641
+ return response_json
642
+
643
+ def update_gateway_role_assignment(self, gateway_id, gateway_role_assignment_id, role):
644
+ """Update a gateway role assignment
645
+ Args:
646
+ gateway_id (str): The ID of the gateway
647
+ gateway_role_assignment_id (str): The ID of the gateway role assignment
648
+ role (str): The role
649
+ Returns:
650
+ dict: The updated gateway role assignment
651
+ """
652
+
653
+ url = f"https://api.fabric.microsoft.com/v1/gateways/{gateway_id}/roleAssignments/{gateway_role_assignment_id}"
654
+
655
+ body = {
656
+ 'role': role
657
+ }
658
+
659
+ response_json = self.calling_routine(url, operation="PATCH", body=body, response_codes=[200, 429],
660
+ error_message="Error updating gateway role assignment", return_format="json")
661
+ return response_json
662
+
271
663
  # Git
272
664
 
273
665
  def commit_to_git(self, workspace_id, mode, comment=None, items=None, workspace_head=None):
@@ -348,6 +740,22 @@ class FabricClientCore(FabricClient):
348
740
  error_message="Error getting git connection info", return_format="json")
349
741
 
350
742
  return response_json
743
+
744
+ def get_my_git_credentials(self, workspace_id):
745
+ # GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/git/myGitCredentials
746
+ """Get my git credentials
747
+ Args:
748
+ workspace_id (str): The ID of the workspace
749
+ Returns:
750
+ dict: The git credentials
751
+ """
752
+
753
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/git/myGitCredentials"
754
+
755
+ response_json = self.calling_routine(url=url, operation="GET", response_codes=[200, 429],
756
+ error_message="Error getting git credentials", return_format="json")
757
+
758
+ return response_json
351
759
 
352
760
  def git_get_status(self, workspace_id):
353
761
  """Get git connection status
@@ -405,6 +813,23 @@ class FabricClientCore(FabricClient):
405
813
 
406
814
  return response.status_code
407
815
 
816
+ def update_my_git_credentials(self, workspace_id, git_credentials):
817
+ #PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/git/myGitCredentials
818
+ """Update my git credentials
819
+ Args:
820
+ git_credentials (dict): The git provider details
821
+ Returns:
822
+ dict: The response object
823
+ """
824
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/git/myGitCredentials"
825
+
826
+ body = git_credentials
827
+
828
+ response = self.calling_routine(url=url, operation="PATCH", body=body,
829
+ response_codes=[200, 429],
830
+ error_message="Error updating git credentials", return_format="json")
831
+
832
+ return response
408
833
 
409
834
  # Items
410
835
 
@@ -442,12 +867,16 @@ class FabricClientCore(FabricClient):
442
867
  return self.get_eventstream(workspace_id, item_dict["id"])
443
868
  if item_dict["type"] == "Eventhouse":
444
869
  return self.get_eventhouse(workspace_id, item_dict["id"])
870
+ if item_dict["type"] == "KQLDashboard":
871
+ return self.get_kql_dashboard(workspace_id, item_dict["id"])
445
872
  if item_dict["type"] == "KQLDatabase":
446
873
  return self.get_kql_database(workspace_id, item_dict["id"])
447
874
  if item_dict["type"] == "KQLQueryset":
448
875
  return self.get_kql_queryset(workspace_id, item_dict["id"])
449
876
  if item_dict["type"] == "Lakehouse":
450
877
  return self.get_lakehouse(workspace_id, item_dict["id"])
878
+ if item_dict["type"] == "MirroredDatabase":
879
+ return self.get_mirrored_database(workspace_id, item_dict["id"])
451
880
  if item_dict["type"] == "MLExperiment":
452
881
  return self.get_ml_experiment(workspace_id, item_dict["id"])
453
882
  if item_dict["type"] == "MLModel":
@@ -511,7 +940,10 @@ class FabricClientCore(FabricClient):
511
940
  "eventhouses",
512
941
  "eventstreams",
513
942
  "kqlDatabases",
943
+ "kqlDashboards",
944
+ "kqlQuerysets",
514
945
  "lakehouses",
946
+ "mirroredDatabases",
515
947
  "mlExperiments",
516
948
  "mlModels",
517
949
  "notebooks",
@@ -528,7 +960,6 @@ class FabricClientCore(FabricClient):
528
960
  url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/{type}"
529
961
  body.pop('type')
530
962
 
531
-
532
963
  item_dict = self.calling_routine(url, operation="POST",
533
964
  body=body, response_codes=[201, 202, 429],
534
965
  error_message="Error creating item", return_format="json+operation_result",
@@ -544,8 +975,11 @@ class FabricClientCore(FabricClient):
544
975
  "environments": "Environment",
545
976
  "eventhouses": "Eventhouse",
546
977
  "eventstreams": "Eventstream",
978
+ "kqlDashboards": "KQLDashboard",
547
979
  "kqlDatabases": "KQLDatabase",
548
- "lakehouses": "Lakehouse",
980
+ "kqlQuerysets": "KQLQueryset",
981
+ "lakehouses": "Lakehouse",
982
+ "mirroredDatabases": "MirroredDatabase",
549
983
  "mlExperiments": "MLExperiment",
550
984
  "mlModels": "MLModel",
551
985
  "notebooks": "Notebook",
@@ -590,6 +1024,8 @@ class FabricClientCore(FabricClient):
590
1024
  return self.get_data_pipeline(workspace_id, item_id, item_name)
591
1025
  if item_type.lower() == "eventstream":
592
1026
  return self.get_eventstream(workspace_id, item_id, item_name)
1027
+ if item_type.lower() == "kqldashboard":
1028
+ return self.get_kql_dashboard(workspace_id, item_id, item_name)
593
1029
  if item_type.lower() == "kqldatabase":
594
1030
  return self.get_kql_database(workspace_id, item_id, item_name)
595
1031
  if item_type.lower() == "kqlqueryset":
@@ -643,6 +1079,22 @@ class FabricClientCore(FabricClient):
643
1079
  return response.status_code
644
1080
 
645
1081
  # List
1082
+
1083
+ def list_item_connections(self, workspace_id, item_id):
1084
+ """List item connections
1085
+ Args:
1086
+ workspace_id (str): The ID of the workspace
1087
+ item_id (str): The ID of the item
1088
+ Returns:
1089
+ dict: The item connections
1090
+ """
1091
+ #GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/items/{itemId}/connections
1092
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/connections"
1093
+
1094
+ response_json = self.calling_routine(url, operation="GET", response_codes=[200, 429],
1095
+ error_message="Error listing item connections", return_format="value_json", paging=True)
1096
+
1097
+ return response_json
646
1098
 
647
1099
  def list_items(self, workspace_id, with_properties = False, type = None):
648
1100
  """List items in a workspace
@@ -692,7 +1144,7 @@ class FabricClientCore(FabricClient):
692
1144
  return_format="json+operation_result")
693
1145
 
694
1146
 
695
- def update_item(self, workspace_id, item_id, display_name = None, description = None, type = None, return_item="Default"):
1147
+ def update_item(self, workspace_id, item_id, display_name = None, description = None, type = None, return_item=False):
696
1148
  """Update the item
697
1149
  Args:
698
1150
  workspace_id (str): The ID of the workspace
@@ -716,19 +1168,12 @@ class FabricClientCore(FabricClient):
716
1168
  resp_dict = self.calling_routine(url, operation="PATCH", body=payload,
717
1169
  response_codes=[200, 429], error_message="Error updating item",
718
1170
  return_format="json")
719
- if return_item == "Default":
720
- warn(
721
- message="Updating an item currently will make invoke an additional API call to get the item object. "
722
- "The default behaviour of returning the item object will change in newer versions of the SDK. "
723
- "To keep this behaviour, set return_item=True in the function call.",
724
- category=FutureWarning,
725
- stacklevel=2
726
- )
1171
+
727
1172
  if return_item:
728
1173
  return self.get_item_specific(workspace_id, resp_dict)
729
1174
  return resp_dict
730
1175
 
731
- def update_item_definition(self, workspace_id, item_id, definition, type = None, wait_for_completion=True):
1176
+ def update_item_definition(self, workspace_id, item_id, definition, type = None, wait_for_completion=True, **kwargs):
732
1177
  """Update the item definition
733
1178
  Args:
734
1179
  workspace_id (str): The ID of the workspace
@@ -738,11 +1183,15 @@ class FabricClientCore(FabricClient):
738
1183
  Returns:
739
1184
  requests.Response: The response object
740
1185
  """
1186
+
741
1187
  url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/updateDefinition"
742
1188
 
743
1189
  if type:
744
1190
  url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/{type}/{item_id}/updateDefinition"
745
-
1191
+
1192
+ if "update_metadata" in kwargs and kwargs["update_metadata"]:
1193
+ url = f"{url}?updateMetadata={kwargs['update_metadata']}"
1194
+
746
1195
  payload = {
747
1196
  'definition': definition
748
1197
  }
@@ -792,6 +1241,65 @@ class FabricClientCore(FabricClient):
792
1241
  job_dict['itemId'] = item_id
793
1242
  return JobInstance.from_dict(job_dict, core_client=self)
794
1243
 
1244
+ def create_item_schedule(self, workspace_id, item_id, job_type, configuration, enabled):
1245
+ """Create a job schedule for the item
1246
+ Args:
1247
+ workspace_id (str): The ID of the workspace
1248
+ item_id (str): The ID of the item
1249
+ job_type (str): The type of the job
1250
+ Returns:
1251
+ dict: The job schedule
1252
+ """
1253
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/jobs/{job_type}/schedules"
1254
+
1255
+ payload = {"configuration": configuration,
1256
+ "enabled": enabled}
1257
+
1258
+ return self.calling_routine(url=url, operation="POST", body=payload, response_codes=[201, 429],
1259
+ error_message="Error creating job schedule", return_format="json")
1260
+
1261
+ def get_item_schedule(self, workspace_id, item_id, job_type, schedule_id):
1262
+ """Get the job schedule of the item
1263
+ Args:
1264
+ workspace_id (str): The ID of the workspace
1265
+ item_id (str): The ID of the item
1266
+ job_type (str): The type of the job
1267
+ schedule_id (str): The ID of the schedule
1268
+ Returns:
1269
+ dict: The job schedule
1270
+ """
1271
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/jobs/{job_type}/schedules/{schedule_id}"
1272
+
1273
+ return self.calling_routine(url=url, operation="GET", response_codes=[200, 429],
1274
+ error_message="Error getting job schedule", return_format="json")
1275
+
1276
+ def list_item_job_instances(self, workspace_id, item_id):
1277
+ """List the job instances of the item
1278
+ Args:
1279
+ workspace_id (str): The ID of the workspace
1280
+ item_id (str): The ID of the item
1281
+ job_type (str): The type of the job
1282
+ Returns:
1283
+ list: The list of job instances
1284
+ """
1285
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/jobs/instances"
1286
+
1287
+ return self.calling_routine(url=url, operation="GET", response_codes=[200, 429],
1288
+ error_message="Error listing job instances", return_format="value_json", paging=True)
1289
+
1290
+ def list_item_schedules(self, workspace_id, item_id, job_type):
1291
+ """List the job schedules of the item
1292
+ Args:
1293
+ workspace_id (str): The ID of the workspace
1294
+ item_id (str): The ID of the item
1295
+ job_type (str): The type of the job
1296
+ Returns:
1297
+ list: The list of job schedules
1298
+ """
1299
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/jobs/{job_type}/schedules"
1300
+
1301
+ return self.calling_routine(url=url, operation="GET", response_codes=[200, 429],
1302
+ error_message="Error listing job schedules", return_format="value_json", paging=True)
795
1303
 
796
1304
  def run_on_demand_item_job(self, workspace_id, item_id, job_type, execution_data = None):
797
1305
  """Run an on demand job on the item
@@ -818,6 +1326,25 @@ class FabricClientCore(FabricClient):
818
1326
  job_instance = self.get_item_job_instance(workspace_id, item_id, job_instance_id=job_instance_id)
819
1327
  return job_instance
820
1328
 
1329
+ def update_item_schedule(self, workspace_id, item_id, job_type, schedule_id, configuration, enabled):
1330
+ """Update the job schedule of the item
1331
+ Args:
1332
+ workspace_id (str): The ID of the workspace
1333
+ item_id (str): The ID of the item
1334
+ job_type (str): The type of the job
1335
+ schedule_id (str): The ID of the schedule
1336
+ configuration (dict): The configuration of the schedule
1337
+ Returns:
1338
+ dict: The updated job schedule
1339
+ """
1340
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items/{item_id}/jobs/{job_type}/schedules/{schedule_id}"
1341
+
1342
+ payload = {"configuration": configuration,
1343
+ "enabled": enabled}
1344
+
1345
+ return self.calling_routine(url=url, operation="PATCH", body=payload, response_codes=[200, 429],
1346
+ error_message="Error updating job schedule", return_format="json")
1347
+
821
1348
  # long running operations
822
1349
 
823
1350
  def get_operation_results(self, operation_id):
@@ -850,6 +1377,82 @@ class FabricClientCore(FabricClient):
850
1377
 
851
1378
  return response_json
852
1379
 
1380
+ # Managed Private Endpoints:
1381
+
1382
+ def create_workspace_managed_private_endpoint(self, workspace_id, name, target_private_link_resource_id,
1383
+ target_subresource_type, request_message = None):
1384
+
1385
+ """Create a managed private endpoint in a workspace
1386
+ Args:
1387
+ workspace_id (str): The ID of the workspace
1388
+ name (str): The name of the managed private endpoint
1389
+ target_private_link_resource_id (str): The target private link resource ID
1390
+ target_subresource_type (str): The target subresource type
1391
+ request_message (str): The request message
1392
+ Returns:
1393
+ dict: The created managed private endpoint
1394
+ """
1395
+
1396
+ body = {
1397
+ "name": name,
1398
+ "targetPrivateLinkResourceId": target_private_link_resource_id,
1399
+ "targetSubresourceType": target_subresource_type
1400
+ }
1401
+ if request_message:
1402
+ body["requestMessage"] = request_message
1403
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/managedPrivateEndpoints"
1404
+
1405
+ response = self.calling_routine(url, operation="POST", body=body,
1406
+ response_codes=[201, 429], error_message="Error creating managed private endpoint",
1407
+ return_format="json")
1408
+
1409
+ return response
1410
+
1411
+ def delete_workspace_managed_private_endpoint(self, workspace_id, managed_private_endpoint_id):
1412
+ """Delete a managed private endpoint in a workspace
1413
+ Args:
1414
+ workspace_id (str): The ID of the workspace
1415
+ managed_private_endpoint_id (str): The ID of the managed private endpoint
1416
+ Returns:
1417
+ int: The status code of the response
1418
+ """
1419
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/managedPrivateEndpoints/{managed_private_endpoint_id}"
1420
+
1421
+ response = self.calling_routine(url, operation="DELETE", response_codes=[200, 429], return_format="response",
1422
+ error_message="Error deleting managed private endpoint")
1423
+
1424
+ return response.status_code
1425
+
1426
+ def get_workspace_managed_private_endpoint(self, workspace_id, managed_private_endpoint_id):
1427
+ """Get a managed private endpoint in a workspace
1428
+ Args:
1429
+ workspace_id (str): The ID of the workspace
1430
+ managed_private_endpoint_id (str): The ID of the managed private endpoint
1431
+ Returns:
1432
+ dict: The managed private endpoint
1433
+ """
1434
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/managedPrivateEndpoints/{managed_private_endpoint_id}"
1435
+
1436
+ response_json = self.calling_routine(url, operation="GET", response_codes=[200, 429],
1437
+ error_message="Error getting managed private endpoint", return_format="json")
1438
+
1439
+ return response_json
1440
+
1441
+ def list_workspace_managed_private_endpoints(self, workspace_id):
1442
+ """List managed private endpoints in a workspace
1443
+ Args:
1444
+ workspace_id (str): The ID of the workspace
1445
+ Returns:
1446
+ list: The list of managed private endpoints
1447
+ """
1448
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/managedPrivateEndpoints"
1449
+
1450
+ response_json = self.calling_routine(url, operation="GET", response_codes=[200, 429], paging=True,
1451
+ error_message="Error listing managed private endpoints", return_format="json")
1452
+
1453
+ return response_json
1454
+
1455
+
853
1456
  # One Lake Data Access Security
854
1457
 
855
1458
  # create and update
@@ -1274,10 +1877,6 @@ class FabricClientCore(FabricClient):
1274
1877
  def list_datamarts(self, workspace_id):
1275
1878
  """List datamarts in a workspace"""
1276
1879
  return self.list_items(workspace_id, type="datamarts")
1277
-
1278
- def list_paginated_reports(self, workspace_id):
1279
- """List paginated reports in a workspace"""
1280
- return self.list_items(workspace_id, type="paginatedReports")
1281
1880
 
1282
1881
  def list_sql_endpoints(self, workspace_id):
1283
1882
  """List sql endpoints in a workspace"""
@@ -1346,7 +1945,7 @@ class FabricClientCore(FabricClient):
1346
1945
  """
1347
1946
  return self.list_items(workspace_id, type="dataPipelines", with_properties=with_properties)
1348
1947
 
1349
- def update_data_pipeline(self, workspace_id, data_pipeline_id, display_name = None, description = None, return_item="Default"):
1948
+ def update_data_pipeline(self, workspace_id, data_pipeline_id, display_name = None, description = None, return_item=False):
1350
1949
  """Update a data pipeline in a workspace
1351
1950
  Args:
1352
1951
  workspace_id (str): The ID of the workspace
@@ -1422,7 +2021,7 @@ class FabricClientCore(FabricClient):
1422
2021
  """
1423
2022
  return self.list_items(workspace_id, type="environments", with_properties=with_properties)
1424
2023
 
1425
- def update_environment(self, workspace_id, environment_id, display_name = None, description = None, return_item="Default"):
2024
+ def update_environment(self, workspace_id, environment_id, display_name = None, description = None, return_item=False):
1426
2025
  """Update an environment in a workspace
1427
2026
  Args:
1428
2027
  workspace_id (str): The ID of the workspace
@@ -1656,7 +2255,7 @@ class FabricClientCore(FabricClient):
1656
2255
  """
1657
2256
  return self.list_items(workspace_id=workspace_id, type="eventhouses", with_properties=with_properties)
1658
2257
 
1659
- def update_eventhouse(self, workspace_id, eventhouse_id, display_name = None, description = None, return_item="Default"):
2258
+ def update_eventhouse(self, workspace_id, eventhouse_id, display_name = None, description = None, return_item=False):
1660
2259
  """Update an eventhouse in a workspace
1661
2260
  Args:
1662
2261
  workspace_id (str): The ID of the workspace
@@ -1732,7 +2331,7 @@ class FabricClientCore(FabricClient):
1732
2331
  """
1733
2332
  return self.list_items(workspace_id=workspace_id, type="eventstreams", with_properties=with_properties)
1734
2333
 
1735
- def update_eventstream(self, workspace_id, eventstream_id, display_name = None, description = None, return_item="Default"):
2334
+ def update_eventstream(self, workspace_id, eventstream_id, display_name = None, description = None, return_item=False):
1736
2335
  """Update an eventstream in a workspace
1737
2336
  Args:
1738
2337
  workspace_id (str): The ID of the workspace
@@ -1745,6 +2344,106 @@ class FabricClientCore(FabricClient):
1745
2344
  return self.update_item(workspace_id, eventstream_id, display_name = display_name, description = description,
1746
2345
  type= "eventstreams", return_item=return_item)
1747
2346
 
2347
+ # kqlDashboard
2348
+ def create_kql_dashboard(self, workspace_id, display_name, description = None):
2349
+ """Create a kql dashboard in a workspace
2350
+ Args:
2351
+ workspace_id (str): The ID of the workspace
2352
+ display_name (str): The display name of the kql dashboard
2353
+ description (str): The description of the kql dashboard
2354
+ Returns:
2355
+ dict: The created kql dashboard
2356
+ """
2357
+ return self.create_item(workspace_id = workspace_id,
2358
+ display_name = display_name,
2359
+ type = "kqlDashboards",
2360
+ description = description)
2361
+
2362
+ def delete_kql_dashboard(self, workspace_id, kql_dashboard_id):
2363
+ """Delete a kql dashboard from a workspace
2364
+ Args:
2365
+ workspace_id (str): The ID of the workspace
2366
+ kql_dashboard_id (str): The ID of the kql dashboard
2367
+ Returns:
2368
+ int: The status code of the response
2369
+ """
2370
+ return self.delete_item(workspace_id, kql_dashboard_id, type="kqlDashboards")
2371
+
2372
+ def get_kql_dashboard(self, workspace_id, kql_dashboard_id = None, kql_dashboard_name = None):
2373
+ """Get a kql dashboard from a workspace
2374
+ Args:
2375
+ workspace_id (str): The ID of the workspace
2376
+ kql_dashboard_id (str): The ID of the kql dashboard
2377
+ kql_dashboard_name (str): The name of the kql dashboard
2378
+ Returns:
2379
+ KQLDashboard: The kql dashboard object
2380
+ """
2381
+
2382
+ from msfabricpysdkcore.otheritems import KQLDashboard
2383
+ if kql_dashboard_id is None and kql_dashboard_name is not None:
2384
+ kql_dashboards = self.list_kql_dashboards(workspace_id)
2385
+ kql_dashboards = [kd for kd in kql_dashboards if kd.display_name == kql_dashboard_name]
2386
+ if len(kql_dashboards) == 0:
2387
+ raise Exception(f"Kql dashboard with name {kql_dashboard_name} not found")
2388
+ kql_dashboard_id = kql_dashboards[0].id
2389
+ if kql_dashboard_id is None:
2390
+ raise Exception("kql_dashboard_id or the kql_dashboard_name is required")
2391
+
2392
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/kqlDashboards/{kql_dashboard_id}"
2393
+
2394
+ item_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
2395
+ error_message="Error getting kql dashboard", return_format="json")
2396
+ kqldashboard = KQLDashboard.from_dict(item_dict, core_client=self)
2397
+ kqldashboard.get_definition()
2398
+ return kqldashboard
2399
+
2400
+ def get_kql_dashboard_definition(self, workspace_id, kql_dashboard_id, format=None):
2401
+ """Get the definition of a kql dashboard
2402
+ Args:
2403
+ workspace_id (str): The ID of the workspace
2404
+ kql_dashboard_id (str): The ID of the kql dashboard
2405
+ Returns:
2406
+ dict: The definition of the kql dashboard
2407
+ """
2408
+ return self.get_item_definition(workspace_id, kql_dashboard_id, type="kqlDashboards", format=format)
2409
+
2410
+
2411
+ def list_kql_dashboards(self, workspace_id, with_properties = False):
2412
+ """List kql dashboards in a workspace
2413
+ Args:
2414
+ workspace_id (str): The ID of the workspace
2415
+ with_properties (bool): Whether to get the item object with properties
2416
+ Returns:
2417
+ list: The list of kql dashboards
2418
+ """
2419
+ return self.list_items(workspace_id=workspace_id, type="kqlDashboards", with_properties=with_properties)
2420
+
2421
+ def update_kql_dashboard(self, workspace_id, kql_dashboard_id, display_name = None, description = None, return_item=False):
2422
+ """Update a kql dashboard in a workspace
2423
+ Args:
2424
+ workspace_id (str): The ID of the workspace
2425
+ kql_dashboard_id (str): The ID of the kql dashboard
2426
+ display_name (str): The display name of the kql dashboard
2427
+ description (str): The description of the kql dashboard
2428
+ Returns:
2429
+ dict: The updated kql dashboard
2430
+ """
2431
+ return self.update_item(workspace_id, kql_dashboard_id, display_name = display_name,
2432
+ description = description, type= "kqlDashboards", return_item=return_item)
2433
+
2434
+ def update_kql_dashboard_definition(self, workspace_id, kql_dashboard_id, definition, update_metadata = None):
2435
+ """Update the definition of a kql dashboard
2436
+ Args:
2437
+ workspace_id (str): The ID of the workspace
2438
+ kql_dashboard_id (str): The ID of the kql dashboard
2439
+ definition (dict): The definition of the kql dashboard
2440
+ update_metadata (bool): Whether to update the metadata
2441
+ Returns:
2442
+ dict: The updated definition of the kql dashboard
2443
+ """
2444
+ return self.update_item_definition(workspace_id, kql_dashboard_id,
2445
+ type="kqlDashboards", definition=definition, update_metadata=update_metadata)
2446
+
1748
2447
  # kqlDatabases
1749
2448
 
1750
2449
  def create_kql_database(self, workspace_id, creation_payload, display_name, description = None):
@@ -1807,7 +2506,7 @@ class FabricClientCore(FabricClient):
1807
2506
  list: The list of kql databases"""
1808
2507
  return self.list_items(workspace_id=workspace_id, type="kqlDatabases", with_properties=with_properties)
1809
2508
 
1810
- def update_kql_database(self, workspace_id, kql_database_id, display_name = None, description = None, return_item="Default"):
2509
+ def update_kql_database(self, workspace_id, kql_database_id, display_name = None, description = None, return_item=False):
1811
2510
  """Update a kql database in a workspace
1812
2511
  Args:
1813
2512
  workspace_id (str): The ID of the workspace
@@ -1822,6 +2521,23 @@ class FabricClientCore(FabricClient):
1822
2521
 
1823
2522
  # kqlQuerysets
1824
2523
 
2524
+ def create_kql_queryset(self, workspace_id, display_name, description = None, definition = None):
2525
+ """Create a kql queryset in a workspace
2526
+ Args:
2527
+ workspace_id (str): The ID of the workspace
2528
+ display_name (str): The display name of the kql queryset
2529
+ description (str): The description of the kql queryset
2530
+ definition (dict): The definition of the kql queryset
2531
+ Returns:
2532
+ dict: The created kql queryset
2533
+ """
2534
+ return self.create_item(workspace_id = workspace_id,
2535
+ display_name = display_name,
2536
+ type = "kqlQuerysets",
2537
+ description = description,
2538
+ definition = definition)
2539
+
2540
+
1825
2541
 
1826
2542
  def delete_kql_queryset(self, workspace_id, kql_queryset_id):
1827
2543
  """Delete a kql queryset from a workspace
@@ -1857,9 +2573,31 @@ class FabricClientCore(FabricClient):
1857
2573
  item_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
1858
2574
  error_message="Error getting kql queryset", return_format="json")
1859
2575
 
1860
- return KQLQueryset.from_dict(item_dict, core_client=self)
2576
+ kql = KQLQueryset.from_dict(item_dict, core_client=self)
2577
+ kql.get_definition()
2578
+ return kql
2579
+
2580
+ def get_kql_queryset_definition(self, workspace_id, kql_queryset_id, format=None):
2581
+ """Get the definition of a kql queryset
2582
+ Args:
2583
+ workspace_id (str): The ID of the workspace
2584
+ kql_queryset_id (str): The ID of the kql queryset
2585
+ Returns:
2586
+ dict: The definition of the kql queryset
2587
+ """
2588
+ return self.get_item_definition(workspace_id, kql_queryset_id, type="kqlQuerysets", format=format)
1861
2589
 
1862
- def update_kql_queryset(self, workspace_id, kql_queryset_id, display_name = None, description = None, return_item="Default"):
2590
+ def list_kql_querysets(self, workspace_id, with_properties = False):
2591
+ """List kql querysets in a workspace
2592
+ Args:
2593
+ workspace_id (str): The ID of the workspace
2594
+ with_properties (bool): Whether to get the item object with properties
2595
+ Returns:
2596
+ list: The list of kql querysets
2597
+ """
2598
+ return self.list_items(workspace_id=workspace_id, type="kqlQuerysets", with_properties=with_properties)
2599
+
2600
+ def update_kql_queryset(self, workspace_id, kql_queryset_id, display_name = None, description = None, return_item=False):
1863
2601
  """Update a kql queryset in a workspace
1864
2602
  Args:
1865
2603
  workspace_id (str): The ID of the workspace
@@ -1872,15 +2610,18 @@ class FabricClientCore(FabricClient):
1872
2610
  return self.update_item(workspace_id, kql_queryset_id, display_name = display_name,
1873
2611
  description = description, type= "kqlQuerysets", return_item=return_item)
1874
2612
 
1875
- def list_kql_querysets(self, workspace_id, with_properties = False):
1876
- """List kql querysets in a workspace
2613
+ def update_kql_queryset_definition(self, workspace_id, kql_queryset_id, definition, update_metadata = None):
2614
+ """Update the definition of a kql queryset
1877
2615
  Args:
1878
2616
  workspace_id (str): The ID of the workspace
1879
- with_properties (bool): Whether to get the item object with properties
2617
+ kql_queryset_id (str): The ID of the kql queryset
2618
+ definition (dict): The definition of the kql queryset
2619
+ update_metadata (bool): Whether to update the metadata
1880
2620
  Returns:
1881
- list: The list of kql querysets
2621
+ dict: The updated definition of the kql queryset
1882
2622
  """
1883
- return self.list_items(workspace_id=workspace_id, type="kqlQuerysets", with_properties=with_properties)
2623
+ return self.update_item_definition(workspace_id, kql_queryset_id,
2624
+ type="kqlQuerysets", definition=definition, update_metadata=update_metadata)
1884
2625
 
1885
2626
 
1886
2627
  # lakehouses
@@ -1969,7 +2710,7 @@ class FabricClientCore(FabricClient):
1969
2710
  """
1970
2711
  return self.list_items(workspace_id, type="lakehouses", with_properties = with_properties)
1971
2712
 
1972
- def update_lakehouse(self, workspace_id, lakehouse_id, display_name = None, description = None, return_item="Default"):
2713
+ def update_lakehouse(self, workspace_id, lakehouse_id, display_name = None, description = None, return_item=False):
1973
2714
  """Update a lakehouse in a workspace
1974
2715
  Args:
1975
2716
  workspace_id (str): The ID of the workspace
@@ -2065,8 +2806,160 @@ class FabricClientCore(FabricClient):
2065
2806
  self._logger.info("Table created")
2066
2807
  return response.status_code
2067
2808
 
2068
- # mlExperiments
2809
+ # mirrored_database
2810
+
2811
+ def create_mirrored_database(self, workspace_id, display_name, description = None, definition = None):
2812
+ """Create a mirrored database in a workspace
2813
+ Args:
2814
+ workspace_id (str): The ID of the workspace
2815
+ display_name (str): The display name of the mirrored database
2816
+ description (str): The description of the mirrored database
2817
+ Returns:
2818
+ dict: The created mirrored database
2819
+ """
2820
+ return self.create_item(workspace_id = workspace_id,
2821
+ display_name = display_name,
2822
+ type = "mirroredDatabases",
2823
+ description = description,
2824
+ definition=definition)
2825
+
2826
+ def delete_mirrored_database(self, workspace_id, mirrored_database_id):
2827
+ """Delete a mirrored database from a workspace
2828
+ Args:
2829
+ workspace_id (str): The ID of the workspace
2830
+ mirrored_database_id (str): The ID of the mirrored database
2831
+ Returns:
2832
+ int: The status code of the response
2833
+ """
2834
+ return self.delete_item(workspace_id, mirrored_database_id, type="mirroredDatabases")
2835
+
2836
+ def get_mirrored_database(self, workspace_id, mirrored_database_id = None, mirrored_database_name = None):
2837
+ """Get a mirrored database from a workspace
2838
+ Args:
2839
+ workspace_id (str): The ID of the workspace
2840
+ mirrored_database_id (str): The ID of the mirrored database
2841
+ mirrored_database_name (str): The name of the mirrored database
2842
+ Returns:
2843
+ MirroredDatabase: The mirrored database object
2844
+ """
2845
+ from msfabricpysdkcore.otheritems import MirroredDatabase
2846
+
2847
+ if mirrored_database_id is None and mirrored_database_name is not None:
2848
+ mirrored_databases = self.list_mirrored_databases(workspace_id)
2849
+ mirrored_databases = [md for md in mirrored_databases if md.display_name == mirrored_database_name]
2850
+ if len(mirrored_databases) == 0:
2851
+ raise Exception(f"Mirrored database with name {mirrored_database_name} not found")
2852
+ mirrored_database_id = mirrored_databases[0].id
2853
+
2854
+ if mirrored_database_id is None:
2855
+ raise Exception("mirrored_database_id or the mirrored_database_name is required")
2856
+
2857
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mirroredDatabases/{mirrored_database_id}"
2858
+
2859
+ item_dict = self.calling_routine(url, operation="GET", response_codes=[200, 429],
2860
+ error_message="Error getting mirrored database", return_format="json")
2861
+ mirrored_db = MirroredDatabase.from_dict(item_dict, core_client=self)
2862
+ return mirrored_db
2863
+
2864
+ def get_mirrored_database_definition(self, workspace_id, mirrored_database_id):
2865
+ """Get the definition of a mirrored database
2866
+ Args:
2867
+ workspace_id (str): The ID of the workspace
2868
+ mirrored_database_id (str): The ID of the mirrored database
2869
+ Returns:
2870
+ dict: The definition of the mirrored database
2871
+ """
2872
+ return self.get_item_definition(workspace_id, mirrored_database_id, type="mirroredDatabases")
2873
+
2874
+ def list_mirrored_databases(self, workspace_id, with_properties = False):
2875
+ """List mirrored databases in a workspace
2876
+ Args:
2877
+ workspace_id (str): The ID of the workspace
2878
+ with_properties (bool): Whether to get the item object with properties
2879
+ Returns:
2880
+ list: The list of mirrored databases
2881
+ """
2882
+ return self.list_items(workspace_id=workspace_id, type="mirroredDatabases", with_properties=with_properties)
2883
+
2884
+ def update_mirrored_database(self, workspace_id, mirrored_database_id, display_name = None, description = None, return_item=False):
2885
+ """Update a mirrored database in a workspace
2886
+ Args:
2887
+ workspace_id (str): The ID of the workspace
2888
+ mirrored_database_id (str): The ID of the mirrored database
2889
+ display_name (str): The display name of the mirrored database
2890
+ description (str): The description of the mirrored database
2891
+ Returns:
2892
+ dict: The updated mirrored database
2893
+ """
2894
+ return self.update_item(workspace_id, mirrored_database_id, display_name = display_name, description = description,
2895
+ type="mirroredDatabases", return_item=return_item)
2896
+
2897
+ def update_mirrored_database_definition(self, workspace_id, mirrored_database_id, definition):
2898
+ """Update the definition of a mirrored database
2899
+ Args:
2900
+ workspace_id (str): The ID of the workspace
2901
+ mirrored_database_id (str): The ID of the mirrored database
2902
+ definition (dict): The definition of the mirrored database
2903
+ Returns:
2904
+ dict: The updated definition of the mirrored database
2905
+ """
2906
+ return self.update_item_definition(workspace_id, mirrored_database_id,
2907
+ type="mirroredDatabases", definition=definition)
2908
+
2909
+
2910
+ def get_mirroring_status(self, workspace_id, mirrored_database_id):
2911
+ """Get the mirroring status of a mirrored database
2912
+ Args:
2913
+ workspace_id (str): The ID of the workspace
2914
+ mirrored_database_id (str): The ID of the mirrored database
2915
+ Returns:
2916
+ dict: The mirroring status of the mirrored database
2917
+ """
2918
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mirroredDatabases/{mirrored_database_id}/getMirroringStatus"
2919
+
2920
+ return self.calling_routine(url, operation="POST", response_codes=[200, 429],
2921
+ error_message="Error getting mirroring status", return_format="json")
2922
+
2923
+ def get_tables_mirroring_status(self, workspace_id, mirrored_database_id):
2924
+ """Get the tables mirroring status of a mirrored database
2925
+ Args:
2926
+ workspace_id (str): The ID of the workspace
2927
+ mirrored_database_id (str): The ID of the mirrored database
2928
+ Returns:
2929
+ dict: The tables mirroring status of the mirrored database
2930
+ """
2931
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mirroredDatabases/{mirrored_database_id}/getTablesMirroringStatus"
2932
+
2933
+ return self.calling_routine(url, operation="POST", response_codes=[200, 429],
2934
+ error_message="Error getting tables mirroring status", return_format="json")
2935
+
2936
+ def start_mirroring(self, workspace_id, mirrored_database_id):
2937
+ """Start mirroring of a mirrored database
2938
+ Args:
2939
+ workspace_id (str): The ID of the workspace
2940
+ mirrored_database_id (str): The ID of the mirrored database
2941
+ Returns:
2942
+ dict: The operation result
2943
+ """
2944
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mirroredDatabases/{mirrored_database_id}/startMirroring"
2945
+
2946
+ return self.calling_routine(url, operation="POST", response_codes=[200, 429],
2947
+ error_message="Error starting mirroring", return_format="response")
2948
+
2949
+ def stop_mirroring(self, workspace_id, mirrored_database_id):
2950
+ """Stop mirroring of a mirrored database
2951
+ Args:
2952
+ workspace_id (str): The ID of the workspace
2953
+ mirrored_database_id (str): The ID of the mirrored database
2954
+ Returns:
2955
+ dict: The operation result
2956
+ """
2957
+ url = f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/mirroredDatabases/{mirrored_database_id}/stopMirroring"
2958
+
2959
+ return self.calling_routine(url, operation="POST", response_codes=[200, 429],
2960
+ error_message="Error stopping mirroring", return_format="response")
2069
2961
 
2962
+ # mlExperiments
2070
2963
 
2071
2964
  def create_ml_experiment(self, workspace_id, display_name, description = None):
2072
2965
  """Create an ml experiment in a workspace
@@ -2127,7 +3020,7 @@ class FabricClientCore(FabricClient):
2127
3020
  """
2128
3021
  return self.list_items(workspace_id=workspace_id, type="mlExperiments", with_properties = with_properties)
2129
3022
 
2130
- def update_ml_experiment(self, workspace_id, ml_experiment_id, display_name = None, description = None, return_item="Default"):
3023
+ def update_ml_experiment(self, workspace_id, ml_experiment_id, display_name = None, description = None, return_item=False):
2131
3024
  """Update an ml experiment in a workspace
2132
3025
  Args:
2133
3026
  workspace_id (str): The ID of the workspace
@@ -2200,7 +3093,7 @@ class FabricClientCore(FabricClient):
2200
3093
  """
2201
3094
  return self.list_items(workspace_id=workspace_id, type="mlModels", with_properties = with_properties)
2202
3095
 
2203
- def update_ml_model(self, workspace_id, ml_model_id, display_name = None, description = None, return_item="Default"):
3096
+ def update_ml_model(self, workspace_id, ml_model_id, display_name = None, description = None, return_item=False):
2204
3097
  """Update an ml model in a workspace
2205
3098
  Args:
2206
3099
  workspace_id (str): The ID of the workspace
@@ -2286,7 +3179,7 @@ class FabricClientCore(FabricClient):
2286
3179
  """
2287
3180
  return self.list_items(workspace_id = workspace_id, type = "notebooks", with_properties = with_properties)
2288
3181
 
2289
- def update_notebook(self, workspace_id, notebook_id, display_name = None, description = None, return_item="Default"):
3182
+ def update_notebook(self, workspace_id, notebook_id, display_name = None, description = None, return_item=False):
2290
3183
  """Update a notebook in a workspace
2291
3184
  Args:
2292
3185
  workspace_id (str): The ID of the workspace
@@ -2310,6 +3203,25 @@ class FabricClientCore(FabricClient):
2310
3203
  """
2311
3204
  return self.update_item_definition(workspace_id, notebook_id, definition, type="notebooks")
2312
3205
 
3206
+ # paginatedReports
3207
+
3208
+ def list_paginated_reports(self, workspace_id):
3209
+ """List paginated reports in a workspace"""
3210
+ return self.list_items(workspace_id, type="paginatedReports")
3211
+
3212
+ def update_paginated_report(self, workspace_id, paginated_report_id, display_name = None, description = None, return_item=False):
3213
+ """Update a paginated report in a workspace
3214
+ Args:
3215
+ workspace_id (str): The ID of the workspace
3216
+ paginated_report_id (str): The ID of the paginated report
3217
+ display_name (str): The display name of the paginated report
3218
+ description (str): The description of the paginated report
3219
+ Returns:
3220
+ dict: The updated paginated report
3221
+ """
3222
+ return self.update_item(workspace_id, paginated_report_id, display_name = display_name, description = description,
3223
+ type="paginatedReports", return_item=return_item)
3224
+
2313
3225
  # reports
2314
3226
 
2315
3227
  def create_report(self, workspace_id, display_name, definition = None, description = None):
@@ -2397,16 +3309,6 @@ class FabricClientCore(FabricClient):
2397
3309
 
2398
3310
  # semanticModels
2399
3311
 
2400
- def list_semantic_models(self, workspace_id, with_properties = False):
2401
- """List semantic models in a workspace
2402
- Args:
2403
- workspace_id (str): The ID of the workspace
2404
- with_properties (bool): Whether to get the item object with properties
2405
- Returns:
2406
- list: The list of semantic models
2407
- """
2408
- return self.list_items(workspace_id = workspace_id, type = "semanticModels", with_properties = with_properties)
2409
-
2410
3312
  def create_semantic_model(self, workspace_id, display_name, definition = None, description = None):
2411
3313
  """Create a semantic model in a workspace
2412
3314
  Args:
@@ -2418,6 +3320,16 @@ class FabricClientCore(FabricClient):
2418
3320
  dict: The created semantic model
2419
3321
  """
2420
3322
  return self.create_item(workspace_id = workspace_id, display_name = display_name, type = "semanticModels", definition = definition, description = description)
3323
+
3324
+ def delete_semantic_model(self, workspace_id, semantic_model_id):
3325
+ """Delete a semantic model from a workspace
3326
+ Args:
3327
+ workspace_id (str): The ID of the workspace
3328
+ semantic_model_id (str): The ID of the semantic model
3329
+ Returns:
3330
+ int: The status code of the response
3331
+ """
3332
+ return self.delete_item(workspace_id, semantic_model_id, type="semanticModels")
2421
3333
 
2422
3334
  def get_semantic_model(self, workspace_id, semantic_model_id = None, semantic_model_name = None):
2423
3335
  """Get a semantic model from a workspace
@@ -2447,31 +3359,39 @@ class FabricClientCore(FabricClient):
2447
3359
 
2448
3360
  return semmodel
2449
3361
 
2450
- def delete_semantic_model(self, workspace_id, semantic_model_id):
2451
- """Delete a semantic model from a workspace
3362
+ def get_semantic_model_definition(self, workspace_id, semantic_model_id, format = None):
3363
+ """Get the definition of a semantic model
2452
3364
  Args:
2453
3365
  workspace_id (str): The ID of the workspace
2454
3366
  semantic_model_id (str): The ID of the semantic model
3367
+ format (str): The format of the definition
2455
3368
  Returns:
2456
- int: The status code of the response
3369
+ dict: The definition of the semantic model
2457
3370
  """
2458
- return self.delete_item(workspace_id, semantic_model_id, type="semanticModels")
3371
+ return self.get_item_definition(workspace_id, semantic_model_id, type="semanticModels", format=format)
2459
3372
 
2460
- # def update_semantic_model(self, workspace_id, semantic_model_id, display_name = None, description = None):
2461
- # """Update a semantic model in a workspace"""
2462
- # ws = self.get_workspace_by_id(workspace_id)
2463
- # return ws.update_semantic_model(semantic_model_id, display_name = display_name, description = description)
3373
+ def list_semantic_models(self, workspace_id, with_properties = False):
3374
+ """List semantic models in a workspace
3375
+ Args:
3376
+ workspace_id (str): The ID of the workspace
3377
+ with_properties (bool): Whether to get the item object with properties
3378
+ Returns:
3379
+ list: The list of semantic models
3380
+ """
3381
+ return self.list_items(workspace_id = workspace_id, type = "semanticModels", with_properties = with_properties)
2464
3382
 
2465
- def get_semantic_model_definition(self, workspace_id, semantic_model_id, format = None):
2466
- """Get the definition of a semantic model
3383
+ def update_semantic_model(self, workspace_id, semantic_model_id, display_name = None, description = None, return_item=False):
3384
+ """Update a semantic model in a workspace
2467
3385
  Args:
2468
3386
  workspace_id (str): The ID of the workspace
2469
3387
  semantic_model_id (str): The ID of the semantic model
2470
- format (str): The format of the definition
3388
+ display_name (str): The display name of the semantic model
3389
+ description (str): The description of the semantic model
2471
3390
  Returns:
2472
- dict: The definition of the semantic model
3391
+ dict: The updated semantic model
2473
3392
  """
2474
- return self.get_item_definition(workspace_id, semantic_model_id, type="semanticModels", format=format)
3393
+ return self.update_item(workspace_id, semantic_model_id, display_name = display_name, description = description,
3394
+ type="semanticModels", return_item=return_item)
2475
3395
 
2476
3396
  def update_semantic_model_definition(self, workspace_id, semantic_model_id, definition):
2477
3397
  """Update the definition of a semantic model
@@ -2483,6 +3403,7 @@ class FabricClientCore(FabricClient):
2483
3403
  dict: The updated semantic model
2484
3404
  """
2485
3405
  return self.update_item_definition(workspace_id, semantic_model_id, definition, type="semanticModels", wait_for_completion=False)
3406
+
2486
3407
  # spark workspace custom pools
2487
3408
 
2488
3409
  def create_workspace_custom_pool(self, workspace_id, name, node_family, node_size, auto_scale, dynamic_executor_allocation):
@@ -2566,7 +3487,7 @@ class FabricClientCore(FabricClient):
2566
3487
  return sppools
2567
3488
 
2568
3489
  def update_workspace_custom_pool(self, workspace_id, pool_id, name = None, node_family = None, node_size = None, auto_scale = None, dynamic_executor_allocation = None,
2569
- return_item = "Default"):
3490
+ return_item = False):
2570
3491
  """Update a workspace custom pool
2571
3492
  Args:
2572
3493
  workspace_id (str): The ID of the workspace
@@ -2600,14 +3521,6 @@ class FabricClientCore(FabricClient):
2600
3521
  response_json = self.calling_routine(url, operation="PATCH", body=body, response_codes=[200, 429],
2601
3522
  error_message="Error updating workspace custom pool", return_format="json")
2602
3523
 
2603
- if return_item == "Default":
2604
- warn(
2605
- message="Warning: Updating an item currently will make invoke an additional API call to get the item "
2606
- "object. This default behaviour will change in newer versions of the SDK. To keep this "
2607
- "behaviour, set return_item=True in the function call.",
2608
- category=FutureWarning,
2609
- stacklevel=2
2610
- )
2611
3524
  if return_item:
2612
3525
  return self.get_workspace_custom_pool(workspace_id, pool_id)
2613
3526
  return response_json
@@ -2721,7 +3634,7 @@ class FabricClientCore(FabricClient):
2721
3634
  """
2722
3635
  return self.list_items(workspace_id = workspace_id, type = "sparkJobDefinitions", with_properties = with_properties)
2723
3636
 
2724
- def update_spark_job_definition(self, workspace_id, spark_job_definition_id, display_name = None, description = None, return_item="Default"):
3637
+ def update_spark_job_definition(self, workspace_id, spark_job_definition_id, display_name = None, description = None, return_item=False):
2725
3638
  """Update a spark job definition in a workspace
2726
3639
  Args:
2727
3640
  workspace_id (str): The ID of the workspace
@@ -2744,7 +3657,7 @@ class FabricClientCore(FabricClient):
2744
3657
  dict: The definition of the spark job definition
2745
3658
  """
2746
3659
  return self.get_item_definition(workspace_id, spark_job_definition_id, type="sparkJobDefinitions", format=format)
2747
-
3660
+
2748
3661
  def update_spark_job_definition_definition(self, workspace_id, spark_job_definition_id, definition):
2749
3662
  """Update the definition of a spark job definition
2750
3663
  Args:
@@ -2837,7 +3750,7 @@ class FabricClientCore(FabricClient):
2837
3750
  """
2838
3751
  return self.list_items(workspace_id = workspace_id, type = "warehouses", with_properties = with_properties)
2839
3752
 
2840
- def update_warehouse(self, workspace_id, warehouse_id, display_name = None, description = None, return_item="Default"):
3753
+ def update_warehouse(self, workspace_id, warehouse_id, display_name = None, description = None, return_item=False):
2841
3754
  """Update a warehouse in a workspace
2842
3755
  Args:
2843
3756
  workspace_id (str): The ID of the workspace