
                         J   S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSS.r\
R(                  " \
R*                  R,                  \
R*                  R.                  5       " S S\
R0                  5      5       r\\l        g)z+Bare Metal Solution volumes update command.    )absolute_import)division)unicode_literals)	BmsClient)waiter)base)
exceptions)flags)labels_util)log)	resourcesa  
          Update a Bare Metal Solution volume.

          This call returns immediately, but the update operation may take
          several minutes to complete. To check if the operation is complete,
          use the `describe` command for the volume.
        z
          To add the label 'key1=value1' to a policy, run:

          $ {command} my-volume --update-labels=key1=value1

          To clear all labels, run:

          $ {command} my-volume --clear-labels
        )DESCRIPTIONEXAMPLESc                   .    \ rS rSrSr\S 5       rS rSrg)Update4   z$Update a Bare Metal Solution volume.c                     [         R                  " U SS9  [        R                  " U 5        [        R
                  R                  U 5        g)z Register flags for this command.T)
positionalN)r
   AddVolumeArgToParserr   AddUpdateLabelsFlagsr   
ASYNC_FLAGAddToParser)parsers    !lib/surface/bms/volumes/update.pyArgsUpdate.Args8   s4     
v$7$$V,OO'    c                 *   [        5       nUR                  R                  R                  5       nS n[        R
                  R                  U5      nUR                  5       (       d  [        R                  " S5      eUR                  U5      nUR                  UR                  R                  R                  UR                  5      R!                  5       nUR#                  UUS S S S9nUR$                  (       a%  [&        R(                  " UR+                  5       SS9  U$ UR,                  (       aI  [&        R.                  R1                  SR3                  UR+                  5       UR4                  5      5        U$ [6        R8                  R;                  UR4                  SSS9n[<        R>                  " UR@                  5      n	[<        RB                  " XS	R3                  UR4                  5      5      n
[&        R(                  " UR+                  5       SS9  U
$ )
NzNo configuration change was requested. Did you mean to include the flags `--update-labels`, `--remove-labels`, or `--clear-labels?`)volume_resourcelabels!snapshot_schedule_policy_resourceremove_snapshot_schedule_policysnapshot_auto_deletevolume)kindz@Update request issued for: [{}]
Check operation [{}] for status.z/baremetalsolution.projects.locations.operationsv2)
collectionapi_versionz&Waiting for operation [{}] to complete)"r   CONCEPTSr$   Parser   DiffFromUpdateArgsMayHaveUpdatesr	   NoConfigurationChangeError	GetVolumeApplymessagesVolumeLabelsValuer    	GetOrNoneUpdateVolumedoner   UpdatedResourceNameasync_statusPrintformatnamer   REGISTRYParseRelativeNamer   CloudOperationPollerNoResourcesoperation_serviceWaitFor)selfargsclientr$   labels_updatelabels_difforig_resourceop_refop_resourcepollerress              r   Run
Update.Run?   s   [F]]!!'')FM""11$7K%%''11MN N $$V,M%%**'ik    *.(,! ! #F {{	&++-h7m{{	jj **0&*LNm$$66D 7 K 33  "F
..AHH#[[*+C H5Jr    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   rM   __static_attributes__rO   r   r   r   r   4   s    ,( (*r   r   N)rT   
__future__r   r   r   %googlecloudsdk.api_lib.bms.bms_clientr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   googlecloudsdk.command_lib.bmsr	   r
   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   r   DETAILED_HELPReleaseTracksReleaseTrackALPHAGAUpdateCommandr   detailed_helprO   r   r   <module>re      s    2 &  ' ; . ( 5 0 < # )		, D%%++T->->-A-AB4T 4 C4n % r   