
    B                        S r SSKJr  SSKJr  SSKJr  SSK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  \R"                  \R$                  " \R&                  R(                  \R&                  R*                  \R&                  R,                  5       " S S\R.                  5      5       5       rg)z Add Attestor public key command.    )absolute_import)division)unicode_literalsN)apis)	attestors)kms)arg_parsers)base)
exceptions)flags)pkixc                   .    \ rS rSrSr\S 5       rS rSrg)Add!   a  Add a public key to an Attestor.

## EXAMPLES

To add a new KMS public key to an existing Attestor `my_attestor`:

  $ {command} \
      --attestor=my_attestor \
      --keyversion-project=foo \
      --keyversion-location=us-west1 \
      --keyversion-keyring=aring \
      --keyversion-key=akey \
      --keyversion=1

To add a new PGP public key to an existing Attestor `my_attestor`:

  $ {command} \
      --attestor=my_attestor \
      --pgp-public-key-file=my_key.pub
c                    [         R                  " U[         R                  " SSSS95        UR                  SSS9  UR	                  SS9nUR                  S	S9nUR                  S
[        R                  " 5       SS9  UR                  SS9n[         R                  " U[         R                  " SSSS[        R                  " S5      S95        UR                  SS9nUR                  SS[        R                  " 5       SS9  UR                  S[        R                  " 5       R                  S[        R                  " S5      S9  UR                  S[        [        R                  " S5      S9  g )NTFz5The attestor to which the public key should be added.)required
positional
group_helpz	--commentz&The comment describing the public key.)help)r   zPGP key definitionz--pgp-public-key-filezHThe path to the file containing the ASCII-armored PGP public key to add.)typer   zCloud KMS key definition
keyversionz              The Cloud KMS (Key Management Service) CryptoKeyVersion whose
              public key will be added to the attestor.)	base_namer   r   use_global_project_flagr   zPKIX key definitionz--pkix-public-key-filez;The path to the file containing the PKIX public key to add.)r   r   r   z--pkix-public-key-algorithmz            The signing algorithm of the associated key. This will be used to
            verify the signatures associated with this key.)choicesr   r   z--public-key-id-overridea=            If provided, the ID to replace the default API-generated one. All IDs
          must be valid URIs as defined by RFC 3986
          (https://tools.ietf.org/html/rfc3986).

          When creating Attestations to be verified by this key, one must always
          provide this custom ID as the public key ID.)r   AddConceptsGetAttestorPresentationSpecadd_argumentadd_mutually_exclusive_group	add_groupr	   FileContents#GetCryptoKeyVersionPresentationSpectextwrapdedentr   GetAlgorithmMapperr   str)clsparser	key_group	pgp_group	kms_group
pkix_groups         ;lib/surface/container/binauthz/attestors/public_keys/add.pyArgsAdd.Args:   s   	))G		
 B  D 33T3BI##)=#>I%%'/  0
 ##)C#DI	11"$) (; <	=
 $$*?$@J %%'J	  L
 %'')11__ ? @	  A "__ : ;  	<    c                    [         R                  " U R                  5       5      n[        R                  " U5      nUR
                  R                  R                  5       nUR                  (       a'  UR                  (       a  [        R                  " S5      eUR                  (       a  UR
                  R                  R                  5       n[        R                  " 5       R                  UR                  5       5      nUR!                  UUR"                  UR%                  UR&                  5      UR                  =(       d    [        R(                  " U5      UR*                  S9$ UR,                  (       a`  [.        R0                  " U5      nUR!                  UUR,                  UR3                  UR4                  5      UR                  UR*                  S9$ UR7                  UUR                  UR*                  S9$ )Nz@--public-key-id-override may not be used with old-style PGP keys)pkix_pubkey_contentpkix_sig_algorithmid_overridecomment)pgp_pubkey_contentr4   )r   GetApiVersionReleaseTrackr   ClientCONCEPTSattestorParsepgp_public_key_filepublic_key_id_overrider   InvalidArgumentErrorr   r   GetPublicKeyRelativeName
AddPkixKeypem ConvertFromKmsSignatureAlgorithm	algorithm	GetKeyUrir4   pkix_public_key_filer   r$   GetEnumForChoicepkix_public_key_algorithm	AddPgpKey)selfargsapi_versionattestors_clientattestor_refkey_resource
public_key
alg_mappers           r,   RunAdd.Runt   s   $$T%6%6%89K ''4==))//1LD$?$?++
LN N ]]--335l::<,,\-F-F-HIj((
(nn-NN""$22 3}}\2,, )     
	"	"**;7j((
"77'88,,.11,, )     ''
!55,, (    r/    N)	__name__
__module____qualname____firstlineno____doc__classmethodr-   rR   __static_attributes__rT   r/   r,   r   r   !   s!    * 7< 7<r# r/   r   )rY   
__future__r   r   r   r"   )googlecloudsdk.api_lib.container.binauthzr   r   r   googlecloudsdk.callioper	   r
   -googlecloudsdk.command_lib.container.binauthzr   r   r   DefaultUniverseOnlyReleaseTracksr7   GABETAALPHACommandr   rT   r/   r,   <module>rf      s    ' &  '  : ? 9 / ( D ? > D%%(($*;*;*@*@%%++-s $,, s - s r/   