
                            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rSSSSSSSSSSSS.rSSSS.rS rS)S jrS\0rS rSSS S!.rS*S" jrS#S$S%S!.rS+S& jr " S' S(\5      rg),z,Command utilities for `gcloud dns dns-keys`.    )absolute_import)division)unicode_literals)encoding)dns_keys)util)apis)base)flagsN                     
            )rsamd5dhdsarsasha1dsansec3sha1rsasha1nsec3sha1	rsasha256	rsasha512eccgostecdsap256sha256ecdsap384sha384   )sha1sha256sha384c                 x   [         R                  " U R                  5      n[         R                  " [        U R                  R
                     5      n[         R                  " [        U R                  S   R                  R
                     5      nU R                  S   R                  nSR                  XX4/5      $ )Nr    )six	text_typekeyTagALGORITHM_NUMBERS	algorithmnameDIGEST_TYPE_NUMBERSdigeststypedigestjoin)keykey_tagkey_algorithmdigest_algorithmr1   s        .lib/googlecloudsdk/command_lib/dns/dns_keys.py_GenerateDSRecordr8   5   s    MM#**%'-- 1#--2D2D EF-]]#++a.--2235;;q>  &	7+;D	EE    c                     [         R                  " SS5      n[        R                  " XR                  5      n [        U5      $ ! [         a    Us $ f = f)Ndnsv1)r	   GetMessagesModuler   DictToMessageDnsKeyr8   AttributeError)r	undefinedmessagesr3   s       r7   TransformDSRecordrD   >   sM    ##E40(q//2#S!!	 s   
A AA	ds_recordc                      [         $ N)_TRANSFORMS r9   r7   GetTransformsrJ   I   s    	r9   z&Show details about a DNS key resource.z?This command displays the details of a single DNS key resource.aw          To show details about a DNS key resource with ID 3 in a managed zone
        `my_zone`, run:

          $ {command} --zone=my_zone 3

        To get the DS record corresponding for the DNSKEY record from the
        previous example, run (the DNSKEY record must be for a key-signing key):

          $ {command} --zone=my_zone 3 --format='value(ds_record())'
        )briefDESCRIPTIONEXAMPLESc                     [         R                  " SUS9R                  U 5        [         R                  " US9R                  U 5        U R                  R                  [        5       5        g )Nz9The name of the managed-zone the DNSKEY record belongs tohide_short_zone_flag)is_beta)r   
GetZoneArgAddToParser	GetKeyArgdisplay_infoAddTransformsrJ   )parserrP   rQ   s      r7   AddDescribeFlagsrX   _   sM    A/11<V1D//'"..v6##MO4r9   zList DNS key resources.z)List DNS key resources in a managed zone.aS          To see the list of all DNS key resources for a managed zone `my_zone`,
        run:

          $ {command} --zone=my_zone

        To see the DS records for every key-signing DnsKey in a managed zone,
        run:

          $ {command} --zone=my_zone --filter='type=keySigning'               --format='value(ds_record())'
        c                 z   U R                   R                  S5        [        R                  R	                  U 5        [        R
                  R	                  U 5        [        R                  " SUS9R                  U 5        U R                   R                  S 5        U R                   R                  [        5       5        g )Nz*table(id,keyTag,type,isActive,description)zAThe name of the managed-zone you want to list DNSKEY records for.rO   )rU   	AddFormatr
   URI_FLAGRemoveFromParserPAGE_SIZE_FLAGr   rR   rS   AddCacheUpdaterrV   rJ   )rW   rP   s     r7   AddListFlagsr_   y   s     LM--  (&&v.I/11<V1D%%d+##MO4r9   c                   L    \ rS rSrSrS rS rS rS rS r	S r
\S	 5       rS
rg)Keys   z(Wrapper object for DNS DNSKEYs commands.c                     Xl         X l        g rG   _keys_client_version)selfkeys_clientversions      r7   __init__Keys.__init__   s    #Mr9   c                 B    [         R                  " U R                  5      $ rG   )r   GetRegistryrf   )rg   s    r7   _GetRegistryKeys._GetRegistry   s    DMM**r9   c                 F    U R                  5       R                  UUUS.SS9$ )N)projectmanagedZonezdns.dnsKeysparams
collectionrn   Parse)rg   key_idzonerq   s       r7   _ParseDnsKeyKeys._ParseDnsKey   s6    $$
 ! % " "r9   c                 D    U R                  5       R                  USU0SS9$ )Nrq   zdns.managedZonesrs   rv   )rg   zone_idrq   s      r7   
_ParseZoneKeys._ParseZone   s5    $$w
 & % ' 'r9   c                 \    U R                  XU5      nU R                  R                  U5      $ )z;Calls Get on the DNS DnsKeys API with the given parameters.)rz   re   Get)rg   rx   ry   rq   key_refs        r7   DescribeKeys.Describe   s+    g6G  ))r9   c                 Z    U R                  X5      nU R                  R                  U5      $ rG   )r~   re   List)rg   r}   rq   zone_refs       r7   r   	Keys.List   s'    w0H!!(++r9   c                 N    U " [         R                  R                  U5      U5      $ rG   )r   ClientFromApiVersion)clsri   s     r7   r   Keys.FromApiVersion   s    x--g6@@r9   rd   N)__name__
__module____qualname____firstlineno____doc__rj   rn   rz   r~   r   r   classmethodr   __static_attributes__rI   r9   r7   ra   ra      s9    0+"'*
, A Ar9   ra   ) )FF)F)r   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.dnsr   r   googlecloudsdk.api_lib.utilr	   googlecloudsdk.callioper
   googlecloudsdk.command_lib.dnsr   r(   r+   r.   r8   rD   rH   rJ   DESCRIBE_HELPrX   	LIST_HELPr_   objectra   rI   r9   r7   <module>r      s    3 &  ' % / + , ( 0 
 
    F -.
 6 
	$5 '>	$5&A6 &Ar9   