
                         v   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
S.r\R                  \R                   " \R"                  R$                  5       " S S\R&                  5      5       5       r\R                   " \R"                  R*                  5       " S S\5      5       r\\l        g)z,Bare Metal Solution instance update command.    )	BmsClient)waiter)base)flags)labels_util)log)	resourcesa  
          Update a Bare Metal Solution instance.

          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 instance.
        aL  
          To update an instance called ``my-instance'' in region ``us-central1'' with
          a new label ``key1=value1'', run:

          $ {command} my-instance  --region=us-central1 --update-labels=key1=value1

          To clear all labels, run:

          $ {command} my-instance --region=us-central1 --clear-labels
        )DESCRIPTIONEXAMPLESc                   4    \ rS rSrSr\S 5       rS rS rSr	g)Update1   &Update a Bare Metal Solution instance.c                     [         R                  " U SS9  [        R                  " U 5        [        R
                  R                  U 5        [         R                  " U SSS9  [         R                  " U SS9  g)z Register flags for this command.T)
positionalF)hiddenrequiredr   N)	r   AddInstanceArgToParserr   AddUpdateLabelsFlagsr   
ASYNC_FLAGAddToParserAddInstanceOsImageToParser'AddInstanceEnableHyperthreadingToParserparsers    #lib/surface/bms/instances/update.pyArgsUpdate.Args6   sV     
  D9$$V,OO'	$$VEEJ	11&G    c                 :   [         R                  R                  U5      nUR                  U5      nUR	                  UR
                  R                  R                  UR                  5      R                  5       n[        USS 5      n[        USS 5      nUUUU/ S SS.$ )Nos_imageenable_hyperthreadingF)instance_resourcelabelsr"   r#   ssh_keyskms_key_versionclear_ssh_keys)r   DiffFromUpdateArgsGetInstanceApplymessagesInstanceLabelsValuer%   	GetOrNonegetattr)	selfargsclientinstancelabels_difforig_resourcelabels_updater"   r#   s	            r   GetRequestFieldsUpdate.GetRequestFields?   s    ""11$7K&&x0M%%foo&>&>&J&J&3&:&:<<EIK tZ.H#D*A4H%!6 r    c           	         [        5       nUR                  R                  R                  5       nUR                  " S
0 U R                  XU5      D6nUR                  (       a%  [        R                  " UR                  5       SS9  U$ UR                  (       a@  [        R                  R                  SUR                  5        SUR                   S35        U$ [        R                  R!                  UR                  SSS9n["        R$                  " UR&                  5      n["        R(                  " XeS	R+                  UR                  5      5      n[        R                  " UR                  5       SS9  U$ )Nr5   )kindzUpdate request issued for: [z]
Check operation [z] for status.z/baremetalsolution.projects.locations.operationsv2)
collectionapi_versionz&Waiting for operation [{}] to complete )r   CONCEPTSr5   ParseUpdateInstancer9   doner   UpdatedResourceNameasync_statusPrintnamer	   REGISTRYParseRelativeNamer   CloudOperationPollerNoResourcesoperation_serviceWaitForformat)r2   r3   r4   r5   op_refop_resourcepollerress           r   Run
Update.RunP   s/   [F}}%%++-H"" 9


h
79F{{	(--/
;m{{	jj((9 :$kk]-9: m$$66D 7 K 33  "F
..077DFC j9Jr    r@   N)
__name__
__module____qualname____firstlineno____doc__staticmethodr   r9   rU   __static_attributes__r@   r    r   r   r   1   s%     /H H"r    r   c                   <   ^  \ rS rSrSr\S 5       rU 4S jrSrU =r	$ )UpdateAlphak   r   c                     [         R                  " U SSS9  [         R                  " U SS9  [        R	                  U 5        g )NFT)r   pluralr   )r    AddProvisioningSshKeyArgToParserAddKMSCryptoKeyVersionToParserr   r   r   s    r   r   UpdateAlpha.Argso   s0    	**6E$O	((>
KKr    c                    > 0 [         TU ]  XU5      EUR                  UR                  R                  R                  5       [        USS5      S.E$ )Nr(   F)r'   r&   r(   )superr9   kms_crypto_key_versionrA   r&   rB   r1   )r2   r3   r4   r5   	__class__s       r   r9   UpdateAlpha.GetRequestFieldsv   sR    
'
"4
:66MM**002!$(8%@	 r    r@   )
rW   rX   rY   rZ   r[   r\   r   r9   r]   __classcell__)ri   s   @r   r_   r_   k   s"    .  r    r_   N)r[   %googlecloudsdk.api_lib.bms.bms_clientr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   googlecloudsdk.command_lib.bmsr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   r	   DETAILED_HELPUniverseCompatibleReleaseTracksReleaseTrackGAUpdateCommandr   ALPHAr_   detailed_helpr@   r    r   <module>rz      s    3 < . ( 0 < # )			. D%%(()5T 5 * 5p D%%++,&  -$ % r    