
                         \    d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 d Zd	 Zy
)z.Utils for cluster maintenance window commands.    )absolute_import)division)unicode_literals)util)
exceptions)flagsc                 ~   ~ t        j                  |d      s|S |j                  st        j                  dd      |j
                  B|j                  j                         }t        j                  |      j                         |_        |j
                  j                  d|j
                  _        t        d|       |S )aU  Clears max_unavailable_worker_nodes in the request.

  If --clear-max-unavailable-worker-nodes flag is specified,
  cluster.upgrade_settings.max_unavailable_worker_nodes is cleared.

  Args:
    ref: reference to the cluster object.
    args: command line arguments.
    request: API request to be issued.

  Returns:
    modified request
  "clear_max_unavailable_worker_nodesz'--no-clear-max-unavailable-worker-nodeszThe flag is not supportedNz-upgrade_settings.max_unavailable_worker_nodes)r   FlagIsExplicitlySetr
   r   BadArgumentExceptionclustercalliope_commandReleaseTrackr   GetMessagesModuleClusterupgradeSettings_AddFieldToUpdateMask)refargsrequestrelease_tracks       Flib/googlecloudsdk/command_lib/edge_cloud/container/max_unavailable.pyClearMaxUnavailabler      s     
		"	"4)M	NN		0	0

)
)13N  __))668M,,];CCEGO__$$0&*GOO#5w 
.    c                 z    |j                   s	| |_         |S | |j                   vr|j                   dz   | z   |_         |S )N,)
updateMask)fieldr   s     r   r   r   ?   sC    			GN
'$$$ ++c1E9G	.r   N)__doc__
__future__r   r   r   +googlecloudsdk.api_lib.edge_cloud.containerr   googlecloudsdk.callioper   googlecloudsdk.command_lib.runr   r   r    r   r   <module>r%      s'    5 &  ' < . 0#Lr   