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

        For an example, refer to the *EXAMPLES* section below.
        z        To update a pre-shared key in 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)	UpdateKeyzUpdate pre-shared key in a Compute Engine interconnect MACsec configuration.

  *{command}* is used to update pre-shared key in 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     6lib/surface/compute/interconnects/macsec/update_key.pyArgszUpdateKey.Args8   sH     557C$$VH$E	44V<	99&A    c                      y)Nzcompute.interconnects )selfs    r   
CollectionzUpdateKey.Collection@   s    "r   c                    t        j                  | j                               }| j                  j	                  |j
                        }t        j                  ||j                        }|j                         j                  }|3t        j                  ddj                  |j                                     	 t        fd|j                  D              }j$                  |_        |j)                  d d d d d d d d d d |      S # t         $ r0 t        j                  ddj                  j"                              w xY w)N)compute_clientzkey-namez.Interconnect '{}' does not have MACsec config.c              3   V   K   | ]   }|j                   j                  k(  s| " y w)N)namekey_name).0keyargss     r   	<genexpr>z UpdateKey.Run.<locals>.<genexpr>P   s%      -#T]]1J#-s   ))zKey '{}' was not found.)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   r	   BadArgumentExceptionformatNamenextpreSharedKeysStopIterationr$   
start_time	startTimePatch)r   r'   holderrefinterconnectr3   preshared_keys    `     r   RunzUpdateKey.RunC   s5   **4+<+<+>?F



1
1$8H8H
IC&&s6==IL""$++F~++

:
A
A#((*
M 
 -- m #ooM!     ++
/66t}}E s   <D 9E )	__name__
__module____qualname____doc__r   classmethodr   r   rG   r   r   r   r   r   ,   s-     B B##r   r   N)rK   
__future__r   r   r   googlecloudsdk.api_lib.computer   ,googlecloudsdk.api_lib.compute.interconnectsr   googlecloudsdk.callioper   r	   0googlecloudsdk.command_lib.compute.interconnectsr
   DETAILED_HELPReleaseTracksr5   ALPHABETAGAUpdateCommandr   detailed_helpr   r   r   <module>rY      s    I &  ' 7 ? ( . B" T..33T5F5F5I5I7"" 77t (	 r   