
    t                     Z    d Z ddlmZ ddlmZ ddlmZ ddlmZ  G d de      Zd Z	d	 Z
y
)z=Utilities for creating/parsing arguments for update commands.    )absolute_import)division)unicode_literals)basec                   6    e Zd ZdZd Zed        Zed        Zy)UpdateResultzResult type for applying updates.

  Attributes:
    needs_update: bool, whether the args require any changes to the existing
      resource.
    value: the value to put
  c                      || _         || _        y )N)needs_updatevalue)selfr
   r   s      7lib/googlecloudsdk/command_lib/util/args/update_util.py__init__zUpdateResult.__init__"   s    $DDJ    c                      | d|      S )NT )clsr   s     r   MakeWithUpdatezUpdateResult.MakeWithUpdate&   s    tUr   c                      | dd       S )NFr   )r   s    r   MakeNoUpdatezUpdateResult.MakeNoUpdate*   s    udr   N)__name__
__module____qualname____doc__r   classmethodr   r   r   r   r   r   r      s4        r   r   c                 2   t        j                  dj                  |      dj                  ||            t        j                  dj                  |      dj                  ||      d      g}| j                  |      }|D ]  }|j	                  |        y)	z;Add arguments corresponding to a field that can be cleared.z--{}zSet the {} for the {}.)helpz
--clear-{}zClear the {} from the {}.
store_true)r   actionN)r   Argumentformatadd_mutually_exclusive_groupAddToParser)parserarg_nameproperty_nameresource	full_helpargsgroupargs           r   AddClearableFieldr+   /   s     mm
--
!'..}hGI mm


h
'*11-J	
$ 
-
-9
-
=%cOOE r   c                     t        | d|z         }t        | |d       }|rt        j                  d       S |rt        j                  |      S t        j                         S )Nclear_)getattrr   r   r   )r(   r$   clearset_s       r   ParseClearableFieldr1   ?   sX    
$8+
,%	x	&$
&&t,,&&t,,$$&&r   N)r   
__future__r   r   r   googlecloudsdk.callioper   objectr   r+   r1   r   r   r   <module>r5      s/    D &  ' )6 , 'r   