msfabricpysdkcore 0.1.8__py3-none-any.whl → 0.2.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. msfabricpysdkcore/adminapi.py +178 -12
  2. msfabricpysdkcore/coreapi.py +1479 -99
  3. msfabricpysdkcore/item.py +45 -6
  4. msfabricpysdkcore/job_instance.py +2 -1
  5. msfabricpysdkcore/otheritems.py +159 -10
  6. msfabricpysdkcore/tests/__init__.py +0 -0
  7. msfabricpysdkcore/tests/test_admin_apis.py +174 -0
  8. msfabricpysdkcore/tests/test_connection.py +111 -0
  9. msfabricpysdkcore/tests/test_datapipelines.py +45 -0
  10. msfabricpysdkcore/tests/test_deployment_pipeline.py +63 -0
  11. msfabricpysdkcore/tests/test_domains.py +126 -0
  12. msfabricpysdkcore/tests/test_environments.py +114 -0
  13. msfabricpysdkcore/tests/test_evenhouses.py +56 -0
  14. msfabricpysdkcore/tests/test_evenstreams.py +52 -0
  15. msfabricpysdkcore/tests/test_external_data_shares.py +51 -0
  16. msfabricpysdkcore/tests/test_fabric_azure_client.py +80 -0
  17. msfabricpysdkcore/tests/test_gateways.py +99 -0
  18. msfabricpysdkcore/tests/test_git.py +66 -0
  19. msfabricpysdkcore/tests/test_graphqlapi.py +44 -0
  20. msfabricpysdkcore/tests/test_items.py +97 -0
  21. msfabricpysdkcore/tests/test_jobs.py +96 -0
  22. msfabricpysdkcore/tests/test_kql_dashboards.py +63 -0
  23. msfabricpysdkcore/tests/test_kql_queryset.py +64 -0
  24. msfabricpysdkcore/tests/test_kqldatabases.py +56 -0
  25. msfabricpysdkcore/tests/test_lakehouse.py +93 -0
  26. msfabricpysdkcore/tests/test_managed_private_endpoints.py +61 -0
  27. msfabricpysdkcore/tests/test_mirroreddatabases.py +80 -0
  28. msfabricpysdkcore/tests/test_ml_experiments.py +47 -0
  29. msfabricpysdkcore/tests/test_ml_models.py +47 -0
  30. msfabricpysdkcore/tests/test_mounted_adf.py +64 -0
  31. msfabricpysdkcore/tests/test_notebooks.py +57 -0
  32. msfabricpysdkcore/tests/test_one_lake_data_access_security.py +63 -0
  33. msfabricpysdkcore/tests/test_other_items.py +45 -0
  34. msfabricpysdkcore/tests/test_reflex.py +57 -0
  35. msfabricpysdkcore/tests/test_reports.py +56 -0
  36. msfabricpysdkcore/tests/test_semantic_model.py +56 -0
  37. msfabricpysdkcore/tests/test_shortcuts.py +60 -0
  38. msfabricpysdkcore/tests/test_spark.py +91 -0
  39. msfabricpysdkcore/tests/test_sparkjobdefinition.py +55 -0
  40. msfabricpysdkcore/tests/test_sqldatabases.py +45 -0
  41. msfabricpysdkcore/tests/test_warehouses.py +50 -0
  42. msfabricpysdkcore/tests/test_workspaces_capacities.py +159 -0
  43. msfabricpysdkcore/workspace.py +295 -16
  44. {msfabricpysdkcore-0.1.8.dist-info → msfabricpysdkcore-0.2.2.dist-info}/METADATA +261 -16
  45. msfabricpysdkcore-0.2.2.dist-info/RECORD +65 -0
  46. {msfabricpysdkcore-0.1.8.dist-info → msfabricpysdkcore-0.2.2.dist-info}/WHEEL +1 -1
  47. msfabricpysdkcore-0.1.8.dist-info/RECORD +0 -28
  48. {msfabricpysdkcore-0.1.8.dist-info → msfabricpysdkcore-0.2.2.dist-info}/LICENSE +0 -0
  49. {msfabricpysdkcore-0.1.8.dist-info → msfabricpysdkcore-0.2.2.dist-info}/top_level.txt +0 -0
