@@ -258,7 +258,14 @@ def begin_update(
258
258
if isinstance (managed_network , str ):
259
259
managed_network = ManagedNetwork (isolation_mode = managed_network )._to_rest_object ()
260
260
elif isinstance (managed_network , ManagedNetwork ):
261
- managed_network = workspace .managed_network ._to_rest_object ()
261
+ if managed_network .outbound_rules is not None :
262
+ # drop recommended and required rules from the update request since it would result in bad request
263
+ managed_network .outbound_rules = [
264
+ rule
265
+ for rule in managed_network .outbound_rules
266
+ if rule .category not in (OutboundRuleCategory .REQUIRED , OutboundRuleCategory .RECOMMENDED )
267
+ ]
268
+ managed_network = managed_network ._to_rest_object ()
262
269
263
270
container_registry = kwargs .get ("container_registry" , workspace .container_registry )
264
271
# Empty string is for erasing the value of container_registry, None is to be ignored value
@@ -331,14 +338,6 @@ def begin_update(
331
338
)
332
339
)
333
340
334
- if workspace .managed_network is not None and workspace .managed_network .outbound_rules is not None :
335
- # drop recommended and required rules from the update request since it would result in bad request
336
- workspace .managed_network .outbound_rules = [
337
- rule
338
- for rule in workspace .managed_network .outbound_rules
339
- if rule .category not in (OutboundRuleCategory .REQUIRED , OutboundRuleCategory .RECOMMENDED )
340
- ]
341
-
342
341
update_role_assignment = (
343
342
kwargs .get ("update_workspace_role_assignment" , None )
344
343
or kwargs .get ("update_offline_store_role_assignment" , None )
0 commit comments