
                         D   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
dZ e
j                  e
j                  j                   e
j                  j"                  e
j                  j$                         G d de
j&                               Zee_        y)z>Command for updating the MACsec configuration of interconnect.    )absolute_import)division)unicode_literals)base_classes)client)base)flagsz        *{command}* is used to add a pre-shared key to MACsec configuration of
        interconnect.

        For an example, refer to the *EXAMPLES* section below.
        z        To add a pre-shared key to MACsec configuration, run:

          $ {command} example-interconnect --key-name=default-key --start-time=2021-02-01T12:12:12Z
        )DESCRIPTIONEXAMPLESc                   0    e Zd ZdZdZed        Zd Zd Zy)AddKeyzAdd pre-shared key to a Compute Engine interconnect MACsec configuration.

  *{command}* is used to add pre-shared key to MACsec configuration of
  interconnect.
  Nc                     t        j                         | _        | j                  j                  |d       t        j                  |       t        j
                  |       y )Nupdate)operation_type)r	   InterconnectArgumentINTERCONNECT_ARGAddArgument*AddMacsecPreSharedKeyNameForAddOrUpdateKey/AddMacsecPreSharedKeyStartTimeForAddOrUpdateKey)clsparsers     3lib/surface/compute/interconnects/macsec/add_key.pyArgszAddKey.Args9   sH     557C$$VH$E	44V<	99&A    c                      y)Nzcompute.interconnects )selfs    r   
CollectionzAddKey.CollectionA   s    "r   c                 t   t        j                  | j                               }| j                  j	                  |j
                        }t        j                  ||j                        }|j                         j                  }|$|j                  j                  j                         }t        fd|j                  D              rT|j                  j                  |j                  j                  j                  j                   j"                               |j%                  d d d d d d d d d d |      S )N)compute_clientc              3   P   K   | ]  }|j                   j                  k7    y w)N)namekey_name).0keyargss     r   	<genexpr>zAddKey.Run.<locals>.<genexpr>M   s!     
E0D388t}}$0Ds   #&)r"   	startTime)descriptioninterconnect_typerequested_link_count	link_typeadmin_enablednoc_contact_emaillocationlabelslabel_fingerprintmacsec_enabledmacsec)r   ComputeApiHolderReleaseTrackr   ResolveAsResource	resourcesr   InterconnectDescriber3   messagesInterconnectMacsecallpreSharedKeysappendInterconnectMacsecPreSharedKeyr#   
start_timePatch)r   r&   holderrefinterconnectr3   s    `    r   Runz
AddKey.RunD   s   **4+<+<+>?F



1
1$8H8H
IC&&s6==IL""$++F~}}%%88:f

E0D0D
EE!!
--
 
 
?
?==DOO @ => !   r   )	__name__
__module____qualname____doc__r   classmethodr   r   rE   r   r   r   r   r   -   s-     B B#r   r   N)rI   
__future__r   r   r   googlecloudsdk.api_lib.computer   ,googlecloudsdk.api_lib.compute.interconnectsr   googlecloudsdk.callioper   0googlecloudsdk.command_lib.compute.interconnectsr	   DETAILED_HELPReleaseTracksr5   ALPHABETAGAUpdateCommandr   detailed_helpr   r   r   <module>rW      s    E &  ' 7 ? ( B		& T..33T5F5F5I5I-T --` % r   