@@ -279,7 +279,7 @@ class FabricClientAdmin(FabricClient):
279
279
 
280
280
  return response.status_code
281
281
 
282
- def update_domain(self, domain_id, description = None, display_name = None, contributors_scope = None, return_item = "Default"):
282
+ def update_domain(self, domain_id, description = None, display_name = None, contributors_scope = None, return_item = False):
283
283
  """Method to update a domain
284
284
 
285
285
  Args:
@@ -301,15 +301,7 @@ class FabricClientAdmin(FabricClient):
301
301
  response_json = self.calling_routine(url = url, operation = "PATCH", body = body,
302
302
  response_codes = [200, 429], error_message = "Error updating domain",
303
303
  return_format="json")
304
-
305
- if return_item == "Default":
306
- warn(
307
- message="Updating a domain currently will make invoke an additional API call to get the domain "
308
- "object. This default behaviour will change in newer versions of the SDK. To keep this "
309
- "behaviour, set return_item=True in the function call.",
310
- category=FutureWarning,
311
- stacklevel=2
312
- )
304
+
313
305
  if return_item:
314
306
  return self.get_domain_by_id(domain_id)
315
307
  return response_json
@@ -513,6 +505,25 @@ class FabricClientAdmin(FabricClient):
513
505
 
514
506
  # Tenant Settings APIs
515
507
 
508
+ # DELETE https://api.fabric.microsoft.com/v1/admin/capacities/{capacityId}/delegatedTenantSettingOverrides/{tenantSettingName}
509
+ def delete_capacity_tenant_setting_override(self, capacity_id, tenant_setting_name):
510
+ """Delete a tenant setting override at the capacity
511
+
512
+ Args:
513
+ capacity_id (str): The ID of the capacity
514
+ tenant_setting_name (str): The name of the tenant setting
515
+
516
+ Returns:
517
+ int: The status code of the response
518
+ """
519
+ url = f"https://api.fabric.microsoft.com/v1/admin/capacities/{capacity_id}/delegatedTenantSettingOverrides/{tenant_setting_name}"
520
+
521
+ response:requests.Response = self.calling_routine(url = url, operation = "DELETE", response_codes = [200, 429],
522
+ error_message = "Error deleting capacity tenant setting override",
523
+ return_format="response")
524
+
525
+ return response.status_code
526
+
516
527
  def list_capacities_tenant_settings_overrides(self):
517
528
  """Returns list of tenant setting overrides that override at the capacities
518
529
 
@@ -524,10 +535,42 @@ class FabricClientAdmin(FabricClient):
524
535
 
525
536
  items: list = self.calling_routine(url = url, operation = "GET", response_codes = [200, 429],
526
537
  error_message = "Error listing capacities tenant settings overrides",
527
- return_format="Overrides", paging=True)
538
+ return_format="value", paging=True)
539
+
540
+ return items
541
+
542
+ # GET https://api.fabric.microsoft.com/v1/admin/capacities/{capacityId}/delegatedTenantSettingOverrides?continuationToken={continuationToken}
543
+ def list_capacity_tenant_settings_overrides_by_capacity_id(self, capacity_id):
544
+ """Returns list of tenant setting overrides that override at the capacity
545
+
546
+ Args:
547
+ capacity_id (str): The ID of the capacity
548
+ Returns:
549
+ list: The capacities tenant settings overrides
550
+ """
551
+ url = f"https://api.fabric.microsoft.com/v1/admin/capacities/{capacity_id}/delegatedTenantSettingOverrides"
552
+
553
+ items: list = self.calling_routine(url = url, operation = "GET", response_codes = [200, 429],
554
+ error_message = "Error listing capacity tenant settings overrides",
555
+ return_format="value", paging=True)
528
556
 
529
557
  return items
530
558
 
