99class WarehouseSnapshotManager :
1010 """Manager for Microsoft Fabric warehouse snapshots."""
1111
12- def __init__ (self , workspace_id : Optional [str ], access_token : str ):
12+ def __init__ (
13+ self ,
14+ workspace_id : Optional [str ],
15+ access_token : str ,
16+ base_url : Optional [str ] = "https://api.fabric.microsoft.com/v1" ,
17+ ):
1318 self .workspace_id = workspace_id
14- self .base_url = "https://msitapi.fabric.microsoft.com/v1"
19+ self .base_url = base_url
1520 self .headers = {
1621 "Authorization" : f"Bearer { access_token } " ,
1722 "Content-Type" : "application/json" ,
@@ -29,7 +34,7 @@ def list_warehouses(self) -> List[Dict[str, Any]]:
2934 data = response .json ()
3035 warehouses = data .get ("value" , [])
3136
32- logger .info (f"Found { len (warehouses )} warehouses in workspace { self .workspace_id } " )
37+ logger .debug (f"Found { len (warehouses )} warehouses in workspace { self .workspace_id } " )
3338 return warehouses
3439
3540 except requests .exceptions .RequestException as e :
@@ -71,7 +76,7 @@ def list_warehouse_snapshots(self) -> List[Dict[str, Any]]:
7176 data = response .json ()
7277 snapshots = data .get ("value" , [])
7378
74- logger .info (
79+ logger .debug (
7580 f"Found { len (snapshots )} warehouse snapshots in workspace { self .workspace_id } "
7681 )
7782 return snapshots
@@ -94,23 +99,23 @@ def _poll_operation_status(
9499 import time
95100
96101 for attempt in range (max_retries ):
97- logger .info (
102+ logger .debug (
98103 f"Polling operation { operation_id } , attempt { attempt + 1 } /{ max_retries } "
99104 )
100105
101106 response = requests .get (operation_url , headers = self .headers )
102107
103108 if response .status_code == 201 :
104109 # Operation is complete - get the result
105- logger .info (f"Operation { operation_id } completed (201)" )
110+ logger .debug (f"Operation { operation_id } completed (201)" )
106111
107112 # Fetch the actual result from /result endpoint
108113 result_url = f"{ operation_url } /result"
109114 result_response = requests .get (result_url , headers = self .headers )
110115 result_response .raise_for_status ()
111116
112117 result = result_response .json ()
113- logger .info (f"Operation { operation_id } result retrieved successfully" )
118+ logger .debug (f"Operation { operation_id } result retrieved successfully" )
114119 return result
115120
116121 elif response .status_code == 200 :
0 commit comments