
                            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 Zej$                   ej&                  ej(                  j*                         G d	 d
ej,                                      Zej$                   ej&                  ej(                  j0                         G d de                    Zej$                   ej&                  ej(                  j4                         G d de                    Zy)z?Command for creating partner customer interconnect attachments.    )base_classes)client)base)parser_errors)flags)logc                 d    dj                  |       }t        j                  j                  |       y)z9Prints the pairing key help text upon command completion.z`      Please use the pairing key to provision the attachment with your partner:
      {0}
      N)formatr   statusPrint)pairing_keymessages     ?lib/surface/compute/interconnects/attachments/partner/create.pyPrintPairingKeyEpilogr      s,    
 &
 
 **7    c                   :    e Zd ZdZdZdZdZed        Zd Z	ddZ
y)Create  Create a Compute Engine partner interconnect attachment.

  *{command}* is used to create partner interconnect attachments. A partner
  interconnect attachment binds the underlying connectivity of a provider's
  Interconnect to a path into and out of the customer's cloud network.
  Nc                    t        j                         | _        | j                  j                  |       t	        j
                         | _        | j                  j                  |d       t	        j                  |d       t	        j                  |       t	        j                  |       t	        j                  |       t	        j                  |       t	        j                         j                  |       t	        j                  |       y )Ncreate)operation_typeF)default_behavior)router_flagsRouterArgumentForOtherResources
ROUTER_ARGAddArgumentattachment_flagsInterconnectAttachmentArgumentINTERCONNECT_ATTACHMENT_ARGAddAdminEnabledAddEdgeAvailabilityDomainAddDescriptionAddMtuAddEncryptionGetIpsecInternalAddressesFlagAddToParserAddStackType)clsparsers     r   ArgszCreate.Args1   s     "AACCNNNv& 	779 ###//x/P$$VeD..v6##F+F#""6*224@@H!!&)r   c                 X   t        j                  | j                               }| j                  j	                  ||j
                  t        j                  |j                              }t        j                  ||j                        }|j                  |j                  |_
        |j                  |j                  k7  rt        j                  d      d }|j                  &| j                  j	                  ||j
                        }d }|j                  }|j                   Q|j                   D cg c]<  }t#        j$                  |j
                  |||j&                        j)                         > }}t#        j*                  |      }	|j-                  |j.                  |d|j0                  |	t3        |dd       t3        |dd       t3        |dd       |t3        |dd       t3        |d	d       t3        |d
d       t3        |dd       t3        |dd             }
|
j4                  | _        |
S c c}w )N)scope_lister)compute_clientz4router-region must be same as the attachment region.PARTNERdry_runmtu
encryption
stack_type!candidate_cloud_router_ip_address$candidate_customer_router_ip_address#candidate_cloud_router_ipv6_address&candidate_customer_router_ipv6_address)descriptionrouterattachment_typeedge_availability_domainadmin_enabledvalidate_onlyr0   r1   ipsec_internal_addressesr2   r3   r4   r5   r6   )r   ComputeApiHolderReleaseTrackr   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerr   InterconnectAttachmentrouter_regionregionr   ArgumentExceptionr8   r   r=   r   GetAddressRefprojectSelfLinkGetAdminEnabledFlagr   r7   r:   getattr
pairingKey_pairing_key)selfargsholderattachment_refinterconnect_attachment
router_refipsec_internal_addresses_urlsrF   namer;   
attachments              r   Runz
Create.RunC   s3   **4+<+<+>?F55GG"88G H IN
 %;;v}}6 !)00d^222++
@B B J{{??44T6;K;KLj$(!""F$$0 33' 4d 
(
()9)94)7)?)?AAIL3 $ ' %88>M(//$$!!%!>!>#dIt4D%&4t4!>4t4*15t+
 .58$.
 -47-
 07:D0
) 0 J0 #--DC's   1AH'c                 .    t        | j                         y N)r   rN   )rO   resources_were_displayeds     r   EpilogzCreate.Epilog~   s    $++,r   )T)__name__
__module____qualname____doc__r   INTERCONNECT_ARGr   classmethodr*   rX   r\    r   r   r   r   $   s7     !%** *"9v-r   r   c                   ,     e Zd ZdZe fd       Z xZS )
CreateBetar   c                     t         t        |   |       t        j                  |       t        j
                  |       t        j                  |       t        j                  |       y rZ   )superre   r*   r    AddCandidateCloudRouterIpAddress#AddCandidateCustomerRouterIpAddress"AddCandidateCloudRouterIpv6Address%AddCandidateCustomerRouterIpv6Addressr(   r)   	__class__s     r   r*   zCreateBeta.Args   sJ    	*c'55f=88@77?::6Br   r]   r^   r_   r`   rb   r*   __classcell__rm   s   @r   re   re      s     C Cr   re   c                   ,     e Zd ZdZe fd       Z xZS )CreateAlphar   c                 V    t         t        |   |       t        j                  |       y rZ   )rg   rr   r*   r   	AddDryRunrl   s     r   r*   zCreateAlpha.Args   s     	+s (v&r   rn   rp   s   @r   rr   rr      s     ' 'r   rr   N)r`   googlecloudsdk.api_lib.computer   8googlecloudsdk.api_lib.compute.interconnects.attachmentsr   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer   rB   <googlecloudsdk.command_lib.compute.interconnects.attachmentsr   *googlecloudsdk.command_lib.compute.routersr   googlecloudsdk.corer   r   UniverseCompatibleReleaseTracksr?   GACreateCommandr   BETAre   ALPHArr   rc   r   r   <module>r      s    F 7 K ( 1 E b L # D%%(()Y-T Y- * Y-x D%%**+C C , C" D%%++,'* ' - 'r   