559
+ # GET https://api.fabric.microsoft.com/v1/admin/domains/delegatedTenantSettingOverrides?continuationToken={continuationToken}
560
+ def list_domain_tenant_settings_overrides(self):
561
+ """Returns list of tenant setting overrides that override at the domains
562
+
563
+ Returns:
564
+ list: The domains tenant settings overrides
565
+ """
566
+ url = "https://api.fabric.microsoft.com/v1/admin/domains/delegatedTenantSettingOverrides"
567
+
568
+ items: list = self.calling_routine(url = url, operation = "GET", response_codes = [200, 429],
569
+ error_message = "Error listing domain tenant settings overrides",
570
+ return_format="value", paging=True)
571
+
572
+ return items
573
+
531
574
  def list_tenant_settings(self):
532
575
  """Get the tenant settings
533
576
 
@@ -537,8 +580,97 @@ class FabricClientAdmin(FabricClient):
537
580
  url = "https://api.fabric.microsoft.com/v1/admin/tenantsettings"
538
581
 
539
582
  response_json = self.calling_routine(url = url, operation = "GET", response_codes = [200, 429],
540
- error_message = "Error getting tenant settings", return_format="json")
583
+ error_message = "Error getting tenant settings", paging= True, return_format="value")
584
+ return response_json
585
+
586
+ # GET https://api.fabric.microsoft.com/v1/admin/workspaces/delegatedTenantSettingOverrides?continuationToken={continuationToken}
587
+ def list_workspace_tenant_settings_overrides(self):
588
+ """Returns list of tenant setting overrides that override at the workspaces
589
+
590
+ Returns:
591
+ list: The workspaces tenant settings overrides
592
+ """
593
+ url = "https://api.fabric.microsoft.com/v1/admin/workspaces/delegatedTenantSettingOverrides"
594
+
595
+ items: list = self.calling_routine(url = url, operation = "GET", response_codes = [200, 429],
596
+ error_message = "Error listing workspace tenant settings overrides",
597
+ return_format="value", paging=True)
598
+
599
+ return items
600
+
601
+ # POST https://api.fabric.microsoft.com/v1/admin/capacities/{capacityId}/delegatedTenantSettingOverrides/{tenantSettingName}/update
602
+ def update_capacity_tenant_setting_override(self, capacity_id, tenant_setting_name, enabled, delegate_to_workspace = None,
603
+ enabled_security_groups = None, excluded_security_groups = None):
604
+ """Update a tenant setting override at the capacity
605
+
606
+ Args:
607
+ capacity_id (str): The ID of the capacity
608
+ tenant_setting_name (str): The name of the tenant setting
609
+ enabled (bool): Whether the tenant setting is enabled
610
+ delegate_to_workspace (bool): Indicates whether the tenant setting can be delegated to a workspace admin. False - Workspace admin cannot override the tenant setting. True - Workspace admin can override the tenant setting.
611
+ enabled_security_groups (list): The list of enabled security groups
612
+ excluded_security_groups (list): The list of excluded security groups
613
+ Returns:
614
+ dict: The overrides
615
+ """
616
+ url = f"https://api.fabric.microsoft.com/v1/admin/capacities/{capacity_id}/delegatedTenantSettingOverrides/{tenant_setting_name}/update"
617
+ body = {
618
+ "enabled": enabled
619
+ }
620
+ if delegate_to_workspace:
621
+ body["delegateToWorkspace"] = delegate_to_workspace
622
+ if enabled_security_groups:
623
+ body["enabledSecurityGroups"] = enabled_security_groups
624
+ if excluded_security_groups:
625
+ body["excludedSecurityGroups"] = excluded_security_groups
626
+
627
+ response_json : dict = self.calling_routine(url = url, operation = "POST", body = body, response_codes = [200, 429],
628
+ error_message = "Error updating capacity tenant setting override", return_format="json")
629
+
630
+ return response_json
631
+
632
+ # POST https://api.fabric.microsoft.com/v1/admin/tenantsettings/{tenantSettingName}/update
633
+ def update_tenant_setting(self, tenant_setting_name, enabled, delegate_to_capacity = None, delegate_to_domain = None,
634
+ delegate_to_workspace = None, enabled_security_groups = None, excluded_security_groups = None, properties = None):
635
+ """Update a tenant setting
636
+
637
+ Args:
638
+ capacity_id (str): The ID of the capacity
639
+ tenant_setting_name (str): The name of the tenant setting
640
+ enabled (bool): Whether the tenant setting is enabled
641
+ delegate_to_capacity (bool): Indicates whether the tenant setting can be delegated to a capacity admin. False - Capacity admin cannot override the tenant setting. True - Capacity admin can override the tenant setting.
642
+ delegate_to_domain (bool): Indicates whether the tenant setting can be delegated to a domain admin. False - Domain admin cannot override the tenant setting. True - Domain admin can override the tenant setting.
643
+ delegate_to_workspace (bool): Indicates whether the tenant setting can be delegated to a workspace admin. False - Workspace admin cannot override the tenant setting. True - Workspace admin can override the tenant setting.
644
+ enabled_security_groups (list): The list of enabled security groups
645
+ excluded_security_groups (list): The list of excluded security groups
646
+ Returns:
647
+ dict: The tenant settings
648
+ """
649
+
650
+ url = f"https://api.fabric.microsoft.com/v1/admin/tenantsettings/{tenant_setting_name}/update"
651
+
652
+ body = {
653
+ "enabled": enabled
654
+ }
655
+ if delegate_to_capacity:
656
+ body["delegateToCapacity"] = delegate_to_capacity
657
+ if delegate_to_domain:
658
+ body["delegateToDomain"] = delegate_to_domain
659
+ if delegate_to_workspace:
660
+ body["delegateToWorkspace"] = delegate_to_workspace
661
+ if enabled_security_groups:
662
+ body["enabledSecurityGroups"] = enabled_security_groups
663
+ if excluded_security_groups:
664
+ body["excludedSecurityGroups"] = excluded_security_groups
665
+ if properties:
666
+ body["properties"] = properties
667
+
668
+ response_json : dict = self.calling_routine(url = url, operation = "POST", body = body, response_codes = [200, 429],
669
+ error_message = "Error updating tenant setting", return_format="json")
670
+
541
671
  return response_json
672
+
673
+
542
674
 
543
675
  # Users APIs
544
676
 
@@ -581,6 +713,19 @@ class FabricClientAdmin(FabricClient):
581
713
 
582
714
  workspace = AdminWorkspace.from_dict(response_json, self)
583
715
  return workspace
716
+
717
+ # GET https://api.fabric.microsoft.com/v1/admin/workspaces/discoverGitConnections
718
+ def discover_git_connections(self):
719
+ """Discover Git connections
720
+
721
+ Returns:
722
+ dict: The Git connections
723
+ """
724
+ url = "https://api.fabric.microsoft.com/v1/admin/workspaces/discoverGitConnections"
725
+
726
+ response_json = self.calling_routine(url = url, operation = "GET", response_codes = [200, 429],
727
+ error_message = "Error discovering Git connections", return_format="value_json", paging=True)
728
+ return response_json
584
729
 
585
730
  def list_workspace_access_details(self, workspace_id):
586
731
  """Get the access details of the workspace
@@ -639,3 +784,24 @@ class FabricClientAdmin(FabricClient):
639
784
  workspaces = [AdminWorkspace.from_dict(i, self) for i in workspaces]
640
785
 
641
786
  return workspaces
787
+
788
+ def restore_workspace(self, workspace_id, new_workspace_admin_principal, new_workspace_name = None):
789
+ """Restore a workspace
790
+
791
+ Args:
792
+ workspace_id (str): The ID of the workspace
793
+ Returns:
794
+ response: The response from the API
795
+ """
796
+
797
+ restore_request = {
798
+ "newWorkspaceAdminPrincipal": new_workspace_admin_principal,
799
+ "newWorkspaceName": new_workspace_name
800
+ }
801
+ url = f"https://api.fabric.microsoft.com/v1/admin/workspaces/{workspace_id}/restore"
802
+
803
+ response_json = self.calling_routine(url = url, operation = "POST", body = restore_request,
804
+ response_codes = [200, 429], error_message = "Error restoring workspace",
805
+ return_format="response")
806
+
807
+ return response_json