File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -128,10 +128,25 @@ def refresh_sql_endpoint_metadata(
128
128
else :
129
129
raise ValueError ("Invalid type. Must be 'Lakehouse' or 'MirroredDatabase'." )
130
130
131
- payload = None
132
131
timeout_unit = timeout_unit .capitalize ()
133
- if timeout_unit != "Minutes" and timeout_value != 15 :
134
- payload = {"timeout" : {"timeUnit" : timeout_unit , "value" : timeout_value }}
132
+ if timeout_unit not in ["Seconds" , "Minutes" , "Hours" , "Days" ]:
133
+ raise ValueError (
134
+ "Invalid timeout_unit. Must be 'Seconds', 'Minutes', 'Hours', or 'Days'."
135
+ )
136
+ if timeout_unit == "Hours" and timeout_value > 24 :
137
+ raise ValueError ("timeout_value cannot exceed 24 when timeout_unit is 'Hours'." )
138
+ if timeout_unit == "Days" and timeout_value > 1 :
139
+ raise ValueError ("timeout_value cannot exceed 1 when timeout_unit is 'Days'." )
140
+ if timeout_unit == "Minutes" and timeout_value > 1440 :
141
+ raise ValueError (
142
+ "timeout_value cannot exceed 1440 when timeout_unit is 'Minutes'."
143
+ )
144
+ if timeout_unit == "Seconds" and timeout_value > 86400 :
145
+ raise ValueError (
146
+ "timeout_value cannot exceed 86400 when timeout_unit is 'Seconds'."
147
+ )
148
+
149
+ payload = {"timeout" : {"timeUnit" : timeout_unit , "value" : timeout_value }}
135
150
136
151
result = _base_api (
137
152
request = f"v1/workspaces/{ workspace_id } /sqlEndpoints/{ sql_endpoint_id } /refreshMetadata" ,
You can’t perform that action at this time.
0 commit comments