
                         J   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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dZ e
j(                  e
j*                  j,                  e
j*                  j.                         G d de
j0                               Zee_        y)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                   &    e Zd ZdZed        Zd Zy)Updatez$Update a Bare Metal Solution volume.c                     t        j                  | d       t        j                  |        t        j
                  j                  |        y)z Register flags for this command.T)
positionalN)r
   AddVolumeArgToParserr   AddUpdateLabelsFlagsr   
ASYNC_FLAGAddToParser)parsers    !lib/surface/bms/volumes/update.pyArgszUpdate.Args8   s4     
v$7$$V,OO'    c                    t               }|j                  j                  j                         }d }t        j
                  j                  |      }|j                         st        j                  d      |j                  |      }|j                  |j                  j                  j                  |j                        j!                         }|j#                  ||d d d       }|j$                  r't'        j(                  |j+                         d       |S |j,                  rIt&        j.                  j1                  dj3                  |j+                         |j4                               |S t6        j8                  j;                  |j4                  dd      }t=        j>                  |j@                        }	t=        jB                  |	|d	j3                  |j4                              }
t'        j(                  |j+                         d       |
S )
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   Runz
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____doc__staticmethodr   rK    r   r   r   r   4   s    ,( (*r   r   N)rO   
__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_helprQ   r   r   <module>r`      s    2 &  ' ; . ( 5 0 < # )		, D%%++T->->-A-AB4T 4 C4n % r   