
                            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 e
j                   e
j                  e
j                  j                   e
j                  j"                         G d
 de
j$                                      Z e
j                  e
j                  j(                         G d de
j$                               Zy)z#Update Attestor public key command.    )absolute_import)division)unicode_literals)apis)	attestors)arg_parsers)base)flagsc                   &    e Zd ZdZed        Zd Zy)Updatea
  Update a public key on an Attestor.

  ## EXAMPLES

  To update a PGP public key on an existing Attestor `my_attestor`:

    $ {command} \
        0638AADD940361EA2D7F14C58C124F0E663DA097 \
        --attestor=my_attestor \
        --pgp-public-key-file=my_key.pub
  c                     t        j                  |t        j                  ddd             |j                  dd       |j                  dt	        j
                         d	
       |j                  dd       y NTFz7The attestor on which the public key should be updated.)required
positional
group_helppublic_key_idz#The ID of the public key to update.)helpz--pgp-public-key-filezGThe path to a file containing the updated ASCII-armored PGP public key.)typer   z	--commentz&The comment describing the public key.r
   AddConceptsGetAttestorPresentationSpecadd_argumentr   FileContentsclsparsers     >lib/surface/container/binauthz/attestors/public_keys/update.pyArgszUpdate.Args+       	))I		
 2  4 %%'0  1
 B  D    c                     t        j                  | j                               }t        j                  |      }|j
                  j                  j                         }|j                  ||j                  |j                  |j                        S N)pgp_pubkey_contentcommentr   GetApiVersionReleaseTrackr   ClientCONCEPTSattestorParse	UpdateKeyr   pgp_public_key_filer$   selfargsapi_versionattestors_clientattestor_refs        r   Runz
Update.RunA   z    $$T%6%6%89K ''4==))//1L %%33	 &  r    N__name__
__module____qualname____doc__classmethodr   r4    r    r   r   r      s"    
 D D*r    r   c                   &    e Zd ZdZed        Zd Zy)UpdateAlphaz#Update a public key on an Attestor.c                     t        j                  |t        j                  ddd             |j                  dd       |j                  dt	        j
                         d	
       |j                  dd       y r   r   r   s     r   r   zUpdateAlpha.ArgsS   r   r    c                     t        j                  | j                               }t        j                  |      }|j
                  j                  j                         }|j                  ||j                  |j                  |j                        S r"   r%   r.   s        r   r4   zUpdateAlpha.Runi   r5   r    Nr6   r<   r    r   r>   r>   O   s    +D D*r    r>   N)r:   
__future__r   r   r   )googlecloudsdk.api_lib.container.binauthzr   r   googlecloudsdk.callioper   r	   -googlecloudsdk.command_lib.container.binauthzr
   DefaultUniverseOnlyReleaseTracksr'   BETAGAUpdateCommandr   ALPHAr>   r<   r    r   <module>rK      s    * &  ' : ? / ( ? D%%**D,=,=,@,@A.T . B .b D%%++,$$$$ $ -$r    